QmlEngineDebugClient: Simplify the client and utility classes

Change-Id: I86033bdbdef94c6f17e706f8e13ce390969171c6
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
Aurindam Jana
2012-03-07 16:19:55 +01:00
parent 8966d82af3
commit 4cd2e32659
15 changed files with 526 additions and 1316 deletions

View File

@@ -57,6 +57,7 @@
#include <extensionsystem/pluginmanager.h>
#include <projectexplorer/applicationlauncher.h>
#include <qmljsdebugclient/qdeclarativeoutputparser.h>
#include <qmljsdebugclient/qmlenginedebugclient.h>
#include <qmljseditor/qmljseditorconstants.h>
#include <qmljs/parser/qmljsast_p.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
@@ -120,6 +121,7 @@ private:
bool m_validContext;
QHash<QString,BreakpointModelId> pendingBreakpoints;
bool m_retryOnConnectFail;
QList<quint32> queryIds;
};
QmlEnginePrivate::QmlEnginePrivate(QmlEngine *q)
@@ -1038,21 +1040,14 @@ void QmlEngine::synchronizeWatchers()
}
}
void QmlEngine::onDebugQueryStateChanged(
QmlJsDebugClient::QDeclarativeDebugQuery::State state)
void QmlEngine::expressionEvaluated(quint32 queryId, const QVariant &result)
{
QmlJsDebugClient::QDeclarativeDebugExpressionQuery *query =
qobject_cast<QmlJsDebugClient::QDeclarativeDebugExpressionQuery *>(
sender());
if (query && state != QmlJsDebugClient::QDeclarativeDebugQuery::Error) {
QtMessageLogItem *item = constructLogItemTree(query->result());
if (d->queryIds.contains(queryId)) {
d->queryIds.removeOne(queryId);
QtMessageLogItem *item = constructLogItemTree(result);
if (item)
qtMessageLogHandler()->appendItem(item);
} else
qtMessageLogHandler()->
appendItem(new QtMessageLogItem(QtMessageLogHandler::ErrorType,
_("Error evaluating expression.")));
delete query;
}
}
bool QmlEngine::hasCapability(unsigned cap) const
@@ -1154,16 +1149,19 @@ bool QmlEngine::evaluateScriptExpression(const QString& expression)
int id = d->m_adapter.currentSelectedDebugId();
if (engineDebug && id != -1) {
QDeclarativeDebugExpressionQuery *query =
engineDebug->queryExpressionResult(id, expression);
connect(query,
SIGNAL(stateChanged(
QmlJsDebugClient::QDeclarativeDebugQuery
::State)),
this,
SLOT(onDebugQueryStateChanged(
QmlJsDebugClient::QDeclarativeDebugQuery
::State)));
quint32 queryId =
engineDebug->queryExpressionResult(
id, expression);
if (queryId) {
d->queryIds << queryId;
} else {
didEvaluate = false;
qtMessageLogHandler()->
appendItem(
new QtMessageLogItem(
QtMessageLogHandler::ErrorType,
_("Error evaluating expression.")));
}
}
} else {
executeDebuggerCommand(expression);