mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-12-23 03:59:38 +00:00
Save settings for each wizard page in "wizard.settings" object and
diplay overview at the last page
This commit is contained in:
parent
78b556575a
commit
63e4d19a92
5 changed files with 59 additions and 16 deletions
|
@ -39,6 +39,12 @@ Item {
|
||||||
|
|
||||||
onOpacityChanged: visible = opacity !== 0
|
onOpacityChanged: visible = opacity !== 0
|
||||||
|
|
||||||
|
function saveSettings(settingsObject) {
|
||||||
|
settingsObject['account_name'] = accountName.text
|
||||||
|
settingsObject['words'] = wordsText.text
|
||||||
|
settingsObject['wallet_path'] = fileUrlInput.text
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: dotsRow
|
id: dotsRow
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -106,6 +112,7 @@ Item {
|
||||||
height: 62
|
height: 62
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
|
id: accountName
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
horizontalAlignment: TextInput.AlignHCenter
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
|
|
@ -38,6 +38,12 @@ Item {
|
||||||
|
|
||||||
onOpacityChanged: visible = opacity !== 0
|
onOpacityChanged: visible = opacity !== 0
|
||||||
|
|
||||||
|
function saveSettings(settingsObject) {
|
||||||
|
settingsObject['auto_donations_enabled'] = enableAutoDonationCheckBox.checked;
|
||||||
|
settingsObject['auto_donations_amount'] = autoDonationAmountText.text;
|
||||||
|
settingsObject['allow_background_mining'] = allowBackgroundMiningCheckBox.checked;
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: dotsRow
|
id: dotsRow
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -94,6 +100,7 @@ Item {
|
||||||
spacing: 2
|
spacing: 2
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
|
id: enableAutoDonationCheckBox
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
text: qsTr("Enable auto-donations of?")
|
text: qsTr("Enable auto-donations of?")
|
||||||
background: "#F0EEEE"
|
background: "#F0EEEE"
|
||||||
|
@ -110,6 +117,7 @@ Item {
|
||||||
width: 41
|
width: 41
|
||||||
|
|
||||||
TextInput {
|
TextInput {
|
||||||
|
id: autoDonationAmountText
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
@ -155,6 +163,7 @@ Item {
|
||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
|
id: allowBackgroundMiningCheckBox
|
||||||
text: qsTr("Allow background mining?")
|
text: qsTr("Allow background mining?")
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
|
@ -37,6 +37,22 @@ Item {
|
||||||
|
|
||||||
onOpacityChanged: visible = opacity !== 0
|
onOpacityChanged: visible = opacity !== 0
|
||||||
|
|
||||||
|
function buildSettingsString() {
|
||||||
|
var str = "<br>" + qsTr("<b>Language:</b> ") + wizard.settings['language'] + "<br>"
|
||||||
|
+ qsTr("<b>Account name:</b> ") + wizard.settings['account_name'] + "<br>"
|
||||||
|
+ qsTr("<b>Words:</b> ") + wizard.settings['words'] + "<br>"
|
||||||
|
+ qsTr("<b>Wallet Path: </b>") + wizard.settings['wallet_path'] + "<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>Allow background mining: </b>") + wizard.settings['allow_background_mining'] + "<br>"
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
function updateSettingsSummary() {
|
||||||
|
settingsText.text = qsTr("An overview of your Monero configuration is below:")
|
||||||
|
+ "<br>"
|
||||||
|
+ buildSettingsString();
|
||||||
|
}
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
id: dotsRow
|
id: dotsRow
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
@ -84,14 +100,15 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
|
id: settingsText
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
font.family: "Arial"
|
font.family: "Arial"
|
||||||
font.pixelSize: 18
|
font.pixelSize: 18
|
||||||
wrapMode: Text.Wrap
|
wrapMode: Text.Wrap
|
||||||
|
textFormat: Text.RichText
|
||||||
//renderType: Text.NativeRendering
|
//renderType: Text.NativeRendering
|
||||||
color: "#4A4646"
|
color: "#4A4646"
|
||||||
text: qsTr("An overview of your Monero configuration is below:")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,9 @@ import "../components"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: wizard
|
id: wizard
|
||||||
property alias nextButton : nextButton
|
property alias nextButton : nextButton
|
||||||
|
property var settings : ({})
|
||||||
|
property int currentPage: 0
|
||||||
|
property var pages: [welcomePage, optionsPage, createWalletPage, passwordPage, /*configurePage,*/ donationPage, finishPage ]
|
||||||
|
|
||||||
signal useMoneroClicked()
|
signal useMoneroClicked()
|
||||||
border.color: "#DBDBDB"
|
border.color: "#DBDBDB"
|
||||||
|
@ -40,6 +42,12 @@ Rectangle {
|
||||||
color: "#FFFFFF"
|
color: "#FFFFFF"
|
||||||
|
|
||||||
function switchPage(next) {
|
function switchPage(next) {
|
||||||
|
|
||||||
|
// save settings for current page;
|
||||||
|
if (typeof pages[currentPage].saveSettings !== 'undefined') {
|
||||||
|
pages[currentPage].saveSettings(settings);
|
||||||
|
}
|
||||||
|
|
||||||
if(next === false) {
|
if(next === false) {
|
||||||
if(currentPage > 0) {
|
if(currentPage > 0) {
|
||||||
pages[currentPage].opacity = 0
|
pages[currentPage].opacity = 0
|
||||||
|
@ -52,10 +60,15 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// disallow "next" button until password matches
|
// disallow "next" button until passwords match
|
||||||
if (pages[currentPage] === passwordPage) {
|
if (pages[currentPage] === passwordPage) {
|
||||||
nextButton.visible = passwordPage.passwordValid
|
nextButton.visible = passwordPage.passwordValid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// display settings summary
|
||||||
|
if (pages[currentPage] === finishPage) {
|
||||||
|
finishPage.updateSettingsSummary();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,8 +97,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
property int currentPage: 0
|
|
||||||
property var pages: [welcomePage, optionsPage, createWalletPage, passwordPage, /*configurePage,*/ donationPage, finishPage ]
|
|
||||||
|
|
||||||
|
|
||||||
WizardWelcome {
|
WizardWelcome {
|
||||||
|
@ -129,16 +141,6 @@ Rectangle {
|
||||||
anchors.rightMargin: 50
|
anchors.rightMargin: 50
|
||||||
}
|
}
|
||||||
|
|
||||||
// WizardConfigure {
|
|
||||||
// id: configurePage
|
|
||||||
// anchors.top: parent.top
|
|
||||||
// anchors.bottom: parent.bottom
|
|
||||||
// anchors.right: nextButton.left
|
|
||||||
// anchors.left: prevButton.right
|
|
||||||
// anchors.leftMargin: 50
|
|
||||||
// anchors.rightMargin: 50
|
|
||||||
// }
|
|
||||||
|
|
||||||
WizardDonation {
|
WizardDonation {
|
||||||
id: donationPage
|
id: donationPage
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
|
|
|
@ -36,6 +36,10 @@ Item {
|
||||||
|
|
||||||
onOpacityChanged: visible = opacity !== 0
|
onOpacityChanged: visible = opacity !== 0
|
||||||
|
|
||||||
|
function saveSettings(settingsObject) {
|
||||||
|
settingsObject['language'] = languagesModel.get(gridView.currentIndex).name
|
||||||
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: headerColumn
|
id: headerColumn
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -76,6 +80,8 @@ Item {
|
||||||
|
|
||||||
XmlRole { name: "name"; query: "@name/string()" }
|
XmlRole { name: "name"; query: "@name/string()" }
|
||||||
XmlRole { name: "flag"; query: "@flag/string()" }
|
XmlRole { name: "flag"; query: "@flag/string()" }
|
||||||
|
// TODO: XmlListModel is read only, we should store current language somewhere else
|
||||||
|
// and set current language accordingly
|
||||||
XmlRole { name: "isCurrent"; query: "@enabled/string()" }
|
XmlRole { name: "isCurrent"; query: "@enabled/string()" }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +131,9 @@ Item {
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: delegateArea
|
id: delegateArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: gridView.currentIndex = index
|
onClicked: {
|
||||||
|
gridView.currentIndex = index
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue