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 property var model: null
25 property var scopes: null
26 property real contentProgress: Math.max(0, Math.min(dashContentList.contentX / (dashContentList.contentWidth - dashContentList.width), units.dp(1)))
27 property alias currentIndex: dashContentList.currentIndex
29 property ScopeDelegateMapper scopeMapper : ScopeDelegateMapper {}
31 signal movementStarted()
32 signal movementEnded()
33 signal contentFlickStarted()
34 signal contentEndReached()
36 signal scopeLoaded(string scopeId)
37 signal positionedAtBeginning()
39 // If we set the current scope index before the scopes have been added,
40 // then we need to wait until the loaded signals gets emitted from the scopes
41 property var set_current_index: undefined
45 if (scopes.loaded && set_current_index != undefined) {
46 setCurrentScopeAtIndex(set_current_index[0], set_current_index[1], set_current_index[2]);
47 set_current_index = undefined;
52 function setCurrentScopeAtIndex(index, animate, reset) {
53 var storedMoveDuration = dashContentList.highlightMoveDuration
54 var storedMoveSpeed = dashContentList.highlightMoveVelocity
56 dashContentList.highlightMoveVelocity = units.gu(4167)
57 dashContentList.highlightMoveDuration = 0
60 // if the scopes haven't loaded yet, then wait until they are.
62 set_current_index = [ index, animate, reset ]
65 set_current_index = undefined;
67 if (dashContentList.count > index)
69 dashContentList.currentIndex = index
72 dashContent.positionedAtBeginning()
77 dashContentList.highlightMoveDuration = storedMoveDuration
78 dashContentList.highlightMoveVelocity = storedMoveSpeed
84 objectName: "dashContentList"
86 interactive: dashContent.scopes.loaded
89 model: dashContent.model
90 orientation: ListView.Horizontal
91 boundsBehavior: Flickable.DragAndOvershootBounds
92 flickDeceleration: units.gu(625)
93 maximumFlickVelocity: width * 5
94 snapMode: ListView.SnapOneItem
95 highlightMoveDuration: 250
96 highlightRangeMode: ListView.StrictlyEnforceRange
97 /* FIXME: workaround rendering issue due to use of ShaderEffectSource in
98 UbuntuShape. While switching from the home scope to the People scope the
99 rendering would block midway.
101 cacheBuffer: 2147483647
102 onMovementStarted: dashContent.movementStarted()
103 onMovementEnded: dashContent.movementEnded()
105 // If the number of items is less than the current index, then need to reset to another item.
107 if (currentIndex >= count)
108 dashContent.setCurrentScopeAtIndex(count-1, true, true)
113 width: ListView.view.width
114 height: ListView.view.height
116 source: scopeMapper.map(scope.id)
118 // these are needed for autopilot tests
119 readonly property string scopeId: scope.id
120 readonly property bool isCurrent: ListView.isCurrentItem
121 readonly property bool isLoaded: status == Loader.Ready
124 item.scope = Qt.binding(function() { return scope })
125 item.isCurrent = Qt.binding(function() { return ListView.isCurrentItem })
126 item.searchHistory = Qt.binding(function() { return shell.searchHistory })
127 dashContentList.movementStarted.connect(item.movementStarted)
128 dashContent.positionedAtBeginning.connect(item.positionedAtBeginning)
129 dashContent.scopeLoaded(item.scope.id)
133 ignoreUnknownSignals: true
134 onEndReached: contentEndReached()
135 onPreviewShownChanged: {
136 if (item.previewShown) {
138 dashContentList.interactive = false
140 dashContentList.interactive = true
145 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