[vlc-devel] [RFC 19/82] qt: add option to setup QML debugging probe
Pierre Lamot
pierre at videolabs.io
Fri Feb 1 14:01:23 CET 2019
see http://doc.qt.io/qt-5/qtquick-debugging.html#starting-applications
---
configure.ac | 4 ++++
modules/gui/qt/Makefile.am | 3 +++
modules/gui/qt/qt.cpp | 33 +++++++++++++++++++++++++++++++--
3 files changed, 38 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index e4167a832b..c55b3685ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3808,6 +3808,10 @@ AS_IF([test "${enable_qt}" != "no"], [
])
])
+AC_ARG_ENABLE(qt-qml-debug,
+ [ --enable-qt-qml-debug enable qml debuger])
+AM_CONDITIONAL(QT_QML_DEBUG, [test "${enable_qt_qml_debug}" = "yes"])
+
AS_IF([test "${enable_qt}" != "no"], [
ALIASES="${ALIASES} qvlc"
])
diff --git a/modules/gui/qt/Makefile.am b/modules/gui/qt/Makefile.am
index 3d218c000d..ec1ccc86d4 100644
--- a/modules/gui/qt/Makefile.am
+++ b/modules/gui/qt/Makefile.am
@@ -38,6 +38,9 @@ endif
if UPDATE_CHECK
libqt_plugin_la_CPPFLAGS += -DUPDATE_CHECK
endif
+if QT_QML_DEBUG
+libqt_plugin_la_CPPFLAGS += -DQT_QML_DEBUG
+endif
libqt_plugin_la_SOURCES = \
gui/qt/qt.cpp gui/qt/qt.hpp \
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index 38870c6467..a0fb7789c4 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -142,6 +142,10 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
#define UPDATER_LONGTEXT N_( "Activate the automatic notification of new " \
"versions of the software. It runs once every " \
"two weeks." )
+
+#define QT_QML_DEBUG_TEXT N_( "set the options for qml debugger" )
+#define QT_QML_DEBUG_LONGTEXT N_( "set the options for qml debugger (see http://doc.qt.io/qt-5/qtquick-debugging.html#starting-applications)" )
+
#define UPDATER_DAYS_TEXT N_("Number of days between two update checks")
#define PRIVACY_TEXT N_( "Ask for network policy at start" )
@@ -281,6 +285,11 @@ vlc_module_begin ()
UPDATER_DAYS_TEXT, UPDATER_DAYS_TEXT, false )
#endif
+#ifdef QT_QML_DEBUG
+ add_string( "qt-qmljsdebugger", NULL,
+ QT_QML_DEBUG_TEXT, QT_QML_DEBUG_LONGTEXT, false )
+#endif
+
#ifdef _WIN32
add_bool( "qt-disable-volume-keys" /* name */,
true /* default value */,
@@ -493,10 +502,30 @@ static void *Thread( void *obj )
intf_thread_t *p_intf = (intf_thread_t *)obj;
intf_sys_t *p_sys = p_intf->p_sys;
char vlc_name[] = "vlc"; /* for WM_CLASS */
- char *argv[2];
+ char *argv[3] = { nullptr };
int argc = 0;
- argv[argc++] = vlc_name;
+ auto argvReleaser = vlc::wrap_carray<char*>(argv, [](char* ptr[]) {
+ for ( int i = 0; ptr[i] != nullptr; ++i )
+ free(ptr[i]);
+ });
+ argv[argc++] = strdup(vlc_name);
+
+#ifdef QT_QML_DEBUG
+ char* qmlJsDebugOpt = var_CreateGetString(p_intf, "qt-qmljsdebugger");
+ if (qmlJsDebugOpt)
+ {
+ msg_Dbg(p_intf, "option qt-qmljsdebugger is %s", qmlJsDebugOpt);
+ char* psz_debug_opt;
+ if (asprintf(&psz_debug_opt, "-qmljsdebugger=%s", qmlJsDebugOpt) < 0)
+ {
+ free(qmlJsDebugOpt);
+ return NULL;
+ }
+ argv[argc++] = psz_debug_opt;
+ free(qmlJsDebugOpt);
+ }
+#endif
argv[argc] = NULL;
Q_INIT_RESOURCE( vlc );
--
2.19.1
More information about the vlc-devel
mailing list