2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2010-08-13 14:18:10 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-08-13 14:18:10 +02:00
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
#ifndef QMLADAPTER_H
|
|
|
|
|
#define QMLADAPTER_H
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
#include "debugger_global.h"
|
|
|
|
|
|
2012-04-18 13:31:36 +02:00
|
|
|
#include <qmldebug/qmldebugclient.h>
|
2010-09-13 13:30:35 +02:00
|
|
|
|
2012-04-18 14:20:54 +02:00
|
|
|
#include <QAbstractSocket>
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
#include <QTimer>
|
|
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
namespace QmlDebug {
|
|
|
|
|
class BaseEngineDebugClient;
|
|
|
|
|
class QmlDebugConnection;
|
2011-12-20 16:12:38 +01:00
|
|
|
class QDebugMessageClient;
|
2010-09-13 13:30:35 +02:00
|
|
|
}
|
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 {
|
2012-04-18 12:06:10 +02:00
|
|
|
class BaseQmlDebuggerClient;
|
2011-01-12 13:51:26 +01:00
|
|
|
class QmlAdapterPrivate;
|
2010-08-13 14:18:10 +02:00
|
|
|
|
2012-04-18 14:20:54 +02:00
|
|
|
class QmlAdapter : public QObject
|
2010-08-13 14:18:10 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2011-09-16 15:00:41 +02:00
|
|
|
|
2010-08-13 14:18:10 +02:00
|
|
|
public:
|
|
|
|
|
explicit QmlAdapter(DebuggerEngine *engine, QObject *parent = 0);
|
2010-09-13 13:30:35 +02:00
|
|
|
virtual ~QmlAdapter();
|
|
|
|
|
|
2012-02-21 15:47:55 +01:00
|
|
|
void beginConnectionTcp(const QString &address, quint16 port);
|
2010-08-18 13:54:12 +02:00
|
|
|
void closeConnection();
|
2010-08-13 14:18:10 +02:00
|
|
|
|
2012-05-10 10:29:11 +02:00
|
|
|
QmlDebug::QmlDebugConnection *connection() const;
|
2011-11-29 11:39:41 +01:00
|
|
|
DebuggerEngine *debuggerEngine() const;
|
2010-08-13 14:18:10 +02:00
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
BaseQmlDebuggerClient *activeDebuggerClient() const;
|
|
|
|
|
QHash<QString, BaseQmlDebuggerClient*> debuggerClients() const;
|
2011-07-26 16:22:49 +02:00
|
|
|
|
2012-05-10 10:29:11 +02:00
|
|
|
QmlDebug::QDebugMessageClient *messageClient() const;
|
2011-12-20 16:12:38 +01:00
|
|
|
|
2010-12-16 17:26:25 +01:00
|
|
|
public slots:
|
2012-04-18 13:31:36 +02:00
|
|
|
void logServiceStatusChange(const QString &service, float version,
|
2012-05-10 10:29:11 +02:00
|
|
|
QmlDebug::ClientStatus newStatus);
|
2010-12-16 17:26:25 +01:00
|
|
|
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-08-27 13:11:55 +02:00
|
|
|
void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
|
2012-05-10 10:29:11 +02:00
|
|
|
void clientStatusChanged(QmlDebug::ClientStatus status);
|
|
|
|
|
void debugClientStatusChanged(QmlDebug::ClientStatus status);
|
2010-08-13 14:18:10 +02:00
|
|
|
void connectionStateChanged();
|
2011-09-14 16:58:10 +02:00
|
|
|
void checkConnectionState();
|
2010-08-13 14:18:10 +02:00
|
|
|
|
|
|
|
|
private:
|
2012-05-10 10:35:42 +02:00
|
|
|
bool isConnected() const;
|
2011-07-26 16:22:49 +02:00
|
|
|
void createDebuggerClients();
|
2010-08-13 14:18:10 +02:00
|
|
|
void showConnectionStatusMessage(const QString &message);
|
|
|
|
|
void showConnectionErrorMessage(const QString &message);
|
|
|
|
|
|
|
|
|
|
private:
|
2012-04-18 14:20:54 +02:00
|
|
|
QPointer<DebuggerEngine> m_engine;
|
|
|
|
|
BaseQmlDebuggerClient *m_qmlClient;
|
|
|
|
|
QTimer m_connectionTimer;
|
2012-05-10 10:29:11 +02:00
|
|
|
QmlDebug::QmlDebugConnection *m_conn;
|
2012-04-18 14:20:54 +02:00
|
|
|
QHash<QString, BaseQmlDebuggerClient*> m_debugClients;
|
2012-05-10 10:29:11 +02:00
|
|
|
QmlDebug::QDebugMessageClient *m_msgClient;
|
2010-08-13 14:18:10 +02:00
|
|
|
};
|
|
|
|
|
|
2012-04-18 14:20:54 +02:00
|
|
|
} // namespace Internal
|
2010-08-13 14:18:10 +02:00
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2012-04-18 12:06:10 +02:00
|
|
|
#endif // QMLADAPTER_H
|