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
=== modified file 'qml/Panel/IndicatorRow.qml'
--- qml/Panel/IndicatorRow.qml 2014-01-10 13:48:13 +0000
+++ qml/Panel/IndicatorRow.qml 2014-01-15 11:27:34 +0000
@@ -26,7 +26,7 @@
26 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -126 readonly property int currentItemIndex: currentItem ? currentItem.ownIndex : -1
27 property alias row: row27 property alias row: row
28 property QtObject indicatorsModel: null28 property QtObject indicatorsModel: null
29 property var visibleIndicators: defined29 property var visibleIndicators: undefined
30 property int overFlowWidth: width30 property int overFlowWidth: width
31 property bool showAll: false31 property bool showAll: false
32 property real currentItemOffset: 0.032 property real currentItemOffset: 0.0
@@ -94,34 +94,56 @@
94 property real opacityMultiplier: highlighted ? 1 : (1 - indicatorRow.unitProgress)94 property real opacityMultiplier: highlighted ? 1 : (1 - indicatorRow.unitProgress)
9595
96 IndicatorItem {96 IndicatorItem {
97 id: indicatorItem97 id: indicatorItem
98 identifier: model.identifier98 identifier: model.identifier
99 height: parent.height99 height: parent.height
100100
101 dimmed: itemWrapper.dimmed101 dimmed: itemWrapper.dimmed
102102
103 widgetSource: model.widgetSource103 widgetSource: model.widgetSource
104 indicatorProperties : model.indicatorProperties104 indicatorProperties : model.indicatorProperties
105105
106 Component.onCompleted: {106 Component.onCompleted: {
107 if (visibleIndicators == undefined) {107 updateVisiblility();
108 visibleIndicators = {}108 }
109 }109 onIndicatorVisibleChanged: {
110 indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;110 updateVisiblility();
111 indicatorRow.visibleIndicatorsChanged();111
112 }112 if (indicatorVisible) {
113 onIndicatorVisibleChanged: {113 showAll = true;
114 if (visibleIndicators == undefined) {114 allVisible.start();
115 visibleIndicators = {}115 }
116 }116 }
117 indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;117
118 indicatorRow.visibleIndicatorsChanged();118 function updateVisiblility() {
119119 if (visibleIndicators == undefined) {
120 if (indicatorVisible) {120 visibleIndicators = {}
121 showAll = true;121 }
122 allVisible.start();122 indicatorRow.visibleIndicators[model.identifier] = indicatorVisible;
123 }123
124 }124 // removed current index?
125 if (indicatorRow.currentItemIndex === index && !indicatorVisible) {
126 // find the next closest visible indicator (after current, else before)
127 var newIndex = -1;
128 for (var i = index+1; i < rowRepeater.count; i++) {
129 if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
130 newIndex = i;
131 break;
132 }
133 }
134 if (newIndex === -1) {
135 for (i = index - 1; i >= 0; i--) {
136 if (indicatorRow.visibleIndicators[i] === undefined || indicatorRow.visibleIndicators[model.identifier]) {
137 newIndex = i;
138 break;
139 }
140 }
141 }
142 indicatorRow.setCurrentItem(newIndex);
143 }
144
145 indicatorRow.visibleIndicatorsChanged();
146 }
125 }147 }
126148
127 states: [149 states: [
128150
=== modified file 'qml/Panel/Indicators.qml'
--- qml/Panel/Indicators.qml 2014-01-06 10:26:03 +0000
+++ qml/Panel/Indicators.qml 2014-01-15 11:27:34 +0000
@@ -193,21 +193,6 @@
193 clip: !indicators.fullyOpened193 clip: !indicators.fullyOpened
194 activeHeader: indicators.state == "hint" || indicators.state == "reveal"194 activeHeader: indicators.state == "hint" || indicators.state == "reveal"
195 enabled: contentEnabled195 enabled: contentEnabled
196 visibleIndicators: indicatorRow.visibleIndicators
197
198 Connections {
199 property bool enableIndexChangeSignal: true
200
201 target: enableIndexChangeSignal ? indicatorRow : null
202 onCurrentItemIndexChanged: {
203 var oldActive = enableIndexChangeSignal;
204 enableIndexChangeSignal = false;
205
206 menuContent.setCurrentMenuIndex(indicatorRow.currentItemIndex);
207
208 enableIndexChangeSignal = oldActive;
209 }
210 }
211196
212 //small shadow gradient at bottom of menu197 //small shadow gradient at bottom of menu
213 Rectangle {198 Rectangle {
@@ -263,8 +248,6 @@
263248
264 Indicators.IndicatorsModel {249 Indicators.IndicatorsModel {
265 id: indicatorsModel250 id: indicatorsModel
266
267 Component.onCompleted: load()
268 }251 }
269252
270 IndicatorRow {253 IndicatorRow {
@@ -279,17 +262,11 @@
279 state: indicators.state262 state: indicators.state
280 unitProgress: indicators.unitProgress263 unitProgress: indicators.unitProgress
281264
282 Connections {265 onVisibleIndicatorsChanged: {
283 property bool enableIndexChangeSignal: true266 // need to do it here so we can control sequence
284267 if (visibleIndicators !== undefined) {
285 target: enableIndexChangeSignal ? menuContent : null268 menuContent.visibleIndicators = visibleIndicators;
286 onCurrentMenuIndexChanged: {269 menuContent.setCurrentMenuIndex(currentItemIndex);
287 var oldActive = enableIndexChangeSignal;
288 enableIndexChangeSignal = false;
289
290 indicatorRow.setCurrentItem(menuContent.currentMenuIndex);
291
292 enableIndexChangeSignal = oldActive;
293 }270 }
294 }271 }
295272
@@ -341,15 +318,45 @@
341 }318 }
342 }319 }
343320
344 property var activeDragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle.dragging ? hideDragHandle : null321 QtObject {
322 id: d
323 property bool enableIndexChangeSignal: true
324 property var activeDragHandle: showDragHandle.dragging ? showDragHandle : hideDragHandle.dragging ? hideDragHandle : null
325 }
326
327 Connections {
328 target: menuContent
329 onCurrentMenuIndexChanged: {
330 var oldActive = d.enableIndexChangeSignal;
331 if (!oldActive) return;
332 d.enableIndexChangeSignal = false;
333
334 indicatorRow.setCurrentItem(menuContent.currentMenuIndex);
335
336 d.enableIndexChangeSignal = oldActive;
337 }
338 }
339
340 Connections {
341 target: indicatorRow
342 onCurrentItemIndexChanged: {
343 var oldActive = d.enableIndexChangeSignal;
344 if (!oldActive) return;
345 d.enableIndexChangeSignal = false;
346
347 menuContent.setCurrentMenuIndex(indicatorRow.currentItemIndex);
348
349 d.enableIndexChangeSignal = oldActive;
350 }
351 }
345 // connections to the active drag handle352 // connections to the active drag handle
346 Connections {353 Connections {
347 target: activeDragHandle354 target: d.activeDragHandle
348 onTouchXChanged: {355 onTouchXChanged: {
349 indicators.calculateCurrentItem(activeDragHandle.touchX, true);356 indicators.calculateCurrentItem(d.activeDragHandle.touchX, true);
350 }357 }
351 onTouchSceneYChanged: {358 onTouchSceneYChanged: {
352 yVelocityCalculator.trackedPosition = activeDragHandle.touchSceneY;359 yVelocityCalculator.trackedPosition = d.activeDragHandle.touchSceneY;
353 }360 }
354 }361 }
355362
@@ -403,8 +410,8 @@
403 }410 }
404 StateChangeScript {411 StateChangeScript {
405 script: {412 script: {
406 if (activeDragHandle) {413 if (d.activeDragHandle) {
407 calculateCurrentItem(activeDragHandle.touchX, false);414 calculateCurrentItem(d.activeDragHandle.touchX, false);
408 }415 }
409 }416 }
410 }417 }
@@ -429,4 +436,9 @@
429 NumberAnimation {targets: [indicatorRow, menuContent]; property: "y"; duration: 300; easing.type: Easing.OutCubic}436 NumberAnimation {targets: [indicatorRow, menuContent]; property: "y"; duration: 300; easing.type: Easing.OutCubic}
430 }437 }
431 ]438 ]
439
440 Component.onCompleted: initialise();
441 function initialise() {
442 indicatorsModel.load();
443 }
432}444}
433445
=== modified file 'qml/Panel/MenuContent.qml'
--- qml/Panel/MenuContent.qml 2014-01-06 10:26:03 +0000
+++ qml/Panel/MenuContent.qml 2014-01-15 11:27:34 +0000
@@ -39,10 +39,10 @@
39 height: units.gu(42)39 height: units.gu(42)
4040
41 function setCurrentMenuIndex(index) {41 function setCurrentMenuIndex(index) {
42 var filteredIndex = filteredIndicators.mapFromSource(index)42 var filteredIndex = filteredIndicators.mapFromSource(index);
4343
44 if (tabs.selectedTabIndex !== filteredIndex) {44 if (tabs.selectedTabIndex !== filteredIndex) {
45 if (tabs.selectedTabIndex == -1 || !animateNextMenuChange) {45 if (tabs.selectedTabIndex === -1 || !animateNextMenuChange) {
46 tabs.tabBar.animate = false;46 tabs.tabBar.animate = false;
47 }47 }
48 tabs.selectedTabIndex = filteredIndex;48 tabs.selectedTabIndex = filteredIndex;
4949
=== modified file 'tests/mocks/Unity/Indicators/IndicatorsModel.qml'
--- tests/mocks/Unity/Indicators/IndicatorsModel.qml 2013-09-17 12:31:19 +0000
+++ tests/mocks/Unity/Indicators/IndicatorsModel.qml 2014-01-15 11:27:34 +0000
@@ -21,12 +21,9 @@
2121
22 property var indicatorData : undefined22 property var indicatorData : undefined
2323
24 function load() {}24 function load() {
25 clear();
2526
26 // Need to do this dynamically.
27 // Apparently ListModels dont order roles visually when using ListElement
28 // which throws off the filter for non-visible indicators.
29 Component.onCompleted: {
30 append({ "identifier": "indicator-fake1",27 append({ "identifier": "indicator-fake1",
31 "position": 0,28 "position": 0,
32 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget1.qml",29 "widgetSource": "qrc:/tests/indciators/qml/fake_menu_widget1.qml",
3330
=== modified file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml'
--- tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 2013-08-22 18:37:09 +0000
+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget2.qml 2014-01-15 11:27:34 +0000
@@ -19,7 +19,5 @@
19Rectangle {19Rectangle {
20 width: 4020 width: 40
21 height: 4021 height: 40
22 color : "yellow"22 color : "blue"
23
24 enabled: false
25}23}
2624
=== modified file 'tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml'
--- tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 2013-06-17 09:02:14 +0000
+++ tests/mocks/Unity/Indicators/qml/fake_menu_widget3.qml 2014-01-15 11:27:34 +0000
@@ -19,5 +19,5 @@
19Rectangle {19Rectangle {
20 width: 4020 width: 40
21 height: 4021 height: 40
22 color : "blue"22 color : "yellow"
23}23}
2424
=== modified file 'tests/qmltests/Panel/tst_IndicatorRow.qml'
--- tests/qmltests/Panel/tst_IndicatorRow.qml 2014-01-07 14:29:23 +0000
+++ tests/qmltests/Panel/tst_IndicatorRow.qml 2014-01-15 11:27:34 +0000
@@ -32,6 +32,8 @@
3232
33 function init_test()33 function init_test()
34 {34 {
35 indicatorModel.load();
36
35 indicatorRow.state = "initial";37 indicatorRow.state = "initial";
36 indicatorRow.currentItem = null;38 indicatorRow.currentItem = null;
37 indicatorRow.unitProgress = 0.0;39 indicatorRow.unitProgress = 0.0;
@@ -53,7 +55,6 @@
5355
54 Indicators.IndicatorsModel {56 Indicators.IndicatorsModel {
55 id: indicatorModel57 id: indicatorModel
56 Component.onCompleted: load()
57 }58 }
5859
59 UT.UnityTestCase {60 UT.UnityTestCase {
6061
=== modified file 'tests/qmltests/Panel/tst_Indicators.qml'
--- tests/qmltests/Panel/tst_Indicators.qml 2014-01-15 08:36:33 +0000
+++ tests/qmltests/Panel/tst_Indicators.qml 2014-01-15 11:27:34 +0000
@@ -83,6 +83,8 @@
83 when: windowShown83 when: windowShown
8484
85 function init() {85 function init() {
86 indicators.initialise();
87
86 indicators.hide();88 indicators.hide();
87 tryCompare(indicators.hideAnimation, "running", false);89 tryCompare(indicators.hideAnimation, "running", false);
88 tryCompare(indicators, "state", "initial");90 tryCompare(indicators, "state", "initial");
@@ -161,21 +163,70 @@
161 compare(indicators.fullyOpened, true);163 compare(indicators.fullyOpened, true);
162 }164 }
163165
166 function init_invisible_indicator(identifier) {
167 tryCompareFunction(function() { return findChild(indicators, identifier+"-widget") !== null }, true);
168 var item = findChild(indicators, identifier+"-widget");
169
170 item.enabled = false;
171 }
172
164 function test_row_visible_menuContent_visible_data() { return [173 function test_row_visible_menuContent_visible_data() { return [
165 {tag: "visible", index: 0, name: "indicator-fake1", visible: true },174 {tag: "first", visible: [false, true, true, true, true] },
166 {tag: "invisible", index: 1, name: "indicator-fake2", visible: false }]175 {tag: "adjacent", visible: [true, false, false, true, true] },
176 {tag: "bounds", visible: [false, true, true, true, false] },
177 {tag: "disjoint", visible: [true, false, true, false, true] },
178 {tag: "last", visible: [true, true, true, true, false] }];
167 }179 }
168180
169 function test_row_visible_menuContent_visible(data) {181 function test_row_visible_menuContent_visible(data) {
170 var indicatorTabs = findChild(indicators, "tabs");182
171 var rowRepeater = findChild(indicators, "rowRepeater");183 indicators.show();
172184
173 var indicatorItem = rowRepeater.itemAt(data.index);185 var indicatorTabs = findChild(indicators, "tabs");
174 tryCompareFunction(function() { return indicatorItem.width > 0}, true);186 var rowRepeater = findChild(indicators, "rowRepeater")
175 tryCompare(indicatorItem, "visible", data.visible);187
176188
177 var indicatorTab = findChild(indicatorTabs, data.name)189 for (var i = 0; i< data.visible.length; i++) {
178 tryCompareFunction(function() { return indicatorTab !== null }, data.visible);190 if (data.visible[i] === false)
191 init_invisible_indicator("indicator-fake" + (i + 1));
192 }
193
194 for (i = 0; i < data.visible.length; i++) {
195 var shouldBeVisible = data.visible[i];
196
197 // check item visibility
198 var indicatorItem = rowRepeater.itemAt(i);
199 tryCompare(indicatorItem, "visible", shouldBeVisible);
200 // check tab visibility
201 tryCompareFunction(function() { return findChild(indicatorTabs, "indicator-fake" + (i + 1)) !== null }, shouldBeVisible);
202 }
203 }
204
205 function test_indicator_visible_correct_tabs_data() { return [
206 {tag: "current-first", currentIndex: 0, visible: [false, true, true, true, true], expected: 1 },
207 {tag: "current-last", currentIndex: 4, visible: [true, true, true, true, false], expected: 3 },
208 {tag: "after", currentIndex: 0, visible: [true, false, true, true, true], expected: 0 },
209 {tag: "before", currentIndex: 1, visible: [false, true, true, true, true], expected: 1 }];
210 }
211
212 function test_indicator_visible_correct_tabs(data) {
213
214 var indicatorTabs = findChild(indicators, "tabs");
215 var indicatorRow = findChild(indicators, "indicatorRow");
216
217 indicators.show();
218 indicatorRow.setCurrentItem(data.currentIndex);
219 tryCompare(indicators, "fullyOpened", true);
220
221 for (var i = 0; i< data.visible.length; i++) {
222 if (data.visible[i] === false)
223 init_invisible_indicator("indicator-fake" + (i + 1));
224 }
225
226 // check for current selected item
227 tryCompare(indicatorRow, "currentItemIndex", data.expected);
228 // check for current selected tab
229 tryCompareFunction(function() { return findChild(indicatorTabs, "indicator-fake" + (data.expected + 1)) === indicatorTabs.selectedTab }, true);
179 }230 }
180 }231 }
181}232}
182233
=== modified file 'tests/qmltests/Panel/tst_MenuContent.qml'
--- tests/qmltests/Panel/tst_MenuContent.qml 2013-12-17 16:04:47 +0000
+++ tests/qmltests/Panel/tst_MenuContent.qml 2014-01-15 11:27:34 +0000
@@ -103,13 +103,13 @@
103103
104 function selected_tab_equals_test_tab() {104 function selected_tab_equals_test_tab() {
105 var currentTab = menu_content_test.findChild(menuContent, "tabs").selectedTab105 var currentTab = menu_content_test.findChild(menuContent, "tabs").selectedTab
106 if (currentTab == undefined) {106 if (currentTab === null) {
107 console.log("selected tab undefined");107 console.log("selected tab undefined");
108 return false;108 return false;
109 }109 }
110110
111 var testTab = menu_content_test.findChild(menuContent, testTabObjectName);111 var testTab = menu_content_test.findChild(menuContent, testTabObjectName);
112 if (testTab == undefined) {112 if (testTab === null) {
113 console.log("test_tab " + testTabObjectName + " undefined");113 console.log("test_tab " + testTabObjectName + " undefined");
114 return false;114 return false;
115 }115 }
116116
=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
--- tests/qmltests/Panel/tst_Panel.qml 2013-12-17 16:04:47 +0000
+++ tests/qmltests/Panel/tst_Panel.qml 2014-01-15 11:27:34 +0000
@@ -56,6 +56,8 @@
56 }56 }
5757
58 function init() {58 function init() {
59 panel.indicators.initialise();
60
59 searchClicked = false;61 searchClicked = false;
60 panel.indicators.hide();62 panel.indicators.hide();
61 tryCompare(panel.indicators.hideAnimation, "running", false);63 tryCompare(panel.indicators.hideAnimation, "running", false);
@@ -64,16 +66,16 @@
6466
65 function get_indicator_item(index) {67 function get_indicator_item(index) {
66 var rowRepeater = findChild(panel.indicators, "rowRepeater");68 var rowRepeater = findChild(panel.indicators, "rowRepeater");
67 verify(rowRepeater != undefined);69 verify(rowRepeater !== null);
68 return rowRepeater.itemAt(index);70 return rowRepeater.itemAt(index);
69 }71 }
7072
71 function get_indicator_item_position(index) {73 function get_indicator_item_position(index) {
72 var indicatorRow = findChild(panel.indicators, "indicatorRow");74 var indicatorRow = findChild(panel.indicators, "indicatorRow");
73 verify(indicatorRow != undefined);75 verify(indicatorRow !== null);
7476
75 var indicatorItem = get_indicator_item(index);77 var indicatorItem = get_indicator_item(index);
76 verify(indicatorItem != undefined);78 verify(indicatorItem !== null);
7779
78 return panel.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);80 return panel.mapFromItem(indicatorItem, indicatorItem.width/2, indicatorItem.height/2);
79 }81 }
@@ -118,7 +120,7 @@
118 // no hint animation when fullscreen120 // no hint animation when fullscreen
119 compare(panel.indicators.y, -panel.panelHeight);121 compare(panel.indicators.y, -panel.panelHeight);
120 var indicatorRow = findChild(panel.indicators, "indicatorRow");122 var indicatorRow = findChild(panel.indicators, "indicatorRow");
121 verify(indicatorRow != undefined);123 verify(indicatorRow !== null);
122 compare(indicatorRow.y, 0);124 compare(indicatorRow.y, 0);
123 compare(panel.indicators.height, panel.indicators.panelHeight);125 compare(panel.indicators.height, panel.indicators.panelHeight);
124 compare(panel.indicators.partiallyOpened, false,126 compare(panel.indicators.partiallyOpened, false,
@@ -143,13 +145,13 @@
143 }145 }
144146
145 var indicatorRow = findChild(panel.indicators, "indicatorRow");147 var indicatorRow = findChild(panel.indicators, "indicatorRow");
146 verify(indicatorRow != undefined);148 verify(indicatorRow !== null);
147149
148 var rowRepeater = findChild(panel.indicators, "rowRepeater");150 var rowRepeater = findChild(panel.indicators, "rowRepeater");
149 verify(indicatorRow != undefined);151 verify(indicatorRow !== null);
150152
151 var menuContent = findChild(panel.indicators, "menuContent");153 var menuContent = findChild(panel.indicators, "menuContent");
152 verify(indicatorRow != undefined);154 verify(indicatorRow !== null);
153155
154 // Wait for the indicators to get into position.156 // Wait for the indicators to get into position.
155 // (switches between normal and fullscreen modes are animated)157 // (switches between normal and fullscreen modes are animated)
@@ -203,7 +205,7 @@
203 panel.searchVisible = true;205 panel.searchVisible = true;
204206
205 var searchIndicator = findChild(panel, "search");207 var searchIndicator = findChild(panel, "search");
206 verify(searchIndicator != undefined);208 verify(searchIndicator !== null);
207209
208 tap(searchIndicator, 1, 1);210 tap(searchIndicator, 1, 1);
209211
@@ -216,7 +218,7 @@
216 panel.searchVisible = false;218 panel.searchVisible = false;
217219
218 var searchIndicator = findChild(panel, "search");220 var searchIndicator = findChild(panel, "search");
219 verify(searchIndicator != undefined);221 verify(searchIndicator !== null);
220222
221 tap(searchIndicator, 1, 1);223 tap(searchIndicator, 1, 1);
222224
@@ -232,14 +234,14 @@
232 panel.searchVisible = false;234 panel.searchVisible = false;
233235
234 var indicatorRow = findChild(panel.indicators, "indicatorRow");236 var indicatorRow = findChild(panel.indicators, "indicatorRow");
235 verify(indicatorRow != undefined);237 verify(indicatorRow !== null);
236238
237 var rowRepeater = findChild(panel.indicators, "rowRepeater");239 var rowRepeater = findChild(panel.indicators, "rowRepeater");
238 verify(indicatorRow != undefined);240 verify(indicatorRow !== null);
239241
240 // Get the first indicator242 // Get the first indicator
241 var indicatorItemFirst = get_indicator_item(0);243 var indicatorItemFirst = get_indicator_item(0);
242 verify(indicatorItemFirst != undefined);244 verify(indicatorItemFirst !== undefined);
243245
244 var indicatorItemCoordFirst = get_indicator_item_position(0);246 var indicatorItemCoordFirst = get_indicator_item_position(0);
245 var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.count - 1);247 var indicatorItemCoordNext = get_indicator_item_position(indicatorRow.count - 1);

Subscribers

People subscribed via source and target branches