on xenial help sign in
Merge greeter_mode
commitf1b16fde0e76b44eafbac530ae9ca8842c201201 authorJosh Arenson <joshua.arenson@canonical.com> dateMon 15 Jun 2015, 19:25 (11 years ago) parentb17bd02d2bbca6
6 files changed+141−34
qml/Greeter/ShimGreeter.qml+45 qml/Shell.qml+47−34 qml/Stages/ShimStage.qml+44 tests/qmltests/Tutorial/tst_Tutorial.qml+1 tests/qmltests/tst_Shell.qml+2 tests/qmltests/tst_ShellWithPin.qml+2
qml/Greeter/ShimGreeter.qmlnew file+45
@@ -0,0 +1,45 @@
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.3
18+
19+/*
20+ * This is a shim greeter that is only used to provide a shell,
21+ * running without a greeter, the requisite information
22+ *
23+ */
24+
25+/* FIXME: this shuld be fine as a QtObject, but bug lp:1447391
26+ * dictates wrapping as an item instead
27+ */
28+Item {
29+ id: shimGreeter
30+
31+ readonly property bool active: false
32+ readonly property bool hasLockedApp: lockedApp !== ""
33+ readonly property bool locked: false
34+ readonly property bool shown: false
35+ readonly property bool waiting: false
36+
37+ property string lockedApp: ""
38+
39+ // Since ShimGreeter is never active, these can just return
40+ property var forceShow: (function() { return; })
41+ property var notifyAboutToFocusApp: (function(appId) { return; })
42+ property var notifyAppFocused: (function(appId) { return; })
43+ property var notifyShowingDashFromDrag: (function(appId) { return false; })
44+
45+}
qml/Shell.qml+47−34
@@ -111,6 +111,8 @@ Item {
111111 // This is _only_ used to expose the property to autopilot tests
112112 readonly property string testShellMode: shellMode
113113
114+ readonly property alias greeter: greeterLoader.item
115+
114116 function activateApplication(appId) {
115117 if (ApplicationManager.findApplication(appId)) {
116118 ApplicationManager.requestFocusApplication(appId);
@@ -262,7 +264,9 @@ Item {
262264 ? "phone"
263265 : shell.usageScenario
264266 source: {
265− if (applicationsDisplayLoader.usageScenario === "phone") {
267+ if(shellMode === "greeter") {
268+ return "Stages/ShimStage.qml"
269+ } else if (applicationsDisplayLoader.usageScenario === "phone") {
266270 return "Stages/PhoneStage.qml";
267271 } else if (applicationsDisplayLoader.usageScenario === "tablet") {
268272 return "Stages/TabletStage.qml";
@@ -414,50 +418,59 @@ Item {
414418 }
415419 }
416420
417− Greeter {
418− id: greeter
419− objectName: "greeter"
420−
421− hides: [launcher, panel.indicators]
422− tabletMode: shell.usageScenario !== "phone"
423− launcherOffset: launcher.progress
424− forcedUnlock: tutorial.running
425− background: shell.background
426−
421+ Loader {
422+ id: greeterLoader
427423 anchors.fill: parent
428424 anchors.topMargin: panel.panelHeight
425+ sourceComponent: shellMode != "shell" ? integratedGreeter :
426+ Qt.createComponent(Qt.resolvedUrl("Greeter/ShimGreeter.qml"));
427+ onLoaded: {
428+ item.objectName = "greeter"
429+ }
430+ }
429431
430− // avoid overlapping with Launcher's edge drag area
431− // FIXME: Fix TouchRegistry & friends and remove this workaround
432− // Issue involves launcher's DDA getting disabled on a long
433− // left-edge drag
434− dragHandleLeftMargin: launcher.available ? launcher.dragAreaWidth + 1 : 0
432+ Component {
433+ id: integratedGreeter
434+ Greeter {
435435
436− onSessionStarted: {
437− launcher.hide();
438− }
436+ hides: [launcher, panel.indicators]
437+ tabletMode: shell.sideStageEnabled
438+ launcherOffset: launcher.progress
439+ forcedUnlock: tutorial.running
440+ background: shell.background
439441
440− onTease: {
441− if (!tutorial.running) {
442− launcher.tease();
442+ // avoid overlapping with Launcher's edge drag area
443+ // FIXME: Fix TouchRegistry & friends and remove this workaround
444+ // Issue involves launcher's DDA getting disabled on a long
445+ // left-edge drag
446+ dragHandleLeftMargin: launcher.available ? launcher.dragAreaWidth + 1 : 0
447+
448+ onSessionStarted: {
449+ launcher.hide();
450+ }
451+
452+ onTease: {
453+ if (!tutorial.running) {
454+ launcher.tease();
455+ }
443456 }
444− }
445457
446− onEmergencyCall: startLockedApp("dialer-app")
458+ onEmergencyCall: startLockedApp("dialer-app")
447459
448− Timer {
449− // See powerConnection for why this is useful
450− id: showGreeterDelayed
451− interval: 1
452− onTriggered: {
453− greeter.forceShow();
460+ Binding {
461+ target: ApplicationManager
462+ property: "suspended"
463+ value: greeter.shown
454464 }
455465 }
466+ }
456467
457− Binding {
458− target: ApplicationManager
459− property: "suspended"
460− value: greeter.shown
468+ Timer {
469+ // See powerConnection for why this is useful
470+ id: showGreeterDelayed
471+ interval: 1
472+ onTriggered: {
473+ greeter.forceShow();
461474 }
462475 }
463476
qml/Stages/ShimStage.qmlnew file+44
@@ -0,0 +1,44 @@
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.3
18+import Ubuntu.Components 0.1
19+
20+Rectangle {
21+ id: shimStage
22+
23+ anchors.fill: parent
24+ color: UbuntuColors.lightAubergine
25+
26+ Text {
27+ id: greeterModeText
28+
29+ anchors.horizontalCenter: parent.horizontalCenter
30+ anchors.top: parent.top
31+ anchors.topMargin: units.gu(10)
32+ font.bold: true
33+ horizontalAlignment: Text.AlignHCenter
34+ text: "Shell is in \"greeter\" mode"
35+ }
36+
37+ Text {
38+ anchors.centerIn: parent
39+ color: UbuntuColors.orange
40+ font.pointSize: units.gu(8)
41+ horizontalAlignment: Text.AlignHCenter
42+ text: "Shim \nStage"
43+ }
44+}
tests/qmltests/Tutorial/tst_Tutorial.qml+1
@@ -73,6 +73,7 @@ Item {
7373 sourceComponent: Component {
7474 Shell {
7575 property string indicatorProfile: "phone"
76+ property string shellMode: "full-greeter" /* default */
7677
7778 Component.onDestruction: {
7879 shellLoader.itemDestroyed = true;
tests/qmltests/tst_Shell.qml+2
@@ -81,6 +81,8 @@ Rectangle {
8181 property bool itemDestroyed: false
8282 sourceComponent: Component {
8383 Shell {
84+ property string shellMode: "full-greeter" /* default */
85+
8486 usageScenario: "phone"
8587 orientation: Qt.PortraitOrientation
8688 primaryOrientation: Qt.PortraitOrientation
tests/qmltests/tst_ShellWithPin.qml+2
@@ -69,6 +69,8 @@ Item {
6969 property bool itemDestroyed: false
7070 sourceComponent: Component {
7171 Shell {
72+ property string shellMode: "full-greeter" /* default */
73+
7274 Component.onDestruction: {
7375 shellLoader.itemDestroyed = true
7476 }