- I used Unsplash Source API (unlimited, public) instead of parsing HTML. It should be faster and more reliable. (Parsing HTML may break anytime they update their website...)
- Create UnsplashBaseProvider, which has collectionId in constructor. Extend it in children classes to support different collections. Now support all wallpaper collections.
Details
- Reviewers
ngraham - Group Reviewers
Plasma - Commits
- R114:fe8c40dc3b9a: Attempt to support different collections of Unsplash
Diff Detail
- Repository
- R114 Plasma Addons
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 14419 Build 14437: arc lint + arc unit
Could we only have Unsplash as the provider and the an additional combobox that would allow choosing the category?
+1, this should be a single Unsplash plugin whose user-facing UI has a combobox allowing you to specify the collection.
I also feel this is better. We can even provide preview thumbnails before users choose a wallpaper collection. The only disadvantage is that I have to write a new wallpaper plugin and its UI.
The new change try to add a new ComboBox "Category" and pass the value to PODT data engine. This also introduced a new configuration option. But now it makes plasmashell crash without useful error output.
Now it is working again! You will have a Category combobox to choose photo collections from Unsplash
Nice!
How about adding an "All" entry for the combo box which would show you wallpapers from any category? Is that possible?
Tried it out. My reaction is: "Wow, this is really nice."
One UI improvement I could see is to allow multi-selection of categories, so for example you could see images from all the nature-related categories but not Car or Sports.
The way I'd envision this working is that instead of a combo box, a label would display the currently selected categories. Next to it would be a button labeled "Change categories" that would use the multi-page KCM API to take the user to another page with a checkbox for each category. This page would allow selecting any assortment of categories, which would then be listed on the main page. It would be sort of like the corner selector UI in the new Notifications KCM.
Anyway, that's definitely a nice-to-have, and this seems fine from a functional and UI perspective already.
Multi-selection might be difficult to implement in back end. The Unsplash Source API I use only supports a single collection ID. Search API might support multiple keywords, but it is like "AND" logic, not "OR" logic. So for now, I cannot achieve this function.
dataengines/potd/potdprovider.cpp | ||
---|---|---|
54 | The lack of error handling and else blocks for all the ifs in this new code makes me feel a bit nervous. | |
wallpapers/potd/contents/ui/config.qml | ||
208 | Since this is only used once, you don't need to make it a function; just put all of this stuff in the Component.onCompleted: directly |
dataengines/potd/potdprovider.cpp | ||
---|---|---|
54 | date is optional, so if it not found, just leave it as undefined. I can add some detection to toString() function, in case they passed some non-string args. mach() should be safe. |