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 int panelWidth: units.gu(8.5)
29 property int dragAreaWidth: units.gu(1)
30 property real progress: dragArea.dragging && dragArea.touchX > panel.width ? dragArea.touchX : 0
32 readonly property bool shown: panel.x > -panel.width
34 // emitted when an application is selected
35 signal launcherApplicationSelected(string desktopFile)
37 // emitted when the apps dash should be shown because of a swipe gesture
40 // emitted when the dash icon in the launcher has been tapped
41 signal dashItemSelected()
47 dismissTimer.restart()
55 function switchToNextState(state) {
56 animateTimer.nextState = state
78 dismissTimer.restart()
83 // Because the animation on x is disabled while dragging
84 // switching state directly in the drag handlers would not animate
85 // the completion of the hide/reveal gesture. Lets update the state
86 // machine and switch to the final state in the next event loop run
90 property string nextState: ""
92 // switching to an intermediate state here to make sure all the
93 // values are restored, even if we were already in the target state
95 root.state = nextState
105 enabled: root.state == "visible"
107 anchors.rightMargin: -units.gu(2)
115 if (panel.x < -panel.width/3) {
116 root.switchToNextState("")
118 root.switchToNextState("visible")
126 left: launcherDragArea.right
129 bottom: parent.bottom
131 enabled: root.state == "visible"
141 opacity: root.state == "visible" ? 0.4 : 0
143 Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutQuad} }
148 objectName: "launcherPanel"
149 width: root.panelWidth
152 bottom: parent.bottom
157 property bool animate: true
159 onApplicationSelected: {
161 launcherApplicationSelected(desktopFile)
163 onDashItemSelected: {
165 root.dashItemSelected(index)
169 if (dismissTimer.running) {
170 dismissTimer.restart();
176 // Disabling animation when dragging
177 duration: dragArea.dragging || launcherDragArea.drag.active ? 0 : 300;
178 easing.type: Easing.OutCubic
186 direction: Direction.Rightwards
188 enabled: root.available && root.state !== "visible"
189 width: root.dragAreaWidth
193 if (status !== DirectionalDragArea.Recognized)
196 // When the gesture finally gets recognized, the finger will likely be
197 // reasonably far from the edge. If we made the panel immediately
198 // follow the finger position it would be visually unpleasant as it
199 // would appear right next to the user's finger out of nowhere.
200 // Instead, we make the panel go towards the user's finger in several
201 // steps. ie., in an animated way.
202 var targetPanelX = Math.min(0, touchX - panel.width)
203 var delta = targetPanelX - panel.x
204 // the trick is not to go all the way (1.0) as it would cause a sudden jump
205 panel.x += 0.4 * delta
210 if (distance > panel.width / 2) {
211 root.switchToNextState("visible")
212 if (distance > panel.width * 2) {
216 root.switchToNextState("")
224 name: "" // hidden state. Must be the default state ("") because "when:" falls back to this.
239 when: teaseTimer.running
242 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