Merge lp:~aacid/unity8/filtergrid_bindingloop into lp:unity8

Proposed by Albert Astals Cid
Status: Merged
Approved by: Andrea Cimitan
Approved revision: 837
Merged at revision: 862
Proposed branch: lp:~aacid/unity8/filtergrid_bindingloop
Merge into: lp:unity8
Prerequisite: lp:~aacid/unity8/card_optimizations
Diff against target: 253 lines (+53/-50)
7 files modified
qml/Components/FilterGrid.qml (+38/-25)
qml/Dash/CardFilterGrid.qml (+3/-8)
qml/Dash/DashRenderer.qml (+3/-3)
qml/Dash/GenericScopeView.qml (+4/-9)
tests/autopilot/unity8/shell/tests/test_emulators.py (+1/-1)
tests/qmltests/Components/tst_FilterGrid.qml (+1/-1)
tests/qmltests/Dash/tst_GenericScopeView.qml (+3/-3)
To merge this branch: bzr merge lp:~aacid/unity8/filtergrid_bindingloop
Reviewer Review Type Date Requested Status
Andrea Cimitan (community) Approve
Michał Sawicz Needs Information
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+216147@code.launchpad.net

This proposal supersedes a proposal from 2014-04-16.

Commit message

Fix binding loop in FilterGrid height

Description of the change

 * Are there any related MPs required for this MP to build/function as expected?
prerequisite

 * Did you perform an exploratory manual test run of your code change and any related functionality?
Yes

 * Did you make sure that your branch does not contain spurious tags?
Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
N/A

 * If you changed the UI, has there been a design review?
N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:835
http://jenkins.qa.ubuntu.com/job/unity8-ci/2839/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/296
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4906
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1703
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1360
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1364
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1364/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1360
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/278
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4483
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4483/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6126
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4238
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5049
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5049/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2839/rebuild

review: Needs Fixing (continuous-integration)
836. By Albert Astals Cid

property rename

837. By Albert Astals Cid

Merge

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:836
http://jenkins.qa.ubuntu.com/job/unity8-ci/2841/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/304
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4919/console
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1705
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1362
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1366
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1366/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1362
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/284
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4503
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4503/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6156
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4250/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5072
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5072/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2841/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:837
http://jenkins.qa.ubuntu.com/job/unity8-ci/2845/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-trusty-touch/308
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4923/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1709
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1366
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1370
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1370/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1366
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/288
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4507
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4507/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/6160
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4253/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5076
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/5076/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2845/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

I wonder... didn't we talk that we could actually get rid of FilterGrid completely and rely on the view's delegate management by simply changing its height?

review: Needs Information
Revision history for this message
Albert Astals Cid (aacid) wrote :

Yeah i remember talking about that and yes, it should be doable, but this is a much minor change (even if the diff seems big it's just changing one thing and the small chain of changes it carries).

If you want I can give it a go at implementing the same behaviour without using the FilterGrid but I doubt it's going to give us much besides killing FilterGrid itself.

Revision history for this message
Michał Sawicz (saviq) wrote :

Right. Yeah, I never expected this to do any more than to kill FilterGrid, but that'd be a good thing in itself :).

Let's get this in, and later we'll look into getting rid of it.

Revision history for this message
Andrea Cimitan (cimi) wrote :

I wanted to get rid of the behaviour but I cannot think of anything smarter than this at the moment :)

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes
 * Did CI run pass? If not, please explain why.
Slow build... passed 60 mins

Revision history for this message
Andrea Cimitan (cimi) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Components/FilterGrid.qml'
2--- qml/Components/FilterGrid.qml 2014-04-08 13:32:59 +0000
3+++ qml/Components/FilterGrid.qml 2014-04-17 08:17:36 +0000
4@@ -28,11 +28,6 @@
5 Item {
6 id: root
7
8- /* If true, the number of elements displayed will be limited by collapsedRowCount.
9- If false, all elements will be displayed, effectively looking the same as a regular
10- ResponsiveGridView. */
11- property bool filter: true
12-
13 /* Whether, when collapsed, a button should be displayed enabling the user to expand
14 the grid to its full size. */
15 readonly property bool expandable: model.count > rowsWhenCollapsed * iconTileGrid.columns
16@@ -65,30 +60,48 @@
17 readonly property alias pressDelay: iconTileGrid.pressDelay
18 property alias highlightIndex: iconTileGrid.highlightIndex
19 readonly property alias currentItem: iconTileGrid.currentItem
20-
21- height: !filterAnimation.running ? childrenRect.height : height
22+ readonly property alias filtered: d.filter
23+
24+ QtObject {
25+ id: d
26+ // We do have filter and collapsed properties because we need to decouple
27+ // the real filtering with the animation since the closing animation
28+ // i.e. setFilter(false. true) we still need to not be filtering until
29+ // the animation finishes otherwise we hide the items when the animation
30+ // is still running
31+ property bool filter: true
32+ property bool collapsed: true
33+ }
34+
35+ height: d.collapsed ? root.collapsedHeight : root.uncollapsedHeight
36 clip: filterAnimation.running
37
38- NumberAnimation {
39- property bool filterEndValue
40- id: filterAnimation
41- target: root
42- property: "height"
43- to: filterEndValue ? root.collapsedHeight : root.uncollapsedHeight
44- // Duration and easing here match the ListViewWithPageHeader::m_contentYAnimation
45- // otherwise since both animations can run at the same time you'll get
46- // some visual weirdness.
47- duration: 200
48- easing.type: Easing.InOutQuad
49- onStopped: {
50- root.filter = filterEndValue;
51+ Behavior on height {
52+ id: heightBehaviour
53+ enabled: false
54+ NumberAnimation {
55+ id: filterAnimation
56+ // Duration and easing here match the ListViewWithPageHeader::m_contentYAnimation
57+ // otherwise since both animations can run at the same time you'll get
58+ // some visual weirdness.
59+ duration: 200
60+ easing.type: Easing.InOutQuad
61+ onRunningChanged: {
62+ if (!running) {
63+ d.filter = d.collapsed;
64+ }
65+ heightBehaviour.enabled = false;
66+ }
67 }
68 }
69
70- function startFilterAnimation(filter) {
71- filterAnimation.filterEndValue = filter
72- filterAnimation.start();
73- }
74+ function setFilter(filter, animate) {
75+ heightBehaviour.enabled = animate;
76+ d.collapsed = filter;
77+ if (!animate || !filter) {
78+ d.filter = filter;
79+ }
80+ }
81
82 ResponsiveGridView {
83 id: iconTileGrid
84@@ -105,7 +118,7 @@
85
86 model: LimitProxyModel {
87 model: root.model
88- limit: (filter && !filterAnimation.running) ? rowsWhenCollapsed * iconTileGrid.columns : -1
89+ limit: d.filter ? rowsWhenCollapsed * iconTileGrid.columns : -1
90 }
91 }
92 }
93
94=== modified file 'qml/Dash/CardFilterGrid.qml'
95--- qml/Dash/CardFilterGrid.qml 2014-04-16 08:29:28 +0000
96+++ qml/Dash/CardFilterGrid.qml 2014-04-17 08:17:36 +0000
97@@ -28,9 +28,10 @@
98 verticalSpacing: units.gu(1)
99 currentItem: filterGrid.currentItem
100 height: filterGrid.height
101+ filtered: filterGrid.filtered
102
103- function startFilterAnimation(filter) {
104- filterGrid.startFilterAnimation(filter)
105+ function setFilter(filter, animate) {
106+ filterGrid.setFilter(filter, animate)
107 }
108
109 FilterGrid {
110@@ -41,7 +42,6 @@
111 delegateHeight: cardTool.cardHeight
112 verticalSpacing: genericFilterGrid.verticalSpacing
113 model: genericFilterGrid.model
114- filter: genericFilterGrid.filter
115 collapsedRowCount: Math.min(2, cardTool && cardTool.template && cardTool.template["collapsed-rows"] || 2)
116 delegateCreationBegin: genericFilterGrid.delegateCreationBegin
117 delegateCreationEnd: genericFilterGrid.delegateCreationEnd
118@@ -66,10 +66,5 @@
119 onPressAndHold: genericFilterGrid.pressAndHold(index, card.y)
120 }
121 }
122-
123- onFilterChanged: {
124- genericFilterGrid.filter = filter
125- filter = Qt.binding(function() { return genericFilterGrid.filter })
126- }
127 }
128 }
129
130=== modified file 'qml/Dash/DashRenderer.qml'
131--- qml/Dash/DashRenderer.qml 2014-04-08 13:32:59 +0000
132+++ qml/Dash/DashRenderer.qml 2014-04-17 08:17:36 +0000
133@@ -20,8 +20,8 @@
134 // Can the item be expanded?
135 property bool expandable: false
136
137- // In case it can be expanded, should we filter it
138- property bool filter: true
139+ // In case it can be expanded, is it filtered
140+ property bool filtered: true
141
142 property int collapsedHeight: height
143
144@@ -58,6 +58,6 @@
145 /// @param itemY is y of the held delegate
146 signal pressAndHold(int index, real itemY)
147
148- function startFilterAnimation(filter) {
149+ function setFilter(filter, animate) {
150 }
151 }
152
153=== modified file 'qml/Dash/GenericScopeView.qml'
154--- qml/Dash/GenericScopeView.qml 2014-04-16 13:44:46 +0000
155+++ qml/Dash/GenericScopeView.qml 2014-04-17 08:17:36 +0000
156@@ -122,7 +122,7 @@
157 showDivider: false
158
159 readonly property bool expandable: rendererLoader.item ? rendererLoader.item.expandable : false
160- readonly property bool filtered: rendererLoader.item ? rendererLoader.item.filter : true
161+ readonly property bool filtered: rendererLoader.item ? rendererLoader.item.filtered : true
162 readonly property string category: categoryId
163 readonly property var item: rendererLoader.item
164
165@@ -168,9 +168,7 @@
166 item.objectName = Qt.binding(function() { return categoryId })
167 if (item.expandable) {
168 var shouldFilter = categoryId != categoryView.expandedCategoryId;
169- if (shouldFilter != item.filter) {
170- item.filter = shouldFilter;
171- }
172+ item.setFilter(shouldFilter, false /*animate*/);
173 }
174 updateDelegateCreationRange();
175 item.cardTool = cardTool;
176@@ -219,11 +217,8 @@
177 var shrinkingVisible = shouldFilter && y + item.collapsedHeight < categoryView.height;
178 var growingVisible = !shouldFilter && y + height < categoryView.height;
179 if (!previewListView.open || !shouldFilter) {
180- if (shrinkingVisible || growingVisible) {
181- item.startFilterAnimation(shouldFilter)
182- } else {
183- item.filter = shouldFilter;
184- }
185+ var animate = shrinkingVisible || growingVisible;
186+ item.setFilter(shouldFilter, animate)
187 if (!shouldFilter && !previewListView.open) {
188 categoryView.maximizeVisibleArea(index, item.uncollapsedHeight);
189 }
190
191=== modified file 'tests/autopilot/unity8/shell/tests/test_emulators.py'
192--- tests/autopilot/unity8/shell/tests/test_emulators.py 2014-04-16 13:44:46 +0000
193+++ tests/autopilot/unity8/shell/tests/test_emulators.py 2014-04-17 08:17:36 +0000
194@@ -196,7 +196,7 @@
195 category)
196 grid = category_element.select_single('CardFilterGrid')
197 filtergrid = grid.select_single('FilterGrid')
198- if (grid.filter):
199+ if (grid.filtered):
200 return filtergrid.collapsedRowCount * filtergrid.columns
201 else:
202 return filtergrid.uncollapsedRowCount * filtergrid.columns
203
204=== modified file 'tests/qmltests/Components/tst_FilterGrid.qml'
205--- tests/qmltests/Components/tst_FilterGrid.qml 2014-01-29 13:37:23 +0000
206+++ tests/qmltests/Components/tst_FilterGrid.qml 2014-04-17 08:17:36 +0000
207@@ -50,6 +50,7 @@
208 CheckBox {
209 id: filterCheckBox
210 checked: true
211+ onCheckedChanged: filterGrid.setFilter(checked, false /*animate*/)
212 }
213 }
214 }
215@@ -99,7 +100,6 @@
216 maximumNumberOfColumns: 3
217 collapsedRowCount:
218 collapsedRowCountSelector.values[collapsedRowCountSelector.selectedIndex]
219- filter: filterCheckBox.checked
220 minimumHorizontalSpacing: units.gu(1)
221 delegateWidth: units.gu(6)
222 delegateHeight: units.gu(6)
223
224=== modified file 'tests/qmltests/Dash/tst_GenericScopeView.qml'
225--- tests/qmltests/Dash/tst_GenericScopeView.qml 2014-04-14 15:49:20 +0000
226+++ tests/qmltests/Dash/tst_GenericScopeView.qml 2014-04-17 08:17:36 +0000
227@@ -140,7 +140,7 @@
228 mouseClick(header, header.width / 2, header.height / 2);
229 tryCompareFunction(function() { middleHeight = category.height; return category.height > initialHeight; }, true);
230 tryCompare(category, "filtered", false);
231- verify(category.height > middleHeight);
232+ tryCompareFunction(function() { return category.height > middleHeight; }, true);
233
234 mouseClick(header, header.width / 2, header.height / 2);
235 verify(category.expandable);
236@@ -165,7 +165,7 @@
237
238 mouseClick(header2, header2.width / 2, header2.height / 2);
239 tryCompare(category2, "filtered", false);
240- tryCompare(category2FilterGrid, "filter", false);
241+ tryCompare(category2FilterGrid, "filtered", false);
242
243 categoryListView.positionAtBeginning();
244
245@@ -182,7 +182,7 @@
246 mouseClick(header0, header0.width / 2, header0.height / 2);
247 tryCompare(category0, "filtered", false);
248 tryCompare(category2, "filtered", true);
249- tryCompare(category2FilterGrid, "filter", true);
250+ tryCompare(category2FilterGrid, "filtered", true);
251 mouseClick(header0, header0.width / 2, header0.height / 2);
252 tryCompare(category0, "filtered", true);
253 tryCompare(category2, "filtered", true);

Subscribers

People subscribed via source and target branches