OSDN Git Service

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