Merge lp:~abreu-alexandre/ubuntu-html5-theme/control-automatic-orientation-of-app into lp:ubuntu-html5-theme

Proposed by Alexandre Abreu
Status: Work in progress
Proposed branch: lp:~abreu-alexandre/ubuntu-html5-theme/control-automatic-orientation-of-app
Merge into: lp:ubuntu-html5-theme
Diff against target: 78 lines (+23/-1)
2 files modified
src/plugin/Ubuntu/WebApps/WebAppContainer.qml (+8/-1)
src/ubuntu-html5-app-launcher/main.cpp (+15/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/ubuntu-html5-theme/control-automatic-orientation-of-app
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Ubuntu HTML5 Theme Developers Pending
Review via email: mp+208053@code.launchpad.net

Commit message

Allow control of automatic orientation of the app

Description of the change

Allow control of automatic orientation of the app.

To test it in the device:

bzr branch lp:~abreu-alexandre/ubuntu-html5-theme/control-automatic-orientation-of-app
cd control-automatic-orientation-of-app
cmake .
make
cd src/ubuntu-html5-app-launcher
QML2_IMPORT_PATH=`pwd`/../src ./ubuntu-html5-app-launcher --www=../../examples/html5-theme/apps/rss-reader/ --desktop_file_hint=/usr/share/applications/webbrowser-app.desktop

-> you should be able when rotating the device to see the app screen rotate too

QML2_IMPORT_PATH=`pwd`/../src ./ubuntu-html5-app-launcher --disableAutomaticOrientation --www=../../examples/html5-theme/apps/rss-reader/ --desktop_file_hint=/usr/share/applications/webbrowser-app.desktop

-> you should NOT be able when rotating the device to see the app screen rotate too

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
David Barth (dbarth) wrote :

Feels like a race condition solved by a different initialization path.

I'm not sure the command line option really makes sense but for tests though: can you remove it? less code is better.

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> Feels like a race condition solved by a different initialization path.
>
> I'm not sure the command line option really makes sense but for tests though:
> can you remove it? less code is better.

Not sure I understand the comment, ... this is a new command line arg & option
... that's it,

Revision history for this message
David Barth (dbarth) wrote :

Le 25/02/2014 14:35, Alexandre Abreu a écrit :
>> Feels like a race condition solved by a different initialization path.
>>
>> I'm not sure the command line option really makes sense but for tests though:
>> can you remove it? less code is better.
> Not sure I understand the comment, ... this is a new command line arg & option
> ... that's it,
right, but less is better: more options means more code and backward
compatibility overhead in the future.

David

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> Le 25/02/2014 14:35, Alexandre Abreu a écrit :
> >> Feels like a race condition solved by a different initialization path.
> >>
> >> I'm not sure the command line option really makes sense but for tests
> though:
> >> can you remove it? less code is better.
> > Not sure I understand the comment, ... this is a new command line arg &
> option
> > ... that's it,

> right, but less is better: more options means more code and backward
> compatibility overhead in the future.

atm there is no way for dev, to specify that their apps runs & supports
automatic rotation or not ... which is something lacking. This is not
just for the sake of adding a setting, but something provided by
other platforms that we dont support & I saw a need for while working on
html5 apps

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

I did set up as WIP since I want to add something else

Unmerged revisions

147. By Alexandre Abreu

Allow control of automatic orientation of the app

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/plugin/Ubuntu/WebApps/WebAppContainer.qml'
2--- src/plugin/Ubuntu/WebApps/WebAppContainer.qml 2014-02-18 15:44:48 +0000
3+++ src/plugin/Ubuntu/WebApps/WebAppContainer.qml 2014-02-25 01:36:43 +0000
4@@ -31,7 +31,12 @@
5 id: root
6 objectName: "root"
7
8- automaticOrientation: true
9+ /*!
10+ \preliminary
11+ The property enables or disables the automatic rotation of the application screen based on the
12+ device's orientation.
13+ */
14+ property bool allowAutomaticOrientation: true
15
16 /*!
17 \preliminary
18@@ -42,6 +47,8 @@
19 */
20 property alias htmlIndexDirectory: cordovaWebviewProvider.htmlIndexDirectory
21
22+ automaticOrientation: allowAutomaticOrientation
23+
24 Page {
25 id: mainPage
26 anchors.fill: parent
27
28=== modified file 'src/ubuntu-html5-app-launcher/main.cpp'
29--- src/ubuntu-html5-app-launcher/main.cpp 2014-02-19 21:23:07 +0000
30+++ src/ubuntu-html5-app-launcher/main.cpp 2014-02-25 01:36:43 +0000
31@@ -87,6 +87,8 @@
32 out << " -h, --help display this help message and exit" << endl;
33 out << " --www=PATH relative or absolute path to the 'index.html' root file" << endl;
34 out << " --maximized maximize the app window at startup time" << endl;
35+ out << " --disableAutomaticOrientation disables the automatic orientation"
36+ << " of the application screen based on the device's orientation" << endl;
37 out << " --inspector run a remote inspector on port "
38 << REMOTE_INSPECTOR_PORT << endl;
39 }
40@@ -104,12 +106,14 @@
41
42 const QString WWW_LOCATION_ARG_HEADER = "--www=";
43 const QString MAXIMIZED_ARG_HEADER = "--maximized";
44+ const QString DISABLE_AUTO_ORIENTATION_ARG_HEADER = "--disableAutomaticOrientation";
45 const QString ARG_HEADER = "--";
46 const QString VALUE_HEADER = "=";
47 const QString INSPECTOR = "--inspector";
48
49 QString wwwfolderArg;
50 bool maximized = false;
51+ bool disableAutomaticOrientation = false;
52
53 QStringList arguments = app.arguments();
54 arguments.pop_front();
55@@ -126,6 +130,11 @@
56 maximized = true;
57 }
58 else
59+ if (argument.contains(DISABLE_AUTO_ORIENTATION_ARG_HEADER))
60+ {
61+ disableAutomaticOrientation = true;
62+ }
63+ else
64 if (argument.contains(INSPECTOR))
65 {
66 QString host;
67@@ -196,6 +205,12 @@
68 }
69 view.rootObject()->setProperty("htmlIndexDirectory", wwwFolder.canonicalFilePath());
70
71+ if (disableAutomaticOrientation)
72+ {
73+ qDebug() << "Disabling automatic orientation";
74+ view.rootObject()->setProperty("allowAutomaticOrientation", false);
75+ }
76+
77 view.setTitle(QCoreApplication::applicationName());
78 view.setResizeMode(QQuickView::SizeRootObjectToView);
79

Subscribers

People subscribed via source and target branches