qmlengine.h 4.52 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 41

struct 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 55 56 57
    void setAttachToRunningExternalApp(bool value);
    void shutdownInferiorAsSlave();
    void shutdownEngineAsSlave();
    void pauseConnection();
58
    void gotoLocation(const QString &fileName, int lineNumber, bool setMarker);
59
    void gotoLocation(const Internal::StackFrame &frame, bool setMarker);
60

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

hjk's avatar
hjk committed
99 100
    void assignValueInDebugger(const Internal::WatchData *data,
        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; }
hjk's avatar
hjk committed
110 111 112
    void updateWatchData(const Internal::WatchData &data,
        const Internal::WatchUpdateFlags &flags);
    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);
Lasse Holmstedt's avatar
Lasse Holmstedt committed
126

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

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

Lasse Holmstedt's avatar
Lasse Holmstedt committed
138
private:
139 140
    friend class QmlCppEngine;

141
    QScopedPointer<QmlEnginePrivate> d;
142 143 144 145 146
};

} // namespace Debugger

#endif // DEBUGGER_QMLENGINE_H