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

Proposed by Albert Astals Cid on 2015-10-21
Status: Merged
Approved by: Gerry Boland on 2015-10-22
Approved revision: 2006
Merged at revision: 2034
Proposed branch: lp:~aacid/unity8/fix_cropped_image_binding_loop
Merge into: lp:unity8
Diff against target: 32 lines (+15/-4)
1 file modified
plugins/Dash/CroppedImageMinimumSourceSize.qml (+15/-4)
To merge this branch: bzr merge lp:~aacid/unity8/fix_cropped_image_binding_loop
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2015-11-02
Gerry Boland Approve on 2015-10-22
Michał Sawicz meh, ohkay 2015-10-21 Approve on 2015-10-21
Review via email: mp+275199@code.launchpad.net

Commit Message

CroppedImageMinimumSourceSize: Fix 'Binding loop detected for property "imageAspectRatio"'

Description of the Change

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

 * 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.
Gerry Boland (gerboland) wrote :

Think a comment explaining "why not bindings?" would do no harm.

Because I'm sure if I saw this code in a year's time, I'd say "I'll use bindings to make it better!" :)

Michał Sawicz (saviq) :
review: Approve (meh, ohkay)
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2005
http://jenkins.qa.ubuntu.com/job/unity8-ci/6503/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/4748
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-wily-touch/885
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1215
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-wily/531
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1110
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1111
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-wily-amd64-ci/742
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-wily-i386-ci/743
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-mako/3833
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4745
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4745/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24433
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-wily-mako/523
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-wily-armhf/885
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-wily-armhf/885/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24435

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

review: Needs Fixing (continuous-integration)
2006. By Albert Astals Cid on 2015-10-22

add commetn

Albert Astals Cid (aacid) wrote :

> Think a comment explaining "why not bindings?" would do no harm.
>
> Because I'm sure if I saw this code in a year's time, I'd say "I'll use
> bindings to make it better!" :)

Comment added

PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:2006
http://jenkins.qa.ubuntu.com/job/unity8-ci/6509/
Executed test runs:
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-vivid-touch/4758
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-wily-touch/891
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-vivid/1221/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-wily/537/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-amd64-ci/1116
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-vivid-i386-ci/1117
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-wily-amd64-ci/748
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-wily-i386-ci/749
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-vivid-mako/3841
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4755
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-vivid-armhf/4755/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24457
    UNSTABLE: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-wily-mako/528
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-wily-armhf/891
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-wily-armhf/891/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/24454

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

review: Needs Fixing (continuous-integration)
Gerry Boland (gerboland) wrote :

Will do

review: Approve
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plugins/Dash/CroppedImageMinimumSourceSize.qml'
2--- plugins/Dash/CroppedImageMinimumSourceSize.qml 2015-08-31 13:29:42 +0000
3+++ plugins/Dash/CroppedImageMinimumSourceSize.qml 2015-10-22 08:13:17 +0000
4@@ -1,5 +1,5 @@
5 /*
6- * Copyright (C) 2014 Canonical, Ltd.
7+ * Copyright (C) 2014, 2015 Canonical, Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11@@ -21,7 +21,18 @@
12
13 fillMode: Image.PreserveAspectCrop
14
15- readonly property real itemAspectRatio: width / height
16- readonly property real imageAspectRatio: implicitWidth / implicitHeight
17- sourceSize: (imageAspectRatio > itemAspectRatio) ? Qt.size(0, height) : Qt.size(width, 0)
18+ property bool useHeight: false
19+ function updateUseHeight()
20+ {
21+ // Do not turn into a binding since otherwise the qml
22+ // engine complains about binding loops
23+ useHeight = (implicitWidth / implicitHeight) > (width / height);
24+ }
25+
26+ onHeightChanged: updateUseHeight();
27+ onWidthChanged: updateUseHeight();
28+ onImplicitHeightChanged: updateUseHeight();
29+ onImplicitWidthChanged: updateUseHeight();
30+
31+ sourceSize: useHeight ? Qt.size(0, height) : Qt.size(width, 0)
32 }

Subscribers

People subscribed via source and target branches