qmlengine.h 4.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/**************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** Commercial Usage
**
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** 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.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://qt.nokia.com/contact.
**
**************************************************************************/

#ifndef DEBUGGER_QMLENGINE_H
#define DEBUGGER_QMLENGINE_H

33 34
#include "debuggerengine.h"

35
#include <QtCore/QScopedPointer>
36
#include <QtNetwork/QAbstractSocket>
37

38
namespace Debugger {
Lasse Holmstedt's avatar
Lasse Holmstedt committed
39
class QmlAdapter;
40

Tobias Hunger's avatar
Tobias Hunger committed
41
class QmlEnginePrivate;
42

43
class DEBUGGER_EXPORT QmlEngine : public DebuggerEngine
44 45 46 47
{
    Q_OBJECT

public:
48
    explicit QmlEngine(const DebuggerStartParameters &startParameters);
49
    virtual ~QmlEngine();
50

51
    void handleRemoteSetupDone(int port);
52 53
    void handleRemoteSetupFailed(const QString &message);

54
    void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
55
    void gotoLocation(const Internal::StackFrame &frame, bool setMarker);
56

57 58
    void pauseConnection();

59
public slots:
60
    void messageReceived(const QByteArray &message);
61
    void disconnected();
62

63 64 65
signals:
    void remoteStartupRequested();

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

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

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

    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();
hjk's avatar
hjk committed
95
    bool acceptsBreakpoint(BreakpointId id);
96

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

112 113
    unsigned int debuggerCapabilities() const;

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

Lasse Holmstedt's avatar
Lasse Holmstedt committed
119 120 121
private slots:
    void connectionEstablished();
    void connectionStartupFailed();
122
    void connectionError(QAbstractSocket::SocketError error);
123
    void serviceConnectionError(const QString &service);
Lasse Holmstedt's avatar
Lasse Holmstedt committed
124

125
private:
126
    void expandObject(const QByteArray &iname, quint64 objectId);
127
    void sendPing();
Lasse Holmstedt's avatar
Lasse Holmstedt committed
128

129 130 131 132
    void closeConnection();
    void startApplicationLauncher();
    void stopApplicationLauncher();

133 134
    bool isShadowBuildProject() const;
    QString fromShadowBuildFilename(const QString &filename) const;
hjk's avatar
hjk committed
135 136
    QString mangleFilenamePaths(const QString &filename,
        const QString &oldBasePath, const QString &newBasePath) const;
137 138 139
    QString toShadowBuildFilename(const QString &filename) const;
    QString qmlImportPath() const;

Lasse Holmstedt's avatar
Lasse Holmstedt committed
140
private:
141 142
    friend class QmlCppEngine;

143
    QScopedPointer<QmlEnginePrivate> d;
144 145 146 147 148
};

} // namespace Debugger

#endif // DEBUGGER_QMLENGINE_H