Merge lp:~dbarth/ubuntu-html5-theme/app-launcher.inspector-support into lp:ubuntu-html5-theme

Proposed by David Barth
Status: Merged
Approved by: David Barth
Approved revision: 107
Merged at revision: 107
Proposed branch: lp:~dbarth/ubuntu-html5-theme/app-launcher.inspector-support
Merge into: lp:ubuntu-html5-theme
Diff against target: 57 lines (+22/-0)
2 files modified
src/ubuntu-html5-app-launcher/config.h.in (+2/-0)
src/ubuntu-html5-app-launcher/main.cpp (+20/-0)
To merge this branch: bzr merge lp:~dbarth/ubuntu-html5-theme/app-launcher.inspector-support
Reviewer Review Type Date Requested Status
Olivier Tilloy (community) Approve
PS Jenkins bot continuous-integration Approve
Ubuntu HTML5 Theme Developers Pending
Review via email: mp+202728@code.launchpad.net

Commit message

add --inspector argument to turn on a web inspector server and debug html5 apps

Description of the change

add --inspector argument to turn on a web inspector server and debug html5 apps.

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
Olivier Tilloy (osomon) wrote :

Looks good to me (how would it not, I originally wrote that code ;)).
You might want to add a comment to state that this code comes from lp:webbrowser-app, in case it changes there, it will be easier to track the changes and import them.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/ubuntu-html5-app-launcher/config.h.in'
2--- src/ubuntu-html5-app-launcher/config.h.in 2014-01-21 21:44:42 +0000
3+++ src/ubuntu-html5-app-launcher/config.h.in 2014-01-22 18:17:46 +0000
4@@ -23,6 +23,8 @@
5 #include <QtCore/QDir>
6 #include <QtCore/QString>
7
8+#define REMOTE_INSPECTOR_PORT 9221
9+
10 namespace Webapp {
11
12 namespace Config {
13
14=== modified file 'src/ubuntu-html5-app-launcher/main.cpp'
15--- src/ubuntu-html5-app-launcher/main.cpp 2013-12-11 17:01:11 +0000
16+++ src/ubuntu-html5-app-launcher/main.cpp 2014-01-22 18:17:46 +0000
17@@ -19,6 +19,7 @@
18 #include "config.h"
19
20 #include <QGuiApplication>
21+#include <QtNetwork/QNetworkInterface>
22 #include <QtQuick/QQuickItem>
23 #include <QtQuick/QQuickView>
24 #include <QDebug>
25@@ -52,6 +53,7 @@
26 const QString MAXIMIZED_ARG_HEADER = "--maximized";
27 const QString ARG_HEADER = "--";
28 const QString VALUE_HEADER = "=";
29+ const QString INSPECTOR = "--inspector";
30
31 QHash<QString, QString> properties;
32 QString wwwfolder;
33@@ -92,6 +94,24 @@
34 properties.insert(property, value);
35 }
36 else
37+ if (argument.contains(INSPECTOR))
38+ {
39+ QString host;
40+ Q_FOREACH(QHostAddress address, QNetworkInterface::allAddresses()) {
41+ if (!address.isLoopback() && (address.protocol() == QAbstractSocket::IPv4Protocol)) {
42+ host = address.toString();
43+ break;
44+ }
45+ }
46+ QString server;
47+ if (host.isEmpty()) {
48+ server = QString::number(REMOTE_INSPECTOR_PORT);
49+ } else {
50+ server = QString("%1:%2").arg(host, QString::number(REMOTE_INSPECTOR_PORT));
51+ }
52+ qputenv("QTWEBKIT_INSPECTOR_SERVER", server.toUtf8());
53+ }
54+ else
55 {
56 qDebug() << "Ignoring argument: " << argument;
57 }

Subscribers

People subscribed via source and target branches