on xenial help sign in
simplify
f6ecb84Michael Zanetti
Components/CrossFadeImage.qml+1−1
@@ -85,7 +85,7 @@ Item {
85 Connections {
85 Connections {
86 target: __nextImage
86 target: __nextImage
87 onStatusChanged: {
87 onStatusChanged: {
88− if (__nextImage.status == Image.Ready) {
88+ if (__nextImage.status == Image.Ready || __nextImage.status == Image.Error) {
89 swapImages();
89 swapImages();
90 }
90 }
91 }
91 }
Greeter/GreeterContent.qml−1
@@ -38,7 +38,6 @@ MouseArea {
38
38
39 source: shell.background
39 source: shell.background
40 anchors.fill: parent
40 anchors.fill: parent
41− crossFade: false
42 fadeInFirst: false
41 fadeInFirst: false
43 }
42 }
44
43
Shell.qml+9−39
@@ -41,8 +41,8 @@ FocusScope {
41 height: tablet ? units.gu(100) : units.gu(71)
41 height: tablet ? units.gu(100) : units.gu(71)
42
42
43 property real edgeSize: units.gu(2)
43 property real edgeSize: units.gu(2)
44− property url default_background: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
44+ property url defaultBackground: shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg"
45− property url background: default_background
45+ property url background: backgroundSettings.pictureUri
46 readonly property real panelHeight: panel.panelHeight
46 readonly property real panelHeight: panel.panelHeight
47
47
48 property bool dashShown: dash.shown
48 property bool dashShown: dash.shown
@@ -118,40 +118,6 @@ FocusScope {
118 schema.id: "org.gnome.desktop.background"
118 schema.id: "org.gnome.desktop.background"
119 }
119 }
120
120
121− function updateImage() {
122− if (testImage.source == "")
123− return
124−
125− if (testImage.status == Image.Ready) {
126− if (shell.width / shell.height <= testImage.sourceSize.width / testImage.sourceSize.height) {
127− backgroundImage.sourceSize.width = 0
128− backgroundImage.sourceSize.height = Qt.binding(function() { return shell.height })
129− } else {
130− backgroundImage.sourceSize.height = 0
131− backgroundImage.sourceSize.width = Qt.binding(function() { return shell.width })
132− }
133−
134− shell.background = testImage.source
135− } else if (testImage.status == Image.Error) {
136− shell.background = shell.default_background
137− }
138−
139− // unload testImage source to save memory
140− testImage.source = ""
141− }
142−
143− Image {
144− id: testImage
145−
146− property url gsettingsImage: backgroundSettings.pictureUri
147−
148− source: gsettingsImage
149− visible: false
150−
151− onGsettingsImageChanged: source = gsettingsImage
152− onStatusChanged: updateImage()
153− }
154−
155 VolumeControl {
121 VolumeControl {
156 id: volumeControl
122 id: volumeControl
157 }
123 }
@@ -173,11 +139,15 @@ FocusScope {
173 || (stages.fullyShown && mainStage.usingScreenshots)
139 || (stages.fullyShown && mainStage.usingScreenshots)
174 || !stages.fullyShown && (mainStage.usingScreenshots || (sideStage.shown && sideStage.usingScreenshots)))
140 || !stages.fullyShown && (mainStage.usingScreenshots || (sideStage.shown && sideStage.usingScreenshots)))
175
141
176− Image {
142+ CrossFadeImage {
177 id: backgroundImage
143 id: backgroundImage
178 source: shell.background
144 source: shell.background
179 anchors.fill: parent
145 anchors.fill: parent
180− fillMode: Image.PreserveAspectCrop
146+ onStatusChanged: {
147+ if (status == Image.Error) {
148+ backgroundSettings.pictureUri = shell.defaultBackground
149+ }
150+ }
181 }
151 }
182
152
183 Rectangle {
153 Rectangle {
@@ -476,7 +446,7 @@ FocusScope {
476 onUnlocked: greeter.hide()
446 onUnlocked: greeter.hide()
477 onSelected: {
447 onSelected: {
478 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
448 var bgPath = greeter.model.data(uid, LightDM.UserRoles.BackgroundPathRole)
479− shell.background = bgPath ? bgPath : default_background
449+ shell.background = bgPath ? bgPath : defaultBackground
480 }
450 }
481
451
482 onLeftTeaserPressedChanged: {
452 onLeftTeaserPressedChanged: {