on xenial help sign in
Implement an 'interface' for Dash Renderers.
e39cdceAndrea Cimitan
Components/Carousel.qml+2−3
@@ -63,6 +63,7 @@ Item {
63 signal pressAndHold(int index, real itemY)
63 signal pressAndHold(int index, real itemY)
64
64
65 implicitHeight: listView.tileHeight * selectedItemScaleFactor
65 implicitHeight: listView.tileHeight * selectedItemScaleFactor
66+ opacity: listView.highlightIndex === -1 ? 1 : 0.6
66
67
67 /* Basic idea behind the carousel effect is to move the items of the delegates (compacting /stuffing them).
68 /* Basic idea behind the carousel effect is to move the items of the delegates (compacting /stuffing them).
68 One drawback is, that more delegates have to be drawn than usually. As some items are moved from the
69 One drawback is, that more delegates have to be drawn than usually. As some items are moved from the
@@ -75,11 +76,11 @@ Item {
75 ListView {
76 ListView {
76 id: listView
77 id: listView
77
78
79+ property int highlightIndex: -1
78 property real minimumTileWidth: 0
80 property real minimumTileWidth: 0
79 property real newContentX: disabledNewContentX
81 property real newContentX: disabledNewContentX
80 property real pathItemCount: referenceWidth / referenceTileWidth
82 property real pathItemCount: referenceWidth / referenceTileWidth
81 property real tileAspectRatio: 1
83 property real tileAspectRatio: 1
82− property int highlightIndex: -1
83
84
84 /* The positioning and scaling of the items in the carousel is based on the variable
85 /* The positioning and scaling of the items in the carousel is based on the variable
85 'continuousIndex', a continuous real variable between [0, 'carousel.model.count'],
86 'continuousIndex', a continuous real variable between [0, 'carousel.model.count'],
@@ -293,7 +294,6 @@ Item {
293 scale: itemScale * explicitScaleFactor
294 scale: itemScale * explicitScaleFactor
294 sourceComponent: itemComponent
295 sourceComponent: itemComponent
295 z: cachedTiles - Math.abs(index - listView.selectedIndex)
296 z: cachedTiles - Math.abs(index - listView.selectedIndex)
296− opacity: highlightIndex == -1 ? 1 : (highlightIndex == index ? 0.6 : 0.2)
297
297
298 transform: Translate {
298 transform: Translate {
299 x: xTransform
299 x: xTransform
@@ -333,7 +333,6 @@ Item {
333 onPressAndHold: {
333 onPressAndHold: {
334 listView.itemPressAndHold(index, item)
334 listView.itemPressAndHold(index, item)
335 }
335 }
336−
337 }
336 }
338 }
337 }
339 }
338 }
Components/FilterGrid.qml+3−2
@@ -41,11 +41,12 @@ Item {
41
41
42 /* Maximum number of rows to be show when filter=true. */
42 /* Maximum number of rows to be show when filter=true. */
43 property int collapsedRowCount: 2
43 property int collapsedRowCount: 2
44+ property int uncollapsedRowCount: Math.ceil(model.count / columns)
44 readonly property int collapsedHeight: {
45 readonly property int collapsedHeight: {
45 return iconTileGrid.contentHeightForRows(Math.min(collapsedRowCount, Math.ceil(model.count / columns)))
46 return iconTileGrid.contentHeightForRows(Math.min(collapsedRowCount, Math.ceil(model.count / columns)))
46 }
47 }
47 readonly property int uncollapsedHeight: {
48 readonly property int uncollapsedHeight: {
48− return iconTileGrid.contentHeightForRows(Math.ceil(model.count / columns))
49+ return iconTileGrid.contentHeightForRows(uncollapsedRowCount)
49 }
50 }
50
51
51 property alias minimumHorizontalSpacing: iconTileGrid.minimumHorizontalSpacing
52 property alias minimumHorizontalSpacing: iconTileGrid.minimumHorizontalSpacing
@@ -66,7 +67,7 @@ Item {
66 property alias highlightIndex: iconTileGrid.highlightIndex
67 property alias highlightIndex: iconTileGrid.highlightIndex
67 readonly property alias currentItem: iconTileGrid.currentItem
68 readonly property alias currentItem: iconTileGrid.currentItem
68
69
69− height: !filterAnimation.running ? childrenRect.height : height
70+ implicitHeight: !filterAnimation.running ? childrenRect.height : height
70 clip: filterAnimation.running
71 clip: filterAnimation.running
71
72
72 NumberAnimation {
73 NumberAnimation {
Dash/DashCarousel.qmlnew file+47
@@ -0,0 +1,47 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+import QtQuick 2.0
18+import Ubuntu.Components 0.1
19+import "../Components"
20+
21+DashRenderer {
22+ id: dashCarousel
23+
24+ property alias cacheBuffer: carousel.cacheBuffer
25+ property alias itemComponent: carousel.itemComponent
26+ property alias minimumTileWidth: carousel.minimumTileWidth
27+ property alias selectedItemScaleFactor: carousel.selectedItemScaleFactor
28+ property alias tileAspectRatio: carousel.tileAspectRatio
29+
30+ currentItem: carousel.currentItem
31+ height: carousel.implicitHeight + units.gu(6)
32+ verticalSpacing: units.gu(3)
33+
34+ Carousel {
35+ id: carousel
36+ anchors.fill: parent
37+ tileAspectRatio: 198 / 288
38+ minimumTileWidth: units.gu(13)
39+ selectedItemScaleFactor: 1.14
40+ cacheBuffer: 1404 // 18px * 13gu * 6
41+ model: dashCarousel.model
42+ highlightIndex: dashCarousel.highlightIndex
43+
44+ onClicked: dashCarousel.clicked(index, itemY)
45+ onPressAndHold: dashCarousel.pressAndHold(index, itemY)
46+ }
47+}
Dash/DashFilterGrid.qmlnew file+60
@@ -0,0 +1,60 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+import QtQuick 2.0
18+import "../Components"
19+import ".."
20+
21+DashRenderer {
22+ id: dashFilterGrid
23+
24+ property alias cellWidth: filterGrid.cellWidth
25+ property alias cellHeight: filterGrid.cellHeight
26+ property alias delegate: filterGrid.delegate
27+ property alias delegateWidth: filterGrid.delegateWidth
28+ property alias delegateHeight: filterGrid.delegateHeight
29+ property alias maximumNumberOfColumns: filterGrid.maximumNumberOfColumns
30+ property alias minimumHorizontalSpacing: filterGrid.minimumHorizontalSpacing
31+
32+ collapsedHeight: filterGrid.collapsedHeight
33+ collapsedRowCount: filterGrid.collapsedRowCount
34+ columns: filterGrid.columns
35+ rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
36+ currentItem: filterGrid.currentItem
37+ expandable: filterGrid.expandable
38+ delegateCreationBegin: filterGrid.delegateCreationBegin
39+ delegateCreationEnd: filterGrid.delegateCreationEnd
40+ implicitHeight: filterGrid.implicitHeight
41+ margins: filterGrid.margins
42+ uncollapsedHeight: filterGrid.uncollapsedHeight
43+ verticalSpacing: filterGrid.verticalSpacing
44+
45+ function startFilterAnimation(filter) {
46+ filterGrid.startFilterAnimation(filter)
47+ }
48+
49+ FilterGrid {
50+ id: filterGrid
51+ anchors.fill: parent
52+ minimumHorizontalSpacing: units.gu(0.5)
53+ delegateWidth: units.gu(11)
54+ delegateHeight: units.gu(9.5)
55+ verticalSpacing: units.gu(2)
56+ model: dashFilterGrid.model
57+ filter: dashFilterGrid.filter
58+ highlightIndex: dashFilterGrid.highlightIndex
59+ }
60+}
Dash/DashRenderer.qmlnew file+65
@@ -0,0 +1,65 @@
1+/*
2+ * Copyright (C) 2013 Canonical, Ltd.
3+ *
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.
7+ *
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.
12+ *
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/>.
15+ */
16+
17+import QtQuick 2.0
18+
19+Item {
20+ // Can the item be expanded?
21+ property bool expandable: false
22+
23+ // In case it can be expanded, should we filter it
24+ property bool filter: true
25+
26+ property int collapsedRowCount: 1
27+
28+ property int collapsedHeight: height
29+
30+ property int columns: 1
31+
32+ property int rows: 1
33+
34+ // Index of the highlighted item
35+ property int highlightIndex: -1
36+
37+ property int margins: 0
38+
39+ property int uncollapsedHeight: height
40+
41+ property real delegateCreationBegin
42+
43+ property real delegateCreationEnd
44+
45+ property real verticalSpacing: 0
46+
47+ // The current item of the renderer
48+ property var currentItem
49+
50+ // The model to renderer
51+ property var model
52+
53+ /// Emitted when the user clicked on an item
54+ /// @param index is the index of the clicked item
55+ /// @param itemY is y of the clicked delegate
56+ signal clicked(int index, real itemY)
57+
58+ /// Emitted when the user pressed and held on an item
59+ /// @param index is the index of the held item
60+ /// @param itemY is y of the held delegate
61+ signal pressAndHold(int index, real itemY)
62+
63+ function startFilterAnimation(filter) {
64+ }
65+}
Dash/Generic/GenericCarousel.qml+2−7
@@ -17,16 +17,11 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import Ubuntu.Components 0.1
18import Ubuntu.Components 0.1
19import "../../Components"
19import "../../Components"
20+import ".."
20
21
21−Carousel {
22+DashCarousel {
22 id: genericCarousel
23 id: genericCarousel
23−
24− tileAspectRatio: 198 / 288
25− minimumTileWidth: units.gu(13)
26 itemComponent: carouselDelegateGeneric
24 itemComponent: carouselDelegateGeneric
27− selectedItemScaleFactor: 1.14
28− cacheBuffer: 1404 // 18px * 13gu * 6
29− height: implicitHeight + units.gu(6)
30
25
31 Component {
26 Component {
32 id: carouselDelegateGeneric
27 id: carouselDelegateGeneric
Dash/Generic/GenericCarouselLoader.qmldeleted−30
@@ -1,30 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−
20−Loader {
21− property var model: null
22− property url carouselUrl: "GenericCarousel.qml"
23− property url filtergridUrl: "GenericFilterGrid.qml"
24−
25− source: model.count > 6 ? carouselUrl : filtergridUrl // FIXME do not hardcode 6, but retrieve correct minimum required count
26−
27− onLoaded: {
28− item.model = Qt.binding(function() { return model; })
29− }
30−}
Dash/Generic/GenericFilterGrid.qml+13−19
@@ -15,38 +15,32 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18+import Ubuntu.Components 0.1
18import "../../Components"
19import "../../Components"
20+import ".."
19
21
20−FilterGrid {
22+DashFilterGrid {
21− id: filtergrid
23+ id: genericFilterGrid
24+
25+ property int iconWidth: units.gu(8)
26+ property int iconHeight: units.gu(7.5)
22
27
23 minimumHorizontalSpacing: units.gu(0.5)
28 minimumHorizontalSpacing: units.gu(0.5)
24 delegateWidth: units.gu(11)
29 delegateWidth: units.gu(11)
25 delegateHeight: units.gu(9.5)
30 delegateHeight: units.gu(9.5)
26 verticalSpacing: units.gu(2)
31 verticalSpacing: units.gu(2)
27
32
28− property int iconWidth: units.gu(8)
29− property int iconHeight: units.gu(7.5)
30−
31− signal clicked(int index, real itemY)
32− signal pressAndHold(int index, real itemY)
33−
34 delegate: Tile {
33 delegate: Tile {
35 id: tile
34 id: tile
36 objectName: "delegate" + index
35 objectName: "delegate" + index
37− width: filtergrid.cellWidth
36+ width: genericFilterGrid.cellWidth
38− height: filtergrid.cellHeight
37+ height: genericFilterGrid.cellHeight
39 text: model.title
38 text: model.title
40− imageWidth: filtergrid.iconWidth
39+ imageWidth: genericFilterGrid.iconWidth
41− imageHeight: filtergrid.iconHeight
40+ imageHeight: genericFilterGrid.iconHeight
42 source: model.icon
41 source: model.icon
43
42
44− onClicked: {
45− filtergrid.clicked(index, tile.y)
43+ onClicked: genericFilterGrid.clicked(index, tile.y)
46− }
47−
48− onPressAndHold: {
49− filtergrid.pressAndHold(index, tile.y)
44+ onPressAndHold: genericFilterGrid.pressAndHold(index, tile.y)
50− }
51 }
45 }
52}
46}
Dash/Generic/GenericFilterGridPotrait.qml+1−3
@@ -15,16 +15,14 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18+import Ubuntu.Components 0.1
18import "../../Components"
19import "../../Components"
19
20
20GenericFilterGrid {
21GenericFilterGrid {
21− id: filtergrid
22−
23 minimumHorizontalSpacing: units.gu(0.5)
22 minimumHorizontalSpacing: units.gu(0.5)
24 delegateWidth: units.gu(11)
23 delegateWidth: units.gu(11)
25 delegateHeight: units.gu(18)
24 delegateHeight: units.gu(18)
26 verticalSpacing: units.gu(2)
25 verticalSpacing: units.gu(2)
27−
28 iconWidth: (width / columns) * 0.8
26 iconWidth: (width / columns) * 0.8
29 iconHeight: iconWidth * 16 / 11
27 iconHeight: iconWidth * 16 / 11
30}
28}
Dash/GenericScopeView.qml+34−26
@@ -140,7 +140,7 @@ FocusScope {
140 right: parent.right
140 right: parent.right
141 }
141 }
142
142
143− source: getRenderer(model.renderer, model.contentType, model.rendererHint)
143+ source: getRenderer(model.renderer, model.contentType, model.rendererHint, results)
144
144
145 onLoaded: {
145 onLoaded: {
146 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
146 if (item.enableHeightBehavior !== undefined && item.enableHeightBehaviorOnNextCreation !== undefined) {
@@ -191,8 +191,8 @@ FocusScope {
191 } else {
191 } else {
192 previewListView.open = true
192 previewListView.open = true
193
193
194− scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title,
194+ scopeView.scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title,
195− item.comment, item.dndUri, item.metadata)
195+ item.comment, item.dndUri, item.metadata)
196 }
196 }
197 }
197 }
198 onPressAndHold: {
198 onPressAndHold: {
@@ -205,7 +205,7 @@ FocusScope {
205 previewListView.open = true
205 previewListView.open = true
206
206
207 var item = target.model.get(index)
207 var item = target.model.get(index)
208− scopeView.scope.preview( item.uri, item.icon, item.category, 0, item.mimetype, item.title,
208+ scopeView.scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title,
209 item.comment, item.dndUri, item.metadata)
209 item.comment, item.dndUri, item.metadata)
210 }
210 }
211 }
211 }
@@ -303,16 +303,21 @@ FocusScope {
303 }
303 }
304 }
304 }
305
305
306− function getRenderer(rendererId, contentType, rendererHint) {
306+ function getRenderer(rendererId, contentType, rendererHint, results) {
307 if (rendererId == "default") {
307 if (rendererId == "default") {
308 rendererId = getDefaultRendererId(contentType);
308 rendererId = getDefaultRendererId(contentType);
309 }
309 }
310+ if (rendererId == "carousel") {
311+ // Selectively disable carousel, 6 is fixed for now, should change on the form factor
312+ if (results.count <= 6)
313+ rendererId = "grid"
314+ }
310 switch (rendererId) {
315 switch (rendererId) {
311 case "carousel": {
316 case "carousel": {
312 switch (contentType) {
317 switch (contentType) {
313− case "music": return "Music/MusicCarouselLoader.qml";
318+ case "music": return "Music/MusicCarousel.qml";
314− case "video": return "Video/VideoCarouselLoader.qml";
319+ case "video": return "Video/VideoCarousel.qml";
315− default: return "Generic/GenericCarouselLoader.qml";
320+ default: return "Generic/GenericCarousel.qml";
316 }
321 }
317 }
322 }
318 case "grid": {
323 case "grid": {
@@ -442,27 +447,30 @@ FocusScope {
442 scopeView.scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
447 scopeView.scope.preview(item.uri, item.icon, item.category, 0, item.mimetype, item.title, item.comment, item.dndUri, item.metadata)
443 }
448 }
444
449
450+ // Adjust contentY in case we need to change to it to show the next row
451+ if (categoryDelegate.rows > 1) {
445− var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
452+ var itemY = categoryView.contentItem.mapFromItem(categoryDelegate.currentItem).y;
446
453
447− // Find new contentY and effect.postionPx
454+ // Find new contentY and effect.postionPx
448− var newContentY = itemY - effect.positionPx - categoryDelegate.verticalSpacing;
455+ var newContentY = itemY - effect.positionPx - categoryDelegate.verticalSpacing;
449
456
450− // Make sure the item is not covered by a header. Move the effect split down if necessary
457+ // Make sure the item is not covered by a header. Move the effect split down if necessary
451− var headerHeight = pageHeader.height + categoryView.stickyHeaderHeight;
458+ var headerHeight = pageHeader.height + categoryView.stickyHeaderHeight;
452− var effectAdjust = Math.max(effect.positionPx, headerHeight);
459+ var effectAdjust = Math.max(effect.positionPx, headerHeight);
453
460
454− // Make sure we don't overscroll the listview. If yes, adjust effect position
461+ // Make sure we don't overscroll the listview. If yes, adjust effect position
455− if (newContentY < 0) {
462+ if (newContentY < 0) {
456− effectAdjust += newContentY;
463+ effectAdjust += newContentY;
457− newContentY = 0;
464+ newContentY = 0;
458− }
465+ }
459− if (newContentY > Math.max(0, categoryView.contentHeight - categoryView.height)) {
466+ if (newContentY > Math.max(0, categoryView.contentHeight - categoryView.height)) {
460− effectAdjust += -(categoryView.contentHeight - categoryView.height) + newContentY
467+ effectAdjust += -(categoryView.contentHeight - categoryView.height) + newContentY
461− newContentY = categoryView.contentHeight - categoryView.height;
468+ newContentY = categoryView.contentHeight - categoryView.height;
462− }
469+ }
463
470
464− effect.positionPx = effectAdjust;
471+ effect.positionPx = effectAdjust;
465− categoryView.contentY = newContentY;
472+ categoryView.contentY = newContentY;
473+ }
466 }
474 }
467
475
468 property bool open: false
476 property bool open: false
@@ -540,7 +548,7 @@ FocusScope {
540 }
548 }
541
549
542 function closePreviewSpinner() {
550 function closePreviewSpinner() {
543− if(item) {
551+ if (item) {
544 item.showProcessingAction = false;
552 item.showProcessingAction = false;
545 }
553 }
546 }
554 }
Dash/Music/MusicCarousel.qml+2−2
@@ -16,15 +16,15 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import "../../Components"
18import "../../Components"
19+import ".."
19
20
20−Carousel {
21+DashCarousel {
21 id: musicCarousel
22 id: musicCarousel
22 tileAspectRatio: 1
23 tileAspectRatio: 1
23 minimumTileWidth: units.gu(13)
24 minimumTileWidth: units.gu(13)
24 itemComponent: carouselDelegateMusic
25 itemComponent: carouselDelegateMusic
25 selectedItemScaleFactor: 1.2
26 selectedItemScaleFactor: 1.2
26 cacheBuffer: 1404 // 18px * 13gu * 6
27 cacheBuffer: 1404 // 18px * 13gu * 6
27− height: implicitHeight + units.gu(6)
28
28
29 Component {
29 Component {
30 id: carouselDelegateMusic
30 id: carouselDelegateMusic
Dash/Music/MusicCarouselLoader.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import "../Generic"
20−
21−GenericCarouselLoader {
22− carouselUrl: "MusicCarousel.qml"
23− filtergridUrl: "MusicFilterGrid.qml"
24−}
Dash/Music/MusicFilterGrid.qml+7−13
@@ -19,22 +19,21 @@ import "../../Components"
19import "../Generic"
19import "../Generic"
20
20
21GenericFilterGrid {
21GenericFilterGrid {
22− id: filtergrid
22+ id: musicFilterGrid
23
23
24 delegateWidth: units.gu(11)
24 delegateWidth: units.gu(11)
25 delegateHeight: units.gu(16)
25 delegateHeight: units.gu(16)
26−
27 iconWidth: units.gu(11)
26 iconWidth: units.gu(11)
28 iconHeight: units.gu(11)
27 iconHeight: units.gu(11)
29
28
30 delegate: Tile {
29 delegate: Tile {
31 id: tile
30 id: tile
32 objectName: "delegate" + index
31 objectName: "delegate" + index
33− width: filtergrid.cellWidth
32+ width: musicFilterGrid.cellWidth
34− height: filtergrid.cellHeight
33+ height: musicFilterGrid.cellHeight
35 text: model.comment
34 text: model.comment
36− imageWidth: filtergrid.iconWidth
35+ imageWidth: musicFilterGrid.iconWidth
37− imageHeight: filtergrid.iconHeight
36+ imageHeight: musicFilterGrid.iconHeight
38 source: model.icon
37 source: model.icon
39 maximumLineCount: 2
38 maximumLineCount: 2
40 horizontalAlignment: Text.AlignLeft
39 horizontalAlignment: Text.AlignLeft
@@ -43,12 +42,7 @@ GenericFilterGrid {
43 artist: model.title
42 artist: model.title
44 }
43 }
45
44
46− onClicked: {
47− filtergrid.clicked(index, tile.y)
45+ onClicked: musicFilterGrid.clicked(index, tile.y)
48− }
49−
50− onPressAndHold: {
51− filtergrid.pressAndHold(index, tile.y)
46+ onPressAndHold: musicFilterGrid.pressAndHold(index, tile.y)
52− }
53 }
47 }
54}
48}
Dash/Video/VideoCarousel.qml+2−2
@@ -16,15 +16,15 @@
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18import "../../Components"
18import "../../Components"
19+import ".."
19
20
20−Carousel {
21+DashCarousel {
21 id: videosCarousel
22 id: videosCarousel
22 tileAspectRatio: 198 / 288
23 tileAspectRatio: 198 / 288
23 minimumTileWidth: units.gu(13)
24 minimumTileWidth: units.gu(13)
24 itemComponent: carouselDelegateVideo
25 itemComponent: carouselDelegateVideo
25 selectedItemScaleFactor: 1.14
26 selectedItemScaleFactor: 1.14
26 cacheBuffer: 1404 // 18px * 13gu * 6
27 cacheBuffer: 1404 // 18px * 13gu * 6
27− height: implicitHeight + units.gu(6)
28
28
29 Component {
29 Component {
30 id: carouselDelegateVideo
30 id: carouselDelegateVideo
Dash/Video/VideoCarouselLoader.qmldeleted−24
@@ -1,24 +0,0 @@
1−/*
2− * Copyright (C) 2013 Canonical, Ltd.
3− *
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.
7− *
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.
12− *
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/>.
15− */
16−
17−import QtQuick 2.0
18−import Ubuntu.Components 0.1
19−import "../Generic"
20−
21−GenericCarouselLoader {
22− carouselUrl: "VideoCarousel.qml"
23− filtergridUrl: "VideoFilterGrid.qml"
24−}
Dash/Video/VideoFilterGrid.qml+8−13
@@ -15,38 +15,33 @@
15 */
15 */
16
16
17import QtQuick 2.0
17import QtQuick 2.0
18+import Ubuntu.Components 0.1
18import "../../Components"
19import "../../Components"
19import "../Generic"
20import "../Generic"
20
21
21GenericFilterGrid {
22GenericFilterGrid {
22− id: filtergrid
23+ id: videoFilterGrid
23
24
24 delegateWidth: units.gu(11)
25 delegateWidth: units.gu(11)
25 delegateHeight: units.gu(15)
26 delegateHeight: units.gu(15)
26−
27 iconWidth: units.gu(11)
27 iconWidth: units.gu(11)
28 iconHeight: units.gu(11)
28 iconHeight: units.gu(11)
29
29
30 delegate: Tile {
30 delegate: Tile {
31 id: tile
31 id: tile
32 objectName: "delegate" + index
32 objectName: "delegate" + index
33− width: filtergrid.cellWidth
33+ width: videoFilterGrid.cellWidth
34− height: filtergrid.cellHeight
34+ height: videoFilterGrid.cellHeight
35 text: model.title
35 text: model.title
36− imageWidth: filtergrid.iconWidth
36+ imageWidth: videoFilterGrid.iconWidth
37− imageHeight: filtergrid.iconHeight
37+ imageHeight: videoFilterGrid.iconHeight
38 source: model.icon
38 source: model.icon
39 maximumLineCount: 2
39 maximumLineCount: 2
40 horizontalAlignment: Text.AlignLeft
40 horizontalAlignment: Text.AlignLeft
41
41
42 style: VideoTileStyle {}
42 style: VideoTileStyle {}
43
43
44− onClicked: {
45− filtergrid.clicked(index, tile.y)
44+ onClicked: videoFilterGrid.clicked(index, tile.y)
46− }
47−
48− onPressAndHold: {
49− filtergrid.pressAndHold(index, tile.y)
45+ onPressAndHold: videoFilterGrid.pressAndHold(index, tile.y)
50− }
51 }
46 }
52}
47}