on xenial help sign in
unify Greeter and Lockscreen wallpaper again

This moves the actual reading of accountsservice into Shell.qml so we only have to read it once. Also this drops the GSettings for wallpaper as it hasn't been used any more (we can't change that in systemsettings any more anyways) Fixes: 1385473 Approved by: Michael Terry, Olga Kemmet

commita72d409d9a5309f92257994154a9296560f018a7 authorMichael Zanetti <michael.zanetti@canonical.com> dateMon 17 Nov 2014, 13:46 (12 years ago) parentf9523a59a98b84
5 files changed+47−30
qml/Components/Lockscreen.qml+15 qml/Greeter/Greeter.qml+1−1 qml/Greeter/GreeterContent.qml+1−18 qml/Notifications/NotificationMenuItemFactory.qml+1 qml/Shell.qml+29−11
qml/Components/Lockscreen.qml+15
@@ -56,6 +56,9 @@ Showable {
5656 property int maxPinLength: -1
5757
5858 property url background: ""
59+ // Use this to put a black overlay above the background
60+ // 0: normal background, 1: black background
61+ property real darkenBackground: 0
5962
6063 readonly property string passphrase: (pinPadLoader.item && pinPadLoader.item.passphrase) ? pinPadLoader.item.passphrase : ""
6164
@@ -100,10 +103,22 @@ Showable {
100103 anchors {
101104 fill: parent
102105 }
106+ // Limit how much memory we'll reserve for this image
107+ sourceSize.height: height
108+ sourceSize.width: width
103109 source: root.required ? root.background : ""
104110 fillMode: Image.PreserveAspectCrop
105111 }
106112
113+ // This is to
114+ // a) align it with the greeter and
115+ // b) keep the white fonts readable on bright backgrounds
116+ Rectangle {
117+ anchors.fill: parent
118+ color: "black"
119+ opacity: root.darkenBackground
120+ }
121+
107122 MouseArea {
108123 anchors.fill: root
109124 onClicked: {
qml/Greeter/Greeter.qml+1−1
@@ -25,7 +25,7 @@ Showable {
2525 enabled: shown
2626 created: greeterContentLoader.status == Loader.Ready && greeterContentLoader.item.ready
2727
28− property url defaultBackground
28+ property url background
2929 property bool loadContent: required
3030
3131 // 1 when fully shown and 0 when fully hidden
qml/Greeter/GreeterContent.qml+1−18
@@ -48,9 +48,6 @@ Item {
4848 color: "black"
4949 }
5050
51− property url backgroundValue: AccountsService.backgroundFile != undefined && AccountsService.backgroundFile.length > 0 ? AccountsService.backgroundFile : greeter.defaultBackground
52− onBackgroundValueChanged: background.source = backgroundValue
53−
5451 CrossFadeImage {
5552 id: background
5653 objectName: "greeterBackground"
@@ -62,21 +59,7 @@ Item {
6259 // Limit how much memory we'll reserve for this image
6360 sourceSize.height: height
6461 sourceSize.width: width
65− }
66−
67− // See Shell.qml's backgroundSettings treatment for why we need a separate
68− // Image, but it boils down to avoiding binding loop detection.
69− Image {
70− source: background.source
71− height: 0
72− width: 0
73− sourceSize.height: 0
74− sourceSize.width: 0
75− onStatusChanged: {
76− if (status == Image.Error && source != greeter.defaultBackground) {
77− background.source = greeter.defaultBackground
78− }
79− }
62+ source: greeter.background
8063 }
8164
8265 Rectangle {
qml/Notifications/NotificationMenuItemFactory.qml+1
@@ -150,6 +150,7 @@ Loader {
150150 errorText: errorAction.valid ? errorAction.state : ""
151151 retryText: notification.body
152152 background: shell.background
153+ darkenBackground: 0.4
153154
154155 onEntered: {
155156 menuModel.changeState(menuIndex, passphrase);
qml/Shell.qml+29−11
@@ -51,7 +51,8 @@ Item {
5151
5252 property real edgeSize: units.gu(2)
5353 property url defaultBackground: Qt.resolvedUrl(shell.width >= units.gu(60) ? "graphics/tablet_background.jpg" : "graphics/phone_background.jpg")
54− property url background
54+ property url background: asImageTester.status == Image.Ready ? asImageTester.source
55+ : gsImageTester.status == Image.Ready ? gsImageTester.source : defaultBackground
5556 readonly property real panelHeight: panel.panelHeight
5657
5758 readonly property bool locked: LightDM.Greeter.active && !LightDM.Greeter.authenticated && !forcedUnlock
@@ -98,6 +99,31 @@ Item {
9899 shell.activateApplication(app);
99100 }
100101
102+ // This is a dummy image to detect if the custom AS set wallpaper loads successfully.
103+ Image {
104+ id: asImageTester
105+ source: AccountsService.backgroundFile != undefined && AccountsService.backgroundFile.length > 0 ? AccountsService.backgroundFile : ""
106+ height: 0
107+ width: 0
108+ sourceSize.height: 0
109+ sourceSize.width: 0
110+ }
111+
112+ GSettings {
113+ id: backgroundSettings
114+ schema.id: "org.gnome.desktop.background"
115+ }
116+
117+ // This is a dummy image to detect if the custom GSettings set wallpaper loads successfully.
118+ Image {
119+ id: gsImageTester
120+ source: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : ""
121+ height: 0
122+ width: 0
123+ sourceSize.height: 0
124+ sourceSize.width: 0
125+ }
126+
101127 Binding {
102128 target: LauncherModel
103129 property: "applicationManager"
@@ -114,15 +140,6 @@ Item {
114140 }
115141 }
116142
117− GSettings {
118− id: backgroundSettings
119− schema.id: "org.gnome.desktop.background"
120− }
121− property url gSettingsPicture: backgroundSettings.pictureUri != undefined && backgroundSettings.pictureUri.length > 0 ? backgroundSettings.pictureUri : shell.defaultBackground
122− onGSettingsPictureChanged: {
123− shell.background = gSettingsPicture
124− }
125−
126143 VolumeControl {
127144 id: volumeControl
128145 }
@@ -328,6 +345,7 @@ Item {
328345 width: parent.width
329346 height: parent.height - panel.panelHeight
330347 background: shell.background
348+ darkenBackground: 0.4
331349 alphaNumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
332350 minPinLength: 4
333351 maxPinLength: 4
@@ -523,7 +541,7 @@ Item {
523541
524542 locked: shell.locked
525543
526− defaultBackground: shell.background
544+ background: shell.background
527545
528546 width: parent.width
529547 height: parent.height