Commit 147396d7 authored by Aurindam Jana's avatar Aurindam Jana Committed by hjk

ScriptConsole: Refactor to QtMessageLogWindow

Move QML/JS independent classes to common Debugger
code. A Debugger Engine needs to override
evaluateScriptExpression() to provide engine
specific script evaluation.

Change-Id: I02b23b380a3eb1b12003b30ded0b7d075e44dfed
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent a8ab1fd7
This diff is collapsed.
......@@ -23,7 +23,6 @@ HEADERS += \
breakpointmarker.h \
breakwindow.h \
commonoptionspage.h \
consolewindow.h \
debugger_global.h \
debuggeractions.h \
debuggercore.h \
......@@ -67,7 +66,13 @@ HEADERS += \
debuggertooltipmanager.h \
debuggertoolchaincombobox.h \
debuggersourcepathmappingwidget.h \
memoryview.h
memoryview.h \
qtmessagelogwindow.h \
qtmessagelogeditor.h \
qtmessagelogview.h \
qtmessagelogproxymodel.h \
qtmessagelogitemdelegate.h \
qtmessageloghandler.h
SOURCES += \
basewindow.cpp \
......@@ -76,7 +81,6 @@ SOURCES += \
breakpointmarker.cpp \
breakwindow.cpp \
commonoptionspage.cpp \
consolewindow.cpp \
debuggeractions.cpp \
debuggerdialogs.cpp \
debuggerengine.cpp \
......@@ -113,7 +117,13 @@ SOURCES += \
debuggertooltipmanager.cpp \
debuggertoolchaincombobox.cpp \
debuggersourcepathmappingwidget.cpp \
memoryview.cpp
memoryview.cpp \
qtmessagelogwindow.cpp \
qtmessagelogproxymodel.cpp \
qtmessagelogview.cpp \
qtmessagelogitemdelegate.cpp \
qtmessageloghandler.cpp \
qtmessagelogeditor.cpp
FORMS += attachexternaldialog.ui \
attachcoredialog.ui \
......
......@@ -178,7 +178,8 @@ enum LogChannel
AppError, // stderr
AppStuff, // (possibly) windows debug channel
StatusBar, // LogStatus and also put to the status bar
ScriptConsoleOutput
QtMessageLogOutput,
QtMessageLogStatus
};
enum DebuggerEngineType
......
......@@ -119,6 +119,7 @@ public:
virtual void openMemoryEditor() = 0;
virtual void languagesChanged() = 0;
virtual void executeDebuggerCommand(const QString &command) = 0;
virtual bool evaluateScriptExpression(const QString &expression) = 0;
virtual Utils::SavedAction *action(int code) const = 0;
virtual bool boolSetting(int code) const = 0;
......
......@@ -50,6 +50,7 @@
#include "stackhandler.h"
#include "threadshandler.h"
#include "watchhandler.h"
#include "qtmessageloghandler.h"
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
......@@ -301,6 +302,7 @@ public:
StackHandler m_stackHandler;
ThreadsHandler m_threadsHandler;
WatchHandler m_watchHandler;
QtMessageLogHandler m_qtMessageHandler;
QFutureInterface<void> m_progress;
DisassemblerAgent m_disassemblerAgent;
......@@ -434,6 +436,11 @@ WatchHandler *DebuggerEngine::watchHandler() const
: &d->m_watchHandler;
}
QtMessageLogHandler *DebuggerEngine::qtMessageLogHandler() const
{
return &d->m_qtMessageHandler;
}
SourceFilesHandler *DebuggerEngine::sourceFilesHandler() const
{
return d->m_masterEngine
......@@ -513,6 +520,14 @@ QAbstractItemModel *DebuggerEngine::sourceFilesModel() const
return model;
}
QAbstractItemModel *DebuggerEngine::qtMessageLogModel() const
{
QAbstractItemModel *model = qtMessageLogHandler()->model();
if (model->objectName().isEmpty()) // Make debugging easier.
model->setObjectName(objectName() + QLatin1String("QtMessageLogModel"));
return model;
}
void DebuggerEngine::fetchMemory(MemoryAgent *, QObject *,
quint64 addr, quint64 length)
{
......@@ -541,6 +556,9 @@ void DebuggerEngine::showMessage(const QString &msg, int channel, int timeout) c
}
//if (msg.size() && msg.at(0).isUpper() && msg.at(1).isUpper())
// qDebug() << qPrintable(msg) << "IN STATE" << state();
if (channel == QtMessageLogOutput)
qtMessageLogHandler()->appendMessage(QtMessageLogHandler::UndefinedType, msg);
debuggerCore()->showMessage(msg, channel, timeout);
if (d->m_runControl) {
d->m_runControl->showMessage(msg, channel);
......@@ -1617,6 +1635,12 @@ void DebuggerEngine::executeDebuggerCommand(const QString &)
showStatusMessage(tr("This debugger cannot handle user input."));
}
bool DebuggerEngine::evaluateScriptExpression(const QString &)
{
showStatusMessage(tr("This debugger cannot handle user input."));
return false;
}
BreakHandler *DebuggerEngine::breakHandler() const
{
return debuggerCore()->breakHandler();
......
......@@ -82,6 +82,7 @@ class BreakpointParameters;
class QmlCppEngine;
class DebuggerToolTipContext;
class MemoryMarkup;
class QtMessageLogHandler;
struct WatchUpdateFlags
{
......@@ -224,6 +225,7 @@ public:
virtual Internal::WatchHandler *watchHandler() const;
virtual Internal::SourceFilesHandler *sourceFilesHandler() const;
virtual Internal::BreakHandler *breakHandler() const;
virtual Internal::QtMessageLogHandler *qtMessageLogHandler() const;
virtual QAbstractItemModel *modulesModel() const;
virtual QAbstractItemModel *registerModel() const;
......@@ -234,6 +236,7 @@ public:
virtual QAbstractItemModel *returnModel() const;
virtual QAbstractItemModel *toolTipsModel() const;
virtual QAbstractItemModel *sourceFilesModel() const;
virtual QAbstractItemModel *qtMessageLogModel() const;
void progressPing();
void handleFinished();
......@@ -361,6 +364,7 @@ protected:
virtual void executeRunToFunction(const QString &functionName);
virtual void executeJumpToLine(const Internal::ContextData &data);
virtual void executeDebuggerCommand(const QString &command);
virtual bool evaluateScriptExpression(const QString &expression);
virtual void frameUp();
virtual void frameDown();
......
......@@ -660,7 +660,7 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
QDockWidget *threadsDock = q->dockWidget(QLatin1String(DOCKWIDGET_THREADS));
QDockWidget *outputDock = q->dockWidget(QLatin1String(DOCKWIDGET_OUTPUT));
QDockWidget *qmlInspectorDock = q->dockWidget(QLatin1String(DOCKWIDGET_QML_INSPECTOR));
QDockWidget *scriptConsoleDock = q->dockWidget(QLatin1String(DOCKWIDGET_QML_SCRIPTCONSOLE));
QDockWidget *consoleDock = q->dockWidget(QLatin1String(DOCKWIDGET_QML_SCRIPTCONSOLE));
QDockWidget *modulesDock = q->dockWidget(QLatin1String(DOCKWIDGET_MODULES));
QDockWidget *registerDock = q->dockWidget(QLatin1String(DOCKWIDGET_REGISTER));
QDockWidget *sourceFilesDock = q->dockWidget(QLatin1String(DOCKWIDGET_SOURCE_FILES));
......@@ -671,7 +671,7 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
QTC_ASSERT(snapshotsDock, return);
QTC_ASSERT(threadsDock, return);
QTC_ASSERT(outputDock, return);
QTC_ASSERT(scriptConsoleDock, return);
QTC_ASSERT(consoleDock, return);
QTC_ASSERT(modulesDock, return);
QTC_ASSERT(registerDock, return);
QTC_ASSERT(sourceFilesDock, return);
......@@ -697,13 +697,13 @@ void DebuggerMainWindowPrivate::setSimpleDockWidgetArrangement()
q->tabifyDockWidget(breakDock, threadsDock);
q->tabifyDockWidget(breakDock, sourceFilesDock);
q->tabifyDockWidget(breakDock, snapshotsDock);
q->tabifyDockWidget(breakDock, scriptConsoleDock);
q->tabifyDockWidget(breakDock, consoleDock);
if (m_activeDebugLanguages.testFlag(Debugger::QmlLanguage)) {
if (qmlInspectorDock)
qmlInspectorDock->show();
if (scriptConsoleDock)
scriptConsoleDock->show();
if (consoleDock)
consoleDock->show();
} else {
// CPP only
threadsDock->show();
......
......@@ -47,7 +47,7 @@
#include "breakpoint.h"
#include "breakhandler.h"
#include "breakwindow.h"
#include "consolewindow.h"
#include "qtmessagelogwindow.h"
#include "disassemblerlines.h"
#include "logwindow.h"
#include "moduleswindow.h"
......@@ -114,8 +114,6 @@
#include <utils/statuslabel.h>
#include <utils/fileutils.h>
#include <qml/qmljsscriptconsole.h>
#include <QTimer>
#include <QtPlugin>
#include <QComboBox>
......@@ -849,7 +847,7 @@ public slots:
void aboutToSaveSession();
void executeDebuggerCommand(const QString &command);
void evaluateExpression(const QString &expression);
bool evaluateScriptExpression(const QString &expression);
void coreShutdown();
#ifdef WITH_TESTS
......@@ -1172,7 +1170,7 @@ public:
BreakWindow *m_breakWindow;
BreakHandler *m_breakHandler;
//ConsoleWindow *m_consoleWindow;
QtMessageLogWindow *m_qtMessageLogWindow;
QTreeView *m_returnWindow;
QTreeView *m_localsWindow;
QTreeView *m_watchersWindow;
......@@ -1183,7 +1181,6 @@ public:
QAbstractItemView *m_stackWindow;
QAbstractItemView *m_threadsWindow;
LogWindow *m_logWindow;
QmlJSScriptConsoleWidget *m_scriptConsoleWindow;
bool m_busy;
QString m_lastPermanentStatusMessage;
......@@ -1237,7 +1234,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(DebuggerPlugin *plugin) :
m_stackWindow = 0;
m_threadsWindow = 0;
m_logWindow = 0;
m_scriptConsoleWindow = 0;
m_qtMessageLogWindow = 0;
m_mainWindow = 0;
m_snapshotHandler = 0;
......@@ -2096,8 +2093,7 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine)
//m_threadBox->setModel(engine->threadsModel());
//m_threadBox->setModelColumn(ThreadData::ComboNameColumn);
m_watchersWindow->setModel(engine->watchersModel());
m_scriptConsoleWindow->setEngine(engine);
m_qtMessageLogWindow->setModel(engine->qtMessageLogModel());
engine->watchHandler()->rebuildModel();
......@@ -2219,7 +2215,7 @@ void DebuggerPluginPrivate::setInitialState()
action(AutoDerefPointers)->setEnabled(true);
action(ExpandStack)->setEnabled(false);
m_scriptConsoleWindow->setEnabled(false);
m_qtMessageLogWindow->setEnabled(true);
}
void DebuggerPluginPrivate::updateWatchersWindow()
......@@ -2519,9 +2515,9 @@ void DebuggerPluginPrivate::showStatusMessage(const QString &msg0, int timeout)
m_statusLabel->showStatusMessage(msg, timeout);
}
void DebuggerPluginPrivate::evaluateExpression(const QString &expression)
bool DebuggerPluginPrivate::evaluateScriptExpression(const QString &expression)
{
currentEngine()->executeDebuggerCommand(expression);
return currentEngine()->evaluateScriptExpression(expression);
}
void DebuggerPluginPrivate::openMemoryEditor()
......@@ -2595,9 +2591,6 @@ void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int tim
m_logWindow->showInput(LogInput, msg);
m_logWindow->showOutput(LogInput, msg);
break;
case ScriptConsoleOutput:
m_scriptConsoleWindow->appendResult(msg);
break;
case LogError: {
m_logWindow->showOutput(channel, msg);
QAction *action = m_mainWindow->dockWidget(_(DOCKWIDGET_OUTPUT))
......@@ -2606,6 +2599,10 @@ void DebuggerPluginPrivate::showMessage(const QString &msg, int channel, int tim
action->trigger();
break;
}
case QtMessageLogStatus:
QTC_ASSERT(m_qtMessageLogWindow, return);
m_qtMessageLogWindow->showStatus(msg, timeout);
break;
default:
m_logWindow->showOutput(channel, msg);
break;
......@@ -2874,8 +2871,8 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_breakWindow->setObjectName(QLatin1String(DOCKWIDGET_BREAK));
m_breakWindow->setModel(m_breakHandler->model());
//m_consoleWindow = new ConsoleWindow;
//m_consoleWindow->setObjectName(QLatin1String("CppDebugConsole"));
m_qtMessageLogWindow = new QtMessageLogWindow();
m_qtMessageLogWindow->setObjectName(QLatin1String(DOCKWIDGET_QML_SCRIPTCONSOLE));
m_modulesWindow = new ModulesWindow;
m_modulesWindow->setObjectName(QLatin1String(DOCKWIDGET_MODULES));
m_logWindow = new LogWindow;
......@@ -2894,11 +2891,6 @@ void DebuggerPluginPrivate::extensionsInitialized()
m_localsWindow->setObjectName(QLatin1String("CppDebugLocals"));
m_watchersWindow = new WatchWindow(WatchWindow::WatchersType);
m_watchersWindow->setObjectName(QLatin1String("CppDebugWatchers"));
m_scriptConsoleWindow = new QmlJSScriptConsoleWidget;
m_scriptConsoleWindow->setWindowTitle(tr("QML Script Console"));
m_scriptConsoleWindow->setObjectName(QLatin1String(DOCKWIDGET_QML_SCRIPTCONSOLE));
connect(m_scriptConsoleWindow, SIGNAL(evaluateExpression(QString)),
SLOT(evaluateExpression(QString)));
// Snapshot
m_snapshotHandler = new SnapshotHandler;
......@@ -3011,11 +3003,10 @@ void DebuggerPluginPrivate::extensionsInitialized()
dock->setProperty(DOCKWIDGET_DEFAULT_AREA, Qt::TopDockWidgetArea);
m_mainWindow->createDockWidget(CppLanguage, m_breakWindow);
//m_mainWindow->createDockWidget(CppLanguage, m_consoleWindow);
m_mainWindow->createDockWidget(QmlLanguage, m_qtMessageLogWindow);
m_mainWindow->createDockWidget(CppLanguage, m_snapshotWindow);
m_mainWindow->createDockWidget(CppLanguage, m_stackWindow);
m_mainWindow->createDockWidget(CppLanguage, m_threadsWindow);
m_mainWindow->createDockWidget(QmlLanguage, m_scriptConsoleWindow);
QSplitter *localsAndWatchers = new MiniSplitter(Qt::Vertical);
localsAndWatchers->setObjectName(QLatin1String(DOCKWIDGET_WATCHERS));
......
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
**
** GNU Lesser General Public License Usage
**
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**************************************************************************/
#include "consolebackend.h"
#include "qmlengine.h"
#include "qmladapter.h"
#include "debuggerstringutils.h"
#include <utils/qtcassert.h>
namespace Debugger {
namespace Internal {
///////////////////////////////////////////////////////////////////////
//
// ConsoleBackend
//
///////////////////////////////////////////////////////////////////////
ConsoleBackend::ConsoleBackend(QObject *parent) :
QObject(parent)
{
}
///////////////////////////////////////////////////////////////////////
//
// QmlJSConsoleBackend
//
///////////////////////////////////////////////////////////////////////
QmlJSConsoleBackend::QmlJSConsoleBackend(QObject *parent) :
ConsoleBackend(parent),
m_engine(0),
m_inferiorStopped(false),
m_isValidContext(false),
m_Error(false)
{
}
void QmlJSConsoleBackend::setInferiorStopped(bool isInferiorStopped)
{
m_inferiorStopped = isInferiorStopped;
}
bool QmlJSConsoleBackend::inferiorStopped() const
{
return m_inferiorStopped;
}
void QmlJSConsoleBackend::setEngine(QmlEngine *engine)
{
m_engine = engine;
}
QmlEngine *QmlJSConsoleBackend::engine() const
{
return m_engine;
}
void QmlJSConsoleBackend::setIsValidContext(bool isValidContext)
{
m_isValidContext = isValidContext;
}
bool QmlJSConsoleBackend::isValidContext() const
{
return m_isValidContext;
}
void QmlJSConsoleBackend::onDebugQueryStateChanged(
QmlJsDebugClient::QDeclarativeDebugQuery::State state)
{
QmlJsDebugClient::QDeclarativeDebugExpressionQuery *query =
qobject_cast<QmlJsDebugClient::QDeclarativeDebugExpressionQuery *>(
sender());
if (query && state != QmlJsDebugClient::QDeclarativeDebugQuery::Error)
emit message(ConsoleItemModel::UndefinedType,
query->result().toString());
else
emit message(ConsoleItemModel::ErrorType,
_("Error evaluating expression."));
delete query;
}
void QmlJSConsoleBackend::evaluate(const QString &script,
bool *returnKeyConsumed)
{
*returnKeyConsumed = true;
m_Error = false;
//Check if string is only white spaces
if (!script.trimmed().isEmpty()) {
//Check for a valid context
if (m_isValidContext) {
//check if it can be evaluated
if (canEvaluateScript(script)) {
//Evaluate expression based on engine state
//When engine->state() == InferiorStopOk, the expression
//is sent to V8DebugService. In all other cases, the
//expression is evaluated by QDeclarativeEngine.
if (!m_inferiorStopped) {
QmlAdapter *adapter = m_engine->adapter();
QTC_ASSERT(adapter, return);
QDeclarativeEngineDebug *engineDebug =
adapter->engineDebugClient();
int id = adapter->currentSelectedDebugId();
if (engineDebug && id != -1) {
QDeclarativeDebugExpressionQuery *query =
engineDebug->queryExpressionResult(id, script);
connect(query,
SIGNAL(stateChanged(
QmlJsDebugClient::QDeclarativeDebugQuery
::State)),
this,
SLOT(onDebugQueryStateChanged(
QmlJsDebugClient::QDeclarativeDebugQuery
::State)));
}
} else {
emit evaluateExpression(script);
}
} else {
*returnKeyConsumed = false;
}
} else {
//Incase of invalid context, append the expression to history
//and show Error message
m_Error = true;
}
}
}
void QmlJSConsoleBackend::emitErrorMessage()
{
if (m_Error)
emit message(
ConsoleItemModel::ErrorType,
_("Cannot evaluate without a valid QML/JS Context"));
}
bool QmlJSConsoleBackend::canEvaluateScript(const QString &script)
{
m_interpreter.clearText();
m_interpreter.appendText(script);
return m_interpreter.canEvaluate();
}
}
}
......@@ -6,29 +6,16 @@ HEADERS += \
$$PWD/qmldebuggerclient.h \
$$PWD/qmljsprivateapi.h \
$$PWD/qmlcppengine.h \
$$PWD/qmljsscriptconsole.h \
$$PWD/qscriptdebuggerclient.h \
$$PWD/qmlv8debuggerclient.h \
$$PWD/interactiveinterpreter.h \
$$PWD/qmlv8debuggerclientconstants.h \
$$PWD/consoletreeview.h \
$$PWD/consoleitemmodel.h \
$$PWD/consoleitemdelegate.h \
$$PWD/consoleeditor.h \
$$PWD/consolebackend.h
$$PWD/qmlv8debuggerclientconstants.h
SOURCES += \
$$PWD/qmlengine.cpp \
$$PWD/qmladapter.cpp \
$$PWD/qmldebuggerclient.cpp \
$$PWD/qmlcppengine.cpp \
$$PWD/qmljsscriptconsole.cpp \
$$PWD/qscriptdebuggerclient.cpp \
$$PWD/qmlv8debuggerclient.cpp \
$$PWD/interactiveinterpreter.cpp \
$$PWD/consoletreeview.cpp \
$$PWD/consoleitemmodel.cpp \
$$PWD/consoleitemdelegate.cpp \
$$PWD/consoleeditor.cpp \
$$PWD/consolebackend.cpp
$$PWD/interactiveinterpreter.cpp
......@@ -36,6 +36,7 @@
#include "debuggerstartparameters.h"
#include "stackhandler.h"
#include "qmlengine.h"
#include "qtmessageloghandler.h"
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
......@@ -426,6 +427,11 @@ void QmlCppEngine::executeDebuggerCommand(const QString &command)
}
}
bool QmlCppEngine::evaluateScriptExpression(const QString &expression)
{
return d->m_qmlEngine->evaluateScriptExpression(expression);
}
/////////////////////////////////////////////////////////
void QmlCppEngine::setupEngine()
......@@ -811,6 +817,11 @@ void QmlCppEngine::resetLocation()
DebuggerEngine::resetLocation();
}
Internal::QtMessageLogHandler *QmlCppEngine::qtMessageLogHandler() const
{
return d->m_qmlEngine->qtMessageLogHandler();
}
DebuggerEngine *QmlCppEngine::cppEngine() const
{
return d->m_cppEngine;
......
......@@ -96,6 +96,8 @@ public:
int timeout = -1) const;
void resetLocation();
Internal::QtMessageLogHandler *qtMessageLogHandler() const;
protected:
void detachDebugger();
void executeStep();
......@@ -112,6 +114,7 @@ protected:
void executeRunToFunction(const QString &functionName);
void executeJumpToLine(const ContextData &data);
void executeDebuggerCommand(const QString &command);
bool evaluateScriptExpression(const QString &expression);
void setupEngine();
void setupInferior();
......
......@@ -32,6 +32,7 @@
#include "qmlengine.h"
#include "qmladapter.h"
#include "interactiveinterpreter.h"
#include "debuggerstartparameters.h"
#include "debuggeractions.h"
......@@ -51,11 +52,13 @@
#include "watchhandler.h"
#include "sourcefileshandler.h"
#include "watchutils.h"
#include "qtmessageloghandler.h"
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/applicationlauncher.h>
#include <qmljsdebugclient/qdeclarativeoutputparser.h>
#include <qmljseditor/qmljseditorconstants.h>
#include <qmljsdebugclient/qdebugmessageclient.h>
#include <utils/environment.h>
#include <utils/qtcassert.h>
......@@ -112,10 +115,13 @@ private:
QmlJsDebugClient::QDeclarativeOutputParser m_outputParser;
QHash<QString, QTextDocument*> m_sourceDocuments;
QHash<QString, QWeakPointer<TextEditor::ITextEditor> > m_sourceEditors;
InteractiveInterpreter m_interpreter;
bool m_validContext;
};
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q)
: m_adapter(q)
: m_adapter(q),
m_validContext(false)
{}
......@@ -145,6 +151,15 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
connect(&d->m_adapter, SIGNAL(connectionStartupFailed()),
SLOT(connectionStartupFailed()));
connect(this, SIGNAL(stateChanged(Debugger::DebuggerState)),
SLOT(updateCurrentContext()));
connect(this->stackHandler(), SIGNAL(currentIndexChanged()),
SLOT(updateCurrentContext()));
connect(&d->m_adapter, SIGNAL(selectionChanged()),
SLOT(updateCurrentContext()));
connect(d->m_adapter.messageClient(), SIGNAL(message(QtMsgType,QString)),
SLOT(appendDebugOutput(QtMsgType,QString)));
connect(&d->m_applicationLauncher,
SIGNAL(processExited(int)),
SLOT(disconnected()));
......@@ -169,6 +184,8 @@ QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters,
d->m_noDebugOutputTimer.setSingleShot(true);
d->m_noDebugOutputTimer.setInterval(8000);
connect(&d->m_noDebugOutputTimer, SIGNAL(timeout()), this, SLOT(beginConnection()));
qtMessageLogHandler()->setHasEditableRow(true);
}
QmlEngine::~QmlEngine()
......@@ -781,6 +798,23 @@ void QmlEngine::synchronizeWatchers()
}
}
void QmlEngine::onDebugQueryStateChanged(
QmlJsDebugClient::QDeclarativeDebugQuery::State state)
{
QmlJsDebugClient::QDeclarativeDebugExpressionQuery *query =
qobject_cast<QmlJsDebugClient::QDeclarativeDebugExpressionQuery *>(
sender());
if (query && state != QmlJsDebugClient::QDeclarativeDebugQuery::Error)
qtMessageLogHandler()->
appendItem(new QtMessageLogItem(QtMessageLogHandler::UndefinedType,
query->result().toString()));
else
qtMessageLogHandler()->
appendItem(new QtMessageLogItem(QtMessageLogHandler::ErrorType,
_("Error evaluating expression.")));
delete query;
}
bool QmlEngine::hasCapability(unsigned cap) const
{