Skip to content

Commit fa433b1

Browse files
committed
qml: Introduce Storage OptionButton that represents custom prune target
This allows for a new OptionButton to be shown in StorageOptions when the user has going into detailed settings during onboarding and chosen a custom prune target
1 parent 205d247 commit fa433b1

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

src/qml/components/StorageOptions.qml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import QtQuick.Layouts 1.15
88
import "../controls"
99

1010
ColumnLayout {
11+
id: root
12+
property bool customStorage: false
13+
property int customStorageAmount
1114
ButtonGroup {
1215
id: group
1316
}
@@ -18,7 +21,7 @@ ColumnLayout {
1821
text: qsTr("Reduce storage")
1922
description: qsTr("Uses about 2GB. For simple wallet use.")
2023
recommended: true
21-
checked: true
24+
checked: !root.customStorage && optionsModel.prune
2225
onClicked: {
2326
optionsModel.prune = true
2427
optionsModel.pruneSizeGB = 2
@@ -32,9 +35,25 @@ ColumnLayout {
3235
Layout.fillWidth: true
3336
ButtonGroup.group: group
3437
text: qsTr("Store all data")
38+
checked: !optionsModel.prune
3539
description: qsTr("Uses about 550GB. Support the network.")
3640
onClicked: {
3741
optionsModel.prune = false
3842
}
3943
}
44+
Loader {
45+
Layout.fillWidth: true
46+
active: root.customStorage
47+
visible: active
48+
sourceComponent: OptionButton {
49+
ButtonGroup.group: group
50+
checked: root.customStorage && optionsModel.prune
51+
text: qsTr("Custom")
52+
description: qsTr("Storing recent blocks up to %1GB").arg(root.customStorageAmount)
53+
onClicked: {
54+
optionsModel.prune = true
55+
optionsModel.pruneSizeGB = root.customStorageAmount
56+
}
57+
}
58+
}
4059
}

src/qml/components/StorageSettings.qml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import QtQuick.Layouts 1.15
88
import "../controls"
99

1010
ColumnLayout {
11+
id: root
12+
property bool customStorage: false
13+
property int customStorageAmount
1114
spacing: 4
1215
Setting {
1316
Layout.fillWidth: true
@@ -42,6 +45,8 @@ ColumnLayout {
4245
if (parseInt(text) < 1) {
4346
pruneTargetSetting.showErrorText = true
4447
} else {
48+
root.customStorage = true
49+
root.customStorageAmount = parseInt(text)
4550
optionsModel.pruneSizeGB = parseInt(text)
4651
pruneTargetSetting.forceActiveFocus()
4752
pruneTargetSetting.showErrorText = false

src/qml/pages/onboarding/OnboardingStorageAmount.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Page {
3333
detailItem: ColumnLayout {
3434
spacing: 0
3535
StorageOptions {
36+
customStorage: advancedStorage.loadedDetailItem.customStorage
37+
customStorageAmount: advancedStorage.loadedDetailItem.customStorageAmount
3638
Layout.maximumWidth: 450
3739
Layout.alignment: Qt.AlignCenter
3840
}
@@ -47,6 +49,7 @@ Page {
4749
buttonMargin: 20
4850
}
4951
SettingsStorage {
52+
id: advancedStorage
5053
navRightDetail: NavButton {
5154
text: qsTr("Done")
5255
onClicked: {

0 commit comments

Comments
 (0)