Changeset View
Changeset View
Standalone View
Standalone View
dataengines/potd/unsplashprovider.h
Show All 21 Lines | |||||
22 | 22 | | |||
23 | #include "potdprovider.h" | 23 | #include "potdprovider.h" | ||
24 | // Qt | 24 | // Qt | ||
25 | #include <QImage> | 25 | #include <QImage> | ||
26 | 26 | | |||
27 | class KJob; | 27 | class KJob; | ||
28 | 28 | | |||
29 | /** | 29 | /** | ||
30 | * This class provides random wallpapers from Unsplash Wallpapers | 30 | * This class provides random wallpapers from Unsplash Wallpapers Desktop Collection | ||
31 | * Image urls are parsed from https://unsplash.com/wallpaper/1065396/desktop-wallpapers | 31 | * https://unsplash.com/wallpaper/1065396/desktop-wallpapers | ||
32 | * | ||||
33 | * By extending this class and modify mCollection (the number in url), | ||||
34 | * we can get photo wallpaper from any collections | ||||
32 | */ | 35 | */ | ||
33 | class UnsplashProvider : public PotdProvider | 36 | class UnsplashProvider : public PotdProvider | ||
34 | { | 37 | { | ||
35 | Q_OBJECT | 38 | Q_OBJECT | ||
36 | 39 | | |||
37 | public: | 40 | public: | ||
38 | /** | 41 | /** | ||
39 | * Creates a new Unsplash provider. | 42 | * Creates a new Unsplash provider. | ||
Show All 11 Lines | |||||
51 | /** | 54 | /** | ||
52 | * Returns the requested image. | 55 | * Returns the requested image. | ||
53 | * | 56 | * | ||
54 | * Note: This method returns only a valid image after the | 57 | * Note: This method returns only a valid image after the | ||
55 | * finished() signal has been emitted. | 58 | * finished() signal has been emitted. | ||
56 | */ | 59 | */ | ||
57 | QImage image() const override; | 60 | QImage image() const override; | ||
58 | 61 | | |||
62 | virtual int collection() const; | ||||
63 | | ||||
59 | private: | 64 | private: | ||
60 | void pageRequestFinished(KJob *job); | | |||
61 | void imageRequestFinished(KJob *job); | 65 | void imageRequestFinished(KJob *job); | ||
62 | 66 | | |||
63 | private: | 67 | private: | ||
64 | QImage mImage; | 68 | QImage mImage; | ||
65 | }; | 69 | }; | ||
66 | 70 | | |||
67 | #endif | 71 | #endif |