on xenial help sign in
Add env var to enable js debugging/profiling even if not built on debug mode

Approved by: Michael Zanetti

commit09963e8c8dec072649ea1cc93ce137cd948836f5 authorAlbert Astals Cid <albert.astals@canonical.com> dateWed 27 Apr 2016, 14:59 (10 years ago) parent3709fdcd9760d3
3 files changed+43
src/Dash/main.cpp+5 src/main.cpp+5 src/qmldebuggerutils.h+33
src/Dash/main.cpp+5
@@ -27,6 +27,7 @@
2727#include <libintl.h>
2828
2929#include <paths.h>
30+#include "../qmldebuggerutils.h"
3031#ifdef UNITY8_ENABLE_TOUCH_EMULATION
3132 #include "../MouseTouchAdaptor.h"
3233#endif
@@ -34,6 +35,10 @@
3435
3536int main(int argc, const char *argv[])
3637{
38+ if (enableQmlDebugger(argc, argv)) {
39+ QQmlDebuggingEnabler qQmlEnableDebuggingHelper(true);
40+ }
41+
3742 QGuiApplication *application = new QGuiApplication(argc, (char**)argv);
3843
3944 QCommandLineParser parser;
src/main.cpp+5
@@ -16,6 +16,7 @@
1616
1717// local
1818#include "ShellApplication.h"
19+#include "qmldebuggerutils.h"
1920
2021int main(int argc, const char *argv[])
2122{
@@ -25,6 +26,10 @@ int main(int argc, const char *argv[])
2526 isMirServer = true;
2627 }
2728
29+ if (enableQmlDebugger(argc, argv)) {
30+ QQmlDebuggingEnabler qQmlEnableDebuggingHelper(true);
31+ }
32+
2833 ShellApplication *application = new ShellApplication(argc, (char**)argv, isMirServer);
2934
3035 int result = application->exec();
src/qmldebuggerutils.hnew file+33
@@ -0,0 +1,33 @@
1+/*
2+ * Copyright (C) 2016 Canonical, Ltd.
3+ *
4+ * This program is free software; you can redistribute it and/or modify
5+ * it under the terms of the GNU General Public License as published by
6+ * the Free Software Foundation; version 3.
7+ *
8+ * This program is distributed in the hope that it will be useful,
9+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
10+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+ * GNU General Public License for more details.
12+ *
13+ * You should have received a copy of the GNU General Public License
14+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
15+ */
16+
17+#ifndef QMLDEBUGGERUTILS_H
18+#define QMLDEBUGGERUTILS_H
19+
20+bool enableQmlDebugger(int argc, const char *argv[])
21+{
22+ for (int i = 1; i < argc; ++i) {
23+ QByteArray arg = argv[i];
24+ if (arg.startsWith("--"))
25+ arg.remove(0, 1);
26+ if (arg.startsWith("-qmljsdebugger=") || (arg == "-qmljsdebugger" && i < argc - 1)) {
27+ return true;
28+ }
29+ }
30+ return false;
31+}
32+
33+#endif