forked from qt-creator/qt-creator
Delegate javascript debugging to Script and V8 debugger clients.
The appropriate client handles the debugging based on the service available at the server side. Change-Id: I46b66036f700fc7e45e8b38cef7f1ce1445b1122 Reviewed-on: http://codereview.qt.nokia.com/2497 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
This commit is contained in:
@@ -37,13 +37,21 @@
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
|
||||
QmlDebuggerClient::QmlDebuggerClient(QmlJsDebugClient::QDeclarativeDebugConnection* client)
|
||||
: QDeclarativeDebugClient(QLatin1String("JSDebugger"), client)
|
||||
class QmlDebuggerClientPrivate
|
||||
{
|
||||
public:
|
||||
QList<QByteArray> sendBuffer;
|
||||
};
|
||||
|
||||
QmlDebuggerClient::QmlDebuggerClient(QmlJsDebugClient::QDeclarativeDebugConnection* client, QLatin1String clientName)
|
||||
: QDeclarativeDebugClient(clientName, client),
|
||||
d(new QmlDebuggerClientPrivate())
|
||||
{
|
||||
}
|
||||
|
||||
QmlDebuggerClient::~QmlDebuggerClient()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void QmlDebuggerClient::statusChanged(Status status)
|
||||
@@ -51,9 +59,21 @@ void QmlDebuggerClient::statusChanged(Status status)
|
||||
emit newStatus(status);
|
||||
}
|
||||
|
||||
void QmlDebuggerClient::messageReceived(const QByteArray &data)
|
||||
void QmlDebuggerClient::sendMessage(const QByteArray &msg)
|
||||
{
|
||||
emit messageWasReceived(data);
|
||||
if (status() == Enabled) {
|
||||
QDeclarativeDebugClient::sendMessage(msg);
|
||||
} else {
|
||||
d->sendBuffer.append(msg);
|
||||
}
|
||||
}
|
||||
|
||||
void QmlDebuggerClient::flushSendBuffer()
|
||||
{
|
||||
QTC_ASSERT(status() == QDeclarativeDebugClient::Enabled, return);
|
||||
foreach (const QByteArray &msg, d->sendBuffer)
|
||||
QDeclarativeDebugClient::sendMessage(msg);
|
||||
d->sendBuffer.clear();
|
||||
}
|
||||
|
||||
} // Internal
|
||||
|
||||
Reference in New Issue
Block a user