OSDN Git Service

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