Merge lp:~tpeeters/ubuntu-ui-toolkit/app-activeChanged into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 897
Merged at revision: 881
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/app-activeChanged
Merge into: lp:ubuntu-ui-toolkit
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/tabBar-pressed
Diff against target: 264 lines (+85/-13)
7 files modified
components.api (+2/-0)
modules/Ubuntu/Components/Header.qml (+6/-1)
modules/Ubuntu/Components/MainView.qml (+22/-0)
modules/Ubuntu/Components/Panel.qml (+20/-2)
modules/Ubuntu/Components/Tabs.qml (+8/-1)
modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml (+22/-8)
tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+5/-1)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/app-activeChanged
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Florian Boucault (community) Approve
Tim Peeters Pending
Review via email: mp+197790@code.launchpad.net

This proposal supersedes a proposal from 2013-12-02.

Commit message

Open the toolbar and tabbar (without animating) when the app is resumed.

Description of the change

Open the toolbar and tabbar (without animating) when the app is resumed.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal

Toolbar tests also fail on my maguro: https://pastebin.canonical.com/101488/

review: Needs Fixing
Revision history for this message
Tim Peeters (tpeeters) wrote : Posted in a previous version of this proposal

..but they pass on my laptop with trusty.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
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
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
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: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

I installed the packages from "PASSED: Continuous integration, rev:897" on my maguro, tested apps and ran AP tests: all good.

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

I ran some additional autopilot tests, all good:

gallery-app: https://pastebin.canonical.com/101580/
dialer-app: https://pastebin.canonical.com/101581/
webbrowser-app: https://pastebin.canonical.com/101582/

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

In modules/Ubuntu/Components/Tabs.qml, QtObject was replaced with Object. Does that work?

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

> In modules/Ubuntu/Components/Tabs.qml, QtObject was replaced with Object. Does
> that work?

Yes, Object is simply a QtObject that can have children (it has a default property set). I changed that because I added the Binding there.

Hmm.. maybe I can move the Binding out.

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

good to go

review: Approve
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) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2013-12-04 19:39:23 +0000
3+++ components.api 2013-12-05 17:29:07 +0000
4@@ -55,6 +55,7 @@
5 readonly property int status
6 modules/Ubuntu/Components/Header.qml
7 StyledItem
8+ property bool animate
9 function show()
10 function hide()
11 property string title
12@@ -238,6 +239,7 @@
13 property bool locked
14 property real hintSize
15 property real triggerSize
16+ property bool animate
17 readonly property bool animating
18 property bool __closeOnContentsClicks
19 property bool pressed
20
21=== modified file 'modules/Ubuntu/Components/Header.qml'
22--- modules/Ubuntu/Components/Header.qml 2013-07-25 11:41:10 +0000
23+++ modules/Ubuntu/Components/Header.qml 2013-12-05 17:29:07 +0000
24@@ -36,8 +36,13 @@
25 }
26 y: 0
27
28+ /*!
29+ Animate showing and hiding of the header.
30+ */
31+ property bool animate: true
32+
33 Behavior on y {
34- enabled: !(header.flickable && header.flickable.moving)
35+ enabled: animate && !(header.flickable && header.flickable.moving)
36 SmoothedAnimation {
37 duration: Ubuntu.UbuntuAnimation.BriskDuration
38 }
39
40=== modified file 'modules/Ubuntu/Components/MainView.qml'
41--- modules/Ubuntu/Components/MainView.qml 2013-12-04 19:39:23 +0000
42+++ modules/Ubuntu/Components/MainView.qml 2013-12-05 17:29:07 +0000
43@@ -292,6 +292,11 @@
44 }
45 }
46
47+ /*!
48+ Animate header and toolbar.
49+ */
50+ property bool animate: true
51+
52 Toolbar {
53 id: toolbarItem
54 onPressedChanged: {
55@@ -300,6 +305,7 @@
56 headerItem.tabBar.selectionMode = false;
57 }
58 }
59+ animate: canvas.animate
60 }
61
62 /*!
63@@ -313,6 +319,7 @@
64 objectName: "MainView_Header"
65 id: headerItem
66 property real bottomY: headerItem.y + headerItem.height
67+ animate: canvas.animate
68
69 property Item tabBar: null
70 Binding {
71@@ -336,6 +343,21 @@
72 }
73 }
74 }
75+
76+ Connections {
77+ target: Qt.application
78+ onActiveChanged: {
79+ if (Qt.application.active) {
80+ canvas.animate = false;
81+ headerItem.show();
82+ if (headerItem.tabBar) {
83+ headerItem.tabBar.selectionMode = true;
84+ }
85+ if (!toolbarItem.locked) toolbarItem.open();
86+ canvas.animate = true;
87+ }
88+ }
89+ }
90 }
91
92 /*!
93
94=== modified file 'modules/Ubuntu/Components/Panel.qml'
95--- modules/Ubuntu/Components/Panel.qml 2013-12-03 18:38:28 +0000
96+++ modules/Ubuntu/Components/Panel.qml 2013-12-05 17:29:07 +0000
97@@ -272,6 +272,19 @@
98 }
99 }
100 }
101+ // disable the timer when the application is not active to avoid closing
102+ // the panel immediately after the application becomes active again
103+ Connections {
104+ target: Qt.application
105+ onActiveChanged: {
106+ if (Qt.application.active) {
107+ hideTimer.conditionalRestart();
108+ } else {
109+ hideTimer.stop();
110+ }
111+ }
112+ }
113+
114
115 /*!
116 How much of the panel to show when the user touches the panel's edge.
117@@ -320,6 +333,11 @@
118 ]
119
120 /*!
121+ Animate transitions between the different panel states.
122+ */
123+ property bool animate: true
124+
125+ /*!
126 The toolbar is currently not in a stable hidden or visible state.
127 */
128 readonly property bool animating: draggingArea.pressed || transitionToAll.running
129@@ -360,7 +378,7 @@
130 UbuntuNumberAnimation {
131 target: bar
132 properties: "position"
133- duration: Toolkit.UbuntuAnimation.SnapDuration
134+ duration: panel.animate ? Toolkit.UbuntuAnimation.SnapDuration : 0
135 }
136 }
137 ]
138@@ -375,7 +393,7 @@
139 The duration in milliseconds of sliding in or out transitions when opening, closing, and showing the hint.
140 Default value: 250
141 */
142- property real transitionDuration: Toolkit.UbuntuAnimation.FastDuration
143+ property real transitionDuration: panel.animate ? Toolkit.UbuntuAnimation.FastDuration : 0
144
145 property string previousState: ""
146 property int movingDelta
147
148=== modified file 'modules/Ubuntu/Components/Tabs.qml'
149--- modules/Ubuntu/Components/Tabs.qml 2013-11-27 14:25:47 +0000
150+++ modules/Ubuntu/Components/Tabs.qml 2013-12-05 17:29:07 +0000
151@@ -282,10 +282,17 @@
152 }
153 }
154
155- QtObject {
156+ Object {
157 id: internal
158 property Header header: tabs.__propagated ? tabs.__propagated.header : null
159
160+ Binding {
161+ target: tabBar
162+ property: "animate"
163+ when: internal.header && internal.header.hasOwnProperty("animate")
164+ value: internal.header.animate
165+ }
166+
167 /*
168 List of connected Repeaters to avoid repeater "hammering" of itemAdded() signal.
169 */
170
171=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml'
172--- modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2013-12-04 20:42:41 +0000
173+++ modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2013-12-05 17:29:07 +0000
174@@ -318,23 +318,36 @@
175 }
176
177 onDragEnded: {
178- activatingTimer.stop();
179 // unset interacting which was set in mouseArea.onPressed
180 mouseArea.interacting = false;
181 }
182
183- // deactivate the tab bar after inactivity
184- onMovementStarted: idleTimer.stop()
185- onMovementEnded: {
186- if (!styledItem.alwaysSelectionMode) {
187- idleTimer.restart();
188- }
189- }
190 Timer {
191 id: idleTimer
192 interval: tabBarStyle.deactivateTime
193 running: styledItem.selectionMode && !styledItem.alwaysSelectionMode
194 onTriggered: styledItem.selectionMode = false
195+ function conditionalRestartOrStop() {
196+ if (Qt.application.active &&
197+ styledItem.selectionMode &&
198+ !styledItem.alwaysSelectionMode &&
199+ !mouseArea.interacting) {
200+ idleTimer.restart();
201+ } else {
202+ idleTimer.stop();
203+ }
204+ }
205+ }
206+
207+ // disable the timer when the application is not active and reset
208+ // it when the application is resumed.
209+ Connections {
210+ target: Qt.application
211+ onActiveChanged: idleTimer.conditionalRestartOrStop()
212+ }
213+ Connections {
214+ target: styledItem
215+ onSelectionModeChanged: idleTimer.conditionalRestartOrStop()
216 }
217 }
218
219@@ -347,6 +360,7 @@
220 // because after not accepting the mouse, the released event will go to
221 // the buttonView or individual buttons.
222 property bool interacting: false
223+ onInteractingChanged: idleTimer.conditionalRestartOrStop()
224
225 // This MouseArea is always enabled, even when the tab bar is in selection mode,
226 // so that press events are detected and tabBarStyle.pressed is updated.
227
228=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py'
229--- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-11-18 15:50:40 +0000
230+++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2013-12-05 17:29:07 +0000
231@@ -181,7 +181,8 @@
232 def setUp(self):
233 super(ToolbarTestCase, self).setUp()
234 self.toolbar = self.main_view.get_toolbar()
235- self.assertFalse(self.toolbar.opened)
236+ # toolbar may be opened or closed now, depending on whether
237+ # the application has been deactivated and resumed already
238
239 def test_open_toolbar(self):
240 self.toolbar.open()
241@@ -204,6 +205,7 @@
242 self.assertFalse(self.toolbar.animating)
243
244 def test_closed_toolbar_is_not_closed_again(self):
245+ self.toolbar.close()
246 with mock.patch.object(
247 self.main_view.pointing_device, 'drag') as mock_drag:
248 self.toolbar.close()
249@@ -212,6 +214,7 @@
250 self.assertFalse(self.toolbar.opened)
251
252 def test_click_toolbar_button(self):
253+ self.toolbar.close()
254 label = self.app.select_single('Label', objectName='clicked_label')
255 self.assertNotEqual(label.text, 'Button clicked.')
256 self.toolbar.open()
257@@ -227,6 +230,7 @@
258 str(error), 'Button with objectName "unexisting" not found.')
259
260 def test_click_button_on_closed_toolbar(self):
261+ self.toolbar.close()
262 error = self.assertRaises(
263 emulators.ToolkitEmulatorException, self.toolbar.click_button,
264 'buttonName')

Subscribers

People subscribed via source and target branches

to status/vote changes: