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/>.
18import Ubuntu.Components 0.1
24 rotation: inverted ? 180 : 0
27 property bool inverted: true
28 property bool dragging: false
29 property bool moving: launcherFlickable.moving
30 property int dragPosition: 0
31 property int highlightIndex: -1
33 signal applicationSelected(string desktopFile)
34 signal dashItemSelected(int index)
36 onDragPositionChanged: {
37 var effectiveDragPosition = root.inverted ? launcherFlickable.height - dragPosition : dragPosition - mainColumn.anchors.margins
39 var hiddenContentHeight = launcherFlickable.contentHeight - launcherFlickable.height
40 // Shortening scrollable height because the first/last item needs to be fully expanded before reaching the top/bottom
41 var scrollableHeight = launcherFlickable.height - (launcherFlickable.itemSize + launcherColumn.spacing) *2
42 // As we shortened the scrollableHeight, lets move everything down by the itemSize
43 var shortenedEffectiveDragPosition = effectiveDragPosition - launcherFlickable.itemSize - launcherColumn.spacing
44 var newContentY = shortenedEffectiveDragPosition * hiddenContentHeight / scrollableHeight
46 // limit top/bottom to prevent overshooting
47 launcherFlickable.contentY = Math.min(hiddenContentHeight, Math.max(0, newContentY));
49 // Now calculate the current index:
50 // > the current mouse position + the hidden/scolled content on top is the mouse position in the averall view
51 // > adjust that removing all the margins
52 // > divide by itemSize to get index
53 highlightIndex = (effectiveDragPosition + launcherFlickable.contentY - mainColumn.anchors.margins*3 - launcherColumn.spacing/2) / (launcherFlickable.itemSize + launcherColumn.spacing)
58 source: "graphics/launcher_bg.sci"
65 anchors.margins: units.gu(1)
70 objectName: "dashItem"
71 width: launcherFlickable.itemSize
72 height: launcherFlickable.itemSize
73 anchors.horizontalCenter: parent.horizontalCenter
75 onClicked: root.dashItemSelected(0)
79 anchors.left: parent.left
80 anchors.right: parent.right
81 height: parent.height - dashItem.height - parent.spacing
82 contentHeight: launcherColumn.height
84 property int itemSize: width
90 anchors.horizontalCenter: parent.horizontalCenter
98 objectName: "launcherDelegate" + index
99 width: launcherFlickable.itemSize
100 height: launcherFlickable.itemSize
102 inverted: root.inverted
103 highlighted: root.dragging && index === root.highlightIndex
109 itemsBeforeThis: index
110 itemsAfterThis: iconRepeater.count - (index+1)
113 root.applicationSelected(launcherModel.get(index).desktopFile);
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