Skip to content

Commit

Permalink
qml: updated these files to use onboardingModel instead of optionsMod…
Browse files Browse the repository at this point in the history
…el. Also moved chainModel args to onboardingModel
  • Loading branch information
D33r-Gee committed Mar 14, 2024
1 parent f9c2937 commit b9f2cd5
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 29 deletions.
20 changes: 12 additions & 8 deletions src/qml/components/ConnectionSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ ColumnLayout {
header: qsTr("Enable listening")
description: qsTr("Allows incoming connections")
actionItem: OptionSwitch {
checked: optionsModel.listen
onToggled: optionsModel.listen = checked
checked: onboardingModel.listen
onToggled: onboardingModel.listen = checked
}
Component.onCompleted: onboardingModel.listen = false
onClicked: {
loadedItem.toggle()
loadedItem.toggled()
Expand All @@ -27,9 +28,10 @@ ColumnLayout {
Layout.fillWidth: true
header: qsTr("Map port using UPnP")
actionItem: OptionSwitch {
checked: optionsModel.upnp
onToggled: optionsModel.upnp = checked
checked: onboardingModel.upnp
onToggled: onboardingModel.upnp = checked
}
Component.onCompleted: onboardingModel.upnp = false
onClicked: {
loadedItem.toggle()
loadedItem.toggled()
Expand All @@ -40,9 +42,10 @@ ColumnLayout {
Layout.fillWidth: true
header: qsTr("Map port using NAT-PMP")
actionItem: OptionSwitch {
checked: optionsModel.natpmp
onToggled: optionsModel.natpmp = checked
checked: onboardingModel.natpmp
onToggled: onboardingModel.natpmp = checked
}
Component.onCompleted: onboardingModel.natpmp = false
onClicked: {
loadedItem.toggle()
loadedItem.toggled()
Expand All @@ -53,9 +56,10 @@ ColumnLayout {
Layout.fillWidth: true
header: qsTr("Enable RPC server")
actionItem: OptionSwitch {
checked: optionsModel.server
onToggled: optionsModel.server = checked
checked: onboardingModel.server
onToggled: onboardingModel.server = checked
}
Component.onCompleted: onboardingModel.server = false
onClicked: {
loadedItem.toggle()
loadedItem.toggled()
Expand Down
26 changes: 13 additions & 13 deletions src/qml/components/StorageOptions.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,27 @@ ColumnLayout {
Layout.fillWidth: true
ButtonGroup.group: group
text: qsTr("Reduce storage")
description: qsTr("Uses about %1GB. For simple wallet use.").arg(chainModel.assumedChainstateSize + 2)
description: qsTr("Uses about %1GB. For simple wallet use.").arg(onboardingModel.assumedChainstateSize + 2)
recommended: true
checked: !root.customStorage && optionsModel.prune
checked: !root.customStorage && onboardingModel.prune
onClicked: {
optionsModel.prune = true
optionsModel.pruneSizeGB = 2
onboardingModel.prune = true
onboardingModel.pruneSizeGB = 2
}
Component.onCompleted: {
optionsModel.prune = true
optionsModel.pruneSizeGB = 2
onboardingModel.prune = true
onboardingModel.pruneSizeGB = 2
}
}
OptionButton {
Layout.fillWidth: true
ButtonGroup.group: group
text: qsTr("Store all data")
checked: !optionsModel.prune
checked: !onboardingModel.prune
description: qsTr("Uses about %1GB. Support the network.").arg(
chainModel.assumedBlockchainSize + chainModel.assumedChainstateSize)
onboardingModel.assumedBlockchainSize + onboardingModel.assumedChainstateSize)
onClicked: {
optionsModel.prune = false
onboardingModel.prune = false
}
}
Loader {
Expand All @@ -51,12 +51,12 @@ ColumnLayout {
visible: active
sourceComponent: OptionButton {
ButtonGroup.group: group
checked: root.customStorage && optionsModel.prune
checked: root.customStorage && onboardingModel.prune
text: qsTr("Custom")
description: qsTr("Storing about %1GB of data.").arg(root.customStorageAmount + chainModel.assumedChainstateSize)
description: qsTr("Storing about %1GB of data.").arg(root.customStorageAmount + onboardingModel.assumedChainstateSize)
onClicked: {
optionsModel.prune = true
optionsModel.pruneSizeGB = root.customStorageAmount
onboardingModel.prune = true
onboardingModel.pruneSizeGB = root.customStorageAmount
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/qml/components/StorageSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ ColumnLayout {
Layout.fillWidth: true
header: qsTr("Store recent blocks only")
actionItem: OptionSwitch {
checked: optionsModel.prune
onToggled: optionsModel.prune = checked
checked: onboardingModel.prune
onToggled: onboardingModel.prune = checked
onCheckedChanged: {
if (checked == false) {
pruneTargetSetting.state = "DISABLED"
Expand All @@ -40,14 +40,14 @@ ColumnLayout {
showErrorText: false
actionItem: ValueInput {
parentState: pruneTargetSetting.state
description: optionsModel.pruneSizeGB
description: onboardingModel.pruneSizeGB
onEditingFinished: {
if (parseInt(text) < 1) {
pruneTargetSetting.showErrorText = true
} else {
root.customStorage = true
root.customStorageAmount = parseInt(text)
optionsModel.pruneSizeGB = parseInt(text)
onboardingModel.pruneSizeGB = parseInt(text)
pruneTargetSetting.forceActiveFocus()
pruneTargetSetting.showErrorText = false
}
Expand Down
12 changes: 9 additions & 3 deletions src/qml/pages/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ ApplicationWindow {
}

Connections {
target: nodeModel
target: onboardingModel
function onRequestedShutdown() {
main.clear()
main.push(shutdown)
Expand All @@ -66,7 +66,13 @@ ApplicationWindow {
OnboardingStorageAmount {}
OnboardingConnection {}

onFinishedChanged: main.push(node)
onFinishedChanged:{
if (swipeView.finished) {
onboardingModel.onboardingFinished()
optionsModel.onboard()
main.push(node)
}
}
}
}

Expand All @@ -93,4 +99,4 @@ ApplicationWindow {
}
}
}
}
}
2 changes: 1 addition & 1 deletion src/qml/pages/onboarding/OnboardingStorageLocation.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ InformationPage {
bold: true
headerText: qsTr("Storage location")
headerMargin: 0
description: qsTr("Where do you want to store the downloaded block data?\nYou need a minimum of %1GB of storage.").arg(chainModel.assumedChainstateSize + 1)
description: qsTr("Where do you want to store the downloaded block data?\nYou need a minimum of %1GB of storage.").arg(onboardingModel.assumedChainstateSize + 1)
descriptionMargin: 20
detailActive: true
detailItem: StorageLocations {}
Expand Down

0 comments on commit b9f2cd5

Please sign in to comment.