Skip to content

Commit fecf2d9

Browse files
Add fortuneMaxLength and refreshOnWallpaper settings
1 parent b4f626a commit fecf2d9

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

not-just-text/Settings.qml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ ColumnLayout {
1515
property bool editFortuneOffensive: cfg.fortuneOffensive ?? defaults.fortuneOffensive ?? false
1616
property bool editFortuneEqual: cfg.fortuneEqual ?? defaults.fortuneEqual ?? false
1717
property string editFortuneCategory: cfg.fortuneCategory ?? defaults.fortuneCategory ?? ""
18+
property int editFortuneMaxLength: cfg.fortuneMaxLength ?? defaults.fortuneMaxLength ?? 60
1819
property bool editListEnabled: cfg.listEnabled ?? defaults.listEnabled ?? false
1920
property string editTextFile: cfg.textFile ?? defaults.textFile ?? ""
21+
property bool editRefreshOnWallpaper: cfg.refreshOnWallpaper ?? defaults.refreshOnWallpaper ?? true
2022

2123
spacing: Style.marginL
2224

@@ -70,6 +72,26 @@ ColumnLayout {
7072
onTextChanged: root.editFortuneCategory = text
7173
}
7274

75+
ColumnLayout {
76+
Layout.fillWidth: true
77+
visible: root.editFortuneEnabled
78+
spacing: Style.marginS
79+
80+
NLabel {
81+
label: pluginApi?.tr("settings.fortuneMaxLength.label", {"value": root.editFortuneMaxLength})
82+
description: pluginApi?.tr("settings.fortuneMaxLength.desc")
83+
}
84+
85+
NSlider {
86+
Layout.fillWidth: true
87+
from: 10
88+
to: 200
89+
value: root.editFortuneMaxLength
90+
stepSize: 5
91+
onMoved: root.editFortuneMaxLength = Math.round(value)
92+
}
93+
}
94+
7395
NToggle {
7496
Layout.fillWidth: true
7597
visible: root.editFortuneEnabled
@@ -88,15 +110,26 @@ ColumnLayout {
88110
onToggled: checked => root.editFortuneEqual = checked
89111
}
90112

113+
NToggle {
114+
Layout.fillWidth: true
115+
visible: root.editFortuneEnabled || root.editListEnabled
116+
label: pluginApi?.tr("settings.refreshOnWallpaper.label")
117+
description: pluginApi?.tr("settings.refreshOnWallpaper.desc")
118+
checked: root.editRefreshOnWallpaper
119+
onToggled: checked => root.editRefreshOnWallpaper = checked
120+
}
121+
91122
function saveSettings() {
92123
if (!pluginApi) return;
93124
pluginApi.pluginSettings.text = root.editText;
94125
pluginApi.pluginSettings.fortuneEnabled = root.editFortuneEnabled;
95126
pluginApi.pluginSettings.fortuneOffensive = root.editFortuneOffensive;
96127
pluginApi.pluginSettings.fortuneEqual = root.editFortuneEqual;
97128
pluginApi.pluginSettings.fortuneCategory = root.editFortuneCategory;
129+
pluginApi.pluginSettings.fortuneMaxLength = root.editFortuneMaxLength;
98130
pluginApi.pluginSettings.listEnabled = root.editListEnabled;
99131
pluginApi.pluginSettings.textFile = root.editTextFile;
132+
pluginApi.pluginSettings.refreshOnWallpaper = root.editRefreshOnWallpaper;
100133
pluginApi.saveSettings();
101134
}
102135
}

0 commit comments

Comments
 (0)