Merge lp:~tpeeters/ubuntu-ui-toolkit/panel-open-close into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Tim Peeters
Approved revision: 747
Merged at revision: 747
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/panel-open-close
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 180 lines (+62/-13)
5 files modified
CHANGES (+3/-0)
components.api (+2/-0)
modules/Ubuntu/Components/Panel.qml (+45/-7)
modules/Ubuntu/Components/Toolbar.qml (+9/-3)
tests/unit_x11/tst_components/tst_panel.qml (+3/-3)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/panel-open-close
Reviewer Review Type Date Requested Status
Tim Peeters Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+183892@code.launchpad.net

Description of the change

Add Panel.open() and Panel.close() functions so that applications can be adapted to use those instead of setting Panel.opened. The behavior of the panel was not changed, this will be done in a following MR.

Also note that applications with a Toolbar do not need to use Panel.open()/close()/opened directly, they can use the opened property of the Page.tools, so they should not be affected by the upcoming changes.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (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: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

Results of autopilot run gallery_app on device with the gallery_app from this MR https://code.launchpad.net/~amanzi-team/gallery-app/gallery-app-actions-api/+merge/184533 (will be merged to gallery trunk soon): all PASSED

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

Ran autopilot tests for webbrowser-app, all 36 tests PASSED.

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

Autopilot tests for notes-app finished all 23 successfully.

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

This MR was happroved before, but I set it back to "needs review" so I could run these tests again. I verified that they work fine with the pending touch image of 10 Sept, so now I'll happrove it again so we will have it in in the morning of 11 Sept.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2013-09-03 10:51:40 +0000
3+++ CHANGES 2013-09-10 11:22:01 +0000
4@@ -50,6 +50,9 @@
5 * ADDED IN MainView: property bool anchorToKeyboard
6 * CHANGED IN Tabs: property Component __headerContents TO property TabBar tabBar
7 * CHANGED IN Header: property Component contents TO property Item contents
8+* ADDED IN Panel: function open()
9+* ADDED IN Panel: function closed()
10+* DEPRECATED IN Panel: writable property opened. Will be made read-only.
11
12 Compatibility Breaks
13 ********************
14
15=== modified file 'components.api'
16--- components.api 2013-09-03 10:51:40 +0000
17+++ components.api 2013-09-10 11:22:01 +0000
18@@ -158,6 +158,8 @@
19 default property list<Object> contents
20 property int align
21 property bool opened
22+ function open()
23+ function close()
24 property bool locked
25 property real hintSize
26 property real triggerSize
27
28=== modified file 'modules/Ubuntu/Components/Panel.qml'
29--- modules/Ubuntu/Components/Panel.qml 2013-09-03 10:51:40 +0000
30+++ modules/Ubuntu/Components/Panel.qml 2013-09-10 11:22:01 +0000
31@@ -178,8 +178,36 @@
32 property bool opened: false
33 /*! \internal */
34 onOpenedChanged: {
35- if (opened) state = "spread";
36- else state = "";
37+ if (internal.openedChangedWarning) {
38+ console.log("DEPRECATED use of Panel.opened property. This property will be made read-only,
39+ please use the opened property of the Page tools or use Panel.open() and Panel.close().");
40+ }
41+
42+ if (opened) {
43+ panel.open();
44+ } else {
45+ panel.close();
46+ }
47+
48+ internal.openedChangedWarning = true;
49+ }
50+
51+ /*!
52+ Open the panel
53+ */
54+ function open() {
55+ internal.openedChangedWarning = false;
56+ panel.state = "spread";
57+ opened = true;
58+ }
59+
60+ /*!
61+ Close the panel
62+ */
63+ function close() {
64+ internal.openedChangedWarning = false;
65+ panel.state = "";
66+ opened = false;
67 }
68
69 /*!
70@@ -288,6 +316,9 @@
71 QtObject {
72 id: internal
73
74+ // FIXME: Remove when opened property is made readonly
75+ property bool openedChangedWarning: true
76+
77 /*!
78 The duration in milliseconds of sliding in or out transitions when opening, closing, and showing the hint.
79 Default value: 250
80@@ -332,11 +363,18 @@
81 if (bottomBarVisibilityCommunicator.forceHidden) {
82 internal.savedLocked = panel.locked;
83 internal.savedOpened = panel.opened;
84- panel.opened = false;
85+ panel.close();
86 panel.locked = true;
87 } else { // don't force hidden
88 panel.locked = internal.savedLocked;
89- if (internal.savedLocked) panel.opened = internal.savedOpened;
90+
91+ if (internal.savedLocked) {
92+ if (internal.savedOpened) {
93+ panel.open();
94+ } else {
95+ panel.close();
96+ }
97+ }
98 // if the panel was locked, do not slide it back in
99 // until the user performs an edge swipe.
100 }
101@@ -350,9 +388,9 @@
102 } else if (state == "moving" && internal.previousState == "spread") {
103 internal.movingDelta = draggingArea.initialPosition;
104 } else if (state == "spread") {
105- panel.opened = true;
106+ panel.open();
107 } else if (state == "") {
108- panel.opened = false;
109+ panel.close();
110 }
111 internal.previousState = state;
112 }
113@@ -363,7 +401,7 @@
114 mouse.accepted = false;
115 // the mouse click may cause an update
116 // of locked by the clicked Item behind
117- if (!panel.locked) panel.opened = false;
118+ if (!panel.locked) panel.close();
119 }
120 propagateComposedEvents: true
121 visible: panel.locked == false && panel.state == "spread"
122
123=== modified file 'modules/Ubuntu/Components/Toolbar.qml'
124--- modules/Ubuntu/Components/Toolbar.qml 2013-09-03 10:51:40 +0000
125+++ modules/Ubuntu/Components/Toolbar.qml 2013-09-10 11:22:01 +0000
126@@ -46,12 +46,12 @@
127 && tools.opened && tools.locked) {
128 // toolbar is locked in visible state.
129 internal.updateVisibleTools();
130- opened = true;
131+ toolbar.open();
132 } else if (!opened && !animating) {
133 // toolbar is closed
134 internal.updateVisibleTools();
135 } else {
136- opened = false;
137+ toolbar.close()
138 // internal.visibleTools will be updated
139 // when the hide animation is finished
140 }
141@@ -72,7 +72,13 @@
142 Connections {
143 target: tools
144 ignoreUnknownSignals: true
145- onOpenedChanged: toolbar.opened = tools.opened;
146+ onOpenedChanged: {
147+ if (tools.opened) {
148+ toolbar.open();
149+ } else {
150+ toolbar.close();
151+ }
152+ }
153 onLockedChanged: toolbar.locked = tools.locked;
154 }
155
156
157=== modified file 'tests/unit_x11/tst_components/tst_panel.qml'
158--- tests/unit_x11/tst_components/tst_panel.qml 2013-09-03 10:51:40 +0000
159+++ tests/unit_x11/tst_components/tst_panel.qml 2013-09-10 11:22:01 +0000
160@@ -58,9 +58,9 @@
161 }
162
163 function test_opened() {
164- panel.opened = true;
165+ panel.open();
166 compare(panel.opened, true, "Can set opened");
167- panel.opened = false;
168+ panel.close();
169 compare(panel.opened, false, "Can unset opened");
170 }
171
172@@ -241,7 +241,7 @@
173 }
174
175 function test_clickToDeactivate() {
176- panel.opened = true;
177+ panel.open();
178 compare(panel.opened && panel.align === Qt.AlignBottom, true, "Panel is opened and bottom-aligned");
179 mouseClick(root, root.width / 2, 5, Qt.LeftButton);
180 compare(panel.opened, false, "Panel is deactivated by clicking in the view outside of the panel");

Subscribers

People subscribed via source and target branches

to status/vote changes: