summaryrefslogtreecommitdiffstats
path: root/examples/debugger/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/debugger/main.cpp')
-rw-r--r--examples/debugger/main.cpp20
1 files changed, 14 insertions, 6 deletions
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();
}