Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/imagepackage/contents/ui/config.qml
Show First 20 Lines • Show All 52 Lines • ▼ Show 20 Line(s) | 52 | Wallpaper.Image { | |||
---|---|---|---|---|---|
53 | id: imageWallpaper | 53 | id: imageWallpaper | ||
54 | targetSize: { | 54 | targetSize: { | ||
55 | if (typeof plasmoid !== "undefined") { | 55 | if (typeof plasmoid !== "undefined") { | ||
56 | return Qt.size(plasmoid.width, plasmoid.height) | 56 | return Qt.size(plasmoid.width, plasmoid.height) | ||
57 | } | 57 | } | ||
58 | // Lock screen configuration case | 58 | // Lock screen configuration case | ||
59 | return Qt.size(Screen.width, Screen.height) | 59 | return Qt.size(Screen.width, Screen.height) | ||
60 | } | 60 | } | ||
61 | onSlidePathsChanged: cfg_SlidePaths = slidePaths | 61 | function onSlidePathsChanged() { cfg_SlidePaths = slidePaths } | ||
62 | onUncheckedSlidesChanged: cfg_UncheckedSlides = uncheckedSlides | 62 | function onUncheckedSlidesChanged() { cfg_UncheckedSlides = uncheckedSlides } | ||
63 | onSlideshowModeChanged: cfg_SlideshowMode = slideshowMode | 63 | function onSlideshowModeChanged() { cfg_SlideshowMode = slideshowMode } | ||
64 | } | 64 | } | ||
65 | 65 | | |||
66 | onCfg_FillModeChanged: { | 66 | function onCfg_FillModeChanged() { | ||
67 | resizeComboBox.setMethod() | 67 | resizeComboBox.setMethod() | ||
68 | } | 68 | } | ||
69 | 69 | | |||
70 | onCfg_SlidePathsChanged: { | 70 | function onCfg_SlidePathsChanged() { | ||
71 | imageWallpaper.slidePaths = cfg_SlidePaths | 71 | imageWallpaper.slidePaths = cfg_SlidePaths | ||
72 | } | 72 | } | ||
73 | onCfg_UncheckedSlidesChanged: { | 73 | function onCfg_UncheckedSlidesChanged() { | ||
74 | imageWallpaper.uncheckedSlides = cfg_UncheckedSlides | 74 | imageWallpaper.uncheckedSlides = cfg_UncheckedSlides | ||
75 | } | 75 | } | ||
76 | 76 | | |||
77 | onCfg_SlideshowModeChanged: { | 77 | function onCfg_SlideshowModeChanged() { | ||
78 | imageWallpaper.slideshowMode = cfg_SlideshowMode | 78 | imageWallpaper.slideshowMode = cfg_SlideshowMode | ||
79 | } | 79 | } | ||
80 | 80 | | |||
81 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | 81 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | ||
82 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | 82 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | ||
83 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | 83 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | ||
84 | 84 | | |||
85 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | 85 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | ||
Show All 22 Lines | 92 | model: [ | |||
108 | }, | 108 | }, | ||
109 | { | 109 | { | ||
110 | 'label': i18nd("plasma_wallpaper_org.kde.image","Tiled"), | 110 | 'label': i18nd("plasma_wallpaper_org.kde.image","Tiled"), | ||
111 | 'fillMode': Image.Tile | 111 | 'fillMode': Image.Tile | ||
112 | } | 112 | } | ||
113 | ] | 113 | ] | ||
114 | 114 | | |||
115 | textRole: "label" | 115 | textRole: "label" | ||
116 | onCurrentIndexChanged: cfg_FillMode = model[currentIndex]["fillMode"] | 116 | function onCurrentIndexChanged() { cfg_FillMode = model[currentIndex]["fillMode"] } | ||
117 | Component.onCompleted: setMethod(); | 117 | Component.onCompleted: setMethod(); | ||
118 | 118 | | |||
119 | function setMethod() { | 119 | function setMethod() { | ||
120 | for (var i = 0; i < model.length; i++) { | 120 | for (var i = 0; i < model.length; i++) { | ||
121 | if (model[i]["fillMode"] === root.cfg_FillMode) { | 121 | if (model[i]["fillMode"] === root.cfg_FillMode) { | ||
122 | resizeComboBox.currentIndex = i; | 122 | resizeComboBox.currentIndex = i; | ||
123 | var tl = model[i]["label"].length; | 123 | var tl = model[i]["label"].length; | ||
124 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | 124 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | ||
Show All 24 Lines | 147 | { | |||
149 | 'slideshowMode': Wallpaper.Image.ModifiedReversed | 149 | 'slideshowMode': Wallpaper.Image.ModifiedReversed | ||
150 | }, | 150 | }, | ||
151 | { | 151 | { | ||
152 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Date modified (oldest first)"), | 152 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Date modified (oldest first)"), | ||
153 | 'slideshowMode': Wallpaper.Image.Modified | 153 | 'slideshowMode': Wallpaper.Image.Modified | ||
154 | } | 154 | } | ||
155 | ] | 155 | ] | ||
156 | textRole: "label" | 156 | textRole: "label" | ||
157 | onCurrentIndexChanged: { | 157 | function onCurrentIndexChanged() { | ||
158 | cfg_SlideshowMode = model[currentIndex]["slideshowMode"]; | 158 | cfg_SlideshowMode = model[currentIndex]["slideshowMode"]; | ||
159 | } | 159 | } | ||
160 | Component.onCompleted: setMethod(); | 160 | Component.onCompleted: setMethod(); | ||
161 | function setMethod() { | 161 | function setMethod() { | ||
162 | for (var i = 0; i < model.length; i++) { | 162 | for (var i = 0; i < model.length; i++) { | ||
163 | if (model[i]["slideshowMode"] === wallpaper.configuration.SlideshowMode) { | 163 | if (model[i]["slideshowMode"] === wallpaper.configuration.SlideshowMode) { | ||
164 | slideshowComboBox.currentIndex = i; | 164 | slideshowComboBox.currentIndex = i; | ||
165 | } | 165 | } | ||
Show All 27 Lines | |||||
193 | } | 193 | } | ||
194 | } | 194 | } | ||
195 | 195 | | |||
196 | Component { | 196 | Component { | ||
197 | id: foldersComponent | 197 | id: foldersComponent | ||
198 | ColumnLayout { | 198 | ColumnLayout { | ||
199 | Connections { | 199 | Connections { | ||
200 | target: root | 200 | target: root | ||
201 | onHoursIntervalValueChanged: hoursInterval.value = root.hoursIntervalValue | 201 | function onHoursIntervalValueChanged() { hoursInterval.value = root.hoursIntervalValue } | ||
202 | onMinutesIntervalValueChanged: minutesInterval.value = root.minutesIntervalValue | 202 | function onMinutesIntervalValueChanged() { minutesInterval.value = root.minutesIntervalValue } | ||
203 | onSecondsIntervalValueChanged: secondsInterval.value = root.secondsIntervalValue | 203 | function onSecondsIntervalValueChanged() { secondsInterval.value = root.secondsIntervalValue } | ||
204 | } | 204 | } | ||
205 | //FIXME: there should be only one spinbox: QtControls spinboxes are still too limited for it tough | 205 | //FIXME: there should be only one spinbox: QtControls spinboxes are still too limited for it tough | ||
206 | Kirigami.FormLayout { | 206 | Kirigami.FormLayout { | ||
207 | twinFormLayouts: parentLayout | 207 | twinFormLayouts: parentLayout | ||
208 | RowLayout { | 208 | RowLayout { | ||
209 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image","Change every:") | 209 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image","Change every:") | ||
210 | QtControls2.SpinBox { | 210 | QtControls2.SpinBox { | ||
211 | id: hoursInterval | 211 | id: hoursInterval | ||
212 | value: root.hoursIntervalValue | 212 | value: root.hoursIntervalValue | ||
213 | from: 0 | 213 | from: 0 | ||
214 | to: 24 | 214 | to: 24 | ||
215 | editable: true | 215 | editable: true | ||
216 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 216 | function onValueChanged() { cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value } | ||
217 | 217 | | |||
218 | textFromValue: function(value, locale) { | 218 | textFromValue: function(value, locale) { | ||
219 | return i18ndp("plasma_wallpaper_org.kde.image","%1 hour", "%1 hours", value) | 219 | return i18ndp("plasma_wallpaper_org.kde.image","%1 hour", "%1 hours", value) | ||
220 | } | 220 | } | ||
221 | valueFromText: function(text, locale) { | 221 | valueFromText: function(text, locale) { | ||
222 | return parseInt(text); | 222 | return parseInt(text); | ||
223 | } | 223 | } | ||
224 | } | 224 | } | ||
225 | QtControls2.SpinBox { | 225 | QtControls2.SpinBox { | ||
226 | id: minutesInterval | 226 | id: minutesInterval | ||
227 | value: root.minutesIntervalValue | 227 | value: root.minutesIntervalValue | ||
228 | from: 0 | 228 | from: 0 | ||
229 | to: 60 | 229 | to: 60 | ||
230 | editable: true | 230 | editable: true | ||
231 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 231 | function onValueChanged() { cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value } | ||
232 | 232 | | |||
233 | textFromValue: function(value, locale) { | 233 | textFromValue: function(value, locale) { | ||
234 | return i18ndp("plasma_wallpaper_org.kde.image","%1 minute", "%1 minutes", value) | 234 | return i18ndp("plasma_wallpaper_org.kde.image","%1 minute", "%1 minutes", value) | ||
235 | } | 235 | } | ||
236 | valueFromText: function(text, locale) { | 236 | valueFromText: function(text, locale) { | ||
237 | return parseInt(text); | 237 | return parseInt(text); | ||
238 | } | 238 | } | ||
239 | } | 239 | } | ||
240 | QtControls2.SpinBox { | 240 | QtControls2.SpinBox { | ||
241 | id: secondsInterval | 241 | id: secondsInterval | ||
242 | value: root.secondsIntervalValue | 242 | value: root.secondsIntervalValue | ||
243 | from: root.hoursIntervalValue === 0 && root.minutesIntervalValue === 0 ? 1 : 0 | 243 | from: root.hoursIntervalValue === 0 && root.minutesIntervalValue === 0 ? 1 : 0 | ||
244 | to: 60 | 244 | to: 60 | ||
245 | editable: true | 245 | editable: true | ||
246 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 246 | function onValueChanged() { cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value } | ||
247 | 247 | | |||
248 | textFromValue: function(value, locale) { | 248 | textFromValue: function(value, locale) { | ||
249 | return i18ndp("plasma_wallpaper_org.kde.image","%1 second", "%1 seconds", value) | 249 | return i18ndp("plasma_wallpaper_org.kde.image","%1 second", "%1 seconds", value) | ||
250 | } | 250 | } | ||
251 | valueFromText: function(text, locale) { | 251 | valueFromText: function(text, locale) { | ||
252 | return parseInt(text); | 252 | return parseInt(text); | ||
253 | } | 253 | } | ||
254 | } | 254 | } | ||
▲ Show 20 Lines • Show All 84 Lines • ▼ Show 20 Line(s) | 336 | QtControls2.Button { | |||
339 | text: i18nd("plasma_wallpaper_org.kde.image","Add Folder...") | 339 | text: i18nd("plasma_wallpaper_org.kde.image","Add Folder...") | ||
340 | onClicked: imageWallpaper.showAddSlidePathsDialog() | 340 | onClicked: imageWallpaper.showAddSlidePathsDialog() | ||
341 | } | 341 | } | ||
342 | NewStuff.Button { | 342 | NewStuff.Button { | ||
343 | Layout.alignment: Qt.AlignRight | 343 | Layout.alignment: Qt.AlignRight | ||
344 | configFile: "wallpaper.knsrc" | 344 | configFile: "wallpaper.knsrc" | ||
345 | text: i18nd("plasma_wallpaper_org.kde.image", "Get New Wallpapers...") | 345 | text: i18nd("plasma_wallpaper_org.kde.image", "Get New Wallpapers...") | ||
346 | viewMode: NewStuff.Page.ViewMode.Preview | 346 | viewMode: NewStuff.Page.ViewMode.Preview | ||
347 | onChangedEntriesChanged: imageWallpaper.newStuffFinished(); | 347 | function onChangedEntriesChanged() { imageWallpaper.newStuffFinished(); } | ||
348 | } | 348 | } | ||
349 | } | 349 | } | ||
350 | } | 350 | } | ||
351 | } | 351 | } | ||
352 | 352 | | |||
353 | Component { | 353 | Component { | ||
354 | id: thumbnailsComponent | 354 | id: thumbnailsComponent | ||
355 | KCM.GridView { | 355 | KCM.GridView { | ||
Show All 10 Lines | |||||
366 | Connections { | 366 | Connections { | ||
367 | target: imageModel | 367 | target: imageModel | ||
368 | onRowsInserted: resetCurrentIndex() | 368 | onRowsInserted: resetCurrentIndex() | ||
369 | onRowsRemoved: resetCurrentIndex() | 369 | onRowsRemoved: resetCurrentIndex() | ||
370 | } | 370 | } | ||
371 | 371 | | |||
372 | Connections { | 372 | Connections { | ||
373 | target: root | 373 | target: root | ||
374 | onCfg_ImageChanged: resetCurrentIndex() | 374 | function onCfg_ImageChanged() { resetCurrentIndex() } | ||
375 | } | 375 | } | ||
376 | 376 | | |||
377 | //kill the space for label under thumbnails | 377 | //kill the space for label under thumbnails | ||
378 | view.model: imageModel | 378 | view.model: imageModel | ||
379 | Component.onCompleted: { | 379 | Component.onCompleted: { | ||
380 | imageModel.usedInConfig = true; | 380 | imageModel.usedInConfig = true; | ||
381 | resetCurrentIndex() | 381 | resetCurrentIndex() | ||
382 | } | 382 | } | ||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Line(s) | 436 | QtControls2.Button { | |||
438 | text: i18nd("plasma_wallpaper_org.kde.image","Add Image...") | 438 | text: i18nd("plasma_wallpaper_org.kde.image","Add Image...") | ||
439 | onClicked: imageWallpaper.showFileDialog(); | 439 | onClicked: imageWallpaper.showFileDialog(); | ||
440 | } | 440 | } | ||
441 | NewStuff.Button { | 441 | NewStuff.Button { | ||
442 | Layout.alignment: Qt.AlignRight | 442 | Layout.alignment: Qt.AlignRight | ||
443 | configFile: "wallpaper.knsrc" | 443 | configFile: "wallpaper.knsrc" | ||
444 | text: i18nd("plasma_wallpaper_org.kde.image", "Get New Wallpapers...") | 444 | text: i18nd("plasma_wallpaper_org.kde.image", "Get New Wallpapers...") | ||
445 | viewMode: NewStuff.Page.ViewMode.Preview | 445 | viewMode: NewStuff.Page.ViewMode.Preview | ||
446 | onChangedEntriesChanged: imageWallpaper.newStuffFinished(); | 446 | function onChangedEntriesChanged() { imageWallpaper.newStuffFinished(); } | ||
447 | } | 447 | } | ||
448 | } | 448 | } | ||
449 | } | 449 | } |