Merge lp:~larsu/ubuntu-ui-toolkit/icons into lp:ubuntu-ui-toolkit/staging

Proposed by Lars Karlitski
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1270
Merged at revision: 1297
Proposed branch: lp:~larsu/ubuntu-ui-toolkit/icons
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 77 lines (+16/-34)
2 files modified
modules/Ubuntu/Components/Icon10.qml (+15/-33)
modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp (+1/-1)
To merge this branch: bzr merge lp:~larsu/ubuntu-ui-toolkit/icons
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Tim Peeters Approve
Review via email: mp+236497@code.launchpad.net

Commit message

Icon: size correctly even if no or only one dimension is given

Description of the change

Icon: size correctly even if no or only one dimension is given

This should fix the test case in

  https://code.launchpad.net/~larsu/unity8/stop-using-statusicon/+merge/234502

while keeping everything else working. Especially the regression from bug #1349769.

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 :
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

nice, much cleaner code now

review: Approve
Revision history for this message
Tim Peeters (tpeeters) wrote :

the example app in https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1349769 works fine, and the regression unit test for that bug passes.

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 :
review: Needs Fixing (continuous-integration)
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 :
review: Needs Fixing (continuous-integration)
Revision history for this message
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 'modules/Ubuntu/Components/Icon10.qml'
2--- modules/Ubuntu/Components/Icon10.qml 2014-09-19 13:22:18 +0000
3+++ modules/Ubuntu/Components/Icon10.qml 2014-09-30 15:23:29 +0000
4@@ -31,45 +31,27 @@
5 */
6 property alias keyColor: colorizedImage.keyColorIn
7
8+ implicitWidth: image.implicitWidth
9+ implicitHeight: image.implicitHeight
10+
11 Image {
12 id: image
13 objectName: "image"
14 anchors.fill: parent
15+ fillMode: Image.PreserveAspectFit
16
17- /* Necessary so that icons are not loaded before a size is set. */
18- source: ""
19 sourceSize {
20- width: 0
21- height: 0
22- }
23-
24- Component.onCompleted: update()
25- onWidthChanged: update()
26- onHeightChanged: update()
27- Connections {
28- target: icon
29- ignoreUnknownSignals: true
30- onNameChanged: image.update()
31- onSourceChanged: image.update()
32- }
33-
34- function update() {
35- // only set sourceSize.width, sourceSize.height and source when
36- // icon dimensions are valid, see bug #1349769.
37- if (width > 0 && height > 0
38- && (icon.name || (icon.hasOwnProperty("source") && icon.source))) {
39- sourceSize.width = width;
40- sourceSize.height = height;
41- if (icon.hasOwnProperty("source")) {
42- source = icon.source;
43- } else {
44- source = "image://theme/%1".arg(icon.name);
45- }
46- } else {
47- source = "";
48- sourceSize.width = 0;
49- sourceSize.height = 0;
50- }
51+ width: icon.width
52+ height: icon.height
53+ }
54+
55+ source: {
56+ if (icon.hasOwnProperty("source"))
57+ return icon.source;
58+ else if (icon.name)
59+ return "image://theme/%1".arg(icon.name);
60+ else
61+ return "";
62 }
63
64 cache: true
65
66=== modified file 'modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp'
67--- modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-09-18 09:29:49 +0000
68+++ modules/Ubuntu/Components/plugin/ucscalingimageprovider.cpp 2014-09-30 15:23:29 +0000
69@@ -65,7 +65,7 @@
70 }
71 }
72
73- if (constrainedSize.isValid()) {
74+ if (!constrainedSize.isEmpty()) {
75 imageReader.setScaledSize(constrainedSize);
76 } else if (scaledSize != realSize) {
77 imageReader.setScaledSize(scaledSize);

Subscribers

People subscribed via source and target branches