summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto.qnx@kdab.com>2012-03-26 11:55:58 -0700
committerQt by Nokia <qt-info@nokia.com>2012-04-20 18:32:24 +0200
commit8599a0e6397391634ee52197e164f6b7121f9a4d (patch)
tree16a88bbe99f83ec30358e107cfb20004a395ed19 /src/corelib/kernel
parent2e897ab99413bb1e4fd3f057f431785e3ac7abb0 (diff)
Moved qmljs_debug_arguments to QCoreApplication
Enable the use of the QML debugger without QtGUI Based on Qt5's 9a096d9e. Change-Id: If97502bc5367e0faadfaf3bbe70b0c89ef2c75c2 Reviewed-by: Kai Koehne <kai.koehne@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp31
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h3
2 files changed, 34 insertions, 0 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index bee95eb0aa..2654a6cb62 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -217,6 +217,30 @@ bool QCoreApplicationPrivate::checkInstance(const char *function)
return b;
}
+Q_GLOBAL_STATIC(QString, qmljs_debug_arguments);
+
+void QCoreApplicationPrivate::processCommandLineArguments()
+{
+ int j = argc ? 1 : 0;
+ for (int i = 1; i < argc; ++i) {
+ if (argv[i] && *argv[i] != '-') {
+ argv[j++] = argv[i];
+ continue;
+ }
+ QByteArray arg = argv[i];
+ if (arg.startsWith("-qmljsdebugger=")) {
+ *qmljs_debug_arguments() = QString::fromLocal8Bit(arg.right(arg.length() - 15));
+ } else {
+ argv[j++] = argv[i];
+ }
+ }
+
+ if (j < argc) {
+ argv[j] = 0;
+ argc = j;
+ }
+}
+
// Support for introspection
QSignalSpyCallbackSet Q_CORE_EXPORT qt_signal_spy_callback_set = { 0, 0, 0, 0 };
@@ -497,6 +521,11 @@ void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
#endif
}
+QString QCoreApplicationPrivate::qmljsDebugArguments()
+{
+ return *qmljs_debug_arguments();
+}
+
QString qAppName()
{
if (!QCoreApplicationPrivate::checkInstance("qAppName"))
@@ -742,6 +771,8 @@ void QCoreApplication::init()
}
#endif
+ d->processCommandLineArguments();
+
qt_startup_hook();
}
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 61b334d2cf..f167d2b01b 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -108,6 +108,9 @@ public:
int &argc;
char **argv;
void appendApplicationPathToLibraryPaths(void);
+ void processCommandLineArguments();
+
+ static QString qmljsDebugArguments(); // access arguments from other libraries
#ifndef QT_NO_TRANSLATION
QTranslatorList translators;