Merge pull request #31

86a6bfb Logging: removed password logging (Ilya Kitaev)
e287ce8 Wizard: setup testnet/daemon address (Ilya Kitaev)
This commit is contained in:
Riccardo Spagni 2016-10-04 12:26:44 +02:00
commit 9bd5a08057
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD
7 changed files with 110 additions and 10 deletions

View file

@ -114,7 +114,7 @@ int main(int argc, char *argv[])
QObject::connect(eventFilter, SIGNAL(mousePressed(QVariant,QVariant,QVariant)), rootObject, SLOT(mousePressed(QVariant,QVariant,QVariant))); QObject::connect(eventFilter, SIGNAL(mousePressed(QVariant,QVariant,QVariant)), rootObject, SLOT(mousePressed(QVariant,QVariant,QVariant)));
QObject::connect(eventFilter, SIGNAL(mouseReleased(QVariant,QVariant,QVariant)), rootObject, SLOT(mouseReleased(QVariant,QVariant,QVariant))); QObject::connect(eventFilter, SIGNAL(mouseReleased(QVariant,QVariant,QVariant)), rootObject, SLOT(mouseReleased(QVariant,QVariant,QVariant)));
WalletManager::instance()->setLogLevel(WalletManager::LogLevel_Silent); WalletManager::instance()->setLogLevel(WalletManager::LogLevel_Max);
return app.exec(); return app.exec();
} }

View file

@ -143,7 +143,8 @@ ApplicationWindow {
connectWallet(wizard.settings['wallet']) connectWallet(wizard.settings['wallet'])
} else { } else {
var wallet_path = walletPath(); var wallet_path = walletPath();
console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.password); // console.log("opening wallet at: ", wallet_path, "with password: ", appWindow.password);
console.log("opening wallet at: ", wallet_path);
walletManager.openWalletAsync(wallet_path, appWindow.password, walletManager.openWalletAsync(wallet_path, appWindow.password,
persistentSettings.testnet); persistentSettings.testnet);
} }

View file

@ -39,6 +39,7 @@ Item {
NumberAnimation { duration: 100; easing.type: Easing.InQuad } NumberAnimation { duration: 100; easing.type: Easing.InQuad }
} }
onOpacityChanged: visible = opacity !== 0 onOpacityChanged: visible = opacity !== 0
//! function called each time we display this page //! function called each time we display this page

View file

@ -45,6 +45,8 @@ Item {
+ qsTr("<b>Enable auto donation: </b>") + wizard.settings['auto_donations_enabled'] + "<br>" + qsTr("<b>Enable auto donation: </b>") + wizard.settings['auto_donations_enabled'] + "<br>"
+ qsTr("<b>Auto donation amount: </b>") + wizard.settings['auto_donations_amount'] + "<br>" + qsTr("<b>Auto donation amount: </b>") + wizard.settings['auto_donations_amount'] + "<br>"
+ qsTr("<b>Allow background mining: </b>") + wizard.settings['allow_background_mining'] + "<br>" + qsTr("<b>Allow background mining: </b>") + wizard.settings['allow_background_mining'] + "<br>"
+ qsTr("<b>Daemon address: </b>") + wizard.settings['daemon_address'] + "<br>"
+ qsTr("<b>testnet: </b>") + wizard.settings['testnet'] + "<br>"
+ translationManager.emptyString + translationManager.emptyString
return str; return str;
} }

View file

@ -122,7 +122,6 @@ Rectangle {
} }
// protecting wallet with password // protecting wallet with password
console.log("Protecting wallet with password: " + settings.wallet_password)
settings.wallet.setPassword(settings.wallet_password); settings.wallet.setPassword(settings.wallet_password);
// saving wallet_filename; // saving wallet_filename;
@ -136,6 +135,9 @@ Rectangle {
appWindow.persistentSettings.allow_background_mining = settings.allow_background_mining appWindow.persistentSettings.allow_background_mining = settings.allow_background_mining
appWindow.persistentSettings.auto_donations_enabled = settings.auto_donations_enabled appWindow.persistentSettings.auto_donations_enabled = settings.auto_donations_enabled
appWindow.persistentSettings.auto_donations_amount = settings.auto_donations_amount appWindow.persistentSettings.auto_donations_amount = settings.auto_donations_amount
appWindow.persistentSettings.daemon_address = settings.daemon_address
appWindow.persistentSettings.testnet = settings.testnet
} }
// reading settings from persistent storage // reading settings from persistent storage

View file

@ -27,6 +27,9 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import QtQuick 2.2 import QtQuick 2.2
import QtQml 2.2
import QtQuick.Layouts 1.1
import "../components"
Item { Item {
id: page id: page
@ -34,6 +37,18 @@ Item {
signal recoveryWalletClicked() signal recoveryWalletClicked()
opacity: 0 opacity: 0
visible: false visible: false
function saveDaemonAddress() {
wizard.settings["daemon_address"] = daemonAddress.text
wizard.settings["testnet"] = testNet.checked
}
QtObject {
id: d
readonly property string daemonAddressTestnet : "localhost:38081"
readonly property string daemonAddressMainnet : "localhost:18081"
}
Behavior on opacity { Behavior on opacity {
NumberAnimation { duration: 100; easing.type: Easing.InQuad } NumberAnimation { duration: 100; easing.type: Easing.InQuad }
} }
@ -76,6 +91,7 @@ Item {
} }
Row { Row {
id: selectPath
anchors.verticalCenterOffset: 35 anchors.verticalCenterOffset: 35
anchors.centerIn: parent anchors.centerIn: parent
spacing: 40 spacing: 40
@ -98,7 +114,10 @@ Item {
id: createWalletArea id: createWalletArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: page.createWalletClicked() onClicked: {
page.saveDaemonAddress()
page.createWalletClicked()
}
} }
} }
@ -129,7 +148,10 @@ Item {
id: recoverWalletArea id: recoverWalletArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: true
onClicked: page.recoveryWalletClicked() onClicked: {
page.saveDaemonAddress()
page.recoveryWalletClicked()
}
} }
} }
@ -142,4 +164,62 @@ Item {
} }
} }
} }
ColumnLayout {
anchors.top: selectPath.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: 35
spacing: 5
Layout.fillWidth: true
Rectangle {
Layout.alignment: Qt.AlignCenter
width: 200
height: 1
color: "gray"
} }
Text {
Layout.alignment: Qt.AlignCenter
font.family: "Arial"
font.pixelSize: 16
color: "#4A4646"
wrapMode: Text.Wrap
text: qsTr("Please setup daemon address below.")
+ translationManager.emptyString
}
RowLayout {
spacing: 20
Layout.alignment: Qt.AlignCenter
LineEdit {
id: daemonAddress
Layout.alignment: Qt.AlignCenter
width: 200
fontSize: 14
text: testNet.checked ? d.daemonAddressTestnet : d.daemonAddressMainnet
}
CheckBox {
id: testNet
Layout.alignment: Qt.AlignCenter
anchors.verticalCenter: parent.verticalCenter
text: qsTr("Testnet") + translationManager.emptyString
background: "#F0EEEE"
fontColor: "#4A4646"
fontSize: 16
checkedIcon: "../images/checkedVioletIcon.png"
uncheckedIcon: "../images/uncheckedIcon.png"
checked: false
}
}
}
}

View file

@ -28,14 +28,25 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.XmlListModel 2.0 import QtQuick.XmlListModel 2.0
import QtQuick.Layouts 1.1
import QtQml 2.2
Item { Item {
Behavior on opacity { Behavior on opacity {
NumberAnimation { duration: 100; easing.type: Easing.InQuad } NumberAnimation { duration: 100; easing.type: Easing.InQuad }
} }
QtObject {
id: d
readonly property string daemonAddressTestnet : "localhost:38018";
readonly property string daemonAddressMainnet : "localhost:18018";
}
onOpacityChanged: visible = opacity !== 0 onOpacityChanged: visible = opacity !== 0
function onPageClosed(settingsObject) { function onPageClosed(settingsObject) {
var lang = languagesModel.get(gridView.currentIndex); var lang = languagesModel.get(gridView.currentIndex);
settingsObject['language'] = lang.display_name; settingsObject['language'] = lang.display_name;
@ -44,7 +55,7 @@ Item {
return true return true
} }
// Welcome text
Column { Column {
id: headerColumn id: headerColumn
anchors.left: parent.left anchors.left: parent.left
@ -66,8 +77,8 @@ Item {
wrapMode: Text.Wrap wrapMode: Text.Wrap
// hack to implement dynamic translation // hack to implement dynamic translation
// https://wiki.qt.io/How_to_do_dynamic_translation_in_QML // https://wiki.qt.io/How_to_do_dynamic_translation_in_QML
text: qsTr("Welcome") + text: qsTr("Welcome") /*+
translationManager.emptyString translationManager.emptyString*/
} }
Text { Text {
@ -80,10 +91,10 @@ Item {
color: "#4A4646" color: "#4A4646"
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: qsTr("Please choose a language and regional format.") text: qsTr("Please choose a language and regional format.")
+ translationManager.emptyString // + translationManager.emptyString
} }
} }
// Flags model
XmlListModel { XmlListModel {
id: languagesModel id: languagesModel
source: "/lang/languages.xml" source: "/lang/languages.xml"
@ -100,6 +111,7 @@ Item {
} }
// Flags view
GridView { GridView {
id: gridView id: gridView
cellWidth: 140 cellWidth: 140
@ -158,4 +170,6 @@ Item {
} }
} }