OSDN Git Service

Update license.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / debugger / qml / qmladapter.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
8 **
9 **
10 ** GNU Lesser General Public License Usage
11 **
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 **
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 **
23 ** Other Usage
24 **
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
27 **
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef DEBGUGGER_QMLADAPTER_H
34 #define DEBGUGGER_QMLADAPTER_H
35
36 #include "debugger_global.h"
37 #include "qmldebuggerclient.h"
38
39 #include <QtCore/QObject>
40 #include <QtCore/QScopedPointer>
41 #include <QtNetwork/QAbstractSocket>
42
43 namespace QmlJsDebugClient {
44 class QDeclarativeEngineDebug;
45 class QDeclarativeDebugConnection;
46 }
47
48 namespace Debugger {
49
50 class DebuggerEngine;
51
52 namespace Internal {
53 class QmlDebuggerClient;
54 class QmlAdapterPrivate;
55 } // namespace Internal
56
57 class DEBUGGER_EXPORT QmlAdapter : public QObject
58 {
59     Q_OBJECT
60 public:
61     explicit QmlAdapter(DebuggerEngine *engine, QObject *parent = 0);
62     virtual ~QmlAdapter();
63
64     void beginConnection();
65     void closeConnection();
66
67     bool isConnected() const;
68
69     QmlJsDebugClient::QDeclarativeDebugConnection *connection() const;
70
71     bool disableJsDebugging(bool block);
72
73 public slots:
74     void logServiceStatusChange(const QString &service, QDeclarativeDebugClient::Status newStatus);    
75     void logServiceActivity(const QString &service, const QString &logMessage);
76
77 signals:
78     void connected();
79     void disconnected();
80     void connectionStartupFailed();
81     void connectionError(QAbstractSocket::SocketError socketError);
82     void serviceConnectionError(const QString serviceName);
83
84 private slots:
85     void sendMessage(const QByteArray &msg);
86     void connectionErrorOccurred(QAbstractSocket::SocketError socketError);
87     void clientStatusChanged(QDeclarativeDebugClient::Status status);
88     void connectionStateChanged();
89     void pollInferior();
90
91 private:
92     void connectToViewer();
93     void createDebuggerClient();
94     void showConnectionStatusMessage(const QString &message);
95     void showConnectionErrorMessage(const QString &message);
96     void flushSendBuffer();
97
98 private:
99     QScopedPointer<Internal::QmlAdapterPrivate> d;
100 };
101
102 } // namespace Debugger
103
104 #endif // DEBGUGGER_QMLADAPTER_H