mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-18 16:54:39 +00:00
wizard: reworked testnet settings
This commit is contained in:
parent
ea49e84215
commit
80618c83fd
6 changed files with 23 additions and 80 deletions
2
main.qml
2
main.qml
|
@ -880,7 +880,7 @@ ApplicationWindow {
|
||||||
property bool allow_background_mining : false
|
property bool allow_background_mining : false
|
||||||
property bool miningIgnoreBattery : true
|
property bool miningIgnoreBattery : true
|
||||||
property bool testnet: false
|
property bool testnet: false
|
||||||
property string daemon_address: "localhost:18081"
|
property string daemon_address: testnet ? "localhost:28081" : "localhost:18081"
|
||||||
property string payment_id
|
property string payment_id
|
||||||
property int restore_height : 0
|
property int restore_height : 0
|
||||||
property bool is_recovering : false
|
property bool is_recovering : false
|
||||||
|
|
|
@ -50,7 +50,7 @@ ColumnLayout {
|
||||||
autoDonationAmount = wizard.settings["auto_donations_amount"] + " %",
|
autoDonationAmount = wizard.settings["auto_donations_amount"] + " %",
|
||||||
backgroundMiningEnabled = wizard.settings["allow_background_mining"] === true,
|
backgroundMiningEnabled = wizard.settings["allow_background_mining"] === true,
|
||||||
backgroundMiningText = backgroundMiningEnabled ? qsTr("Enabled") : qsTr("Disabled"),
|
backgroundMiningText = backgroundMiningEnabled ? qsTr("Enabled") : qsTr("Disabled"),
|
||||||
testnetEnabled = wizard.settings['testnet'] === true,
|
testnetEnabled = appWindow.persistentSettings.testnet,
|
||||||
testnetText = testnetEnabled ? qsTr("Enabled") : qsTr("Disabled"),
|
testnetText = testnetEnabled ? qsTr("Enabled") : qsTr("Disabled"),
|
||||||
restoreHeightEnabled = wizard.settings['restore_height'] !== undefined;
|
restoreHeightEnabled = wizard.settings['restore_height'] !== undefined;
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ ColumnLayout {
|
||||||
// ? trStart + qsTr("Donation amount") + trMiddle + autoDonationAmount + trEnd
|
// ? trStart + qsTr("Donation amount") + trMiddle + autoDonationAmount + trEnd
|
||||||
// : "")
|
// : "")
|
||||||
// + trStart + qsTr("Background mining") + trMiddle + backgroundMiningText + trEnd
|
// + trStart + qsTr("Background mining") + trMiddle + backgroundMiningText + trEnd
|
||||||
+ trStart + qsTr("Daemon address") + trMiddle + wizard.settings["daemon_address"] + trEnd
|
+ trStart + qsTr("Daemon address") + trMiddle + persistentSettings.daemon_address + trEnd
|
||||||
+ trStart + qsTr("Testnet") + trMiddle + testnetText + trEnd
|
+ trStart + qsTr("Testnet") + trMiddle + testnetText + trEnd
|
||||||
+ (restoreHeightEnabled
|
+ (restoreHeightEnabled
|
||||||
? trStart + qsTr("Restore height") + trMiddle + wizard.settings['restore_height'] + trEnd
|
? trStart + qsTr("Restore height") + trMiddle + wizard.settings['restore_height'] + trEnd
|
||||||
|
|
|
@ -233,11 +233,8 @@ ColumnLayout {
|
||||||
appWindow.persistentSettings.allow_background_mining = false //settings.allow_background_mining
|
appWindow.persistentSettings.allow_background_mining = false //settings.allow_background_mining
|
||||||
appWindow.persistentSettings.auto_donations_enabled = false //settings.auto_donations_enabled
|
appWindow.persistentSettings.auto_donations_enabled = false //settings.auto_donations_enabled
|
||||||
appWindow.persistentSettings.auto_donations_amount = false //settings.auto_donations_amount
|
appWindow.persistentSettings.auto_donations_amount = false //settings.auto_donations_amount
|
||||||
appWindow.persistentSettings.daemon_address = settings.daemon_address
|
|
||||||
appWindow.persistentSettings.testnet = settings.testnet
|
|
||||||
appWindow.persistentSettings.restore_height = (isNaN(settings.restore_height))? 0 : settings.restore_height
|
appWindow.persistentSettings.restore_height = (isNaN(settings.restore_height))? 0 : settings.restore_height
|
||||||
appWindow.persistentSettings.is_recovering = (settings.is_recovering === undefined)? false : settings.is_recovering
|
appWindow.persistentSettings.is_recovering = (settings.is_recovering === undefined)? false : settings.is_recovering
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// reading settings from persistent storage
|
// reading settings from persistent storage
|
||||||
|
|
|
@ -56,10 +56,10 @@ ColumnLayout {
|
||||||
property int rowSpacing: 10
|
property int rowSpacing: 10
|
||||||
|
|
||||||
function checkFields(){
|
function checkFields(){
|
||||||
var addressOK = walletManager.addressValid(addressLine.text, wizard.settings.testnet)
|
var addressOK = walletManager.addressValid(addressLine.text, persistentSettings.testnet)
|
||||||
var viewKeyOK = walletManager.keyValid(viewKeyLine.text, addressLine.text, true, wizard.settings.testnet)
|
var viewKeyOK = walletManager.keyValid(viewKeyLine.text, addressLine.text, true, persistentSettings.testnet)
|
||||||
// Spendkey is optional
|
// Spendkey is optional
|
||||||
var spendKeyOK = (spendKeyLine.text.length > 0)? walletManager.keyValid(spendKeyLine.text, addressLine.text, false, wizard.settings.testnet) : true
|
var spendKeyOK = (spendKeyLine.text.length > 0)? walletManager.keyValid(spendKeyLine.text, addressLine.text, false, persistentSettings.testnet) : true
|
||||||
|
|
||||||
addressLine.error = !addressOK && addressLine.text.length != 0
|
addressLine.error = !addressOK && addressLine.text.length != 0
|
||||||
viewKeyLine.error = !viewKeyOK && viewKeyLine.text.length != 0
|
viewKeyLine.error = !viewKeyOK && viewKeyLine.text.length != 0
|
||||||
|
|
|
@ -44,25 +44,12 @@ ColumnLayout {
|
||||||
function onPageClosed() {
|
function onPageClosed() {
|
||||||
// Save settings used in open from file.
|
// Save settings used in open from file.
|
||||||
// other wizard settings are saved on last page in applySettings()
|
// other wizard settings are saved on last page in applySettings()
|
||||||
appWindow.persistentSettings.testnet = wizard.settings["testnet"]
|
|
||||||
appWindow.persistentSettings.daemon_address = wizard.settings["daemon_address"]
|
|
||||||
appWindow.persistentSettings.language = wizard.settings.language
|
appWindow.persistentSettings.language = wizard.settings.language
|
||||||
appWindow.persistentSettings.locale = wizard.settings.locale
|
appWindow.persistentSettings.locale = wizard.settings.locale
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 }
|
||||||
}
|
}
|
||||||
|
@ -139,7 +126,6 @@ ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
page.saveDaemonAddress()
|
|
||||||
page.createWalletClicked()
|
page.createWalletClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,7 +168,6 @@ ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
page.saveDaemonAddress()
|
|
||||||
page.recoveryWalletClicked()
|
page.recoveryWalletClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,7 +211,6 @@ ColumnLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onClicked: {
|
onClicked: {
|
||||||
page.saveDaemonAddress()
|
|
||||||
page.openWalletClicked()
|
page.openWalletClicked()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,62 +231,30 @@ ColumnLayout {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// daemon select
|
RowLayout {
|
||||||
// TODO: Move to separate page
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.leftMargin: wizardLeftMargin
|
Layout.leftMargin: wizardLeftMargin
|
||||||
Layout.rightMargin: wizardRightMargin
|
Layout.rightMargin: wizardRightMargin
|
||||||
|
Layout.topMargin: 30
|
||||||
Layout.alignment: Qt.AlignCenter
|
Layout.alignment: Qt.AlignCenter
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
Label {
|
width: 100
|
||||||
Layout.topMargin: 20
|
CheckBox {
|
||||||
fontSize: 14
|
id: testNet
|
||||||
text: qsTr("Custom daemon address (optional)") + translationManager.emptyString
|
text: qsTr("Testnet") + translationManager.emptyString
|
||||||
+ translationManager.emptyString
|
background: "#FFFFFF"
|
||||||
}
|
fontColor: "#4A4646"
|
||||||
|
fontSize: 16
|
||||||
GridLayout {
|
checkedIcon: "../images/checkedVioletIcon.png"
|
||||||
Layout.fillWidth: true
|
uncheckedIcon: "../images/uncheckedIcon.png"
|
||||||
Layout.alignment: Qt.AlignHCenter
|
checked: appWindow.persistentSettings.testnet;
|
||||||
|
onClicked: {
|
||||||
columnSpacing: 20
|
persistentSettings.testnet = testNet.checked
|
||||||
rowSpacing: 20
|
console.log("testnet set to ", persistentSettings.testnet)
|
||||||
flow: isMobile ? GridLayout.TopToBottom : GridLayout.LeftToRight
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
spacing: 20
|
|
||||||
Layout.alignment: Qt.AlignCenter
|
|
||||||
|
|
||||||
LineEdit {
|
|
||||||
id: daemonAddress
|
|
||||||
Layout.alignment: Qt.AlignCenter
|
|
||||||
width: 200
|
|
||||||
fontSize: 14
|
|
||||||
text: {
|
|
||||||
if(appWindow.persistentSettings.daemon_address)
|
|
||||||
return appWindow.persistentSettings.daemon_address;
|
|
||||||
return testNet.checked ? d.daemonAddressTestnet : d.daemonAddressMainnet
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
CheckBox {
|
|
||||||
id: testNet
|
|
||||||
Layout.alignment: Qt.AlignCenter
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: qsTr("Testnet") + translationManager.emptyString
|
|
||||||
background: "#FFFFFF"
|
|
||||||
fontColor: "#4A4646"
|
|
||||||
fontSize: 16
|
|
||||||
checkedIcon: "../images/checkedVioletIcon.png"
|
|
||||||
uncheckedIcon: "../images/uncheckedIcon.png"
|
|
||||||
checked: appWindow.persistentSettings.testnet;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,12 +39,6 @@ ColumnLayout {
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in a new issue