debugger: The DebuggerEngine refactoring.

This replaces the (de facto) singleton engines and data handlers by classes
that are instantiated per run. The DebuggerRunControl will now create an
object of (a class derived from) DebuggerEngine that contains all the relevant
"dynamic" data.

DebuggerManager is no more. The "singleton" bits are merged into DebuggerPlugin,
whereas the data bits went to DebuggerEngine.

There is no formal notion of a "current" DebuggerEngine. However, as there's
only one DebuggerEngine at a time that has its data models connected to the
view, there's still some "de facto" notion of a "current" engine. Calling
SomeModel::setData(int role, QVariant data) with custom role is used as the
primary dispatch mechanism from the views to the "current" data models
(and the engine, as all data models know their engine).
This commit is contained in:
hjk
2010-06-16 11:08:54 +02:00
parent 4cc244469a
commit 6a6cba5518
93 changed files with 5258 additions and 4846 deletions

View File

@@ -29,17 +29,16 @@
#include "qmlengine.h"
#include "debuggerstringutils.h"
#include "debuggerdialogs.h"
#include "breakhandler.h"
#include "debuggerconstants.h"
#include "debuggermanager.h"
#include "debuggerdialogs.h"
#include "debuggerstringutils.h"
#include "breakhandler.h"
#include "moduleshandler.h"
#include "registerhandler.h"
#include "stackhandler.h"
#include "watchhandler.h"
#include "watchutils.h"
#include "moduleshandler.h"
#include <utils/qtcassert.h>
@@ -104,8 +103,8 @@ QString QmlEngine::QmlCommand::toString() const
//
///////////////////////////////////////////////////////////////////////
QmlEngine::QmlEngine(DebuggerManager *manager)
: IDebuggerEngine(manager)
QmlEngine::QmlEngine(const DebuggerStartParameters &startParameters)
: DebuggerEngine(startParameters)
{
m_congestion = 0;
m_inAir = 0;
@@ -169,7 +168,7 @@ void QmlEngine::socketError(QAbstractSocket::SocketError)
QString msg = tr("%1.").arg(m_socket->errorString());
//QMessageBox::critical(q->mainWindow(), tr("Error"), msg);
showStatusMessage(msg);
manager()->notifyInferiorExited();
exitDebugger();
}
void QmlEngine::executeDebuggerCommand(const QString &command)
@@ -198,22 +197,20 @@ void QmlEngine::shutdown()
void QmlEngine::exitDebugger()
{
SDEBUG("QmlEngine::exitDebugger()");
manager()->notifyInferiorExited();
}
void QmlEngine::startDebugger()
{
QTC_ASSERT(runControl(), return);
qDebug() << "STARTING QML ENGINE";
setState(InferiorRunningRequested);
showStatusMessage(tr("Running requested..."), 5000);
const DebuggerStartParameters &sp = runControl()->sp();
const DebuggerStartParameters &sp = startParameters();
const int pos = sp.remoteChannel.indexOf(QLatin1Char(':'));
const QString host = sp.remoteChannel.left(pos);
const quint16 port = sp.remoteChannel.mid(pos + 1).toInt();
//QTimer::singleShot(0, this, SLOT(runInferior()));
m_socket->connectToHost(host, port);
emit startSuccessful();
startSuccessful();
}
void QmlEngine::continueInferior()
@@ -526,7 +523,7 @@ void QmlEngine::updateLocals()
void QmlEngine::updateWatchData(const WatchData &)
{
//qq->watchHandler()->rebuildModel();
//watchHandler()->rebuildModel();
showStatusMessage(tr("Stopped."), 5000);
}
@@ -536,9 +533,9 @@ void QmlEngine::updateSubItem(const WatchData &data0)
QTC_ASSERT(false, return);
}
IDebuggerEngine *createQmlEngine(DebuggerManager *manager)
DebuggerEngine *createQmlEngine(const DebuggerStartParameters &sp)
{
return new QmlEngine(manager);
return new QmlEngine(sp);
}
} // namespace Internal