OSDN Git Service

Merge branch '2.3'
[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 (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 info@qt.nokia.com.
30 **
31 **************************************************************************/
32
33 #ifndef DEBUGGER_QMLENGINE_H
34 #define DEBUGGER_QMLENGINE_H
35
36 #include "debuggerengine.h"
37
38 #include <utils/outputformat.h>
39
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     QmlEngine(const DebuggerStartParameters &startParameters,
53         DebuggerEngine *masterEngine);
54     ~QmlEngine();
55
56     void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
57     void handleRemoteSetupFailed(const QString &message);
58
59     bool canDisplayTooltip() const;
60
61     void showMessage(const QString &msg, int channel = LogDebug,
62                      int timeout = -1) const;
63     void filterApplicationMessage(const QString &msg, int channel);
64     virtual bool acceptsWatchesWhileRunning() const;
65
66 public slots:
67     void messageReceived(const QByteArray &message);
68     void disconnected();
69
70 private slots:
71     void retryMessageBoxFinished(int result);
72     void wrongSetupMessageBoxFinished(int result);
73
74 private:
75     // DebuggerEngine implementation.
76     bool isSynchronous() const { return false; }
77     void executeStep();
78     void executeStepOut();
79     void executeNext();
80     void executeStepI();
81     void executeNextI();
82
83     void setupEngine();
84     void setupInferior();
85     void runEngine();
86     void shutdownInferior();
87     void shutdownEngine();
88
89     bool setToolTipExpression(const QPoint &mousePos,
90         TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
91
92     void continueInferior();
93     void interruptInferior();
94
95     void executeRunToLine(const ContextData &data);
96     void executeRunToFunction(const QString &functionName);
97     void executeJumpToLine(const ContextData &data);
98
99     void activateFrame(int index);
100     void selectThread(int index);
101
102     void attemptBreakpointSynchronization();
103     bool acceptsBreakpoint(BreakpointModelId id) const;
104
105     void assignValueInDebugger(const WatchData *data,
106         const QString &expr, const QVariant &value);
107     void loadSymbols(const QString &moduleName);
108     void loadAllSymbols();
109     void requestModuleSymbols(const QString &moduleName);
110     void reloadModules();
111     void reloadRegisters() {}
112     void reloadSourceFiles() {}
113     void reloadFullStack() {}
114
115     bool supportsThreads() const { return false; }
116     void updateWatchData(const WatchData &data,
117         const WatchUpdateFlags &flags);
118     void executeDebuggerCommand(const QString &command);
119
120     unsigned int debuggerCapabilities() const;
121
122 signals:
123     void sendMessage(const QByteArray &msg);
124     void tooltipRequested(const QPoint &mousePos,
125         TextEditor::ITextEditor *editor, int cursorPos);
126
127 private slots:
128     void connectionEstablished();
129     void connectionStartupFailed();
130     void connectionError(QAbstractSocket::SocketError error);
131     void serviceConnectionError(const QString &service);
132     void appendMessage(const QString &msg, Utils::OutputFormat);
133
134     void synchronizeWatchers();
135
136 private:
137     void expandObject(const QByteArray &iname, quint64 objectId);
138     void sendPing();
139
140     void closeConnection();
141     void startApplicationLauncher();
142     void stopApplicationLauncher();
143
144     bool isShadowBuildProject() const;
145     QString fromShadowBuildFilename(const QString &filename) const;
146     QString mangleFilenamePaths(const QString &filename,
147         const QString &oldBasePath, const QString &newBasePath) const;
148     QString qmlImportPath() const;
149
150     enum LogDirection {
151         LogSend,
152         LogReceive
153     };
154     void logMessage(LogDirection direction, const QString &str);
155     QString toFileInProject(const QUrl &fileUrl);
156
157 private:
158     friend class QmlCppEngine;
159     QmlEnginePrivate *d;
160 };
161
162 } // namespace Internal
163 } // namespace Debugger
164
165 #endif // DEBUGGER_QMLENGINE_H