OSDN Git Service

Merge remote branch 'origin/2.1'
[qt-creator-jp/qt-creator-jp.git] / src / plugins / debugger / qml / qmlengine.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef DEBUGGER_QMLENGINE_H
35 #define DEBUGGER_QMLENGINE_H
36
37 #include "debuggerengine.h"
38
39 #include <QtCore/QScopedPointer>
40 #include <QtNetwork/QAbstractSocket>
41
42 namespace Debugger {
43 namespace Internal {
44
45 class QmlEnginePrivate;
46
47 class QmlEngine : public DebuggerEngine
48 {
49     Q_OBJECT
50
51 public:
52     explicit QmlEngine(const DebuggerStartParameters &startParameters);
53     ~QmlEngine();
54
55     void handleRemoteSetupDone(int port);
56     void handleRemoteSetupFailed(const QString &message);
57
58     void gotoLocation(const Location &location);
59     void pauseConnection();
60
61 public slots:
62     void messageReceived(const QByteArray &message);
63     void disconnected();
64
65 signals:
66     void remoteStartupRequested();
67
68 private:
69     // DebuggerEngine implementation.
70     bool isSynchronous() const { return false; }
71     void executeStep();
72     void executeStepOut();
73     void executeNext();
74     void executeStepI();
75     void executeNextI();
76
77     void setupEngine();
78     void setupInferior();
79     void runEngine();
80     void shutdownInferior();
81     void shutdownEngine();
82
83     void setToolTipExpression(const QPoint &mousePos,
84         TextEditor::ITextEditor *editor, int cursorPos);
85
86     void continueInferior();
87     void interruptInferior();
88
89     void executeRunToLine(const QString &fileName, int lineNumber);
90     void executeRunToFunction(const QString &functionName);
91     void executeJumpToLine(const QString &fileName, int lineNumber);
92
93     void activateFrame(int index);
94     void selectThread(int index);
95
96     void attemptBreakpointSynchronization();
97     bool acceptsBreakpoint(BreakpointId id) const;
98
99     void assignValueInDebugger(const WatchData *data,
100         const QString &expr, const QVariant &value);
101     void loadSymbols(const QString &moduleName);
102     void loadAllSymbols();
103     void requestModuleSymbols(const QString &moduleName);
104     void reloadModules();
105     void reloadRegisters() {}
106     void reloadSourceFiles() {}
107     void reloadFullStack() {}
108
109     bool supportsThreads() const { return false; }
110     void updateWatchData(const WatchData &data,
111         const WatchUpdateFlags &flags);
112     void executeDebuggerCommand(const QString &command);
113
114     unsigned int debuggerCapabilities() const;
115
116 signals:
117     void sendMessage(const QByteArray &msg);
118     void tooltipRequested(const QPoint &mousePos,
119         TextEditor::ITextEditor *editor, int cursorPos);
120
121 private slots:
122     void connectionEstablished();
123     void connectionStartupFailed();
124     void connectionError(QAbstractSocket::SocketError error);
125     void serviceConnectionError(const QString &service);
126     void appendMessage(const QString &msg, bool);
127     void appendOutput(const QString &msg, bool);
128
129 private:
130     void expandObject(const QByteArray &iname, quint64 objectId);
131     void sendPing();
132
133     void closeConnection();
134     void startApplicationLauncher();
135     void stopApplicationLauncher();
136
137     bool isShadowBuildProject() const;
138     QString fromShadowBuildFilename(const QString &filename) const;
139     QString mangleFilenamePaths(const QString &filename,
140         const QString &oldBasePath, const QString &newBasePath) const;
141     QString toShadowBuildFilename(const QString &filename) const;
142     QString qmlImportPath() const;
143
144     enum LogDirection {
145         LogSend,
146         LogReceive
147     };
148     void logMessage(LogDirection direction, const QString &str);
149
150 private:
151     friend class QmlCppEngine;
152
153     QScopedPointer<QmlEnginePrivate> d;
154 };
155
156 } // namespace Internal
157 } // namespace Debugger
158
159 #endif // DEBUGGER_QMLENGINE_H