qmlengine.h 4.55 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 {
39

40
namespace Internal {
Tobias Hunger's avatar
Tobias Hunger committed
41
class QmlEnginePrivate;
42
} // namespace Internal
43

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

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

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

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

58 59
    void pauseConnection();

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

64 65 66
signals:
    void remoteStartupRequested();

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

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

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

    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();
96
    bool acceptsBreakpoint(BreakpointId id) const;
97

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

113 114
    unsigned int debuggerCapabilities() const;

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

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

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

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

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

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

144
    QScopedPointer<Internal::QmlEnginePrivate> d;
145 146 147 148 149
};

} // namespace Debugger

#endif // DEBUGGER_QMLENGINE_H