on xenial help sign in
Add gui files
19316e1Josh Arenson
qml/Greeter/FullLightDMImpl.qml+2
@@ -22,6 +22,8 @@ Item{
22
22
23 property var greeter: LightDM.Greeter
23 property var greeter: LightDM.Greeter
24 property var infographic: LightDM.Infographic
24 property var infographic: LightDM.Infographic
25+ property var sessions: LightDM.Sessions
26+ property var sessionRoles: LightDM.SessionRoles
25 property var users: LightDM.Users
27 property var users: LightDM.Users
26 property var userRoles: LightDM.UserRoles
28 property var userRoles: LightDM.UserRoles
27
29
qml/Greeter/Greeter.qml+11−1
@@ -55,6 +55,16 @@ Showable {
55
55
56 readonly property bool animating: loader.item ? loader.item.animating : false
56 readonly property bool animating: loader.item ? loader.item.animating : false
57
57
58+ property string sessionToStart: {
59+ if (loader.item.sessionToStart) {
60+ return loader.item.sessionToStart
61+ } else if (LightDMService.greeter.defaultSession) {
62+ return LightDMService.greeter.defaultSession
63+ } else {
64+ return "ubuntu"
65+ }
66+ }
67+
58 signal tease()
68 signal tease()
59 signal sessionStarted()
69 signal sessionStarted()
60 signal emergencyCall()
70 signal emergencyCall()
@@ -142,7 +152,7 @@ Showable {
142
152
143 function login() {
153 function login() {
144 enabled = false;
154 enabled = false;
145− if (LightDMService.greeter.startSessionSync()) {
155+ if (LightDMService.greeter.startSessionSync(root.sessionToStart.toLowerCase())) {
146 sessionStarted();
156 sessionStarted();
147 if (loader.item) {
157 if (loader.item) {
148 loader.item.notifyAuthenticationSucceeded();
158 loader.item.notifyAuthenticationSucceeded();
qml/Greeter/IntegratedLightDMImpl.qml+2−1
@@ -22,7 +22,8 @@ Item{
22
22
23 property var greeter: LightDM.Greeter
23 property var greeter: LightDM.Greeter
24 property var infographic: LightDM.Infographic
24 property var infographic: LightDM.Infographic
25+ property var sessions: LightDM.Sessions
26+ property var sessionRoles: LightDM.SessionRoles
25 property var users: LightDM.Users
27 property var users: LightDM.Users
26 property var userRoles: LightDM.UserRoles
28 property var userRoles: LightDM.UserRoles
27−
28}
29}
qml/Greeter/LightDMService.qml+2
@@ -27,6 +27,8 @@ Loader {
27
27
28 property var greeter: d.valid ? loader.item.greeter : null
28 property var greeter: d.valid ? loader.item.greeter : null
29 property var infographic: d.valid ? loader.item.infographic : null
29 property var infographic: d.valid ? loader.item.infographic : null
30+ property var sessions: d.valid ? loader.item.sessions : null
31+ property var sessionRoles: d.valid ? loader.item.sessionRoles : null
30 property var users: d.valid ? loader.item.users : null
32 property var users: d.valid ? loader.item.users : null
31 property var userRoles: d.valid ? loader.item.userRoles : null
33 property var userRoles: d.valid ? loader.item.userRoles : null
32
34
qml/Greeter/LoginAreaContainer.qmlnew file+11
@@ -0,0 +1,11 @@
1+import QtQuick 2.4
2+import "." 0.1
3+
4+Rectangle {
5+ height: units.gu(10)
6+ color: Qt.rgba(0.1, 0.1, 0.1, 0.4)
7+ border.color: Qt.rgba(0.4, 0.4, 0.4, 0.4)
8+ border.width: units.dp(1)
9+ radius: units.gu(1.5)
10+ antialiasing: true
11+}
qml/Greeter/LoginList.qml+41−8
@@ -17,11 +17,13 @@
17import QtQuick 2.4
17import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19import "../Components"
19import "../Components"
20+import "." 0.1
20
21
21Item {
22Item {
22 id: root
23 id: root
23
24
24 property alias model: userList.model
25 property alias model: userList.model
26+ property url sessionIcon
25 property int currentIndex
27 property int currentIndex
26 property bool locked
28 property bool locked
27
29
@@ -29,11 +31,18 @@ Item {
29 readonly property int cellHeight: units.gu(5)
31 readonly property int cellHeight: units.gu(5)
30 readonly property int highlightedHeight: units.gu(10)
32 readonly property int highlightedHeight: units.gu(10)
31 readonly property int moveDuration: 200
33 readonly property int moveDuration: 200
34+ property string selectedSession
35+ property string currentSession: selectedSession ?
36+ selectedSession : userList.currentItem.userSession
32 readonly property string currentUser: userList.currentItem.username
37 readonly property string currentUser: userList.currentItem.username
33 property bool wasPrompted: false
38 property bool wasPrompted: false
34
39
35− signal selected(int index)
36 signal responded(string response)
40 signal responded(string response)
41+ signal selected(int index)
42+ signal sessionChooserButtonClicked()
43+ signal loginListSessionChanged(string session)
44+
45+ onCurrentSessionChanged: loginListSessionChanged(currentSession)
37
46
38 function tryToUnlock() {
47 function tryToUnlock() {
39 if (wasPrompted) {
48 if (wasPrompted) {
@@ -85,19 +94,42 @@ Item {
85 userList.currentIndex = currentIndex;
94 userList.currentIndex = currentIndex;
86 }
95 }
87
96
88− Rectangle {
97+ LoginAreaContainer {
89 id: highlightItem
98 id: highlightItem
90 anchors {
99 anchors {
91 left: parent.left
100 left: parent.left
92 right: parent.right
101 right: parent.right
93 verticalCenter: parent.verticalCenter
102 verticalCenter: parent.verticalCenter
94 }
103 }
95− height: root.highlightedHeight
104+
96− color: Qt.rgba(0.1, 0.1, 0.1, 0.4)
105+ z: sessionChooser.visible ? userList.z + 1 : z
97− border.color: Qt.rgba(0.4, 0.4, 0.4, 0.4)
106+
98− border.width: units.dp(1)
107+ // Use an AbstractButton due to icon limitations with Button
99− radius: units.gu(1.5)
108+ AbstractButton {
100− antialiasing: true
109+ id: sessionChooser
110+
111+ visible: LightDMService.sessions.count > 1
112+
113+ height: units.gu(2.5)
114+ width: units.gu(2.5)
115+
116+ anchors {
117+ right: parent.right
118+ rightMargin: units.gu(1)
119+
120+ top: parent.top
121+ topMargin: units.gu(1)
122+ }
123+
124+ Image {
125+ anchors.fill: parent
126+ source: LightDMService.sessions.iconUrl(root.currentSession)
127+ }
128+
129+ onClicked: {
130+ sessionChooserButtonClicked();
131+ }
132+ }
101 }
133 }
102
134
103 ListView {
135 ListView {
@@ -130,6 +162,7 @@ Item {
130
162
131 readonly property bool belowHighlight: (userList.currentIndex < 0 && index > 0) || (userList.currentIndex >= 0 && index > userList.currentIndex)
163 readonly property bool belowHighlight: (userList.currentIndex < 0 && index > 0) || (userList.currentIndex >= 0 && index > userList.currentIndex)
132 readonly property int belowOffset: root.highlightedHeight - root.cellHeight
164 readonly property int belowOffset: root.highlightedHeight - root.cellHeight
165+ readonly property string userSession: session
133 readonly property string username: name
166 readonly property string username: name
134
167
135 opacity: {
168 opacity: {
qml/Greeter/NarrowView.qml+1
@@ -31,6 +31,7 @@ FocusScope {
31 property bool alphanumeric
31 property bool alphanumeric
32 property var userModel // unused
32 property var userModel // unused
33 property alias infographicModel: coverPage.infographicModel
33 property alias infographicModel: coverPage.infographicModel
34+ property string sessionToStart
34 readonly property bool fullyShown: coverPage.showProgress === 1 || lockscreen.shown
35 readonly property bool fullyShown: coverPage.showProgress === 1 || lockscreen.shown
35 readonly property bool required: coverPage.required || lockscreen.required
36 readonly property bool required: coverPage.required || lockscreen.required
36 readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
37 readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
qml/Greeter/SessionsList.qmlnew file+68
@@ -0,0 +1,68 @@
1+/*
2+ * Copyright (C) 2015 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+import QtQuick 2.4
18+import Ubuntu.Components 1.3
19+import Ubuntu.Components.ListItems 1.3
20+import "." 0.1
21+
22+Item {
23+ id: root
24+
25+ property string initiallySelectedSession
26+ property alias selectedIndex: sessionsList.selectedIndex
27+ signal sessionSelected(string sessionName)
28+
29+ LoginAreaContainer {
30+ height: sessionsList.itemHeight * sessionsList.model.count
31+
32+ anchors {
33+ left: parent.left
34+ right: parent.right
35+ verticalCenter: parent.verticalCenter
36+ }
37+
38+ ItemSelector {
39+ id: sessionsList
40+ property color originalBackground
41+ anchors.centerIn: parent
42+ width: parent.width - units.gu(1)
43+ expanded:true
44+ style: Item{}
45+
46+ model: LightDMService.sessions
47+ delegate: OptionSelectorDelegate {
48+ iconSource: icon_url
49+ text: display
50+ selected: display.toLowerCase() === initiallySelectedSession.toLowerCase()
51+ }
52+
53+ Component.onCompleted: {
54+ // Disbale the highlighting since it leaks outside of rounded corners
55+ originalBackground = theme.palette.selected.background
56+ theme.palette.selected.background = "transparent"
57+ }
58+ Component.onDestruction: {
59+ theme.palette.selected.background = originalBackground
60+ }
61+
62+ onDelegateClicked: {
63+ sessionSelected(sessionsList.model.data(index,
64+ LightDMService.sessionRoles.DisplayRole));
65+ }
66+ }
67+ }
68+}
qml/Greeter/WideView.qml+126−36
@@ -16,23 +16,27 @@
16
16
17import QtQuick 2.4
17import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19+import "." 0.1
19
20
20FocusScope {
21FocusScope {
21 id: root
22 id: root
22
23
24+ property alias background: coverPage.background
25+ property alias backgroundTopMargin: coverPage.backgroundTopMargin
23 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
26 property alias dragHandleLeftMargin: coverPage.dragHandleLeftMargin
27+ property alias infographicModel: coverPage.infographicModel
24 property alias launcherOffset: coverPage.launcherOffset
28 property alias launcherOffset: coverPage.launcherOffset
25− property alias currentIndex: loginList.currentIndex
29+ property alias loginListShown: loginAreaLoader.loginListShown
30+ property int currentIndex // Set from outside
26 property int delayMinutes // TODO
31 property int delayMinutes // TODO
27− property alias backgroundTopMargin: coverPage.backgroundTopMargin
28− property alias background: coverPage.background
29− property bool locked
30 property bool alphanumeric // unused
32 property bool alphanumeric // unused
31− property alias userModel: loginList.model
33+ property bool locked
32− property alias infographicModel: coverPage.infographicModel
34+ property alias sessionToStart: loginAreaLoader.currentSession
35+ property var userModel // Set from outside
36+
37+ readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
33 readonly property bool fullyShown: coverPage.showProgress === 1
38 readonly property bool fullyShown: coverPage.showProgress === 1
34 readonly property bool required: coverPage.required
39 readonly property bool required: coverPage.required
35− readonly property bool animating: coverPage.showAnimation.running || coverPage.hideAnimation.running
36
40
37 // so that it can be replaced in tests with a mock object
41 // so that it can be replaced in tests with a mock object
38 property var inputMethod: Qt.inputMethod
42 property var inputMethod: Qt.inputMethod
@@ -42,38 +46,39 @@ FocusScope {
42 signal tease()
46 signal tease()
43 signal emergencyCall() // unused
47 signal emergencyCall() // unused
44
48
45− function showMessage(html) {
49+ /***** Functions that depend on LoginList being loaded *****/
46− loginList.showMessage(html);
50+ // A decorator to only call LoginList functions when its shown
51+ function ifLoginlistShownThen(f) {
52+ return function() {
53+ if (loginListShown) f.apply(this, arguments);
47− }
54+ }
48−
49− function showPrompt(text, isSecret, isDefaultPrompt) {
50− loginList.showPrompt(text, isSecret, isDefaultPrompt);
51 }
55 }
52
56
53− function showLastChance() {
57+ readonly property var notifyAuthenticationFailed: ifLoginlistShownThen(doNotifyAuthenticationFailed);
54− // TODO
58+ function doNotifyAuthenticationFailed() {
59+ loginAreaLoader.item.showError();
55 }
60 }
56
61
62+ readonly property var reset: ifLoginlistShownThen(doReset);
57− function hide() {
63+ function doReset() {
58− coverPage.hide();
64+ loginAreaLoader.item.reset();
59 }
65 }
60
66
61− function notifyAuthenticationSucceeded() {
67+ readonly property var showMessage: ifLoginlistShownThen(doShowMessage);
62− // Nothing needed
68+ function doShowMessage(html) {
69+ loginAreaLoader.item.showMessage(html);
63 }
70 }
64
71
65− function notifyAuthenticationFailed() {
72+ readonly property var showPrompt: ifLoginlistShownThen(doShowPrompt);
66− loginList.showError();
73+ function doShowPrompt(text, isSecret, isDefaultPrompt) {
74+ loginAreaLoader.item.showPrompt(text, isSecret, isDefaultPrompt);
67 }
75 }
68
76
69− function reset() {
77+ readonly property var tryToUnlock: ifLoginlistShownThen(doTryToUnlock);
70− loginList.reset();
71− }
72−
73− function tryToUnlock(toTheRight) {
78+ function doTryToUnlock(toTheRight) {
74 if (root.locked) {
79 if (root.locked) {
75 coverPage.show();
80 coverPage.show();
76− loginList.tryToUnlock();
81+ loginAreaLoader.item.tryToUnlock();
77 return false;
82 return false;
78 } else {
83 } else {
79 var coverChanged = coverPage.shown;
84 var coverChanged = coverPage.shown;
@@ -86,6 +91,19 @@ FocusScope {
86 }
91 }
87 }
92 }
88
93
94+ /***** Functions that are agnostic of what object is loaded *****/
95+ function hide() {
96+ coverPage.hide();
97+ }
98+
99+ function notifyAuthenticationSucceeded() {
100+ // Nothing needed
101+ }
102+
103+ function showLastChance() {
104+ // TODO
105+ }
106+
89 Rectangle {
107 Rectangle {
90 anchors.fill: parent
108 anchors.fill: parent
91 color: "black"
109 color: "black"
@@ -101,7 +119,7 @@ FocusScope {
101
119
102 infographics {
120 infographics {
103 height: 0.75 * parent.height
121 height: 0.75 * parent.height
104− anchors.leftMargin: loginList.x + loginList.width
122+ anchors.leftMargin: loginAreaLoader.x + loginAreaLoader.width
105 }
123 }
106
124
107 onTease: root.tease()
125 onTease: root.tease()
@@ -112,24 +130,96 @@ FocusScope {
112 }
130 }
113 }
131 }
114
132
115− LoginList {
133+ Loader {
116− id: loginList
134+ id: loginAreaLoader
117− objectName: "loginList"
135+
136+ // True when LoginList is shown, false when SessionList is shown
137+ property bool loginListShown: true
138+ property bool sessionUpdated: false
139+ property string currentSession // Set as soon as LoginList is loaded
140+
141+ source: loginListShown ? "LoginList.qml" : "SessionsList.qml"
142+ onSourceChanged: loadingAnimation.running = true
118
143
119 anchors {
144 anchors {
120 left: parent.left
145 left: parent.left
121 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
146 leftMargin: Math.min(parent.width * 0.16, units.gu(20))
122 top: parent.top
147 top: parent.top
123 }
148 }
149+
124 width: units.gu(29)
150 width: units.gu(29)
151+ height: inputMethod && inputMethod.visible ?
125− height: inputMethod && inputMethod.visible ? parent.height - inputMethod.keyboardRectangle.height
152+ parent.height - inputMethod.keyboardRectangle.height : parent.height
126− : parent.height
153+
127 Behavior on height { UbuntuNumberAnimation {} }
154 Behavior on height { UbuntuNumberAnimation {} }
128
155
156+ UbuntuNumberAnimation {
157+ id: loadingAnimation
158+ target: loginAreaLoader.item
159+ property: "x"
160+ from: loader.item.width
161+ to: 0
162+ running: false
163+ }
164+
165+ Binding {
166+ target: loginAreaLoader.item
167+ property: "currentIndex"
168+ value: loginListShown ? root.currentIndex : null
169+ }
170+
171+ Binding {
172+ target: loginAreaLoader.item
173+ property: "locked"
129− locked: root.locked
174+ value: root.locked
175+ }
130
176
177+ Binding {
178+ target: loginAreaLoader.item
179+ property: "model"
180+ value: loginListShown ? root.userModel : null
181+ }
182+
183+ // Only inform LoginList if the session isn't the user's default session
184+ // because LoginList gets the default session on its own
185+ Binding {
186+ target: loginAreaLoader.item
187+ property: "selectedSession"
188+ value: loginListShown && loginAreaLoader.sessionUpdated ?
189+ loginAreaLoader.currentSession : null
190+ }
191+
192+ Binding {
193+ target: loginAreaLoader.item
194+ property: "initiallySelectedSession"
195+ value: !loginListShown ? loginAreaLoader.currentSession : null
196+ }
197+
198+ Connections {
199+ target: loginListShown ? loginAreaLoader.item : null
131− onSelected: root.selected(index)
200+ onSelected: root.selected(index)
132− onResponded: root.responded(response)
201+ onResponded: root.responded(response)
202+ // The initially selected session lags behind the component completion
203+ // so this provides the initial session name when available
204+ onLoginListSessionChanged: {
205+ if (loginListShown && !loginAreaLoader.sessionUpdated) {
206+ loginAreaLoader.currentSession = loginAreaLoader.item.currentSession
207+ }
208+ }
209+
210+ onSessionChooserButtonClicked: loginListShown = false;
211+ ignoreUnknownSignals: true
212+ }
213+
214+ Connections {
215+ target: !loginListShown ? loginAreaLoader.item : null
216+ onSessionSelected: {
217+ loginAreaLoader.loginListShown = true
218+ loginAreaLoader.sessionUpdated = true
219+ loginAreaLoader.currentSession = sessionName
220+ }
221+ ignoreUnknownSignals: true
222+ }
133 }
223 }
134 }
224 }
135}
225}
qml/Greeter/graphics/session_icons/gnome_badge.pngnew file

Binary file not shown.

qml/Greeter/graphics/session_icons/plasma_badge.pngnew file

Binary file not shown.

qml/Greeter/graphics/session_icons/recovery_console_badge.pngnew file

Binary file not shown.

qml/Greeter/graphics/session_icons/ubuntu_badge.pngnew file

Binary file not shown.

qml/Greeter/graphics/session_icons/unknown_badge.pngnew file

Binary file not shown.