Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/image/imagepackage/contents/ui/config.qml
Show First 20 Lines • Show All 232 Lines • ▼ Show 20 Line(s) | 227 | QtControls2.SpinBox { | |||
---|---|---|---|---|---|
233 | to: 60 | 233 | to: 60 | ||
234 | editable: true | 234 | editable: true | ||
235 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | 235 | onValueChanged: cfg_SlideInterval = hoursInterval.value * 3600 + minutesInterval.value * 60 + secondsInterval.value | ||
236 | } | 236 | } | ||
237 | QtControls2.Label { | 237 | QtControls2.Label { | ||
238 | text: i18nd("plasma_wallpaper_org.kde.image","Seconds") | 238 | text: i18nd("plasma_wallpaper_org.kde.image","Seconds") | ||
239 | } | 239 | } | ||
240 | } | 240 | } | ||
241 | Kirigami.Heading { | ||||
242 | text: "Folders" | ||||
243 | level: 2 | ||||
244 | } | ||||
245 | GridLayout { | ||||
246 | columns: 2 | ||||
247 | Layout.fillWidth: true | ||||
248 | Layout.fillHeight: true | ||||
249 | columnSpacing: Kirigami.Units.largeSpacing | ||||
241 | QtControls2.ScrollView { | 250 | QtControls2.ScrollView { | ||
242 | id: foldersScroll | 251 | id: foldersScroll | ||
243 | Layout.fillHeight: true; | 252 | Layout.fillHeight: true | ||
244 | Layout.fillWidth: true | 253 | Layout.preferredWidth: 0.25 * parent.width | ||
245 | Component.onCompleted: foldersScroll.background.visible = true; | 254 | Component.onCompleted: foldersScroll.background.visible = true; | ||
246 | ListView { | 255 | ListView { | ||
247 | id: slidePathsView | 256 | id: slidePathsView | ||
248 | anchors.margins: 4 | 257 | anchors.margins: 4 | ||
249 | model: imageWallpaper.slidePaths | 258 | model: imageWallpaper.slidePaths | ||
250 | delegate: QtControls2.Label { | 259 | delegate: Kirigami.SwipeListItem { | ||
251 | text: modelData | 260 | id: folderDelegate | ||
261 | actions: [ | ||||
262 | Kirigami.Action { | ||||
263 | iconName: "list-remove" | ||||
264 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Remove Folder") | ||||
265 | onTriggered: imageWallpaper.removeSlidePath(modelData) | ||||
266 | }, | ||||
267 | Kirigami.Action { | ||||
268 | icon.name: "document-open-folder" | ||||
269 | tooltip: i18nd("plasma_wallpaper_org.kde.image", "Open Folder") | ||||
ngraham: `KIO::highlightInFileManager()` does in fact open the containing folder, so the old tooltip was… | |||||
270 | onTriggered: imageWallpaper.openFolder(modelData) | ||||
271 | } | ||||
272 | ] | ||||
273 | QtControls2.Label { | ||||
274 | text: modelData.endsWith("/") ? modelData.split('/').reverse()[1] : modelData.split('/').pop() | ||||
275 | Layout.fillWidth: true | ||||
276 | QtControls2.ToolTip.text: modelData | ||||
277 | QtControls2.ToolTip.visible: folderDelegate.hovered | ||||
278 | QtControls2.ToolTip.delay: 1000 | ||||
This should also hide itself when either of the actions' tooltips is visible (otherwise they overlap each other) ngraham: This should also hide itself when either of the actions' tooltips is visible (otherwise they… | |||||
279 | QtControls2.ToolTip.timeout: 5000 | ||||
280 | } | ||||
252 | width: slidePathsView.width | 281 | width: slidePathsView.width | ||
253 | height: Math.max(paintedHeight, removeButton.height); | 282 | height: paintedHeight; | ||
254 | QtControls2.ToolButton { | | |||
255 | id: removeButton | | |||
256 | anchors { | | |||
257 | verticalCenter: parent.verticalCenter | | |||
258 | right: parent.right | | |||
259 | } | 283 | } | ||
260 | icon.name: "list-remove" | | |||
261 | onClicked: imageWallpaper.removeSlidePath(modelData); | | |||
262 | } | 284 | } | ||
263 | } | 285 | } | ||
286 | Loader { | ||||
287 | sourceComponent: thumbnailsComponent | ||||
288 | Layout.fillWidth: true | ||||
289 | Layout.fillHeight: true | ||||
290 | anchors.fill: undefined | ||||
291 | } | ||||
292 | QtControls2.Button { | ||||
293 | Layout.alignment: Qt.AlignRight | ||||
294 | icon.name: "list-add" | ||||
295 | text: i18nd("plasma_wallpaper_org.kde.image","Add Folder...") | ||||
296 | onClicked: imageWallpaper.showAddSlidePathsDialog() | ||||
297 | } | ||||
298 | QtControls2.Button { | ||||
299 | Layout.alignment: Qt.AlignRight | ||||
300 | icon.name: "get-hot-new-stuff" | ||||
301 | text: i18nd("plasma_wallpaper_org.kde.image","Get New Wallpapers...") | ||||
302 | visible: KAuthorized.authorize("ghns") | ||||
303 | onClicked: imageWallpaper.getNewWallpaper(this); | ||||
264 | } | 304 | } | ||
265 | } | 305 | } | ||
266 | } | 306 | } | ||
267 | } | 307 | } | ||
268 | 308 | | |||
269 | Component { | 309 | Component { | ||
270 | id: thumbnailsComponent | 310 | id: thumbnailsComponent | ||
271 | KCM.GridView { | 311 | KCM.GridView { | ||
272 | id: wallpapersGrid | 312 | id: wallpapersGrid | ||
273 | anchors.fill: parent | 313 | anchors.fill: parent | ||
274 | 314 | property var imageModel: (configDialog.currentWallpaper == "org.kde.image")? imageWallpaper.wallpaperModel : imageWallpaper.slideshowModel | |||
275 | //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 | ||
276 | //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 | ||
277 | view.currentIndex: Math.min(imageWallpaper.wallpaperModel.indexOf(cfg_Image), imageWallpaper.wallpaperModel.count-1) | 317 | view.currentIndex: Math.min(imageModel.indexOf(cfg_Image), imageModel.count-1) | ||
278 | //kill the space for label under thumbnails | 318 | //kill the space for label under thumbnails | ||
279 | view.model: imageWallpaper.wallpaperModel | 319 | view.model: imageModel | ||
280 | view.delegate: WallpaperDelegate { | 320 | view.delegate: WallpaperDelegate { | ||
281 | color: cfg_Color | 321 | color: cfg_Color | ||
282 | } | 322 | } | ||
283 | } | 323 | } | ||
284 | } | 324 | } | ||
285 | 325 | | |||
286 | DragDrop.DropArea { | 326 | DragDrop.DropArea { | ||
287 | Layout.fillWidth: true | 327 | Layout.fillWidth: true | ||
Show All 14 Lines | 341 | } else { | |||
302 | imageWallpaper.addSlidePath(path); | 342 | imageWallpaper.addSlidePath(path); | ||
303 | } | 343 | } | ||
304 | } | 344 | } | ||
305 | }); | 345 | }); | ||
306 | } | 346 | } | ||
307 | 347 | | |||
308 | Loader { | 348 | Loader { | ||
309 | anchors.fill: parent | 349 | anchors.fill: parent | ||
310 | sourceComponent: (configDialog.currentWallpaper == "org.kde.image") ? thumbnailsComponent : foldersComponent | 350 | sourceComponent: (configDialog.currentWallpaper == "org.kde.image") ? thumbnailsComponent : | ||
351 | ((configDialog.currentWallpaper == "org.kde.slideshow") ? foldersComponent : undefined) | ||||
There's a funny bug here: When you're on the Image (not slideshow!) tab, and then close the window or select "Plain color" it will instantiate an instance of SlideModel during closure. It seems to be because configDialog.currentWallpaper changing gets evaluated here before the main view reloads. As an easy test put Component.onCompleted: { console.log("Dave") } Inside the ColumnView of foldersComponent it shouldn't be emitted when changing between image and colour. davidedmundson: There's a funny bug here:
When you're on the Image (not slideshow!) tab, and then close the… | |||||
311 | } | 352 | } | ||
312 | } | 353 | } | ||
313 | 354 | | |||
314 | RowLayout { | 355 | RowLayout { | ||
315 | id: buttonsRow | 356 | id: buttonsRow | ||
316 | Layout.alignment: Qt.AlignRight | Qt.AlignVCenter | 357 | Layout.alignment: Qt.AlignRight | Qt.AlignVCenter | ||
358 | visible: configDialog.currentWallpaper == "org.kde.image" | ||||
317 | QtControls2.Button { | 359 | QtControls2.Button { | ||
318 | visible: (configDialog.currentWallpaper == "org.kde.slideshow") | | |||
319 | icon.name: "list-add" | | |||
320 | text: i18nd("plasma_wallpaper_org.kde.image","Add Folder...") | | |||
321 | onClicked: imageWallpaper.showAddSlidePathsDialog() | | |||
322 | } | | |||
323 | QtControls2.Button { | | |||
324 | visible: (configDialog.currentWallpaper == "org.kde.image") | | |||
325 | icon.name: "list-add" | 360 | icon.name: "list-add" | ||
326 | text: i18nd("plasma_wallpaper_org.kde.image","Add Image...") | 361 | text: i18nd("plasma_wallpaper_org.kde.image","Add Image...") | ||
327 | onClicked: imageWallpaper.showFileDialog(); | 362 | onClicked: imageWallpaper.showFileDialog(); | ||
328 | } | 363 | } | ||
329 | QtControls2.Button { | 364 | QtControls2.Button { | ||
330 | icon.name: "get-hot-new-stuff" | 365 | icon.name: "get-hot-new-stuff" | ||
331 | text: i18nd("plasma_wallpaper_org.kde.image","Get New Wallpapers...") | 366 | text: i18nd("plasma_wallpaper_org.kde.image","Get New Wallpapers...") | ||
332 | visible: KAuthorized.authorize("ghns") | 367 | visible: KAuthorized.authorize("ghns") | ||
333 | onClicked: imageWallpaper.getNewWallpaper(this); | 368 | onClicked: imageWallpaper.getNewWallpaper(this); | ||
334 | } | 369 | } | ||
335 | } | 370 | } | ||
336 | } | 371 | } |
KIO::highlightInFileManager() does in fact open the containing folder, so the old tooltip was correct! :) If you want to use "Open Folder" as the text, you should go back to using KRun to open the folder itself.