qmlengine.h 5.03 KB
Newer Older
1 2 3 4 5 6
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
8 9 10 11
**
**
** GNU Lesser General Public License Usage
**
hjk's avatar
hjk committed
12 13 14 15 16 17
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this file.
** Please review the following information to ensure the GNU Lesser General
** Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18
**
con's avatar
con committed
19
** In addition, as a special exception, Nokia gives you certain additional
hjk's avatar
hjk committed
20
** rights. These rights are described in the Nokia Qt LGPL Exception
con's avatar
con committed
21 22
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
hjk's avatar
hjk committed
23 24 25 26 27
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
con's avatar
con committed
28
** If you have questions regarding the use of this file, please contact
29
** Nokia at qt-info@nokia.com.
30 31 32 33 34 35
**
**************************************************************************/

#ifndef DEBUGGER_QMLENGINE_H
#define DEBUGGER_QMLENGINE_H

36 37
#include "debuggerengine.h"

con's avatar
con committed
38
#include <utils/outputformat.h>
hjk's avatar
hjk committed
39

40
#include <QtNetwork/QAbstractSocket>
41

42
namespace Debugger {
43 44 45

class QmlAdapter;

46
namespace Internal {
47

Tobias Hunger's avatar
Tobias Hunger committed
48
class QmlEnginePrivate;
49

50
class QmlEngine : public DebuggerEngine
51 52 53 54
{
    Q_OBJECT

public:
55 56 57 58 59
    enum LogDirection {
        LogSend,
        LogReceive
    };

60 61
    QmlEngine(const DebuggerStartParameters &startParameters,
        DebuggerEngine *masterEngine);
62
    ~QmlEngine();
63

Christian Kandeler's avatar
Christian Kandeler committed
64
    void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
65 66
    void handleRemoteSetupFailed(const QString &message);

67
    bool canDisplayTooltip() const;
68

69 70 71
    void showMessage(const QString &msg, int channel = LogDebug,
                     int timeout = -1) const;
    void filterApplicationMessage(const QString &msg, int channel);
72 73 74
    QString toFileInProject(const QUrl &fileUrl);
    void inferiorSpontaneousStop();

75
    void logMessage(const QString &service, LogDirection direction, const QString &str);
76

77 78
    QmlAdapter *adapter() const;

79 80
public slots:
    void disconnected();
81

82
private slots:
83
    void retryMessageBoxFinished(int result);
84
    void wrongSetupMessageBox(const QString &errorMessage);
85
    void wrongSetupMessageBoxFinished(int result);
86

87
private:
88
    // DebuggerEngine implementation.
hjk's avatar
hjk committed
89
    bool isSynchronous() const { return false; }
90 91 92 93 94 95
    void executeStep();
    void executeStepOut();
    void executeNext();
    void executeStepI();
    void executeNextI();

hjk's avatar
hjk committed
96
    void setupEngine();
hjk's avatar
hjk committed
97 98 99 100 101
    void setupInferior();
    void runEngine();
    void shutdownInferior();
    void shutdownEngine();

102
    bool setToolTipExpression(const QPoint &mousePos,
103
        TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
104 105 106 107

    void continueInferior();
    void interruptInferior();

108
    void executeRunToLine(const ContextData &data);
109
    void executeRunToFunction(const QString &functionName);
110
    void executeJumpToLine(const ContextData &data);
111 112 113 114 115

    void activateFrame(int index);
    void selectThread(int index);

    void attemptBreakpointSynchronization();
116 117 118
    void insertBreakpoint(BreakpointModelId id);
    void removeBreakpoint(BreakpointModelId id);
    void changeBreakpoint(BreakpointModelId id);
119
    bool acceptsBreakpoint(BreakpointModelId id) const;
120

121
    void assignValueInDebugger(const WatchData *data,
hjk's avatar
hjk committed
122
        const QString &expr, const QVariant &value);
123 124 125 126 127 128 129 130
    void loadSymbols(const QString &moduleName);
    void loadAllSymbols();
    void requestModuleSymbols(const QString &moduleName);
    void reloadModules();
    void reloadRegisters() {}
    void reloadSourceFiles() {}
    void reloadFullStack() {}

Olivier Goffart's avatar
Olivier Goffart committed
131
    bool supportsThreads() const { return false; }
132 133
    void updateWatchData(const WatchData &data,
        const WatchUpdateFlags &flags);
hjk's avatar
hjk committed
134
    void executeDebuggerCommand(const QString &command);
135

136 137
    unsigned int debuggerCapabilities() const;

138
signals:
hjk's avatar
hjk committed
139 140
    void tooltipRequested(const QPoint &mousePos,
        TextEditor::ITextEditor *editor, int cursorPos);
141

Lasse Holmstedt's avatar
Lasse Holmstedt committed
142
private slots:
143
    void beginConnection();
Lasse Holmstedt's avatar
Lasse Holmstedt committed
144 145
    void connectionEstablished();
    void connectionStartupFailed();
146
    void connectionError(QAbstractSocket::SocketError error);
147
    void serviceConnectionError(const QString &service);
con's avatar
con committed
148
    void appendMessage(const QString &msg, Utils::OutputFormat);
Lasse Holmstedt's avatar
Lasse Holmstedt committed
149

150 151
    void synchronizeWatchers();

152
private:
153 154 155 156
    void closeConnection();
    void startApplicationLauncher();
    void stopApplicationLauncher();

157 158
    bool isShadowBuildProject() const;
    QString fromShadowBuildFilename(const QString &filename) const;
hjk's avatar
hjk committed
159 160
    QString mangleFilenamePaths(const QString &filename,
        const QString &oldBasePath, const QString &newBasePath) const;
161 162
    QString qmlImportPath() const;

Lasse Holmstedt's avatar
Lasse Holmstedt committed
163
private:
164
    friend class QmlCppEngine;
hjk's avatar
hjk committed
165
    QmlEnginePrivate *d;
166 167
};

168
} // namespace Internal
169 170 171
} // namespace Debugger

#endif // DEBUGGER_QMLENGINE_H