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
26 property var model: null
27 property var scopes: null
28 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))
29 property alias currentIndex: dashContentList.currentIndex
31 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
33 signal movementStarted()
34 signal movementEnded()
35 signal contentFlickStarted()
36 signal contentEndReached()
38 signal scopeLoaded(string scopeId)
39 signal positionedAtBeginning()
41 // If we set the current scope index before the scopes have been added,
42 // then we need to wait until the loaded signals gets emitted from the scopes
43 property var set_current_index: undefined
47 if (scopes.loaded && set_current_index != undefined) {
48 setCurrentScopeAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);
49 set_current_index = undefined;
54 function setCurrentScopeAtIndex(index, animate, reset) {
55 var storedMoveDuration = dashContentList.highlightMoveDuration
56 var storedMoveSpeed = dashContentList.highlightMoveVelocity
58 dashContentList.highlightMoveVelocity = units.gu(4167)
59 dashContentList.highlightMoveDuration = 0
62 // if the scopes haven't loaded yet, then wait until they are.
64 set_current_index = [ index, animate, reset ]
67 set_current_index = undefined;
69 if (dashContentList.count > index)
71 dashContentList.currentIndex = index
74 dashContent.positionedAtBeginning()
79 dashContentList.highlightMoveDuration = storedMoveDuration
80 dashContentList.highlightMoveVelocity = storedMoveSpeed
86 objectName: "dashContentList"
88 interactive: dashContent.scopes.loaded
91 model: dashContent.model
92 orientation: ListView.Horizontal
93 boundsBehavior: Flickable.DragAndOvershootBounds
94 flickDeceleration: units.gu(625)
95 maximumFlickVelocity: width * 5
96 snapMode: ListView.SnapOneItem
97 highlightMoveDuration: 250
98 highlightRangeMode: ListView.StrictlyEnforceRange
99 /* FIXME: workaround rendering issue due to use of ShaderEffectSource in
100 UbuntuShape. While switching from the home scope to the People scope the
101 rendering would block midway.
103 cacheBuffer: 2147483647
104 onMovementStarted: dashContent.movementStarted()
105 onMovementEnded: dashContent.movementEnded()
107 // If the number of items is less than the current index, then need to reset to another item.
109 if (currentIndex >= count)
110 dashContent.setCurrentScopeAtIndex(count-1, true, true)
115 width: ListView.view.width
116 height: ListView.view.height
118 source: scopeMapper.map(scope.id)
121 item.scope = Qt.binding(function() { return scope })
122 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })
123 item.searchHistory = Qt.binding(function() { return shell.searchHistory })
124 dashContentList.movementStarted.connect(item.movementStarted)
125 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)
126 dashContent.scopeLoaded(item.scope.id)
130 ignoreUnknownSignals: true
131 onEndReached: contentEndReached()
132 onPreviewShownChanged: {
133 if (item.previewShown) {
135 dashContentList.interactive = false
137 dashContentList.interactive = true
142 Component.onDestruction: active = false
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