Merge lp:~abreu-alexandre/ubuntu-html5-theme/add-ubuntu-api-bindings-to-container into lp:ubuntu-html5-theme

Proposed by Alexandre Abreu
Status: Merged
Approved by: Robert Bruce Park
Approved revision: 109
Merged at revision: 110
Proposed branch: lp:~abreu-alexandre/ubuntu-html5-theme/add-ubuntu-api-bindings-to-container
Merge into: lp:ubuntu-html5-theme
Diff against target: 95 lines (+45/-4)
3 files modified
debian/control (+1/-0)
src/qml/Ubuntu/WebApps/WebAppContainer.qml (+34/-2)
src/ubuntu-html5-app-launcher/main.cpp (+10/-2)
To merge this branch: bzr merge lp:~abreu-alexandre/ubuntu-html5-theme/add-ubuntu-api-bindings-to-container
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Robert Bruce Park (community) Approve
Review via email: mp+203346@code.launchpad.net

Commit message

Expose Ubuntu API bindings to HTML5 applications

Description of the change

Expose Ubuntu API bindings to HTML5 applications.

The "Html5 container" at the moment is made of:

- a small qml wrapper around a cordovaview object that basically allows you to open your html5 application in a webview window and have access to cordova apis (roughly),

- a small "launcher" executable that hides the qml magic bits and only exposes the index.html and the various html specific pieces to the qtcreator developer,

It was meant as some sort of a facade to the HTML5 runtime environment and to the various API extensions that we provide.

With this change, we bring the Ubuntu APIs to the set of available APIs to the HTML5 developer. The QML component expands a bit and acts as a bridge between cordova and the extra ubuntu apis.

In order to test it, one needs:

- trunk of cordova 2.8 (or the one from the campo ppa https://launchpad.net/~campo/+archive/1.0?field.series_filter=trusty)

- this branch of unity-webapps-qml https://code.launchpad.net/~abreu-alexandre/unity-webapps-qml/ubuntu-api-bindings-generation/+merge/203342 (or the one from the campo ppa https://launchpad.net/~campo/+archive/1.0?field.series_filter=trusty)

then:

bzr branch lp:~abreu-alexandre/ubuntu-html5-theme/add-ubuntu-api-bindings-to-container
bzr branch lp:~abreu-alexandre/unity-webapps-qml/ubuntu-api-bindings-generation
cd add-ubuntu-api-bindings-to-container/src/ubuntu-html5-app-launcher
./ubuntu-html5-app-launcher --www=../../../ubuntu-api-bindings-generation/examples/api-bindings/alarm/www

You should be able to set an alarm (hence have access to the ubuntu APIs from the container in addition to the cordova ones)

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
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
108. By Robert Bruce Park

Rename ubuntu-html5-theme binary package to ubuntu-html5-ui-toolkit.

Approved by PS Jenkins bot, Alexandre Abreu.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
109. By Alexandre Abreu

resolve conflicts

Revision history for this message
Robert Bruce Park (robru) wrote :

lgtm

review: Approve
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 'debian/control'
2--- debian/control 2014-01-27 18:47:29 +0000
3+++ debian/control 2014-01-28 01:21:20 +0000
4@@ -77,6 +77,7 @@
5 qtdeclarative5-cordova-2.8-plugin,
6 qtdeclarative5-qtquick2-plugin,
7 qtdeclarative5-ubuntu-ui-extras-browser-plugin,
8+ unity-webapps-qml (>= 0.1+14.04.20131106-0ubuntu2),
9 ubuntu-html5-ui-toolkit (= ${source:Version}),
10 ${misc:Depends},
11 ${python:Depends},
12
13=== modified file 'src/qml/Ubuntu/WebApps/WebAppContainer.qml'
14--- src/qml/Ubuntu/WebApps/WebAppContainer.qml 2014-01-21 21:44:42 +0000
15+++ src/qml/Ubuntu/WebApps/WebAppContainer.qml 2014-01-28 01:21:20 +0000
16@@ -19,6 +19,7 @@
17 import QtQuick 2.0
18 import Ubuntu.Components 0.1
19 import CordovaUbuntu 2.8
20+import Ubuntu.UnityWebApps 0.1
21
22
23 /*!
24@@ -38,16 +39,47 @@
25
26 The path is absolute or relative to the current dir.
27 */
28- property alias htmlIndexDirectory: view.wwwDir
29+ property alias htmlIndexDirectory: cordovaView.wwwDir
30
31 /*!
32 \internal
33 */
34 CordovaView {
35- id: view
36+ id: cordovaView
37 objectName: "view"
38
39 anchors.fill: parent
40 }
41+
42+ /*!
43+ \internal
44+ */
45+ function getUnityWebappsProxies() {
46+ return UnityWebAppsUtils.makeProxiesForQtWebViewBindee(cordovaView.mainWebview);
47+ }
48+
49+ /*!
50+ \internal
51+ */
52+ Loader {
53+ id: webappBindingsLoader
54+ visible: false
55+ anchors.fill: parent
56+ sourceComponent: cordovaView.mainWebview ? webappBindingsComponent : undefined
57+ }
58+
59+ /*!
60+ \internal
61+ */
62+ Component {
63+ id: webappBindingsComponent
64+
65+ UnityWebApps {
66+ id: webapps
67+ bindee: root
68+ injectExtraUbuntuApis: true
69+ requiresInit: false
70+ }
71+ }
72 }
73
74
75=== modified file 'src/ubuntu-html5-app-launcher/main.cpp'
76--- src/ubuntu-html5-app-launcher/main.cpp 2014-01-27 18:42:31 +0000
77+++ src/ubuntu-html5-app-launcher/main.cpp 2014-01-28 01:21:20 +0000
78@@ -35,8 +35,16 @@
79 QString importPath = Webapp::Config::getContainerImportPath();
80 if ( !importPath.isEmpty())
81 {
82- qDebug() << "Setting import path to: " << importPath;
83- qputenv("QML2_IMPORT_PATH", importPath.toLatin1());
84+ QString existingImportPath (qgetenv("QML2_IMPORT_PATH"));
85+ existingImportPath = existingImportPath.trimmed();
86+
87+ if ( ! existingImportPath.trimmed().isEmpty())
88+ existingImportPath.append(":");
89+ existingImportPath.append(importPath);
90+
91+ qDebug() << "Setting import path to: " << existingImportPath;
92+
93+ qputenv("QML2_IMPORT_PATH", existingImportPath.toLatin1());
94 }
95 }
96

Subscribers

People subscribed via source and target branches