Merge lp:~artmello/camera-app/camera-app-gridlines into lp:camera-app

Proposed by Arthur Mello
Status: Superseded
Proposed branch: lp:~artmello/camera-app/camera-app-gridlines
Merge into: lp:camera-app
Diff against target: 273 lines (+98/-19)
4 files modified
OptionValueButton.qml (+3/-2)
OptionsOverlay.qml (+15/-10)
ViewFinderOverlay.qml (+53/-5)
ViewFinderView.qml (+27/-2)
To merge this branch: bzr merge lp:~artmello/camera-app/camera-app-gridlines
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Florian Boucault (community) Needs Fixing
Review via email: mp+243092@code.launchpad.net

This proposal has been superseded by a proposal from 2014-12-02.

Commit message

Add gridlines to the viewfinder controlled by a new settings option

Description of the change

Add gridlines to the viewfinder controlled by a new settings option

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

- making the grid of options 4 columns does not really solve the problem of too many options long term (especially with your other MR coming in); thankfully this was solved already in another branch's commit. I think we should merge the specific commit that fixes it: commit 428 from lp:~fboucault/camera-app/jpeg_quality
Merge command: bzr merge -c428 lp:~fboucault/camera-app/jpeg_quality
- icon "view-grid-symbolic" is not good enough. I asked Matthieu (tiheum) from design to provide a better one.
- visually the grid should not have lines around the picture, only the 4 lines inside it; these lines outside are not useful and they create a boxing feel to the UI
- no need to use a Binding object (I understand the consistency reason, but it won't work out for other settings)
- better to not instantiate the Rectangles at all when the grid is disabled; "Repeater.model: settings.gridEnabled ? gridlines.columns * gridlines.rows : 0" will do the trick
- using Rectangle.border to draw is slightly more expensive than using Rectangle.color

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

Merged bottom edge UI fixes from lp:~fboucault/camera-app/sdcard

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

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'OptionValueButton.qml'
2--- OptionValueButton.qml 2014-07-09 21:57:43 +0000
3+++ OptionValueButton.qml 2014-12-01 01:56:45 +0000
4@@ -47,14 +47,15 @@
5 id: label
6 anchors {
7 left: icon.name != "" ? icon.right : parent.left
8- leftMargin: units.gu(2)
9+ leftMargin: icon.name != "" ? units.gu(2) : icon.anchors.leftMargin
10 right: parent.right
11- rightMargin: units.gu(2)
12+ rightMargin: icon.anchors.leftMargin
13 verticalCenter: parent.verticalCenter
14 }
15
16 color: "white"
17 opacity: optionValueButton.selected ? 1.0 : 0.5
18+ elide: Text.ElideRight
19 }
20
21 Rectangle {
22
23=== modified file 'OptionsOverlay.qml'
24--- OptionsOverlay.qml 2014-09-05 12:04:54 +0000
25+++ OptionsOverlay.qml 2014-12-01 01:56:45 +0000
26@@ -21,12 +21,13 @@
27 id: optionsOverlay
28
29 property list<ListModel> options
30+ property bool valueSelectorOpened: optionValueSelector.caller != null
31
32 function closeValueSelector() {
33 optionValueSelector.hide();
34 }
35
36- height: optionsGrid.height
37+ height: optionsGrid.height + optionsGrid.rowSpacing
38
39 Grid {
40 id: optionsGrid
41@@ -34,9 +35,7 @@
42 horizontalCenter: parent.horizontalCenter
43 }
44
45- columns: 3
46- columnSpacing: units.gu(9.5)
47- rowSpacing: units.gu(9.5)
48+ rowSpacing: units.gu(4)
49
50 Repeater {
51 model: optionsOverlay.options
52@@ -44,6 +43,9 @@
53 id: optionButton
54 model: modelData
55 onClicked: optionValueSelector.toggle(model, optionButton)
56+ enabled: model.available && (!optionValueSelector.caller || optionValueSelector.caller == optionButton)
57+ opacity: enabled ? 1.0 : 0.05
58+ Behavior on opacity {UbuntuNumberAnimation {duration: UbuntuAnimation.FastDuration}}
59 }
60 }
61 }
62@@ -51,11 +53,9 @@
63 Column {
64 id: optionValueSelector
65 objectName: "optionValueSelector"
66- anchors {
67- bottom: optionsGrid.top
68- bottomMargin: units.gu(2)
69- }
70- width: units.gu(12)
71+ width: units.gu(16)
72+
73+ property OptionButton caller
74
75 function toggle(model, callerButton) {
76 if (optionValueSelectorVisible && optionsRepeater.model === model) {
77@@ -66,13 +66,15 @@
78 }
79
80 function show(model, callerButton) {
81+ optionValueSelector.caller = callerButton;
82+ optionsRepeater.model = model;
83 alignWith(callerButton);
84- optionsRepeater.model = model;
85 optionValueSelectorVisible = true;
86 }
87
88 function hide() {
89 optionValueSelectorVisible = false;
90+ optionValueSelector.caller = null;
91 }
92
93 function alignWith(item) {
94@@ -90,6 +92,9 @@
95 } else {
96 x = centeredX;
97 }
98+
99+ // vertically position the options above the caller button
100+ y = Qt.binding(function() { return optionsGrid.y + item.y - height - units.gu(2) });
101 }
102
103 visible: opacity !== 0.0
104
105=== modified file 'ViewFinderOverlay.qml'
106--- ViewFinderOverlay.qml 2014-09-05 12:04:54 +0000
107+++ ViewFinderOverlay.qml 2014-12-01 01:56:45 +0000
108@@ -20,6 +20,7 @@
109 import QtMultimedia 5.0
110 import QtPositioning 5.2
111 import CameraApp 0.1
112+import Qt.labs.settings 1.0
113
114 Item {
115 id: viewFinderOverlay
116@@ -34,15 +35,15 @@
117 focusRing.show();
118 }
119
120- QtObject {
121+ Settings {
122 id: settings
123
124 property int flashMode: Camera.FlashAuto
125 property bool gpsEnabled: false
126 property bool hdrEnabled: false
127 property int videoFlashMode: Camera.FlashOff
128-
129- StateSaver.properties: "flashMode, gpsEnabled, hdrEnabled, videoFlashMode"
130+ property bool gridEnabled: false
131+ property int encodingQuality: 2 // QMultimedia.NormalQuality
132 }
133
134 Binding {
135@@ -65,6 +66,12 @@
136 value: settings.hdrEnabled
137 }
138
139+ Binding {
140+ target: gridlines
141+ property: "visible"
142+ value: settings.gridEnabled
143+ }
144+
145 Connections {
146 target: camera.imageCapture
147 onReadyChanged: {
148@@ -77,10 +84,19 @@
149 }
150 }
151
152+ function optionsOverlayClose() {
153+ print("optionsOverlayClose")
154+ if (optionsOverlayLoader.item.valueSelectorOpened) {
155+ optionsOverlayLoader.item.closeValueSelector();
156+ } else {
157+ bottomEdge.close();
158+ }
159+ }
160+
161 MouseArea {
162 id: bottomEdgeClose
163 anchors.fill: parent
164- onClicked: bottomEdge.close()
165+ onClicked: optionsOverlayClose()
166 }
167
168 Panel {
169@@ -90,9 +106,19 @@
170 left: parent.left
171 bottom: parent.bottom
172 }
173- height: units.gu(9)
174+ height: optionsOverlayLoader.height
175 onOpenedChanged: optionsOverlayLoader.item.closeValueSelector()
176
177+ Item {
178+ /* Use the 'trigger' feature of Panel so that tapping on the Panel
179+ has the same effect as tapping outside of it (bottomEdgeClose) */
180+ id: clickReceiver
181+ anchors.fill: parent
182+ function trigger() {
183+ optionsOverlayClose();
184+ }
185+ }
186+
187 property real progress: (bottomEdge.height - bottomEdge.position) / bottomEdge.height
188 property list<ListModel> options: [
189 ListModel {
190@@ -187,6 +213,28 @@
191 label: QT_TR_NOOP("Off")
192 value: false
193 }
194+ },
195+ ListModel {
196+ id: gridOptionsModel
197+
198+ property string settingsProperty: "gridEnabled"
199+ property string icon: "view-grid-symbolic"
200+ property string label: ""
201+ property bool isToggle: true
202+ property int selectedIndex: bottomEdge.indexForValue(gridOptionsModel, settings.gridEnabled)
203+ property bool available: true
204+ property bool visible: true
205+
206+ ListElement {
207+ icon: ""
208+ label: QT_TR_NOOP("On")
209+ value: true
210+ }
211+ ListElement {
212+ icon: ""
213+ label: QT_TR_NOOP("Off")
214+ value: false
215+ }
216 }
217 ]
218
219
220=== modified file 'ViewFinderView.qml'
221--- ViewFinderView.qml 2014-10-09 19:14:01 +0000
222+++ ViewFinderView.qml 2014-12-01 01:56:45 +0000
223@@ -132,7 +132,8 @@
224 Item {
225 id: viewFinderSwitcher
226 anchors.fill: parent
227-
228+ visible: !viewFinderSwitcherBlurred.visible
229+
230 ShaderEffectSource {
231 id: viewFinderGrab
232 live: false
233@@ -247,6 +248,26 @@
234 viewFinderWidth: viewFinder.width
235 viewFinderOrientation: viewFinder.orientation
236 }
237+
238+ Grid {
239+ id: gridlines
240+ anchors.fill: parent
241+ visible: false
242+ columns: 3
243+ property int rows: 3
244+
245+ Repeater {
246+ model: gridlines.columns * gridlines.rows
247+
248+ Rectangle {
249+ width: parent.width / gridlines.columns
250+ height: parent.height / gridlines.rows
251+ border.width: 1
252+ border.color: "gray"
253+ color: "transparent"
254+ }
255+ }
256+ }
257 }
258
259 Rectangle {
260@@ -274,8 +295,12 @@
261 }
262
263 FastBlur {
264+ id: viewFinderSwitcherBlurred
265 anchors.fill: viewFinderSwitcher
266- radius: photoRollHint.visible ? 64 : viewFinderOverlay.revealProgress * 64
267+ property real finalRadius: 64
268+ property real finalOpacity: 0.7
269+ radius: photoRollHint.visible ? finalRadius : viewFinderOverlay.revealProgress * finalRadius
270+ opacity: photoRollHint.visible ? finalOpacity : (1.0 - viewFinderOverlay.revealProgress) * finalOpacity + finalOpacity
271 source: radius !== 0 ? viewFinderSwitcher : null
272 visible: radius !== 0
273 }

Subscribers

People subscribed via source and target branches