Merge lp:~fboucault/camera-app/bottom_edge_hint into lp:camera-app

Proposed by Florian Boucault
Status: Merged
Approved by: Florian Boucault
Approved revision: 533
Merged at revision: 535
Proposed branch: lp:~fboucault/camera-app/bottom_edge_hint
Merge into: lp:camera-app
Diff against target: 344 lines (+230/-66)
5 files modified
BottomEdgeIndicators.qml (+104/-0)
ViewFinderOverlay.qml (+2/-64)
debian/control (+1/-0)
tests/unittests/CMakeLists.txt (+7/-2)
tests/unittests/tst_BottomEdgeIndicators.qml (+116/-0)
To merge this branch: bzr merge lp:~fboucault/camera-app/bottom_edge_hint
Reviewer Review Type Date Requested Status
Ugo Riboni (community) Approve
PS Jenkins bot continuous-integration Needs Fixing
Review via email: mp+251940@code.launchpad.net

Commit message

Show placeholder bottom edge hint when no option is set so that the user can always guess the existence of the bottom edge.

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
Ugo Riboni (uriboni) wrote :

Code LGTM and does what it says on the tin

review: Approve
Revision history for this message
Bill Filler (bfiller) wrote :

needs test

Revision history for this message
Florian Boucault (fboucault) wrote :

Test added.

On Wed, Mar 11, 2015 at 3:31 PM, Bill Filler <email address hidden>
wrote:

> needs test
> --
>
> https://code.launchpad.net/~fboucault/camera-app/bottom_edge_hint/+merge/251940
> You are the owner of lp:~fboucault/camera-app/bottom_edge_hint.
>

534. By Florian Boucault

Reverted unrelated change.

Revision history for this message
Florian Boucault (fboucault) wrote :

Tests now successfully pass in CI.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'BottomEdgeIndicators.qml'
--- BottomEdgeIndicators.qml 1970-01-01 00:00:00 +0000
+++ BottomEdgeIndicators.qml 2015-03-12 22:36:26 +0000
@@ -0,0 +1,104 @@
1/*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17import QtQuick 2.2
18import Ubuntu.Components 1.1
19
20Item {
21 id: bottomEdgeIndicators
22
23 property var options
24 width: indicatorsRow.width + units.gu(2) + emptyIndicatorsHint.width
25 height: units.gu(3)
26
27 Image {
28 anchors {
29 left: parent.left
30 right: parent.right
31 top: parent.top
32 }
33 height: parent.height * 2
34 opacity: 0.3
35 source: "assets/ubuntu_shape.svg"
36 sourceSize.width: width
37 sourceSize.height: height
38 cache: false
39 asynchronous: true
40 }
41
42 Icon {
43 id: emptyIndicatorsHint
44 objectName: "emptyIndicatorsHint"
45 name: "go-up"
46 opacity: 0.5
47 color: "white"
48 visible: indicatorsRow.visibleChildren.length <= 1
49 anchors {
50 top: parent.top
51 topMargin: units.gu(0.5)
52 bottom: parent.bottom
53 bottomMargin: units.gu(0.5)
54 horizontalCenter: parent.horizontalCenter
55 }
56 width: visible ? height * 1.5 : 0
57 }
58
59 Row {
60 id: indicatorsRow
61 objectName: "indicatorsRow"
62
63 anchors {
64 top: parent.top
65 bottom: parent.bottom
66 horizontalCenter: parent.horizontalCenter
67 }
68 spacing: units.gu(1)
69
70 Repeater {
71 model: bottomEdgeIndicators.options
72 delegate: Item {
73 anchors {
74 top: parent.top
75 topMargin: units.gu(0.5)
76 bottom: parent.bottom
77 bottomMargin: units.gu(0.5)
78 }
79 width: units.gu(2)
80 visible: modelData.showInIndicators && modelData.available && modelData.visible ? (modelData.isToggle ? modelData.get(model.selectedIndex).value : true) : false
81 opacity: 0.5
82
83 Icon {
84 id: indicatorIcon
85 anchors.fill: parent
86 color: "white"
87 name: modelData && modelData.isToggle ? modelData.icon : modelData.get(model.selectedIndex).icon
88 source: name ? "image://theme/%1".arg(name) : (modelData.iconSource || "")
89 visible: source != ""
90 }
91
92 Label {
93 id: indicatorLabel
94 anchors.fill: parent
95 fontSize: "xx-small"
96 color: "white"
97 text: modelData.label
98 verticalAlignment: Text.AlignVCenter
99 visible: indicatorIcon.name === ""
100 }
101 }
102 }
103 }
104}
0105
=== modified file 'ViewFinderOverlay.qml'
--- ViewFinderOverlay.qml 2015-01-27 17:37:09 +0000
+++ ViewFinderOverlay.qml 2015-03-12 22:36:26 +0000
@@ -413,76 +413,14 @@
413 return -1;413 return -1;
414 }414 }
415415
416 Item {416 BottomEdgeIndicators {
417 options: bottomEdge.options
417 anchors {418 anchors {
418 horizontalCenter: parent.horizontalCenter419 horizontalCenter: parent.horizontalCenter
419 bottom: parent.top420 bottom: parent.top
420 }421 }
421 width: indicators.width + units.gu(2)
422 height: units.gu(3)
423 opacity: bottomEdge.pressed || bottomEdge.opened ? 0.0 : 1.0422 opacity: bottomEdge.pressed || bottomEdge.opened ? 0.0 : 1.0
424 Behavior on opacity { UbuntuNumberAnimation {} }423 Behavior on opacity { UbuntuNumberAnimation {} }
425
426 Image {
427 anchors {
428 left: parent.left
429 right: parent.right
430 top: parent.top
431 }
432 height: parent.height * 2
433 opacity: 0.3
434 source: "assets/ubuntu_shape.svg"
435 sourceSize.width: width
436 sourceSize.height: height
437 cache: false
438 asynchronous: true
439 visible: indicators.visibleChildren.length > 1
440 }
441
442 Row {
443 id: indicators
444
445 anchors {
446 top: parent.top
447 bottom: parent.bottom
448 horizontalCenter: parent.horizontalCenter
449 }
450 spacing: units.gu(1)
451
452 Repeater {
453 model: bottomEdge.options
454 delegate: Item {
455 anchors {
456 top: parent.top
457 topMargin: units.gu(0.5)
458 bottom: parent.bottom
459 bottomMargin: units.gu(0.5)
460 }
461 width: units.gu(2)
462 visible: modelData.showInIndicators && modelData.available && modelData.visible ? (modelData.isToggle ? modelData.get(model.selectedIndex).value : true) : false
463 opacity: 0.5
464
465 Icon {
466 id: indicatorIcon
467 anchors.fill: parent
468 color: "white"
469 name: modelData && modelData.isToggle ? modelData.icon : modelData.get(model.selectedIndex).icon
470 source: name ? "image://theme/%1".arg(name) : (modelData.iconSource || "")
471 visible: source != ""
472 }
473
474 Label {
475 id: indicatorLabel
476 anchors.fill: parent
477 fontSize: "xx-small"
478 color: "white"
479 text: modelData.label
480 verticalAlignment: Text.AlignVCenter
481 visible: indicatorIcon.name === ""
482 }
483 }
484 }
485 }
486 }424 }
487 }425 }
488426
489427
=== modified file 'debian/control'
--- debian/control 2015-02-12 17:22:13 +0000
+++ debian/control 2015-03-12 22:36:26 +0000
@@ -21,6 +21,7 @@
21 libusermetricsinput1-dev,21 libusermetricsinput1-dev,
22 gettext,22 gettext,
23 dh-translations,23 dh-translations,
24 xvfb,
24Standards-Version: 3.9.525Standards-Version: 3.9.5
25Homepage: https://launchpad.net/camera-app26Homepage: https://launchpad.net/camera-app
26# If you aren't a member of ~phablet-team but need to upload packaging changes,27# If you aren't a member of ~phablet-team but need to upload packaging changes,
2728
=== modified file 'tests/unittests/CMakeLists.txt'
--- tests/unittests/CMakeLists.txt 2015-01-23 15:02:49 +0000
+++ tests/unittests/CMakeLists.txt 2015-03-12 22:36:26 +0000
@@ -1,8 +1,13 @@
1find_program(XVFB_RUN_BIN
2 NAMES xvfb-run
3)
4
5set(XVFB_RUN_CMD ${XVFB_RUN_BIN} -a -s "-screen 0 1024x768x24")
6
1add_executable(tst_QmlTests tst_QmlTests.cpp)7add_executable(tst_QmlTests tst_QmlTests.cpp)
2qt5_use_modules(tst_QmlTests Core Qml Quick Test QuickTest)8qt5_use_modules(tst_QmlTests Core Qml Quick Test QuickTest)
3target_link_libraries(tst_QmlTests ${TPL_QT5_LIBRARIES})9target_link_libraries(tst_QmlTests ${TPL_QT5_LIBRARIES})
4add_test(tst_QmlTests ${CMAKE_CURRENT_BINARY_DIR}/tst_QmlTests -import ${CMAKE_SOURCE_DIR})10add_test(tst_QmlTests ${XVFB_RUN_CMD} ${CMAKE_CURRENT_BINARY_DIR}/tst_QmlTests -import ${CMAKE_SOURCE_DIR})
5set_tests_properties(tst_QmlTests PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
611
7# copy qml test files to build dir12# copy qml test files to build dir
8file(GLOB qmlTestFiles RELATIVE ${CMAKE_SOURCE_DIR}/tests/unittests/ *qml)13file(GLOB qmlTestFiles RELATIVE ${CMAKE_SOURCE_DIR}/tests/unittests/ *qml)
914
=== added file 'tests/unittests/tst_BottomEdgeIndicators.qml'
--- tests/unittests/tst_BottomEdgeIndicators.qml 1970-01-01 00:00:00 +0000
+++ tests/unittests/tst_BottomEdgeIndicators.qml 2015-03-12 22:36:26 +0000
@@ -0,0 +1,116 @@
1/*
2 * Copyright 2015 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 */
17
18import QtQuick 2.0
19import QtTest 1.0
20import "../../"
21import "../../.." //Needed for out of source build
22
23TestCase {
24 name: "BottomEdgeIndicators"
25 when: windowShown
26 visible: true
27
28 property list<ListModel> noOptions
29 property list<ListModel> noVisibleOptions: [
30 ListModel {
31 property string settingsProperty: "invisibleOption"
32 property string icon
33 property string label: ""
34 property bool isToggle: true
35 property int selectedIndex
36 property bool available: true
37 property bool visible: true
38 property bool showInIndicators: false
39
40 ListElement {
41 icon: ""
42 label: QT_TR_NOOP("On")
43 value: true
44 }
45 ListElement {
46 icon: ""
47 label: QT_TR_NOOP("Off")
48 value: false
49 }
50 }
51 ]
52 property list<ListModel> someVisibleOptions: [
53 ListModel {
54 property string settingsProperty: "invisibleOption"
55 property string icon
56 property string label: ""
57 property bool isToggle: true
58 property int selectedIndex
59 property bool available: true
60 property bool visible: true
61 property bool showInIndicators: false
62
63 ListElement {
64 icon: ""
65 label: QT_TR_NOOP("On")
66 value: true
67 }
68 ListElement {
69 icon: ""
70 label: QT_TR_NOOP("Off")
71 value: false
72 }
73 },
74 ListModel {
75 property string settingsProperty: "visibleOption"
76 property string icon
77 property string label: ""
78 property bool isToggle: true
79 property int selectedIndex
80 property bool available: true
81 property bool visible: true
82 property bool showInIndicators: true
83
84 ListElement {
85 icon: ""
86 label: QT_TR_NOOP("On")
87 value: true
88 }
89 ListElement {
90 icon: ""
91 label: QT_TR_NOOP("Off")
92 value: false
93 }
94 }
95 ]
96
97 function test_options_data() {
98 return [
99 {tag: "no options", options: noOptions, visibleChildren: 1, hintVisible: true },
100 {tag: "no visible options", options: noVisibleOptions, visibleChildren: 1, hintVisible: true },
101 {tag: "some visible options", options: someVisibleOptions, visibleChildren: 2, hintVisible: false },
102 ]
103 }
104
105 function test_options(data) {
106 indicators.options = data.options;
107 var emptyIndicatorsHint = findChild(indicators, "emptyIndicatorsHint");
108 var indicatorsRow = findChild(indicators, "indicatorsRow");
109 compare(indicatorsRow.visibleChildren.length, data.visibleChildren, "Incorrect number of visible children in indicatorsRow");
110 compare(emptyIndicatorsHint.visible, data.hintVisible, "Incorrect emptyIndicatorsHint's visibility");
111 }
112
113 BottomEdgeIndicators {
114 id: indicators
115 }
116}

Subscribers

People subscribed via source and target branches