qmlengine.h 4.76 KB
Newer Older
1 2 3 4 5 6 7 8
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
con's avatar
con committed
9
** No Commercial Usage
10
**
con's avatar
con committed
11 12 13 14
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
15 16 17 18 19 20 21 22 23 24
**
** GNU Lesser General Public License Usage
**
** Alternatively, 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.
**
con's avatar
con committed
25 26 27 28 29 30
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
31 32 33 34 35 36
**
**************************************************************************/

#ifndef DEBUGGER_QMLENGINE_H
#define DEBUGGER_QMLENGINE_H

37 38
#include "debuggerengine.h"

39
#include <QtCore/QScopedPointer>
40
#include <QtNetwork/QAbstractSocket>
41

42
namespace Debugger {
43
namespace Internal {
44

Tobias Hunger's avatar
Tobias Hunger committed
45
class QmlEnginePrivate;
46

47
class QmlEngine : public DebuggerEngine
48 49 50 51
{
    Q_OBJECT

public:
52
    explicit QmlEngine(const DebuggerStartParameters &startParameters);
53
    ~QmlEngine();
54

55
    void handleRemoteSetupDone(int port);
56 57
    void handleRemoteSetupFailed(const QString &message);

58
    void gotoLocation(const Location &location);
59 60
    void pauseConnection();

61
public slots:
62
    void messageReceived(const QByteArray &message);
63
    void disconnected();
64

65 66 67
signals:
    void remoteStartupRequested();

68
private:
69
    // DebuggerEngine implementation.
hjk's avatar
hjk committed
70
    bool isSynchronous() const { return false; }
71 72 73 74 75 76
    void executeStep();
    void executeStepOut();
    void executeNext();
    void executeStepI();
    void executeNextI();

hjk's avatar
hjk committed
77
    void setupEngine();
hjk's avatar
hjk committed
78 79 80 81 82
    void setupInferior();
    void runEngine();
    void shutdownInferior();
    void shutdownEngine();

hjk's avatar
hjk committed
83 84
    void setToolTipExpression(const QPoint &mousePos,
        TextEditor::ITextEditor *editor, int cursorPos);
85 86 87 88 89 90 91 92 93 94 95 96

    void continueInferior();
    void interruptInferior();

    void executeRunToLine(const QString &fileName, int lineNumber);
    void executeRunToFunction(const QString &functionName);
    void executeJumpToLine(const QString &fileName, int lineNumber);

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

    void attemptBreakpointSynchronization();
97
    bool acceptsBreakpoint(BreakpointId id) const;
98

99
    void assignValueInDebugger(const WatchData *data,
hjk's avatar
hjk committed
100
        const QString &expr, const QVariant &value);
101 102 103 104 105 106 107 108
    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
109
    bool supportsThreads() const { return false; }
110 111
    void updateWatchData(const WatchData &data,
        const WatchUpdateFlags &flags);
hjk's avatar
hjk committed
112
    void executeDebuggerCommand(const QString &command);
113

114 115
    unsigned int debuggerCapabilities() const;

116
signals:
117
    void sendMessage(const QByteArray &msg);
hjk's avatar
hjk committed
118 119
    void tooltipRequested(const QPoint &mousePos,
        TextEditor::ITextEditor *editor, int cursorPos);
120

Lasse Holmstedt's avatar
Lasse Holmstedt committed
121 122 123
private slots:
    void connectionEstablished();
    void connectionStartupFailed();
124
    void connectionError(QAbstractSocket::SocketError error);
125
    void serviceConnectionError(const QString &service);
hjk's avatar
hjk committed
126 127
    void appendMessage(const QString &msg, bool);
    void appendOutput(const QString &msg, bool);
Lasse Holmstedt's avatar
Lasse Holmstedt committed
128

129
private:
130
    void expandObject(const QByteArray &iname, quint64 objectId);
131
    void sendPing();
Lasse Holmstedt's avatar
Lasse Holmstedt committed
132

133 134 135 136
    void closeConnection();
    void startApplicationLauncher();
    void stopApplicationLauncher();

137 138
    bool isShadowBuildProject() const;
    QString fromShadowBuildFilename(const QString &filename) const;
hjk's avatar
hjk committed
139 140
    QString mangleFilenamePaths(const QString &filename,
        const QString &oldBasePath, const QString &newBasePath) const;
141 142 143
    QString toShadowBuildFilename(const QString &filename) const;
    QString qmlImportPath() const;

144 145 146 147 148 149
    enum LogDirection {
        LogSend,
        LogReceive
    };
    void logMessage(LogDirection direction, const QString &str);

Lasse Holmstedt's avatar
Lasse Holmstedt committed
150
private:
151 152
    friend class QmlCppEngine;

153
    QScopedPointer<QmlEnginePrivate> d;
154 155
};

156
} // namespace Internal
157 158 159
} // namespace Debugger

#endif // DEBUGGER_QMLENGINE_H