[Slideshow Wallpaper] Don't hardcode list of supported image formats
ClosedPublic

Authored by broulik on Aug 20 2016, 10:14 PM.

Details

Summary

Instead use QImageReader to get the glob patterns of all supported formats, similar to what the "Open image" dialog in the regular image wallpaper did.

Also, make use of QDir::setNameFilters rather than manually filtering out non-matching files.

Test Plan

As reported in https://www.reddit.com/r/kde/comments/4yqv68/webp_as_wallpaper/ and thanks for seeking the proper code snippets.

Created a test folder with a few .jpg and .webp files and some other junk as well as two sub folders with images in them.
Slideshow would pick up the .jpg and .webp images as well as the images from the subdirectories but not the other junk files.

Diff Detail

Repository
R120 Plasma Workspace
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik updated this revision to Diff 6106.Aug 20 2016, 10:14 PM
broulik retitled this revision from to [Slideshow Wallpaper] Don't hardcode list of supported image formats.
broulik updated this object.
broulik edited the test plan for this revision. (Show Details)
broulik added a reviewer: Plasma.
broulik set the repository for this revision to R120 Plasma Workspace.
Restricted Application added a project: Plasma. · View Herald TranscriptAug 20 2016, 10:14 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
davidedmundson accepted this revision.Aug 20 2016, 10:25 PM
davidedmundson added a reviewer: davidedmundson.
davidedmundson added a subscriber: davidedmundson.

You don't need the inner for loop. You're appending a string list to a string list

This revision is now accepted and ready to land.Aug 20 2016, 10:25 PM
This revision was automatically updated to reflect the committed changes.