2 * Copyright (C) 2013 Canonical, Ltd.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 import AccountsService 0.1
19 import Ubuntu.Components 0.1
20 import LightDM 0.1 as LightDM
21 import "../Components"
27 property bool ready: background.source == "" || background.status == Image.Ready || background.status == Image.Error
29 signal selected(int uid)
30 signal unlocked(int uid)
32 function tryToUnlock() {
33 if (loginLoader.item) {
34 loginLoader.item.tryToUnlock()
39 if (loginLoader.item) {
40 loginLoader.item.reset()
45 // In case background fails to load
51 property url backgroundValue: AccountsService.backgroundFile != undefined && AccountsService.backgroundFile.length > 0 ? AccountsService.backgroundFile : greeter.defaultBackground
52 onBackgroundValueChanged: background.source = backgroundValue
56 objectName: "greeterBackground"
59 topMargin: backgroundTopMargin
61 fillMode: Image.PreserveAspectCrop
62 // Limit how much memory we'll reserve for this image
63 sourceSize.height: height
64 sourceSize.width: width
67 // See Shell.qml's backgroundSettings treatment for why we need a separate
68 // Image, but it boils down to avoiding binding loop detection.
70 source: background.source
76 if (status == Image.Error && source != greeter.defaultBackground) {
77 background.source = greeter.defaultBackground
90 objectName: "loginLoader"
93 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
94 verticalCenter: parent.verticalCenter
99 // TODO: Once we have a system API for determining which mode we are
100 // in, tablet/phone/desktop, that should be used instead of narrowMode.
101 source: greeter.narrowMode ? "" : "LoginList.qml"
104 item.currentIndex = greeterContentLoader.currentIndex;
108 target: loginLoader.item
110 value: greeterContentLoader.model
114 target: loginLoader.item
124 onCurrentIndexChanged: {
125 if (greeterContentLoader.currentIndex !== loginLoader.item.currentIndex) {
126 greeterContentLoader.currentIndex = loginLoader.item.currentIndex;
134 objectName: "infographics"
135 height: narrowMode ? parent.height : 0.75 * parent.height
136 model: greeterContentLoader.infographicModel
138 property string selectedUser
139 property string infographicUser: AccountsService.statsWelcomeScreen ? selectedUser : ""
140 onInfographicUserChanged: greeterContentLoader.infographicModel.username = infographicUser
142 Component.onCompleted: {
143 selectedUser = greeterContentLoader.model.data(greeterContentLoader.currentIndex, LightDM.UserRoles.NameRole)
144 greeterContentLoader.infographicModel.username = infographicUser
145 greeterContentLoader.infographicModel.readyForDataChange()
150 onSelected: infographics.selectedUser = greeterContentLoader.model.data(uid, LightDM.UserRoles.NameRole)
154 verticalCenter: parent.verticalCenter
155 left: narrowMode ? root.left : loginLoader.right
166 topMargin: units.gu(2)
167 horizontalCenter: parent.horizontalCenter