Skip to content

Commit 00fac08

Browse files
committed
qml: Add validator & specify errorText & loading to ValueInput settings
Adds an IntValidator to integer input ValueInput settings. Additionally, specifies the "errorText" for these settings as well as the condition for when to load the errorText
1 parent 033f3ce commit 00fac08

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/qml/components/DeveloperOptions.qml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,12 @@ ColumnLayout {
2727
id: dbcacheSetting
2828
Layout.fillWidth: true
2929
header: qsTr("Database cache size (MiB)")
30+
errorText: qsTr("This is not a valid cache size.")
31+
showErrorText: !loadedItem.acceptableInput && loadedItem.length > 0
3032
actionItem: ValueInput {
3133
parentState: dbcacheSetting.state
3234
description: optionsModel.dbcacheSizeMiB
35+
validator: IntValidator{bottom: 100;}
3336
onEditingFinished: {
3437
optionsModel.dbcacheSizeMiB = parseInt(text)
3538
dbcacheSetting.forceActiveFocus()
@@ -45,9 +48,12 @@ ColumnLayout {
4548
id: parSetting
4649
Layout.fillWidth: true
4750
header: qsTr("Script verification threads")
51+
errorText: qsTr("This is not a valid thread count.")
52+
showErrorText: !loadedItem.acceptableInput && loadedItem.length > 0
4853
actionItem: ValueInput {
4954
parentState: parSetting.state
5055
description: optionsModel.scriptThreads
56+
validator: IntValidator{bottom: -10; top: 10;}
5157
onEditingFinished: {
5258
optionsModel.scriptThreads = parseInt(text)
5359
parSetting.forceActiveFocus()

src/qml/components/StorageSettings.qml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@ ColumnLayout {
3333
id: pruneTargetSetting
3434
Layout.fillWidth: true
3535
header: qsTr("Storage limit (GB)")
36+
errorText: qsTr("This is not a valid prune target.")
37+
showErrorText: !loadedItem.acceptableInput && loadedItem.length > 0
3638
actionItem: ValueInput {
3739
parentState: pruneTargetSetting.state
3840
description: optionsModel.pruneSizeGB
41+
validator: IntValidator{bottom: 2;}
3942
onEditingFinished: {
4043
optionsModel.pruneSizeGB = parseInt(text)
4144
pruneTargetSetting.forceActiveFocus()

0 commit comments

Comments
 (0)