2 * Copyright (C) 2013 Canonical, Ltd.
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.
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.
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/>.
19import Ubuntu.Components 0.1
20import Ubuntu.Gestures 0.1
26 property bool available: true // can be used to disable all interactions
28 property bool teasing: false
29 property int panelWidth: units.gu(8.5)
30 property int dragAreaWidth: units.gu(1)
31 property real progress: dragArea.dragging && dragArea.touchX > panel.width ? dragArea.touchX : 0
33 readonly property bool shown: panel.x > -panel.width
35 // emitted when an application is selected
36 signal launcherApplicationSelected(string desktopFile)
38 // emitted when the apps dash should be shown because of a swipe gesture
41 // emitted when the dash icon in the launcher has been tapped
42 signal dashItemSelected()
48 dismissTimer.restart()
56 function switchToNextState(state) {
57 animateTimer.nextState = state
79 dismissTimer.restart()
84 // Because the animation on x is disabled while dragging
85 // switching state directly in the drag handlers would not animate
86 // the completion of the hide/reveal gesture. Lets update the state
87 // machine and switch to the final state in the next event loop run
91 property string nextState: ""
93 // switching to an intermediate state here to make sure all the
94 // values are restored, even if we were already in the target state
96 root.state = nextState
106 enabled: root.state == "visible"
108 anchors.rightMargin: -units.gu(2)
116 if (panel.x < -panel.width/3) {
117 root.switchToNextState("")
119 root.switchToNextState("visible")
127 left: launcherDragArea.right
130 bottom: parent.bottom
132 enabled: root.state == "visible"
142 opacity: root.state == "visible" ? 0.4 : 0
144 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuad} }
149 objectName: "launcherPanel"
150 width: root.panelWidth
153 bottom: parent.bottom
158 property bool animate: true
160 onApplicationSelected: {
162 launcherApplicationSelected(desktopFile)
164 onDashItemSelected: {
166 root.dashItemSelected(index)
170 if (dismissTimer.running) {
171 dismissTimer.restart();
177 // Disabling animation when dragging
178 duration: dragArea.dragging || launcherDragArea.drag.active ? 0 : 300;
179 easing.type: Easing.OutCubic
184 DirectionalDragArea {
187 direction: DirectionalDragArea.Rightwards
189 // values to be tweaked and later removed from here and set in stone as defaults
190 // once we are confident it's all good.
191 maxDeviation: units.gu(1.5)
193 distanceThreshold: units.gu(4)
195 enabled: root.available && root.state !== "visible"
196 width: root.dragAreaWidth
201 panel.x = Math.min(0, touchX - panel.width);
207 if (distance > root.width / 2) {
209 root.switchToNextState("")
210 } else if (distance > panel.width/2) {
211 root.switchToNextState("visible")
213 root.switchToNextState("")
221 name: "" // hidden state. Must be the default state ("") because "when:" falls back to this.
236 when: root.teasing || teaseTimer.running
239 x: -root.panelWidth + units.gu(2)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list