on xenial help sign in
also add Super+1..9 shortcuts and the hints

design unfinished

commit9f459caa5c44ac07e7a7f1c44b161433b6f74c0e authorMichael Zanetti <michael.zanetti@canonical.com> dateWed 25 Nov 2015, 14:23 (11 years ago) parentf101d24
6 files changed+73−1
qml/Components/PhysicalKeysMapper.qml+1 qml/Launcher/Launcher.qml+32 qml/Launcher/LauncherDelegate.qml+14 qml/Launcher/LauncherPanel.qml+2 qml/Shell.qml+14−1 tests/qmltests/Launcher/tst_Launcher.qml+10
qml/Components/PhysicalKeysMapper.qml+1
@@ -41,6 +41,7 @@ Item {
4141 signal screenshotTriggered;
4242
4343 readonly property bool altTabPressed: d.altTabPressed
44+ readonly property bool superPressed: d.superPressed
4445 readonly property bool superTabPressed: d.superTabPressed
4546
4647 property int powerKeyLongPressTime: 2000
qml/Launcher/Launcher.qml+32
@@ -35,6 +35,7 @@ FocusScope {
3535 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
3636 (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) : 0
3737
38+ property bool superPressed: false
3839 property bool superTabPressed: false
3940
4041 readonly property bool dragging: dragArea.dragging
@@ -60,11 +61,25 @@ FocusScope {
6061 }
6162 }
6263
64+ onSuperPressedChanged: {
65+ if (superPressed) {
66+ superPressTimer.start();
67+ superLongPressTimer.start();
68+ } else {
69+ superPressTimer.stop();
70+ superLongPressTimer.stop();
71+ launcher.switchToNextState("");
72+ panel.shortcutHintsShown = false;
73+ }
74+ }
75+
6376 onSuperTabPressedChanged: {
6477 if (superTabPressed) {
6578 switchToNextState("visible")
6679 panel.highlightIndex = -1;
6780 root.focus = true;
81+ superPressTimer.stop();
82+ superLongPressTimer.stop();
6883 } else {
6984 if (panel.highlightIndex == -1) {
7085 showDashHome();
@@ -158,6 +173,23 @@ FocusScope {
158173 }
159174 }
160175
176+ Timer {
177+ id: superPressTimer
178+ interval: 200
179+ onTriggered: {
180+ switchToNextState("visible")
181+ }
182+ }
183+
184+ Timer {
185+ id: superLongPressTimer
186+ interval: 1000
187+ onTriggered: {
188+ switchToNextState("visible")
189+ panel.shortcutHintsShown = true;
190+ }
191+ }
192+
161193 Timer {
162194 id: teaseTimer
163195 interval: mode == "teasing" ? 200 : 300
qml/Launcher/LauncherDelegate.qml+14
@@ -30,6 +30,7 @@ Item {
3030 property bool inverted: false
3131 property bool alerting: false
3232 property bool highlighted: false
33+ property bool shortcutHintShown: false
3334
3435 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
3536 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
@@ -254,6 +255,19 @@ Item {
254255 color: "white"
255256 visible: root.itemFocused
256257 }
258+
259+ Rectangle {
260+ objectName: "shortcutHint"
261+ anchors.fill: parent
262+ anchors.margins: units.gu(2)
263+ color: UbuntuColors.lightGrey
264+ visible: root.shortcutHintShown
265+ Label {
266+ anchors.centerIn: parent
267+ text: index + 1
268+ color: "white"
269+ }
270+ }
257271 }
258272
259273 ShaderEffect {
qml/Launcher/LauncherPanel.qml+2
@@ -35,6 +35,7 @@ Rectangle {
3535 property bool moving: launcherListView.moving || launcherListView.flicking
3636 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
3737 property int highlightIndex: -2
38+ property bool shortcutHintsShown: false
3839
3940 signal applicationSelected(string appId)
4041 signal showDashHome()
@@ -230,6 +231,7 @@ Rectangle {
230231 inverted: root.inverted
231232 alerting: model.alerting
232233 highlighted: root.highlightIndex == index
234+ shortcutHintShown: root.shortcutHintsShown && index <= 9
233235 z: -Math.abs(offset)
234236 maxAngle: 55
235237 property bool dragging: false
qml/Shell.qml+14−1
@@ -550,6 +550,7 @@ Item {
550550 && !greeter.hasLockedApp
551551 inverted: shell.usageScenario !== "desktop"
552552 shadeBackground: !tutorial.running
553+ superPressed: physicalKeysMapper.superPressed
553554 superTabPressed: physicalKeysMapper.superTabPressed
554555
555556 onShowDashHome: showHome()
@@ -577,11 +578,23 @@ Item {
577578 }
578579
579580 GlobalShortcut {
580− shortcut: Qt.AltModifier|Qt.Key_F1
581+ shortcut: Qt.AltModifier | Qt.Key_F1
581582 onTriggered: {
582583 launcher.openForKeyboardNavigation();
583584 }
584585 }
586+
587+ Repeater {
588+ model: 9
589+ GlobalShortcut {
590+ shortcut: Qt.MetaModifier | (Qt.Key_1 + index)
591+ onTriggered: {
592+ if (LauncherModel.get(index)) {
593+ activateApplication(LauncherModel.get(index).appId);
594+ }
595+ }
596+ }
597+ }
585598 }
586599
587600 Wizard {
tests/qmltests/Launcher/tst_Launcher.qml+10
@@ -919,5 +919,15 @@ Item {
919919 tryCompare(focusRing0, "visible", false);
920920 tryCompare(bfb, "highlighted", true);
921921 }
922+
923+ function test_longpressSuperKeyShowsHints() {
924+ var shortCutHint0 = findChild(findChild(launcher, "launcherDelegate0"), "shortcutHint");
925+
926+ tryCompare(shortCutHint0, "visible", false);
927+
928+ launcher.superPressed = true;
929+ tryCompare(launcher, "state", "visible");
930+ tryCompare(shortCutHint0, "visible", true);
931+ }
922932 }
923933}