Merge lp:~kalikiana/ubuntu-ui-toolkit/windowmagic into lp:ubuntu-ui-toolkit

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 836
Merged at revision: 834
Proposed branch: lp:~kalikiana/ubuntu-ui-toolkit/windowmagic
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 48 lines (+23/-10)
1 file modified
modules/Ubuntu/Components/OrientationHelper.qml (+23/-10)
To merge this branch: bzr merge lp:~kalikiana/ubuntu-ui-toolkit/windowmagic
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Pat McGowan (community) tested on device Approve
Tim Peeters Approve
Review via email: mp+195367@code.launchpad.net

Commit message

Track magic window with a property signal instead of defining it

To post a comment you must log in.
Revision history for this message
Tim Peeters (tpeeters) wrote :

Can make __windowActive really internal by putting it inside an Item?

The functions can also be put inside the internal item.

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

Code looks good.

review: Approve
Revision history for this message
Pat McGowan (pat-mcgowan) wrote :

Works on Mako in environment bug was reported against.

review: Approve (tested on device)
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 'modules/Ubuntu/Components/OrientationHelper.qml'
2--- modules/Ubuntu/Components/OrientationHelper.qml 2013-10-31 16:19:41 +0000
3+++ modules/Ubuntu/Components/OrientationHelper.qml 2013-11-15 12:22:48 +0000
4@@ -91,21 +91,34 @@
5
6 Component.onCompleted: orientationTransition.enabled = transitionEnabled
7
8- /*!
9- Technically 'window' is defined by QML automatically however this can
10- happen very late. We define it here so there's no race condition.
11- */
12- Window {
13- id: window
14+ Object {
15+ id: internal
16+
17+ /*!
18+ 'window' is defined by QML between startup and showing on the screen.
19+ There is no signal for when it becomes available and re-declaring it is not safe.
20+
21+ http://qt-project.org/doc/qt-5.1/qtqml/qml-qtqml2-qt.html
22+ http://qt-project.org/doc/qt-5.1/qtquick/qmlmodule-qtquick-window2-qtquick-window-2.html
23+ */
24+ property bool windowActive: typeof window != 'undefined'
25+
26+ /*!
27+ Report the current orientation of the application via QWindow::contentOrientation.
28+ http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop
29+ */
30+ function applyOrientation() {
31+ if (windowActive)
32+ window.contentOrientation = Screen.orientation
33+ }
34+
35+ onWindowActiveChanged: applyOrientation()
36 }
37
38 /*!
39 \internal
40-
41- Report the current orientation of the application via QWindow::contentOrientation.
42- http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop
43 */
44- onOrientationAngleChanged: window.contentOrientation = Screen.orientation
45+ onOrientationAngleChanged: internal.applyOrientation()
46
47 Item {
48 id: stateWrapper

Subscribers

People subscribed via source and target branches

to status/vote changes: