Merge lp:~nick-dedekind/unity8/lp1264678-indicator.misalignment into lp:unity8

Proposed by Nick Dedekind
Status: Merged
Approved by: MichaƂ Sawicz
Approved revision: 624
Merged at revision: 640
Proposed branch: lp:~nick-dedekind/unity8/lp1264678-indicator.misalignment
Merge into: lp:unity8
Diff against target: 517 lines (+183/-100)
10 files modified
qml/Panel/IndicatorRow.qml (+51/-29)
qml/Panel/Indicators.qml (+46/-34)
qml/Panel/MenuContent.qml (+2/-2)
tests/mocks/Unity/Indicators/IndicatorsModel.qml (+2/-5)
tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml (+1/-3)
tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml (+1/-1)
tests/qmltests/Panel/tst_IndicatorRow.qml (+2/-1)
tests/qmltests/Panel/tst_Indicators.qml (+62/-11)
tests/qmltests/Panel/tst_MenuContent.qml (+2/-2)
tests/qmltests/Panel/tst_Panel.qml (+14/-12)
To merge this branch: bzr merge lp:~nick-dedekind/unity8/lp1264678-indicator.misalignment
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Albert Astals Cid (community) Approve
Review via email: mp+200866@code.launchpad.net

Commit message

Fixes visible indicator misalignment in indicator items/menus (lp#1264678)

Description of the change

Fixes visible indicator misalignment in indicator items/menus (lp#1264678)

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

PASSED: Continuous integration, rev:619
http://jenkins.qa.ubuntu.com/job/unity8-ci/2014/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2125
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2023
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/845
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/536
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/538
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/538/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/536
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/1858
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2127
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2127/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2023
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2023/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4493
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/2865

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

review: Approve (continuous-integration)
Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

Most of this is to resolve some binding loops.

Fix is:
116 + onDataChanged: tabs.selectedTabIndexChanged();
117 + onRowsInserted: tabs.selectedTabIndexChanged();
118 + onRowsRemoved: tabs.selectedTabIndexChanged();

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

As discussed in IRC Nick is

<dednick> but i think IndicatorRow should probably be doing the updating and notifying the MenuContent.
<dednick> investigating it :) i'll try work on a unit test as well

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

Putting a "Needs Fixing" just to mark this is waiting some work from Nick

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

FAILED: Continuous integration, rev:622
http://jenkins.qa.ubuntu.com/job/unity8-ci/2057/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2304
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2185
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/904
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/579
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/581
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/581/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/579
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2023
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2306
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2306/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2185
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2185/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4643
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3052

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

If i unlock and then press with the mouse over the Messaging icon and don't move at all i get http://imgur.com/FwNQDlU

Can you reproduce? Is this something we can fix?

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

I actually meant "Is this something we can test?" instead of "Is this something we can fix?" :D

Revision history for this message
Nick Dedekind (nick-dedekind) wrote :

> If i unlock and then press with the mouse over the Messaging icon and don't
> move at all i get http://imgur.com/FwNQDlU
>
> Can you reproduce? Is this something we can fix?

This is a bug in the SDK
https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1268922

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

FAILED: Continuous integration, rev:622
http://jenkins.qa.ubuntu.com/job/unity8-ci/2066/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2354
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2227
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/916/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/588
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/590
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/590/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/588
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2066
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2356
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2356/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2227
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2227/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4684
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3110

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Needs remerging
Text conflict in tests/qmltests/Panel/tst_Indicators.qml

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

FAILED: Continuous integration, rev:624
http://jenkins.qa.ubuntu.com/job/unity8-ci/2068/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2356
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2229
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/918
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/590
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/592
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/592/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/590
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2068
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2358
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2358/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2229
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2229/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4686
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3112

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good to me

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

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/938/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3882
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2359
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2232
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/919
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/324
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/324
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/324/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/324
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2071
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2361
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2361/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2232
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2232/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4689
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3115

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

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/939/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3885
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2364
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2237
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/921
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/325
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/325
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/325/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/325
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2076
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2366
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2366/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2237
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2237/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4693
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3119

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

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/940/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3886
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2368
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2241
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/924
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/326
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/326
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/326/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/326
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2079
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2370
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2370/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2241
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2241/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4697
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3123

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

FAILED: Autolanding.
More details in the following jenkins job:
http://jenkins.qa.ubuntu.com/job/unity8-autolanding/941/
Executed test runs:
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/generic-cleanup-mbs/3888
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/2372
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/2245
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/928
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-autolanding/327
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/327
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-autolanding/327/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-autolanding/327
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/2082
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2374
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/2374/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2245
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/2245/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/4700
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/3127

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Panel/IndicatorRow.qml'
2--- qml/Panel/IndicatorRow.qml 2014-01-10 13:48:13 +0000
3+++ qml/Panel/IndicatorRow.qml 2014-01-15 11:27:34 +0000
4@@ -26,7 +26,7 @@
5 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
6 property alias row: row
7 property QtObject indicatorsModel: null
8- property var visibleIndicators: defined
9+ property var visibleIndicators: undefined
10 property int overFlowWidth: width
11 property bool showAll: false
12 property real currentItemOffset: 0.0
13@@ -94,34 +94,56 @@
14 property real opacityMultiplier: highlighted ? 1 : (1 - indicatorRow.unitProgress)
15
16 IndicatorItem {
17- id: indicatorItem
18- identifier: model.identifier
19- height: parent.height
20-
21- dimmed: itemWrapper.dimmed
22-
23- widgetSource: model.widgetSource
24- indicatorProperties : model.indicatorProperties
25-
26- Component.onCompleted: {
27- if (visibleIndicators == undefined) {
28- visibleIndicators = {}
29- }
30- indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
31- indicatorRow.visibleIndicatorsChanged();
32- }
33- onIndicatorVisibleChanged: {
34- if (visibleIndicators == undefined) {
35- visibleIndicators = {}
36- }
37- indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
38- indicatorRow.visibleIndicatorsChanged();
39-
40- if (indicatorVisible) {
41- showAll = true;
42- allVisible.start();
43- }
44- }
45+ id: indicatorItem
46+ identifier: model.identifier
47+ height: parent.height
48+
49+ dimmed: itemWrapper.dimmed
50+
51+ widgetSource: model.widgetSource
52+ indicatorProperties : model.indicatorProperties
53+
54+ Component.onCompleted: {
55+ updateVisiblility();
56+ }
57+ onIndicatorVisibleChanged: {
58+ updateVisiblility();
59+
60+ if (indicatorVisible) {
61+ showAll = true;
62+ allVisible.start();
63+ }
64+ }
65+
66+ function updateVisiblility() {
67+ if (visibleIndicators == undefined) {
68+ visibleIndicators = {}
69+ }
70+ indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
71+
72+ // removed current index?
73+ if (indicatorRow.currentItemIndex === index && !indicatorVisible) {
74+ // find the next closest visible indicator (after current, else before)
75+ var newIndex = -1;
76+ for (var i = index+1; i < rowRepeater.count; i++) {
77+ if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
78+ newIndex = i;
79+ break;
80+ }
81+ }
82+ if (newIndex === -1) {
83+ for (i = index - 1; i >= 0; i--) {
84+ if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
85+ newIndex = i;
86+ break;
87+ }
88+ }
89+ }
90+ indicatorRow.setCurrentItem(newIndex);
91+ }
92+
93+ indicatorRow.visibleIndicatorsChanged();
94+ }
95 }
96
97 states: [
98
99=== modified file 'qml/Panel/Indicators.qml'
100--- qml/Panel/Indicators.qml 2014-01-06 10:26:03 +0000
101+++ qml/Panel/Indicators.qml 2014-01-15 11:27:34 +0000
102@@ -193,21 +193,6 @@
103 clip: !indicators.fullyOpened
104 activeHeader: indicators.state == "hint" || indicators.state == "reveal"
105 enabled: contentEnabled
106- visibleIndicators: indicatorRow.visibleIndicators
107-
108- Connections {
109- property bool enableIndexChangeSignal: true
110-
111- target: enableIndexChangeSignal ? indicatorRow : null
112- onCurrentItemIndexChanged: {
113- var oldActive = enableIndexChangeSignal;
114- enableIndexChangeSignal = false;
115-
116- menuContent.setCurrentMenuIndex(indicatorRow.currentItemIndex);
117-
118- enableIndexChangeSignal = oldActive;
119- }
120- }
121
122 //small shadow gradient at bottom of menu
123 Rectangle {
124@@ -263,8 +248,6 @@
125
126 Indicators.IndicatorsModel {
127 id: indicatorsModel
128-
129- Component.onCompleted: load()
130 }
131
132 IndicatorRow {
133@@ -279,17 +262,11 @@
134 state: indicators.state
135 unitProgress: indicators.unitProgress
136
137- Connections {
138- property bool enableIndexChangeSignal: true
139-
140- target: enableIndexChangeSignal ? menuContent : null
141- onCurrentMenuIndexChanged: {
142- var oldActive = enableIndexChangeSignal;
143- enableIndexChangeSignal = false;
144-
145- indicatorRow.setCurrentItem(menuContent.currentMenuIndex);
146-
147- enableIndexChangeSignal = oldActive;
148+ onVisibleIndicatorsChanged: {
149+ // need to do it here so we can control sequence
150+ if (visibleIndicators !== undefined) {
151+ menuContent.visibleIndicators = visibleIndicators;
152+ menuContent.setCurrentMenuIndex(currentItemIndex);
153 }
154 }
155
156@@ -341,15 +318,45 @@
157 }
158 }
159
160- property var activeDragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle.dragging ? hideDragHandle : null
161+ QtObject {
162+ id: d
163+ property bool enableIndexChangeSignal: true
164+ property var activeDragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle.dragging ? hideDragHandle : null
165+ }
166+
167+ Connections {
168+ target: menuContent
169+ onCurrentMenuIndexChanged: {
170+ var oldActive = d.enableIndexChangeSignal;
171+ if (!oldActive) return;
172+ d.enableIndexChangeSignal = false;
173+
174+ indicatorRow.setCurrentItem(menuContent.currentMenuIndex);
175+
176+ d.enableIndexChangeSignal = oldActive;
177+ }
178+ }
179+
180+ Connections {
181+ target: indicatorRow
182+ onCurrentItemIndexChanged: {
183+ var oldActive = d.enableIndexChangeSignal;
184+ if (!oldActive) return;
185+ d.enableIndexChangeSignal = false;
186+
187+ menuContent.setCurrentMenuIndex(indicatorRow.currentItemIndex);
188+
189+ d.enableIndexChangeSignal = oldActive;
190+ }
191+ }
192 // connections to the active drag handle
193 Connections {
194- target: activeDragHandle
195+ target: d.activeDragHandle
196 onTouchXChanged: {
197- indicators.calculateCurrentItem(activeDragHandle.touchX, true);
198+ indicators.calculateCurrentItem(d.activeDragHandle.touchX, true);
199 }
200 onTouchSceneYChanged: {
201- yVelocityCalculator.trackedPosition = activeDragHandle.touchSceneY;
202+ yVelocityCalculator.trackedPosition = d.activeDragHandle.touchSceneY;
203 }
204 }
205
206@@ -403,8 +410,8 @@
207 }
208 StateChangeScript {
209 script: {
210- if (activeDragHandle) {
211- calculateCurrentItem(activeDragHandle.touchX, false);
212+ if (d.activeDragHandle) {
213+ calculateCurrentItem(d.activeDragHandle.touchX, false);
214 }
215 }
216 }
217@@ -429,4 +436,9 @@
218 NumberAnimation {targets: [indicatorRow, menuContent]; property: "y"; duration: 300; easing.type: Easing.OutCubic}
219 }
220 ]
221+
222+ Component.onCompleted: initialise();
223+ function initialise() {
224+ indicatorsModel.load();
225+ }
226 }
227
228=== modified file 'qml/Panel/MenuContent.qml'
229--- qml/Panel/MenuContent.qml 2014-01-06 10:26:03 +0000
230+++ qml/Panel/MenuContent.qml 2014-01-15 11:27:34 +0000
231@@ -39,10 +39,10 @@
232 height: units.gu(42)
233
234 function setCurrentMenuIndex(index) {
235- var filteredIndex = filteredIndicators.mapFromSource(index)
236+ var filteredIndex = filteredIndicators.mapFromSource(index);
237
238 if (tabs.selectedTabIndex !== filteredIndex) {
239- if (tabs.selectedTabIndex == -1 || !animateNextMenuChange) {
240+ if (tabs.selectedTabIndex === -1 || !animateNextMenuChange) {
241 tabs.tabBar.animate = false;
242 }
243 tabs.selectedTabIndex = filteredIndex;
244
245=== modified file 'tests/mocks/Unity/Indicators/IndicatorsModel.qml'
246--- tests/mocks/Unity/Indicators/IndicatorsModel.qml 2013-09-17 12:31:19 +0000
247+++ tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-01-15 11:27:34 +0000
248@@ -21,12 +21,9 @@
249
250 property var indicatorData : undefined
251
252- function load() {}
253+ function load() {
254+ clear();
255
256- // Need to do this dynamically.
257- // Apparently ListModels dont order roles visually when using ListElement
258- // which throws off the filter for non-visible indicators.
259- Component.onCompleted: {
260 append({ "identifier": "indicator-fake1",
261 "position": 0,
262 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget1.qml",
263
264=== modified file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml'
265--- tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 2013-08-22 18:37:09 +0000
266+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 2014-01-15 11:27:34 +0000
267@@ -19,7 +19,5 @@
268 Rectangle {
269 width: 40
270 height: 40
271- color : "yellow"
272-
273- enabled: false
274+ color : "blue"
275 }
276
277=== modified file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml'
278--- tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 2013-06-17 09:02:14 +0000
279+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 2014-01-15 11:27:34 +0000
280@@ -19,5 +19,5 @@
281 Rectangle {
282 width: 40
283 height: 40
284- color : "blue"
285+ color : "yellow"
286 }
287
288=== modified file 'tests/qmltests/Panel/tst_IndicatorRow.qml'
289--- tests/qmltests/Panel/tst_IndicatorRow.qml 2014-01-07 14:29:23 +0000
290+++ tests/qmltests/Panel/tst_IndicatorRow.qml 2014-01-15 11:27:34 +0000
291@@ -32,6 +32,8 @@
292
293 function init_test()
294 {
295+ indicatorModel.load();
296+
297 indicatorRow.state = "initial";
298 indicatorRow.currentItem = null;
299 indicatorRow.unitProgress = 0.0;
300@@ -53,7 +55,6 @@
301
302 Indicators.IndicatorsModel {
303 id: indicatorModel
304- Component.onCompleted: load()
305 }
306
307 UT.UnityTestCase {
308
309=== modified file 'tests/qmltests/Panel/tst_Indicators.qml'
310--- tests/qmltests/Panel/tst_Indicators.qml 2014-01-15 08:36:33 +0000
311+++ tests/qmltests/Panel/tst_Indicators.qml 2014-01-15 11:27:34 +0000
312@@ -83,6 +83,8 @@
313 when: windowShown
314
315 function init() {
316+ indicators.initialise();
317+
318 indicators.hide();
319 tryCompare(indicators.hideAnimation, "running", false);
320 tryCompare(indicators, "state", "initial");
321@@ -161,21 +163,70 @@
322 compare(indicators.fullyOpened, true);
323 }
324
325+ function init_invisible_indicator(identifier) {
326+ tryCompareFunction(function() { return findChild(indicators, identifier+"-widget") !== null }, true);
327+ var item = findChild(indicators, identifier+"-widget");
328+
329+ item.enabled = false;
330+ }
331+
332 function test_row_visible_menuContent_visible_data() { return [
333- {tag: "visible", index: 0, name: "indicator-fake1", visible: true },
334- {tag: "invisible", index: 1, name: "indicator-fake2", visible: false }]
335+ {tag: "first", visible: [false, true, true, true, true] },
336+ {tag: "adjacent", visible: [true, false, false, true, true] },
337+ {tag: "bounds", visible: [false, true, true, true, false] },
338+ {tag: "disjoint", visible: [true, false, true, false, true] },
339+ {tag: "last", visible: [true, true, true, true, false] }];
340 }
341
342 function test_row_visible_menuContent_visible(data) {
343- var indicatorTabs = findChild(indicators, "tabs");
344- var rowRepeater = findChild(indicators, "rowRepeater");
345-
346- var indicatorItem = rowRepeater.itemAt(data.index);
347- tryCompareFunction(function() { return indicatorItem.width > 0}, true);
348- tryCompare(indicatorItem, "visible", data.visible);
349-
350- var indicatorTab = findChild(indicatorTabs, data.name)
351- tryCompareFunction(function() { return indicatorTab !== null }, data.visible);
352+
353+ indicators.show();
354+
355+ var indicatorTabs = findChild(indicators, "tabs");
356+ var rowRepeater = findChild(indicators, "rowRepeater")
357+
358+
359+ for (var i = 0; i< data.visible.length; i++) {
360+ if (data.visible[i] === false)
361+ init_invisible_indicator("indicator-fake" + (i + 1));
362+ }
363+
364+ for (i = 0; i < data.visible.length; i++) {
365+ var shouldBeVisible = data.visible[i];
366+
367+ // check item visibility
368+ var indicatorItem = rowRepeater.itemAt(i);
369+ tryCompare(indicatorItem, "visible", shouldBeVisible);
370+ // check tab visibility
371+ tryCompareFunction(function() { return findChild(indicatorTabs, "indicator-fake" + (i + 1)) !== null }, shouldBeVisible);
372+ }
373+ }
374+
375+ function test_indicator_visible_correct_tabs_data() { return [
376+ {tag: "current-first", currentIndex: 0, visible: [false, true, true, true, true], expected: 1 },
377+ {tag: "current-last", currentIndex: 4, visible: [true, true, true, true, false], expected: 3 },
378+ {tag: "after", currentIndex: 0, visible: [true, false, true, true, true], expected: 0 },
379+ {tag: "before", currentIndex: 1, visible: [false, true, true, true, true], expected: 1 }];
380+ }
381+
382+ function test_indicator_visible_correct_tabs(data) {
383+
384+ var indicatorTabs = findChild(indicators, "tabs");
385+ var indicatorRow = findChild(indicators, "indicatorRow");
386+
387+ indicators.show();
388+ indicatorRow.setCurrentItem(data.currentIndex);
389+ tryCompare(indicators, "fullyOpened", true);
390+
391+ for (var i = 0; i< data.visible.length; i++) {
392+ if (data.visible[i] === false)
393+ init_invisible_indicator("indicator-fake" + (i + 1));
394+ }
395+
396+ // check for current selected item
397+ tryCompare(indicatorRow, "currentItemIndex", data.expected);
398+ // check for current selected tab
399+ tryCompareFunction(function() { return findChild(indicatorTabs, "indicator-fake" + (data.expected + 1)) === indicatorTabs.selectedTab }, true);
400 }
401 }
402 }
403
404=== modified file 'tests/qmltests/Panel/tst_MenuContent.qml'
405--- tests/qmltests/Panel/tst_MenuContent.qml 2013-12-17 16:04:47 +0000
406+++ tests/qmltests/Panel/tst_MenuContent.qml 2014-01-15 11:27:34 +0000
407@@ -103,13 +103,13 @@
408
409 function selected_tab_equals_test_tab() {
410 var currentTab = menu_content_test.findChild(menuContent, "tabs").selectedTab
411- if (currentTab == undefined) {
412+ if (currentTab === null) {
413 console.log("selected tab undefined");
414 return false;
415 }
416
417 var testTab = menu_content_test.findChild(menuContent, testTabObjectName);
418- if (testTab == undefined) {
419+ if (testTab === null) {
420 console.log("test_tab " + testTabObjectName + " undefined");
421 return false;
422 }
423
424=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
425--- tests/qmltests/Panel/tst_Panel.qml 2013-12-17 16:04:47 +0000
426+++ tests/qmltests/Panel/tst_Panel.qml 2014-01-15 11:27:34 +0000
427@@ -56,6 +56,8 @@
428 }
429
430 function init() {
431+ panel.indicators.initialise();
432+
433 searchClicked = false;
434 panel.indicators.hide();
435 tryCompare(panel.indicators.hideAnimation, "running", false);
436@@ -64,16 +66,16 @@
437
438 function get_indicator_item(index) {
439 var rowRepeater = findChild(panel.indicators, "rowRepeater");
440- verify(rowRepeater != undefined);
441+ verify(rowRepeater !== null);
442 return rowRepeater.itemAt(index);
443 }
444
445 function get_indicator_item_position(index) {
446 var indicatorRow = findChild(panel.indicators, "indicatorRow");
447- verify(indicatorRow != undefined);
448+ verify(indicatorRow !== null);
449
450 var indicatorItem = get_indicator_item(index);
451- verify(indicatorItem != undefined);
452+ verify(indicatorItem !== null);
453
454 return panel.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
455 }
456@@ -118,7 +120,7 @@
457 // no hint animation when fullscreen
458 compare(panel.indicators.y, -panel.panelHeight);
459 var indicatorRow = findChild(panel.indicators, "indicatorRow");
460- verify(indicatorRow != undefined);
461+ verify(indicatorRow !== null);
462 compare(indicatorRow.y, 0);
463 compare(panel.indicators.height, panel.indicators.panelHeight);
464 compare(panel.indicators.partiallyOpened, false,
465@@ -143,13 +145,13 @@
466 }
467
468 var indicatorRow = findChild(panel.indicators, "indicatorRow");
469- verify(indicatorRow != undefined);
470+ verify(indicatorRow !== null);
471
472 var rowRepeater = findChild(panel.indicators, "rowRepeater");
473- verify(indicatorRow != undefined);
474+ verify(indicatorRow !== null);
475
476 var menuContent = findChild(panel.indicators, "menuContent");
477- verify(indicatorRow != undefined);
478+ verify(indicatorRow !== null);
479
480 // Wait for the indicators to get into position.
481 // (switches between normal and fullscreen modes are animated)
482@@ -203,7 +205,7 @@
483 panel.searchVisible = true;
484
485 var searchIndicator = findChild(panel, "search");
486- verify(searchIndicator != undefined);
487+ verify(searchIndicator !== null);
488
489 tap(searchIndicator, 1, 1);
490
491@@ -216,7 +218,7 @@
492 panel.searchVisible = false;
493
494 var searchIndicator = findChild(panel, "search");
495- verify(searchIndicator != undefined);
496+ verify(searchIndicator !== null);
497
498 tap(searchIndicator, 1, 1);
499
500@@ -232,14 +234,14 @@
501 panel.searchVisible = false;
502
503 var indicatorRow = findChild(panel.indicators, "indicatorRow");
504- verify(indicatorRow != undefined);
505+ verify(indicatorRow !== null);
506
507 var rowRepeater = findChild(panel.indicators, "rowRepeater");
508- verify(indicatorRow != undefined);
509+ verify(indicatorRow !== null);
510
511 // Get the first indicator
512 var indicatorItemFirst = get_indicator_item(0);
513- verify(indicatorItemFirst != undefined);
514+ verify(indicatorItemFirst !== undefined);
515
516 var indicatorItemCoordFirst = get_indicator_item_position(0);
517 var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.count - 1);

Subscribers

People subscribed via source and target branches