2010-08-13 14:18:10 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMLADAPTER_H
|
|
|
|
|
#define QMLADAPTER_H
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QScopedPointer>
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
#include "debugger_global.h"
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
#include <QtNetwork/QAbstractSocket>
|
2010-09-30 14:05:20 +02:00
|
|
|
#include "qmldebuggerclient.h"
|
2010-09-13 13:30:35 +02:00
|
|
|
|
|
|
|
|
namespace QmlJsDebugClient {
|
|
|
|
|
class QDeclarativeEngineDebug;
|
|
|
|
|
class QDeclarativeDebugConnection;
|
|
|
|
|
}
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
2010-09-13 13:30:35 +02:00
|
|
|
|
2010-08-13 14:18:10 +02:00
|
|
|
class DebuggerEngine;
|
2010-09-13 13:30:35 +02:00
|
|
|
|
|
|
|
|
namespace Internal {
|
2010-08-13 14:18:10 +02:00
|
|
|
class QmlDebuggerClient;
|
2010-09-13 13:30:35 +02:00
|
|
|
} // namespace Internal
|
2010-08-13 14:18:10 +02:00
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
struct QmlAdapterPrivate;
|
2010-08-13 14:18:10 +02:00
|
|
|
class DEBUGGER_EXPORT QmlAdapter : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit QmlAdapter(DebuggerEngine *engine, QObject *parent = 0);
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual ~QmlAdapter();
|
|
|
|
|
|
2010-08-13 14:18:10 +02:00
|
|
|
void beginConnection();
|
2010-08-18 13:54:12 +02:00
|
|
|
void pauseConnection();
|
|
|
|
|
void closeConnection();
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
bool isConnected() const;
|
|
|
|
|
bool isUnconnected() const;
|
|
|
|
|
|
2010-09-13 13:30:35 +02:00
|
|
|
QmlJsDebugClient::QDeclarativeEngineDebug *client() const;
|
|
|
|
|
QmlJsDebugClient::QDeclarativeDebugConnection *connection() const;
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
// TODO move to private API b/w engine and adapter
|
|
|
|
|
void setMaxConnectionAttempts(int maxAttempts);
|
|
|
|
|
void setConnectionAttemptInterval(int interval);
|
|
|
|
|
|
2010-09-30 14:05:20 +02:00
|
|
|
void logServiceStatusChange(const QString &service, QDeclarativeDebugClient::Status newStatus);
|
|
|
|
|
|
2010-08-13 14:18:10 +02:00
|
|
|
signals:
|
|
|
|
|
void connected();
|
|
|
|
|
void disconnected();
|
|
|
|
|
void connectionStartupFailed();
|
2010-08-27 13:11:55 +02:00
|
|
|
void connectionError(QAbstractSocket::SocketError socketError);
|
2010-09-30 14:05:20 +02:00
|
|
|
void serviceConnectionError(const QString serviceName);
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
private slots:
|
2010-09-30 15:03:42 +02:00
|
|
|
void sendMessage(const QByteArray &msg);
|
2010-08-27 13:11:55 +02:00
|
|
|
void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
|
2010-09-30 14:05:20 +02:00
|
|
|
void clientStatusChanged(QDeclarativeDebugClient::Status status);
|
2010-08-13 14:18:10 +02:00
|
|
|
void connectionStateChanged();
|
|
|
|
|
void pollInferior();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
bool connectToViewer();
|
|
|
|
|
void createDebuggerClient();
|
|
|
|
|
void showConnectionStatusMessage(const QString &message);
|
|
|
|
|
void showConnectionErrorMessage(const QString &message);
|
2010-09-30 15:03:42 +02:00
|
|
|
void flushSendBuffer();
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
private:
|
2010-09-13 13:30:35 +02:00
|
|
|
QScopedPointer<QmlAdapterPrivate> d;
|
2010-08-13 14:18:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
|
|
|
|
#endif // QMLADAPTER_H
|