Merge lp:~abreu-alexandre/qtcreator-plugin-ubuntu/html5-run-desktop into lp:qtcreator-plugin-ubuntu

Proposed by Alexandre Abreu
Status: Work in progress
Proposed branch: lp:~abreu-alexandre/qtcreator-plugin-ubuntu/html5-run-desktop
Merge into: lp:qtcreator-plugin-ubuntu
Diff against target: 72 lines (+34/-5)
3 files modified
src/ubuntu/ubuntuconstants.h (+2/-0)
src/ubuntu/ubuntulocalrunconfiguration.cpp (+24/-3)
src/ubuntu/ubuntumenu.cpp (+8/-2)
To merge this branch: bzr merge lp:~abreu-alexandre/qtcreator-plugin-ubuntu/html5-run-desktop
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+269765@code.launchpad.net

Commit message

Fix running html5 app on the host machine. The exec launcher selection is based on the policy version since it has changed between 1.2 and 1.3 from html5-app-launcher to webapp-container.

Description of the change

Fix running html5 app on the host machine. The exec launcher selection is based on the policy version since it has changed between 1.2 and 1.3 from html5-app-launcher to webapp-container.

To post a comment you must log in.

Unmerged revisions

412. By Alexandre Abreu

Handle run html5 apps on desktop

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntu/ubuntuconstants.h'
2--- src/ubuntu/ubuntuconstants.h 2015-08-10 15:36:37 +0000
3+++ src/ubuntu/ubuntuconstants.h 2015-09-01 15:02:38 +0000
4@@ -158,6 +158,8 @@
5 const char UBUNTUHTML_PROJECT_LAUNCHER_EXE[] = "ubuntu-html5-app-launcher";
6 const char UBUNTUWEBAPP_PROJECT_LAUNCHER_EXE[] = "webapp-container";
7 const char UBUNTUSCOPES_PROJECT_LAUNCHER_EXE[] = "qtc_desktop_scoperunner.py";
8+
9+const char UBUNTUHTML_WEBAPP_CONTAINER_POLICY_MIN[] = "1.3";
10
11 const char UBUNTU_PROJECT_WIZARD_CATEGORY_DISPLAY[] = QT_TRANSLATE_NOOP("ProjectExplorer", "Ubuntu");
12
13
14=== modified file 'src/ubuntu/ubuntulocalrunconfiguration.cpp'
15--- src/ubuntu/ubuntulocalrunconfiguration.cpp 2015-06-30 13:34:14 +0000
16+++ src/ubuntu/ubuntulocalrunconfiguration.cpp 2015-09-01 15:02:38 +0000
17@@ -449,10 +449,31 @@
18 if (ubuntuProject) {
19 m_workingDir = ubuntuProject->projectDirectory();
20 if (ubuntuProject->mainFile().compare(QString::fromLatin1("www/index.html"), Qt::CaseInsensitive) == 0) {
21+ QString manifestFilePath =
22+ UbuntuProjectHelper::getManifestPath (target(),
23+ QStringLiteral("manifest.json"));
24+
25 Utils::Environment env = Utils::Environment::systemEnvironment();
26- m_executable = env.searchInPath(QString::fromLatin1(Ubuntu::Constants::UBUNTUHTML_PROJECT_LAUNCHER_EXE)).toString();
27- m_args = QStringList()<<QString::fromLatin1("--www=%0/www").arg(ubuntuProject->projectDirectory().toString())
28- <<QString::fromLatin1("--inspector");
29+
30+ UbuntuClickManifest manifest;
31+ if (QFile::exists(manifestFilePath)
32+ && manifest.load(manifestFilePath)
33+ && manifest.policyVersion() >= QString::fromLatin1(Ubuntu::Constants::UBUNTUHTML_WEBAPP_CONTAINER_POLICY_MIN)) {
34+ m_executable =
35+ env.searchInPath(QString::fromLatin1(Ubuntu::Constants::UBUNTUWEBAPP_PROJECT_LAUNCHER_EXE)).toString();
36+ m_args = QStringList()
37+ << QString::fromLatin1("%0/www/index.html")
38+ .arg(ubuntuProject->projectDirectory().toString());
39+ } else {
40+ m_executable =
41+ env.searchInPath(QString::fromLatin1(Ubuntu::Constants::UBUNTUHTML_PROJECT_LAUNCHER_EXE)).toString();
42+ m_args = QStringList()
43+ << QString::fromLatin1("--www=%0/www")
44+ .arg(ubuntuProject->projectDirectory().toString());
45+ }
46+
47+ m_args << QString::fromLatin1("--inspector");
48+
49 } else if (ubuntuProject->mainFile().endsWith(QStringLiteral(".desktop"), Qt::CaseInsensitive)) {
50 Utils::Environment env = Utils::Environment::systemEnvironment();
51
52
53=== modified file 'src/ubuntu/ubuntumenu.cpp'
54--- src/ubuntu/ubuntumenu.cpp 2015-06-19 07:22:31 +0000
55+++ src/ubuntu/ubuntumenu.cpp 2015-09-01 15:02:38 +0000
56@@ -673,8 +673,14 @@
57 }
58
59 if (isProperUbuntuHtmlProject(project)) {
60- command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_APP_RUNNER_EXECNAME),
61- QLatin1String(Constants::UBUNTUHTML_PROJECT_LAUNCHER_EXE));
62+ QString launcherExec =
63+ QLatin1String(Constants::UBUNTUHTML_PROJECT_LAUNCHER_EXE);
64+ if (manifest.isInitialized()
65+ && manifest.policyVersion() >= QLatin1String(Constants::UBUNTUHTML_WEBAPP_CONTAINER_POLICY_MIN)) {
66+ launcherExec = QLatin1String(Constants::UBUNTUWEBAPP_PROJECT_LAUNCHER_EXE);
67+ }
68+
69+ command = command.replace(QLatin1String(Constants::UBUNTU_ACTION_APP_RUNNER_EXECNAME), launcherExec);
70 }
71
72 QVariant clickTargetRequired = act->property(Constants::UBUNTU_MENUJSON_CLICKTARGETREQUIRED);

Subscribers

People subscribed via source and target branches