diff options
author | Kent Hansen <khansen@trolltech.com> | 2009-06-15 14:12:28 +0200 |
---|---|---|
committer | Kent Hansen <khansen@trolltech.com> | 2009-06-15 14:12:28 +0200 |
commit | a5756c3216ff67bca2bd232efbaac431ec9633a6 (patch) | |
tree | 9350c3306a0f3b7a33352f1802fb0e050cd45174 /examples | |
parent | 45a72e2dfeffb582da7f8b4ffd92924bcd6a9166 (diff) |
renamings
Diffstat (limited to 'examples')
-rw-r--r-- | examples/debuggee/debuggee.pro | 2 | ||||
-rw-r--r-- | examples/debuggee/main.cpp | 38 | ||||
-rw-r--r-- | examples/debugger/main.cpp | 20 |
3 files changed, 34 insertions, 26 deletions
diff --git a/examples/debuggee/debuggee.pro b/examples/debuggee/debuggee.pro index 00cb1df..53a6fbe 100644 --- a/examples/debuggee/debuggee.pro +++ b/examples/debuggee/debuggee.pro @@ -5,5 +5,5 @@ INCLUDEPATH += . QT += network script scripttools win32: CONFIG += console mac:CONFIG -= app_bundle -include(../../src/debuggerconnector.pri) +include(../../src/debuggerengine.pri) SOURCES += main.cpp diff --git a/examples/debuggee/main.cpp b/examples/debuggee/main.cpp index ee024ef..f7cde4a 100644 --- a/examples/debuggee/main.cpp +++ b/examples/debuggee/main.cpp @@ -20,36 +20,36 @@ ****************************************************************************/ #include <QtScript> -#include <qscriptdebuggerconnector.h> +#include <qscriptdebuggerengine.h> void qScriptDebugRegisterMetaTypes(); -class MyObject : public QObject +class Runner : public QObject { Q_OBJECT public: - MyObject(const QHostAddress &addr, quint16 port, bool connect, QObject *parent = 0); + Runner(const QHostAddress &addr, quint16 port, bool connect, QObject *parent = 0); private slots: void onConnected(); void onDisconnected(); private: - QScriptEngine *m_engine; - QScriptDebuggerConnector *m_connector; + QScriptEngine *m_scriptEngine; + QScriptDebuggerEngine *m_debuggerEngine; }; -MyObject::MyObject(const QHostAddress &addr, quint16 port, bool connect, QObject *parent) +Runner::Runner(const QHostAddress &addr, quint16 port, bool connect, QObject *parent) : QObject(parent) { - m_engine = new QScriptEngine(this); - m_connector = new QScriptDebuggerConnector(this); - QObject::connect(m_connector, SIGNAL(connected()), this, SLOT(onConnected()), Qt::QueuedConnection); - QObject::connect(m_connector, SIGNAL(disconnected()), this, SLOT(onDisconnected()), Qt::QueuedConnection); - m_connector->setEngine(m_engine); + m_scriptEngine = new QScriptEngine(this); + m_debuggerEngine = new QScriptDebuggerEngine(this); + QObject::connect(m_debuggerEngine, SIGNAL(connected()), this, SLOT(onConnected()), Qt::QueuedConnection); + QObject::connect(m_debuggerEngine, SIGNAL(disconnected()), this, SLOT(onDisconnected()), Qt::QueuedConnection); + m_debuggerEngine->setTarget(m_scriptEngine); if (connect) { qDebug("attempting to connect to debugger at %s:%d", qPrintable(addr.toString()), port); - m_connector->connectToDebugger(addr, port); + m_debuggerEngine->connectToDebugger(addr, port); } else { - if (m_connector->listen(addr, port)) + if (m_debuggerEngine->listen(addr, port)) qDebug("waiting for debugger to connect at %s:%d", qPrintable(addr.toString()), port); else { qWarning("Failed to listen!"); @@ -58,9 +58,9 @@ MyObject::MyObject(const QHostAddress &addr, quint16 port, bool connect, QObject } } -void MyObject::onConnected() +void Runner::onConnected() { - qDebug("connected!!"); + qDebug("connected to debugger"); QStringList fileNames; QString path = QDir::currentPath(); fileNames << (path + QDir::separator() + "foo.qs") @@ -71,13 +71,13 @@ void MyObject::onConnected() file.open(QIODevice::ReadOnly); QString program = file.readAll(); qDebug("calling evaluate"); - m_engine->evaluate(program, fn); + m_scriptEngine->evaluate(program, fn); qDebug("evaluate done"); } - m_connector->disconnectFromDebugger(); + m_debuggerEngine->disconnectFromDebugger(); } -void MyObject::onDisconnected() +void Runner::onDisconnected() { qDebug("disconnected"); QCoreApplication::quit(); @@ -116,7 +116,7 @@ int main(int argc, char **argv) } qScriptDebugRegisterMetaTypes(); - MyObject obj(addr, port, connect); + Runner runner(addr, port, connect); return app.exec(); } diff --git a/examples/debugger/main.cpp b/examples/debugger/main.cpp index 74f0e9e..90b361b 100644 --- a/examples/debugger/main.cpp +++ b/examples/debugger/main.cpp @@ -26,24 +26,27 @@ void qScriptDebugRegisterMetaTypes(); -class MyObject : public QObject +class Runner : public QObject { Q_OBJECT public: - MyObject(const QHostAddress &addr, quint16 port, bool listen, QObject *parent = 0); + Runner(const QHostAddress &addr, quint16 port, bool listen, QObject *parent = 0); private slots: void onAttached(); void onDetached(); + void onError(QScriptRemoteTargetDebugger::Error error); private: QScriptRemoteTargetDebugger *m_debugger; }; -MyObject::MyObject(const QHostAddress &addr, quint16 port, bool listen, QObject *parent) +Runner::Runner(const QHostAddress &addr, quint16 port, bool listen, QObject *parent) : QObject(parent) { m_debugger = new QScriptRemoteTargetDebugger(this); QObject::connect(m_debugger, SIGNAL(attached()), this, SLOT(onAttached())); QObject::connect(m_debugger, SIGNAL(detached()), this, SLOT(onDetached())); + QObject::connect(m_debugger, SIGNAL(error(QScriptRemoteTargetDebugger::Error)), + this, SLOT(onError(QScriptRemoteTargetDebugger::Error))); if (listen) { if (m_debugger->listen(addr, port)) qDebug("listening for debuggee connection at %s:%d", qPrintable(addr.toString()), port); @@ -57,11 +60,16 @@ MyObject::MyObject(const QHostAddress &addr, quint16 port, bool listen, QObject } } -void MyObject::onAttached() +void Runner::onAttached() { } -void MyObject::onDetached() +void Runner::onDetached() +{ + QApplication::quit(); +} + +void Runner::onError(QScriptRemoteTargetDebugger::Error /*error*/) { QApplication::quit(); } @@ -100,7 +108,7 @@ int main(int argc, char **argv) } qScriptDebugRegisterMetaTypes(); - MyObject object(addr, port, listen); + Runner runner(addr, port, listen); return app.exec(); } |