Merge lp:~phablet-team/camera-app/autosize-option-labels into lp:camera-app

Proposed by Ugo Riboni
Status: Merged
Approved by: Florian Boucault
Approved revision: 482
Merged at revision: 487
Proposed branch: lp:~phablet-team/camera-app/autosize-option-labels
Merge into: lp:camera-app
Diff against target: 148 lines (+51/-40)
4 files modified
OptionButton.qml (+1/-1)
OptionValueButton.qml (+42/-30)
OptionsOverlay.qml (+6/-7)
ViewFinderOverlay.qml (+2/-2)
To merge this branch: bzr merge lp:~phablet-team/camera-app/autosize-option-labels
Reviewer Review Type Date Requested Status
Florian Boucault (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+247691@code.launchpad.net

Commit message

Size option labels to fit the widest text in the column, so they look good in all languages

Description of the change

Size option labels to fit the widest text in the column, so they look good in all languages.

Since I was there, I took the opportunity to also suppress some harmless warnings that were adding to the noise in the application log.

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

More properly align icons and labels

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

Works well

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'OptionButton.qml'
2--- OptionButton.qml 2014-12-05 18:57:32 +0000
3+++ OptionButton.qml 2015-01-27 15:23:10 +0000
4@@ -24,7 +24,7 @@
5 property string settingsProperty: model.settingsProperty
6
7 iconName: model.isToggle || !model.get(model.selectedIndex).icon ? model.icon : model.get(model.selectedIndex).icon
8- iconSource: model.iconSource
9+ iconSource: (model && model.iconSource) ? model.iconSource : ""
10 on: model.isToggle ? model.get(model.selectedIndex).value : true
11 enabled: model.available
12 label: model.label
13
14=== modified file 'OptionValueButton.qml'
15--- OptionValueButton.qml 2014-12-11 12:24:25 +0000
16+++ OptionValueButton.qml 2015-01-27 15:23:10 +0000
17@@ -26,44 +26,56 @@
18 property alias iconName: icon.name
19 property bool selected
20 property bool isLast
21-
22- Icon {
23- id: icon
24- anchors {
25- top: parent.top
26- bottom: parent.bottom
27- left: parent.left
28- topMargin: units.gu(1)
29- bottomMargin: units.gu(1)
30- leftMargin: units.gu(1)
31- }
32- width: height
33- color: "white"
34- opacity: optionValueButton.selected ? 1.0 : 0.5
35- visible: name !== ""
36- }
37-
38- Label {
39- id: label
40- anchors {
41- left: icon.name != "" ? icon.right : parent.left
42- leftMargin: icon.name != "" ? units.gu(2) : icon.anchors.leftMargin
43- right: parent.right
44- rightMargin: icon.anchors.leftMargin
45+ property int columnWidth
46+ property int marginSize: units.gu(1)
47+
48+ width: marginSize + iconLabelGroup.width + marginSize
49+
50+ Item {
51+ id: iconLabelGroup
52+ width: childrenRect.width
53+ height: icon.height
54+
55+ anchors {
56+ left: (iconName) ? undefined : parent.left
57+ leftMargin: (iconName) ? undefined : marginSize
58+ horizontalCenter: (iconName) ? parent.horizontalCenter : undefined
59 verticalCenter: parent.verticalCenter
60- }
61-
62- color: "white"
63- opacity: optionValueButton.selected ? 1.0 : 0.5
64- elide: Text.ElideRight
65+ topMargin: marginSize
66+ bottomMargin: marginSize
67+ }
68+
69+ Icon {
70+ id: icon
71+ anchors {
72+ verticalCenter: parent.verticalCenter
73+ left: parent.left
74+ }
75+ width: optionValueButton.height - optionValueButton.marginSize * 2
76+ color: "white"
77+ opacity: optionValueButton.selected ? 1.0 : 0.5
78+ visible: name !== ""
79+ }
80+
81+ Label {
82+ id: label
83+ anchors {
84+ left: icon.name != "" ? icon.right : parent.left
85+ verticalCenter: parent.verticalCenter
86+ }
87+
88+ color: "white"
89+ opacity: optionValueButton.selected ? 1.0 : 0.5
90+ width: paintedWidth
91+ }
92 }
93
94 Rectangle {
95 anchors {
96 left: parent.left
97- right: parent.right
98 bottom: parent.bottom
99 }
100+ width: parent.columnWidth
101 height: units.dp(1)
102 color: "white"
103 opacity: 0.5
104
105=== modified file 'OptionsOverlay.qml'
106--- OptionsOverlay.qml 2014-12-11 12:24:25 +0000
107+++ OptionsOverlay.qml 2015-01-27 15:23:10 +0000
108@@ -55,7 +55,7 @@
109 Column {
110 id: optionValueSelector
111 objectName: "optionValueSelector"
112- width: units.gu(16)
113+ width: childrenRect.width
114
115 property OptionButton caller
116
117@@ -108,12 +108,11 @@
118 id: optionsRepeater
119
120 delegate: OptionValueButton {
121- anchors {
122- right: optionValueSelector.right
123- left: optionValueSelector.left
124- }
125- label: i18n.tr(model.label)
126- iconName: model.icon
127+ anchors.left: optionValueSelector.left
128+ columnWidth: optionValueSelector.childrenRect.width
129+
130+ label: (model && model.label) ? i18n.tr(model.label) : ""
131+ iconName: (model && model.icon) ? model.icon : ""
132 selected: optionsRepeater.model.selectedIndex == index
133 isLast: index === optionsRepeater.count - 1
134 onClicked: settings[optionsRepeater.model.settingsProperty] = optionsRepeater.model.get(index).value
135
136=== modified file 'ViewFinderOverlay.qml'
137--- ViewFinderOverlay.qml 2015-01-25 14:18:09 +0000
138+++ ViewFinderOverlay.qml 2015-01-27 15:23:10 +0000
139@@ -463,8 +463,8 @@
140 id: indicatorIcon
141 anchors.fill: parent
142 color: "white"
143- name: modelData.isToggle ? modelData.icon : modelData.get(model.selectedIndex).icon
144- source: name ? "image://theme/%1".arg(name) : modelData.iconSource
145+ name: modelData && modelData.isToggle ? modelData.icon : modelData.get(model.selectedIndex).icon
146+ source: name ? "image://theme/%1".arg(name) : (modelData.iconSource || "")
147 visible: source != ""
148 }
149

Subscribers

People subscribed via source and target branches