on xenial help sign in
first multiwindow greeter
commit389a48b5d57d474331124df2e0a59b1f1558ee10 authorNick Dedekind <nick.dedekind@canonical.com> dateThu 12 Jan 2017, 14:54 (10 years ago) parent5cf02ba
5 files changed+142−5
qml/Greeter/Greeter.qml+21−3 qml/Greeter/SecondaryGreeter.qml+75 qml/Shell.qml+14−2 qml/ShellNotifier.qml+31 qml/qmldir+1
qml/Greeter/Greeter.qml+21−3
@@ -25,6 +25,7 @@ import Unity.Launcher 0.1
2525import Unity.Session 0.1
2626
2727import "." 0.1
28+import ".." 0.1
2829import "../Components"
2930
3031Showable {
@@ -234,7 +235,7 @@ Showable {
234235 if (forcedUnlock && shown) {
235236 hideView();
236237 if (hideNow) {
237− root.hideNow(); // skip hide animation
238+ ShellNotifier.greeter.hide(true); // skip hide animation
238239 }
239240 }
240241 }
@@ -397,7 +398,7 @@ Showable {
397398 onEmergencyCall: root.emergencyCall()
398399 onRequiredChanged: {
399400 if (!loader.item.required) {
400− root.hide();
401+ ShellNotifier.greeter.hide(false);
401402 }
402403 }
403404 }
@@ -529,12 +530,29 @@ Showable {
529530 onRequestAuthenticationUser: d.selectUser(d.getUserIndex(user), true)
530531 }
531532
533+ Connections {
534+ target: ShellNotifier.greeter
535+ onHide: {
536+ if (now) {
537+ root.hideNow(); // skip hide animation
538+ } else {
539+ root.hide();
540+ }
541+ }
542+ }
543+
544+ Binding {
545+ target: ShellNotifier.greeter
546+ property: "shown"
547+ value: root.shown
548+ }
549+
532550 Connections {
533551 target: DBusUnitySessionService
534552 onLockRequested: root.forceShow()
535553 onUnlocked: {
536554 root.forcedUnlock = true;
537− root.hideNow();
555+ ShellNotifier.greeter.hide(true);
538556 }
539557 }
540558
qml/Greeter/SecondaryGreeter.qmlnew file+75
@@ -0,0 +1,75 @@
1+/*
2+ * Copyright (C) 2016 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+
20+import "../Components"
21+import ".." 0.1
22+
23+Showable {
24+ id: root
25+
26+ readonly property bool active: required || hasLockedApp
27+
28+ readonly property bool hasLockedApp: lockedApp !== ""
29+ readonly property bool locked: false
30+ readonly property bool waiting: false
31+ readonly property bool fullyShown: shown
32+
33+ property string lockedApp: ""
34+
35+ function forceShow() { show(); }
36+ property var notifyAboutToFocusApp: (function(appId) { return; })
37+ property var notifyAppFocused: (function(appId) { return; })
38+ property var notifyShowingDashFromDrag: (function(appId) { return false; })
39+
40+ showAnimation: StandardAnimation { property: "opacity"; to: 1 }
41+ hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
42+
43+ shown: ShellNotifier.greeter.shown
44+ Component.onCompleted: opacity = shown ? 1 : 0
45+ visible: opacity != 0
46+
47+ Rectangle {
48+ anchors.fill: parent
49+ color: UbuntuColors.purple
50+ }
51+
52+ MouseArea {
53+ anchors.fill: parent
54+ acceptedButtons: Qt.AllButtons
55+ onWheel: wheel.accepted = true
56+ }
57+
58+ Connections {
59+ target: ShellNotifier.greeter
60+ onHide: {
61+ if (now) {
62+ root.hideNow(); // skip hide animation
63+ } else {
64+ root.hide();
65+ }
66+ }
67+ onShownChanged: {
68+ if (ShellNotifier.greeter.shown) {
69+ root.show();
70+ } else {
71+ root.hide();
72+ }
73+ }
74+ }
75+}
qml/Shell.qml+14−2
@@ -332,8 +332,13 @@ StyledItem {
332332 objectName: "greeterLoader"
333333 anchors.fill: parent
334334 anchors.topMargin: panel.panelHeight
335− sourceComponent: shell.mode != "shell" ? integratedGreeter :
336− Qt.createComponent(Qt.resolvedUrl("Greeter/ShimGreeter.qml"));
335+ sourceComponent: {
336+ if (shell.mode != "shell") {
337+ if (screenWindow.primary) return integratedGreeter;
338+ return secondaryGreeter;
339+ }
340+ return Qt.createComponent(Qt.resolvedUrl("Greeter/ShimGreeter.qml"));
341+ }
337342 onLoaded: {
338343 item.objectName = "greeter"
339344 }
@@ -373,6 +378,13 @@ StyledItem {
373378 }
374379 }
375380
381+ Component {
382+ id: secondaryGreeter
383+ SecondaryGreeter {
384+ hides: [launcher, panel.indicators]
385+ }
386+ }
387+
376388 Timer {
377389 // See powerConnection for why this is useful
378390 id: showGreeterDelayed
qml/ShellNotifier.qmlnew file+31
@@ -0,0 +1,31 @@
1+/*
2+ * Copyright (C) 2016 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+/*
18+ Shared signals & properties on multi-window desktop
19+ */
20+
21+pragma Singleton
22+import QtQuick 2.4
23+
24+QtObject {
25+ property var greeter: QtObject {
26+ signal show()
27+ signal hide(bool now)
28+
29+ property bool shown: false
30+ }
31+}
qml/qmldirnew file+1
@@ -0,0 +1 @@
1+singleton ShellNotifier 0.1 ShellNotifier.qml