Changeset View
Changeset View
Standalone View
Standalone View
wallpapers/potd/contents/ui/main.qml
Show All 19 Lines | |||||
20 | import QtQuick 2.5 | 20 | import QtQuick 2.5 | ||
21 | import org.kde.plasma.core 2.0 as PlasmaCore | 21 | import org.kde.plasma.core 2.0 as PlasmaCore | ||
22 | import org.kde.kquickcontrolsaddons 2.0 | 22 | import org.kde.kquickcontrolsaddons 2.0 | ||
23 | 23 | | |||
24 | Rectangle { | 24 | Rectangle { | ||
25 | id: root | 25 | id: root | ||
26 | 26 | | |||
27 | readonly property string provider: wallpaper.configuration.Provider | 27 | readonly property string provider: wallpaper.configuration.Provider | ||
28 | readonly property string category: wallpaper.configuration.Category | ||||
29 | readonly property string identifier: provider === 'unsplash' && category ? provider + ':' + category : provider | ||||
28 | 30 | | |||
29 | PlasmaCore.DataSource { | 31 | PlasmaCore.DataSource { | ||
30 | id: engine | 32 | id: engine | ||
31 | engine: "potd" | 33 | engine: "potd" | ||
32 | connectedSources: [provider] | 34 | connectedSources: [identifier] | ||
33 | } | 35 | } | ||
34 | 36 | | |||
35 | Rectangle { | 37 | Rectangle { | ||
36 | id: backgroundColor | 38 | id: backgroundColor | ||
37 | anchors.fill: parent | 39 | anchors.fill: parent | ||
38 | color: wallpaper.configuration.Color | 40 | color: wallpaper.configuration.Color | ||
39 | Behavior on color { | 41 | Behavior on color { | ||
40 | ColorAnimation { duration: units.longDuration } | 42 | ColorAnimation { duration: units.longDuration } | ||
41 | } | 43 | } | ||
42 | } | 44 | } | ||
43 | 45 | | |||
44 | QImageItem { | 46 | QImageItem { | ||
45 | anchors.fill: parent | 47 | anchors.fill: parent | ||
46 | image: engine.data[provider]["Image"] | 48 | image: engine.data[identifier].Image | ||
47 | fillMode: wallpaper.configuration.FillMode | 49 | fillMode: wallpaper.configuration.FillMode | ||
48 | smooth: true | 50 | smooth: true | ||
49 | } | 51 | } | ||
50 | } | 52 | } |