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
20import "../Components/ListItems" as ListItems
21import "../Components/IconUtil.js" as IconUtil
25 property alias previewShown: previewLoader.onScreen
28 pageHeader.resetSearch();
31 onMovementStarted: categoryView.showHeader()
34 target: scopeView.scope
35 property: "searchQuery"
36 value: pageHeader.searchQuery
41 onSearchClicked: if (isCurrent) {
42 pageHeader.triggerSearch()
43 categoryView.showHeader()
50 model: scopeView.categories
51 forceNoClip: previewLoader.onScreen
53 onAtYEndChanged: if (atYEnd) endReached()
54 onMovingChanged: if (moving && atYEnd) endReached()
56 delegate: ListItems.Base {
57 highlightWhenPressed: false
59 function headerClicked() {
60 if (rendererLoader.item.expandable) {
61 rendererLoader.item.filter = !rendererLoader.item.filter;
73 source: getRenderer(model.renderer, model.contentType)
80 target: rendererLoader.item
82 effect.positionPx = mapToItem(categoryView, 0, itemY).y
83 scopeView.scope.activate(delegateItem.model.uri,
84 delegateItem.model.icon,
85 delegateItem.model.category,
87 delegateItem.model.mimetype,
88 delegateItem.model.title,
89 delegateItem.model.comment,
90 delegateItem.model.dndUri,
91 delegateItem.model.metadata)
94 effect.positionPx = mapToItem(categoryView, 0, itemY).y
95 scopeView.scope.preview( delegateItem.model.uri,
96 delegateItem.model.icon,
97 delegateItem.model.category,
99 delegateItem.model.mimetype,
100 delegateItem.model.title,
101 delegateItem.model.comment,
102 delegateItem.model.dndUri,
103 delegateItem.model.metadata)
107 categoryView.maximizeVisibleArea(index);
113 sectionProperty: "name"
114 sectionDelegate: ListItems.Header {
115 width: categoryView.width
118 var obj = categoryView.item(delegateIndex);
123 pageHeader: PageHeader {
125 objectName: "pageHeader"
126 width: categoryView.width
127 text: scopeView.scope.name
128 searchEntryEnabled: true
132 function getDefaultRendererId(contentType) {
133 switch (contentType) {
134 default: return "grid";
138 function getRenderer(rendererId, contentType) {
139 if (rendererId == "default") {
140 rendererId = getDefaultRendererId(contentType);
142 switch (rendererId) {
144 switch (contentType) {
145 case "video": return "Generic/GenericFilterGridPotrait.qml";
146 default: return "Generic/GenericFilterGrid.qml";
149 case "carousel": return "Generic/GenericCarousel.qml";
150 default: return "Generic/GenericFilterGrid.qml";
158 bottomMargin: -bottomOverflow
160 sourceItem: categoryView
164 topGapPx: (1 - gap) * positionPx
165 topOpacity: (1 - gap * 1.2)
166 bottomGapPx: positionPx + gap * (targetBottomGapPx - positionPx)
167 bottomOverflow: units.gu(20)
168 bottomOpacity: 1 - (gap * 0.8)
170 property int targetBottomGapPx: height - units.gu(8) - bottomOverflow
171 property real gap: previewLoader.open ? 1.0 : 0.0
176 easing.type: Easing.InOutQuad
178 if (!previewLoader.open && !running) {
179 previewLoader.onScreen = false
187 target: scopeView.scope
189 previewLoader.previewData = preview
190 previewLoader.open = true
194 PreviewDelegateMapper {
195 id: previewDelegateMapper
199 ignoreUnknownSignals: true
200 target: previewLoader.valid ? previewLoader.item : null
202 previewLoader.open = false
208 property var previewData
209 height: effect.bottomGapPx - effect.topGapPx
212 topMargin: effect.topGapPx
216 source: onScreen ? previewDelegateMapper.map(previewLoader.previewData.rendererName) : ""
218 property bool open: false
219 property bool onScreen: false
220 property bool valid: item !== null
229 item.previewData = previewLoader.previewData
233 // TODO: Move as InverseMouseArea to DashPreview
235 enabled: previewLoader.onScreen
238 topMargin: effect.bottomGapPx
241 previewLoader.open = 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