Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/imagepackage/contents/ui/config.qml
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Copyright 2013 Marco Martin <mart@kde.org> | 2 | * Copyright 2013 Marco Martin <mart@kde.org> | ||
3 | * Copyright 2014 Kai Uwe Broulik <kde@privat.broulik.de> | 3 | * Copyright 2014 Kai Uwe Broulik <kde@privat.broulik.de> | ||
4 | * Copyright 2019 David Redondo <kde@david-redondo.de> | ||||
4 | * | 5 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | 9 | * (at your option) any later version. | ||
9 | * | 10 | * | ||
10 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
Show All 17 Lines | |||||
29 | import org.kde.kcm 1.1 as KCM | 30 | import org.kde.kcm 1.1 as KCM | ||
30 | import org.kde.kirigami 2.5 as Kirigami | 31 | import org.kde.kirigami 2.5 as Kirigami | ||
31 | 32 | | |||
32 | ColumnLayout { | 33 | ColumnLayout { | ||
33 | id: root | 34 | id: root | ||
34 | property alias cfg_Color: colorButton.color | 35 | property alias cfg_Color: colorButton.color | ||
35 | property string cfg_Image | 36 | property string cfg_Image | ||
36 | property int cfg_FillMode | 37 | property int cfg_FillMode | ||
38 | property int cfg_SlideshowMode | ||||
37 | property alias cfg_Blur: blurRadioButton.checked | 39 | property alias cfg_Blur: blurRadioButton.checked | ||
38 | property var cfg_SlidePaths: "" | 40 | property var cfg_SlidePaths: "" | ||
39 | property int cfg_SlideInterval: 0 | 41 | property int cfg_SlideInterval: 0 | ||
40 | property var cfg_UncheckedSlides: [] | 42 | property var cfg_UncheckedSlides: [] | ||
41 | 43 | | |||
42 | function saveConfig() { | 44 | function saveConfig() { | ||
43 | imageWallpaper.commitDeletion(); | 45 | imageWallpaper.commitDeletion(); | ||
44 | } | 46 | } | ||
45 | 47 | | |||
46 | SystemPalette { | 48 | SystemPalette { | ||
47 | id: syspal | 49 | id: syspal | ||
48 | } | 50 | } | ||
49 | 51 | | |||
50 | Wallpaper.Image { | 52 | Wallpaper.Image { | ||
51 | id: imageWallpaper | 53 | id: imageWallpaper | ||
52 | targetSize: { | 54 | targetSize: { | ||
53 | if (typeof plasmoid !== "undefined") { | 55 | if (typeof plasmoid !== "undefined") { | ||
54 | return Qt.size(plasmoid.width, plasmoid.height) | 56 | return Qt.size(plasmoid.width, plasmoid.height) | ||
55 | } | 57 | } | ||
56 | // Lock screen configuration case | 58 | // Lock screen configuration case | ||
57 | return Qt.size(Screen.width, Screen.height) | 59 | return Qt.size(Screen.width, Screen.height) | ||
58 | } | 60 | } | ||
59 | onSlidePathsChanged: cfg_SlidePaths = slidePaths | 61 | onSlidePathsChanged: cfg_SlidePaths = slidePaths | ||
60 | onUncheckedSlidesChanged: cfg_UncheckedSlides = uncheckedSlides | 62 | onUncheckedSlidesChanged: cfg_UncheckedSlides = uncheckedSlides | ||
63 | onSlideshowModeChanged: cfg_SlideshowMode = slideshowMode | ||||
61 | } | 64 | } | ||
62 | 65 | | |||
63 | onCfg_SlidePathsChanged: { | 66 | onCfg_SlidePathsChanged: { | ||
64 | imageWallpaper.slidePaths = cfg_SlidePaths | 67 | imageWallpaper.slidePaths = cfg_SlidePaths | ||
65 | } | 68 | } | ||
66 | onCfg_UncheckedSlidesChanged: { | 69 | onCfg_UncheckedSlidesChanged: { | ||
67 | imageWallpaper.uncheckedSlides = cfg_UncheckedSlides | 70 | imageWallpaper.uncheckedSlides = cfg_UncheckedSlides | ||
68 | } | 71 | } | ||
69 | 72 | | |||
73 | onCfg_SlideshowModeChanged: { | ||||
74 | imageWallpaper.slideshowMode = cfg_SlideshowMode | ||||
75 | } | ||||
76 | | ||||
70 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | 77 | property int hoursIntervalValue: Math.floor(cfg_SlideInterval / 3600) | ||
71 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | 78 | property int minutesIntervalValue: Math.floor(cfg_SlideInterval % 3600) / 60 | ||
72 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | 79 | property int secondsIntervalValue: cfg_SlideInterval % 3600 % 60 | ||
73 | 80 | | |||
74 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | 81 | //Rectangle { color: "orange"; x: formAlignment; width: formAlignment; height: 20 } | ||
75 | 82 | | |||
76 | Kirigami.FormLayout { | 83 | Kirigami.FormLayout { | ||
77 | twinFormLayouts: parentLayout | 84 | twinFormLayouts: parentLayout | ||
Show All 33 Lines | 117 | if (model[i]["fillMode"] === wallpaper.configuration.FillMode) { | |||
111 | resizeComboBox.currentIndex = i; | 118 | resizeComboBox.currentIndex = i; | ||
112 | var tl = model[i]["label"].length; | 119 | var tl = model[i]["label"].length; | ||
113 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | 120 | //resizeComboBox.textLength = Math.max(resizeComboBox.textLength, tl+5); | ||
114 | } | 121 | } | ||
115 | } | 122 | } | ||
116 | } | 123 | } | ||
117 | } | 124 | } | ||
118 | 125 | | |||
126 | QtControls2.ComboBox { | ||||
127 | id: slideshowComboBox | ||||
128 | visible: configDialog.currentWallpaper == "org.kde.slideshow" | ||||
129 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image", "Order:") | ||||
130 | model: [ | ||||
131 | { | ||||
132 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Random"), | ||||
133 | 'slideshowMode': Wallpaper.Image.Random | ||||
134 | }, | ||||
135 | { | ||||
136 | 'label': i18nd("plasma_wallpaper_org.kde.image", "A to Z"), | ||||
filipf: Instead of "A first" I think we can just say "A to Z" or even "A-Z" | |||||
137 | 'slideshowMode': Wallpaper.Image.Alphabetical | ||||
138 | }, | ||||
139 | { | ||||
140 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Z to A"), | ||||
filipf: Same comment as above just reverse A and Z. | |||||
141 | 'slideshowMode': Wallpaper.Image.AlphabeticalReversed | ||||
142 | }, | ||||
143 | { | ||||
144 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Date modified (newest first)"), | ||||
Something like "Date modified" might be closer to what we have in file managers. filipf: Something like "Date modified" might be closer to what we have in file managers. | |||||
145 | 'slideshowMode': Wallpaper.Image.ModifiedReversed | ||||
146 | }, | ||||
147 | { | ||||
148 | 'label': i18nd("plasma_wallpaper_org.kde.image", "Date modified (oldest first)"), | ||||
ngraham: Needs a trailing ")" in the label | |||||
149 | 'slideshowMode': Wallpaper.Image.Modified | ||||
150 | } | ||||
151 | ] | ||||
152 | textRole: "label" | ||||
153 | onCurrentIndexChanged: { | ||||
154 | cfg_SlideshowMode = model[currentIndex]["slideshowMode"]; | ||||
155 | } | ||||
156 | Component.onCompleted: setMethod(); | ||||
157 | function setMethod() { | ||||
158 | for (var i = 0; i < model.length; i++) { | ||||
159 | if (model[i]["slideshowMode"] === wallpaper.configuration.SlideshowMode) { | ||||
160 | slideshowComboBox.currentIndex = i; | ||||
161 | } | ||||
162 | } | ||||
163 | } | ||||
164 | } | ||||
165 | | ||||
119 | QtControls2.ButtonGroup { id: backgroundGroup } | 166 | QtControls2.ButtonGroup { id: backgroundGroup } | ||
120 | 167 | | |||
121 | QtControls2.RadioButton { | 168 | QtControls2.RadioButton { | ||
122 | id: blurRadioButton | 169 | id: blurRadioButton | ||
123 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | 170 | visible: cfg_FillMode === Image.PreserveAspectFit || cfg_FillMode === Image.Pad | ||
124 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image", "Background:") | 171 | Kirigami.FormData.label: i18nd("plasma_wallpaper_org.kde.image", "Background:") | ||
125 | text: i18nd("plasma_wallpaper_org.kde.image", "Blur") | 172 | text: i18nd("plasma_wallpaper_org.kde.image", "Blur") | ||
126 | QtControls2.ButtonGroup.group: backgroundGroup | 173 | QtControls2.ButtonGroup.group: backgroundGroup | ||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Line(s) | 192 | Component { | |||
259 | } | 306 | } | ||
260 | } | 307 | } | ||
261 | 308 | | |||
262 | Component { | 309 | Component { | ||
263 | id: thumbnailsComponent | 310 | id: thumbnailsComponent | ||
264 | KCM.GridView { | 311 | KCM.GridView { | ||
265 | id: wallpapersGrid | 312 | id: wallpapersGrid | ||
266 | anchors.fill: parent | 313 | anchors.fill: parent | ||
267 | property var imageModel: (configDialog.currentWallpaper == "org.kde.image")? imageWallpaper.wallpaperModel : imageWallpaper.slideshowModel | 314 | property var imageModel: (configDialog.currentWallpaper == "org.kde.image")? imageWallpaper.wallpaperModel : imageWallpaper.slideFilterModel | ||
268 | //that min is needed as the module will be populated in an async way | 315 | //that min is needed as the module will be populated in an async way | ||
269 | //and only on demand so we can't ensure it already exists | 316 | //and only on demand so we can't ensure it already exists | ||
270 | view.currentIndex: Math.min(imageModel.indexOf(cfg_Image), imageModel.count-1) | 317 | view.currentIndex: Math.min(imageModel.indexOf(cfg_Image), imageModel.count-1) | ||
271 | //kill the space for label under thumbnails | 318 | //kill the space for label under thumbnails | ||
272 | view.model: imageModel | 319 | view.model: imageModel | ||
320 | Component.onCompleted: { | ||||
321 | console.log("Completed" + imageModel); | ||||
322 | //imageModel.sort(0); | ||||
323 | imageModel.filterUncheckedSlides = false; | ||||
324 | } | ||||
273 | view.delegate: WallpaperDelegate { | 325 | view.delegate: WallpaperDelegate { | ||
274 | color: cfg_Color | 326 | color: cfg_Color | ||
275 | } | 327 | } | ||
276 | } | 328 | } | ||
277 | } | 329 | } | ||
278 | 330 | | |||
279 | DragDrop.DropArea { | 331 | DragDrop.DropArea { | ||
280 | Layout.fillWidth: true | 332 | Layout.fillWidth: true | ||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |
Instead of "A first" I think we can just say "A to Z" or even "A-Z"