2010-08-13 14:18:10 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
|
|
|
|
** 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.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2011-01-12 13:51:26 +01:00
|
|
|
#ifndef DEBGUGGER_QMLADAPTER_H
|
|
|
|
|
#define DEBGUGGER_QMLADAPTER_H
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
#include "debugger_global.h"
|
2011-01-12 13:51:26 +01:00
|
|
|
#include "qmldebuggerclient.h"
|
2010-08-13 14:18:10 +02:00
|
|
|
|
2011-01-12 13:51:26 +01:00
|
|
|
#include <QtCore/QObject>
|
|
|
|
|
#include <QtCore/QScopedPointer>
|
2010-09-13 13:30:35 +02:00
|
|
|
#include <QtNetwork/QAbstractSocket>
|
|
|
|
|
|
|
|
|
|
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;
|
2011-01-12 13:51:26 +01:00
|
|
|
class QmlAdapterPrivate;
|
2010-09-13 13:30:35 +02:00
|
|
|
} // namespace Internal
|
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);
|
|
|
|
|
|
2011-01-24 16:30:34 +01:00
|
|
|
bool disableJsDebugging(bool block);
|
|
|
|
|
|
2010-12-16 17:26:25 +01:00
|
|
|
public slots:
|
|
|
|
|
void logServiceStatusChange(const QString &service, QDeclarativeDebugClient::Status newStatus);
|
|
|
|
|
void logServiceActivity(const QString &service, const QString &logMessage);
|
2010-09-30 14:05:20 +02:00
|
|
|
|
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:
|
2011-01-12 13:51:26 +01:00
|
|
|
QScopedPointer<Internal::QmlAdapterPrivate> d;
|
2010-08-13 14:18:10 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2011-01-12 13:51:26 +01:00
|
|
|
#endif // DEBGUGGER_QMLADAPTER_H
|