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
53 objectName: "greeterBackground"
56 topMargin: backgroundTopMargin
58 fillMode: Image.PreserveAspectCrop
59 // Limit how much memory we'll reserve for this image
60 sourceSize.height: height
61 sourceSize.width: width
62 source: greeter.background
73 objectName: "loginLoader"
76 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
77 verticalCenter: parent.verticalCenter
82 // TODO: Once we have a system API for determining which mode we are
83 // in, tablet/phone/desktop, that should be used instead of narrowMode.
84 source: greeter.narrowMode ? "" : "LoginList.qml"
87 item.currentIndex = greeterContentLoader.currentIndex;
91 target: loginLoader.item
93 value: greeterContentLoader.model
97 target: loginLoader.item
107 onCurrentIndexChanged: {
108 if (greeterContentLoader.currentIndex !== loginLoader.item.currentIndex) {
109 greeterContentLoader.currentIndex = loginLoader.item.currentIndex;
117 objectName: "infographics"
118 height: narrowMode ? parent.height : 0.75 * parent.height
119 model: greeterContentLoader.infographicModel
121 property string selectedUser
122 property string infographicUser: AccountsService.statsWelcomeScreen ? selectedUser : ""
123 onInfographicUserChanged: greeterContentLoader.infographicModel.username = infographicUser
125 Component.onCompleted: {
126 selectedUser = greeterContentLoader.model.data(greeterContentLoader.currentIndex, LightDM.UserRoles.NameRole)
127 greeterContentLoader.infographicModel.username = infographicUser
128 greeterContentLoader.infographicModel.readyForDataChange()
133 onSelected: infographics.selectedUser = greeterContentLoader.model.data(uid, LightDM.UserRoles.NameRole)
137 verticalCenter: parent.verticalCenter
138 left: narrowMode ? root.left : loginLoader.right
149 topMargin: units.gu(2)
150 horizontalCenter: parent.horizontalCenter