generic: implement special qml debugger handling for Katie

This commit is contained in:
Ivailo Monev 2015-11-29 18:30:02 +02:00
parent ba1417fd42
commit fbd0e11b3d
3 changed files with 26 additions and 18 deletions

View file

@ -172,9 +172,27 @@ void KDeclarative::setupBindings()
// setup ImageProvider for KDE icons
d->declarativeEngine.data()->addImageProvider(QString("icon"), new KIconProvider);
}
QScriptEngine *KDeclarative::scriptEngine() const
{
return d->scriptEngine.data();
}
void KDeclarative::setupQmlJsDebugger()
{
#ifndef QT_KATIE
if (KCmdLineArgs::parsedArgs("qt")->isSet("qmljsdebugger")) {
#ifdef QT_KATIE
QDeclarativeDebuggingEnabler enabler;
}
#else
if (KCmdLineArgs::parsedArgs("kde")->isSet("qmljsdebugger")) {
QScriptEngine *engine = scriptEngine();
if (!engine) {
kWarning() << "no engine has been set";
return;
}
QScriptEngineDebugger debugger;
debugger.attachTo(engine);
QMainWindow *dbgwindow = debugger.standardWindow();
@ -186,22 +204,8 @@ void KDeclarative::setupBindings()
dbgwidget->setLayout(dbglayout);
dbgwindow->setCentralWidget(dbgwidget);
dbgwindow->show();
#endif
}
}
QScriptEngine *KDeclarative::scriptEngine() const
{
return d->scriptEngine.data();
}
void KDeclarative::setupQmlJsDebugger()
{
if (KCmdLineArgs::parsedArgs("qt")->isSet("qmljsdebugger")) {
#ifndef QT_KATIE
QDeclarativeDebuggingEnabler enabler;
#endif
}
}
QString KDeclarative::defaultComponentsTarget()

View file

@ -45,10 +45,10 @@ public:
/**
* This method must be called very early at startup time to ensure the
* QDeclarativeDebugger is enabled. Ideally it should be called in main(),
* after command-line options are defined.
* debugger is enabled. Ideally it should be called in main(), after
* command-line options are defined.
*/
static void setupQmlJsDebugger();
void setupQmlJsDebugger();
/**
* @return the runtime platform, e.g. "desktop" or "tablet, touch". The first entry/ies in

View file

@ -305,7 +305,11 @@ KCmdLineArgsStatic::KCmdLineArgsStatic () {
qt_options.add("reverse", ki18n("mirrors the whole layout of widgets"));
qt_options.add("stylesheet <file.qss>", ki18n("applies the Qt stylesheet to the application widgets"));
qt_options.add("graphicssystem <system>", ki18n("use a different graphics system instead of the default one, options are raster and opengl (experimental)"));
#ifndef QT_KATIE
qt_options.add("qmljsdebugger <port>", ki18n("QML JS debugger information. Application must be\nbuilt with -DQT_DECLARATIVE_DEBUG for the debugger to be\nenabled"));
#else
kde_options.add("qmljsdebugger", ki18n("QML JS debugger information."));
#endif
// KDE options
kde_options.add("caption <caption>", ki18n("Use 'caption' as name in the titlebar"));
kde_options.add("icon <icon>", ki18n("Use 'icon' as the application icon"));