on xenial help sign in
also add Super+1..9 shortcuts and the hints
9f459caMichael Zanetti
qml/Components/PhysicalKeysMapper.qml+1
@@ -41,6 +41,7 @@ Item {
41 signal screenshotTriggered;
41 signal screenshotTriggered;
42
42
43 readonly property bool altTabPressed: d.altTabPressed
43 readonly property bool altTabPressed: d.altTabPressed
44+ readonly property bool superPressed: d.superPressed
44 readonly property bool superTabPressed: d.superTabPressed
45 readonly property bool superTabPressed: d.superTabPressed
45
46
46 property int powerKeyLongPressTime: 2000
47 property int powerKeyLongPressTime: 2000
qml/Launcher/Launcher.qml+32
@@ -35,6 +35,7 @@ FocusScope {
35 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
35 property real progress: dragArea.dragging && dragArea.touchX > panelWidth ?
36 (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) : 0
36 (width * (dragArea.touchX-panelWidth) / (width - panelWidth)) : 0
37
37
38+ property bool superPressed: false
38 property bool superTabPressed: false
39 property bool superTabPressed: false
39
40
40 readonly property bool dragging: dragArea.dragging
41 readonly property bool dragging: dragArea.dragging
@@ -60,11 +61,25 @@ FocusScope {
60 }
61 }
61 }
62 }
62
63
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+
63 onSuperTabPressedChanged: {
76 onSuperTabPressedChanged: {
64 if (superTabPressed) {
77 if (superTabPressed) {
65 switchToNextState("visible")
78 switchToNextState("visible")
66 panel.highlightIndex = -1;
79 panel.highlightIndex = -1;
67 root.focus = true;
80 root.focus = true;
81+ superPressTimer.stop();
82+ superLongPressTimer.stop();
68 } else {
83 } else {
69 if (panel.highlightIndex == -1) {
84 if (panel.highlightIndex == -1) {
70 showDashHome();
85 showDashHome();
@@ -158,6 +173,23 @@ FocusScope {
158 }
173 }
159 }
174 }
160
175
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+
161 Timer {
193 Timer {
162 id: teaseTimer
194 id: teaseTimer
163 interval: mode == "teasing" ? 200 : 300
195 interval: mode == "teasing" ? 200 : 300
qml/Launcher/LauncherDelegate.qml+14
@@ -30,6 +30,7 @@ Item {
30 property bool inverted: false
30 property bool inverted: false
31 property bool alerting: false
31 property bool alerting: false
32 property bool highlighted: false
32 property bool highlighted: false
33+ property bool shortcutHintShown: false
33
34
34 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
35 readonly property int effectiveHeight: Math.cos(angle * Math.PI / 180) * itemHeight
35 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
36 readonly property real foldedHeight: Math.cos(maxAngle * Math.PI / 180) * itemHeight
@@ -254,6 +255,19 @@ Item {
254 color: "white"
255 color: "white"
255 visible: root.itemFocused
256 visible: root.itemFocused
256 }
257 }
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+ }
257 }
271 }
258
272
259 ShaderEffect {
273 ShaderEffect {
qml/Launcher/LauncherPanel.qml+2
@@ -35,6 +35,7 @@ Rectangle {
35 property bool moving: launcherListView.moving || launcherListView.flicking
35 property bool moving: launcherListView.moving || launcherListView.flicking
36 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
36 property bool preventHiding: moving || dndArea.draggedIndex >= 0 || quickList.state === "open" || dndArea.pressed
37 property int highlightIndex: -2
37 property int highlightIndex: -2
38+ property bool shortcutHintsShown: false
38
39
39 signal applicationSelected(string appId)
40 signal applicationSelected(string appId)
40 signal showDashHome()
41 signal showDashHome()
@@ -230,6 +231,7 @@ Rectangle {
230 inverted: root.inverted
231 inverted: root.inverted
231 alerting: model.alerting
232 alerting: model.alerting
232 highlighted: root.highlightIndex == index
233 highlighted: root.highlightIndex == index
234+ shortcutHintShown: root.shortcutHintsShown && index <= 9
233 z: -Math.abs(offset)
235 z: -Math.abs(offset)
234 maxAngle: 55
236 maxAngle: 55
235 property bool dragging: false
237 property bool dragging: false
qml/Shell.qml+14−1
@@ -550,6 +550,7 @@ Item {
550 && !greeter.hasLockedApp
550 && !greeter.hasLockedApp
551 inverted: shell.usageScenario !== "desktop"
551 inverted: shell.usageScenario !== "desktop"
552 shadeBackground: !tutorial.running
552 shadeBackground: !tutorial.running
553+ superPressed: physicalKeysMapper.superPressed
553 superTabPressed: physicalKeysMapper.superTabPressed
554 superTabPressed: physicalKeysMapper.superTabPressed
554
555
555 onShowDashHome: showHome()
556 onShowDashHome: showHome()
@@ -577,11 +578,23 @@ Item {
577 }
578 }
578
579
579 GlobalShortcut {
580 GlobalShortcut {
580− shortcut: Qt.AltModifier|Qt.Key_F1
581+ shortcut: Qt.AltModifier | Qt.Key_F1
581 onTriggered: {
582 onTriggered: {
582 launcher.openForKeyboardNavigation();
583 launcher.openForKeyboardNavigation();
583 }
584 }
584 }
585 }
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+ }
585 }
598 }
586
599
587 Wizard {
600 Wizard {
tests/qmltests/Launcher/tst_Launcher.qml+10
@@ -919,5 +919,15 @@ Item {
919 tryCompare(focusRing0, "visible", false);
919 tryCompare(focusRing0, "visible", false);
920 tryCompare(bfb, "highlighted", true);
920 tryCompare(bfb, "highlighted", true);
921 }
921 }
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+ }
922 }
932 }
923}
933}