on xenial help sign in
Merge DashFilterGrid.qml to CardFilterGrid.qml
commiteef2f2567a2cb65393d9b5d727460a7397b7e648 authorAlbert Astals <albert.astals@canonical.com> dateMon 17 Mar 2014, 11:38 (13 years ago) parent91d9f95
4 files changed+51−93
qml/Dash/CardCarousel.qml−1 qml/Dash/CardFilterGrid.qml+51−24 qml/Dash/DashFilterGrid.qml−65 qml/Dash/DashRenderer.qml−3
qml/Dash/CardCarousel.qml−1
@@ -42,7 +42,6 @@ DashRenderer {
4242 selectedItemScaleFactor: cardTool.carouselSelectedItemScaleFactor
4343 cacheBuffer: 1404 // 18px * 13gu * 6
4444 model: cardCarousel.model
45− highlightIndex: cardCarousel.highlightIndex
4645
4746 onClicked: cardCarousel.clicked(index, itemY)
4847 onPressAndHold: cardCarousel.pressAndHold(index, itemY)
qml/Dash/CardFilterGrid.qml+51−24
@@ -15,35 +15,62 @@
1515 */
1616
1717import QtQuick 2.0
18−import Ubuntu.Components 0.1
18+import "../Components"
1919
20−DashFilterGrid {
20+DashRenderer {
2121 id: genericFilterGrid
2222
23− minimumHorizontalSpacing: units.gu(1)
24− delegateWidth: cardTool.cardWidth
25− delegateHeight: cardTool.cardHeight
26− verticalSpacing: units.gu(1)
23+ expandable: filterGrid.expandable
2724 collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2)
25+ collapsedHeight: filterGrid.collapsedHeight
26+ columns: filterGrid.columns
27+ rows: filter ? collapsedRowCount : uncollapsedRowCount
28+ margins: filterGrid.margins
29+ uncollapsedHeight: filterGrid.uncollapsedHeight
30+ verticalSpacing: units.gu(1)
31+ currentItem: filterGrid.currentItem
32+ height: filterGrid.height
33+
34+ function startFilterAnimation(filter) {
35+ filterGrid.startFilterAnimation(filter)
36+ }
37+
38+ FilterGrid {
39+ id: filterGrid
40+ width: genericFilterGrid.width
41+ minimumHorizontalSpacing: units.gu(1)
42+ delegateWidth: cardTool.cardWidth
43+ delegateHeight: cardTool.cardHeight
44+ verticalSpacing: genericFilterGrid.verticalSpacing
45+ model: genericFilterGrid.model
46+ filter: genericFilterGrid.filter
47+ collapsedRowCount: genericFilterGrid.collapsedRowCount
48+ delegateCreationBegin: genericFilterGrid.delegateCreationBegin
49+ delegateCreationEnd: genericFilterGrid.delegateCreationEnd
50+ delegate: Item {
51+ width: filterGrid.cellWidth
52+ height: filterGrid.cellHeight
53+ Card {
54+ id: card
55+ width: cardTool.cardWidth
56+ height: cardTool.cardHeight
57+ headerHeight: cardTool.headerHeight
58+ anchors.horizontalCenter: parent.horizontalCenter
59+ objectName: "delegate" + index
60+ cardData: model
61+ template: cardTool.template
62+ components: cardTool.components
63+
64+ headerAlignment: cardTool.headerAlignment
65+
66+ onClicked: genericFilterGrid.clicked(index, card.y)
67+ onPressAndHold: genericFilterGrid.pressAndHold(index, card.y)
68+ }
69+ }
2870
29− delegate: Item {
30− width: genericFilterGrid.cellWidth
31− height: genericFilterGrid.cellHeight
32− Card {
33− id: card
34− width: cardTool.cardWidth
35− height: cardTool.cardHeight
36− headerHeight: cardTool.headerHeight
37− anchors.horizontalCenter: parent.horizontalCenter
38− objectName: "delegate" + index
39− cardData: model
40− template: cardTool.template
41− components: cardTool.components
42−
43− headerAlignment: cardTool.headerAlignment
44−
45− onClicked: genericFilterGrid.clicked(index, card.y)
46− onPressAndHold: genericFilterGrid.pressAndHold(index, card.y)
71+ onFilterChanged: {
72+ genericFilterGrid.filter = filter
73+ filter = Qt.binding(function() { return genericFilterGrid.filter })
4774 }
4875 }
4976}
qml/Dash/DashFilterGrid.qmldeleted−65
@@ -1,65 +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 "../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 verticalSpacing: filterGrid.verticalSpacing
30− property alias maximumNumberOfColumns: filterGrid.maximumNumberOfColumns
31− property alias minimumHorizontalSpacing: filterGrid.minimumHorizontalSpacing
32− property alias collapsedRowCount: filterGrid.collapsedRowCount
33−
34− collapsedHeight: filterGrid.collapsedHeight
35− columns: filterGrid.columns
36− rows: filter ? filterGrid.collapsedRowCount : filterGrid.uncollapsedRowCount
37− currentItem: filterGrid.currentItem
38− expandable: filterGrid.expandable
39− height: filterGrid.height
40− margins: filterGrid.margins
41− uncollapsedHeight: filterGrid.uncollapsedHeight
42−
43− function startFilterAnimation(filter) {
44− filterGrid.startFilterAnimation(filter)
45− }
46−
47− FilterGrid {
48− id: filterGrid
49− width: dashFilterGrid.width
50− minimumHorizontalSpacing: units.gu(0.5)
51− delegateWidth: units.gu(11)
52− delegateHeight: units.gu(9.5)
53− verticalSpacing: units.gu(2)
54− model: dashFilterGrid.model
55− filter: dashFilterGrid.filter
56− highlightIndex: dashFilterGrid.highlightIndex
57− delegateCreationBegin: dashFilterGrid.delegateCreationBegin
58− delegateCreationEnd: dashFilterGrid.delegateCreationEnd
59−
60− onFilterChanged: {
61− dashFilterGrid.filter = filter
62− filter = Qt.binding(function() { return dashFilterGrid.filter })
63− }
64− }
65−}
qml/Dash/DashRenderer.qml−3
@@ -31,9 +31,6 @@ Item {
3131
3232 property int rows: 1
3333
34− // Index of the highlighted item
35− property int highlightIndex: -1
36−
3734 property int margins: 0
3835
3936 property int uncollapsedHeight: height