18
import AccountsService 0.1
20
18
import Ubuntu.Components 1.3
23
Defines the background URL based on several factors, such as:
24
- default, fallback, background
25
- Background set in AccountSettings, if any
26
- Background set in GSettings, if any
29
// Users should set their UI width here.
32
property url defaultBackground: Qt.resolvedUrl(width >= units.gu(60) ? "../graphics/tablet_background.jpg"
33
: "../graphics/phone_background.jpg")
35
// That's the property users of this component are going to consume.
36
readonly property url background: asImageTester.status == Image.Ready ? asImageTester.source
37
: gsImageTester.status == Image.Ready ? gsImageTester.source : defaultBackground
39
// This is a dummy image to detect if the custom AS set wallpaper loads successfully.
40
property var _asImageTester: Image {
42
source: AccountsService.backgroundFile != undefined && AccountsService.backgroundFile.length > 0 ? AccountsService.backgroundFile : ""
49
// This is a dummy image to detect if the custom GSettings set wallpaper loads successfully.
50
property var _gsImageTester: Image {
52
source: backgroundSettings.pictureUri && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : ""
59
property var _gsettings: GSettings {
60
id: backgroundSettings
61
schema.id: "org.gnome.desktop.background"
23
// Provide a list of wallpapers to resolve here, preferred ones first
24
property var candidates: []
26
readonly property url background: {
27
for (var i = 0; i < repeater.count; i++) {
28
if (repeater.itemAt(i).status === Image.Ready)
32
return candidates[i - 1]; // last item is last resort
40
model: root.candidates