OSDN Git Service

Merge branch '2.3'
[qt-creator-jp/qt-creator-jp.git] / src / plugins / debugger / qml / qmlengine.h
index 3088af4..3c6d6a7 100644 (file)
@@ -4,26 +4,29 @@
 **
 ** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
 **
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: Nokia Corporation (info@qt.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.
+** 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.
+**
+** 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.
+**
+** 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.
 **
-** If you are unsure which license is appropriate for your use, please
-** contact the sales department at http://qt.nokia.com/contact.
+** If you have questions regarding the use of this file, please contact
+** Nokia at info@qt.nokia.com.
 **
 **************************************************************************/
 
 
 #include "debuggerengine.h"
 
-#include <QtCore/QByteArray>
-#include <QtCore/QHash>
-#include <QtCore/QObject>
-#include <QtCore/QPoint>
-#include <QtCore/QProcess>
-#include <QtCore/QQueue>
-#include <QtCore/QTimer>
-#include <QtCore/QVariant>
+#include <utils/outputformat.h>
 
 #include <QtNetwork/QAbstractSocket>
-#include <QtNetwork/QTcpSocket>
-
-#include <projectexplorer/applicationlauncher.h>
 
 namespace Debugger {
 namespace Internal {
 
-class ScriptAgent;
-class WatchData;
-class QmlAdapter;
-class QmlResponse;
-class QmlDebuggerClient;
+class QmlEnginePrivate;
 
-class DEBUGGER_EXPORT QmlEngine : public DebuggerEngine
+class QmlEngine : public DebuggerEngine
 {
     Q_OBJECT
 
 public:
-    explicit QmlEngine(const DebuggerStartParameters &startParameters);
+    QmlEngine(const DebuggerStartParameters &startParameters,
+        DebuggerEngine *masterEngine);
     ~QmlEngine();
 
-    void setAttachToRunningExternalApp(bool value);
-    void shutdownInferiorAsSlave();
-    void shutdownEngineAsSlave();
-    void pauseConnection();
+    void handleRemoteSetupDone(int gdbServerPort, int qmlPort);
+    void handleRemoteSetupFailed(const QString &message);
+
+    bool canDisplayTooltip() const;
+
+    void showMessage(const QString &msg, int channel = LogDebug,
+                     int timeout = -1) const;
+    void filterApplicationMessage(const QString &msg, int channel);
+    virtual bool acceptsWatchesWhileRunning() const;
 
 public slots:
     void messageReceived(const QByteArray &message);
     void disconnected();
 
+private slots:
+    void retryMessageBoxFinished(int result);
+    void wrongSetupMessageBoxFinished(int result);
+
 private:
-    // DebuggerEngine implementation
-    bool isSynchroneous() const { return false; }
+    // DebuggerEngine implementation.
+    bool isSynchronous() const { return false; }
     void executeStep();
     void executeStepOut();
     void executeNext();
@@ -87,21 +86,24 @@ private:
     void shutdownInferior();
     void shutdownEngine();
 
-    void setToolTipExpression(const QPoint &mousePos, TextEditor::ITextEditor *editor, int cursorPos);
+    bool setToolTipExpression(const QPoint &mousePos,
+        TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
 
     void continueInferior();
     void interruptInferior();
 
-    void executeRunToLine(const QString &fileName, int lineNumber);
+    void executeRunToLine(const ContextData &data);
     void executeRunToFunction(const QString &functionName);
-    void executeJumpToLine(const QString &fileName, int lineNumber);
+    void executeJumpToLine(const ContextData &data);
 
     void activateFrame(int index);
     void selectThread(int index);
 
     void attemptBreakpointSynchronization();
+    bool acceptsBreakpoint(BreakpointModelId id) const;
 
-    void assignValueInDebugger(const QString &expr, const QString &value);
+    void assignValueInDebugger(const WatchData *data,
+        const QString &expr, const QVariant &value);
     void loadSymbols(const QString &moduleName);
     void loadAllSymbols();
     void requestModuleSymbols(const QString &moduleName);
@@ -111,34 +113,50 @@ private:
     void reloadFullStack() {}
 
     bool supportsThreads() const { return false; }
-    void updateWatchData(const WatchData &data);
-    void executeDebuggerCommand(const QString& command);
+    void updateWatchData(const WatchData &data,
+        const WatchUpdateFlags &flags);
+    void executeDebuggerCommand(const QString &command);
 
     unsigned int debuggerCapabilities() const;
 
 signals:
     void sendMessage(const QByteArray &msg);
+    void tooltipRequested(const QPoint &mousePos,
+        TextEditor::ITextEditor *editor, int cursorPos);
 
 private slots:
     void connectionEstablished();
     void connectionStartupFailed();
-    void connectionError();
+    void connectionError(QAbstractSocket::SocketError error);
+    void serviceConnectionError(const QString &service);
+    void appendMessage(const QString &msg, Utils::OutputFormat);
+
+    void synchronizeWatchers();
 
-    void slotMessage(QString, bool);
-    void slotAddToOutputWindow(QString, bool);
 private:
     void expandObject(const QByteArray &iname, quint64 objectId);
     void sendPing();
 
+    void closeConnection();
+    void startApplicationLauncher();
+    void stopApplicationLauncher();
+
+    bool isShadowBuildProject() const;
+    QString fromShadowBuildFilename(const QString &filename) const;
+    QString mangleFilenamePaths(const QString &filename,
+        const QString &oldBasePath, const QString &newBasePath) const;
+    QString qmlImportPath() const;
+
+    enum LogDirection {
+        LogSend,
+        LogReceive
+    };
+    void logMessage(LogDirection direction, const QString &str);
+    QString toFileInProject(const QUrl &fileUrl);
+
 private:
     friend class QmlCppEngine;
-
-    int m_ping;
-    QmlAdapter *m_adapter;
-    ProjectExplorer::ApplicationLauncher m_applicationLauncher;
-    bool m_addedAdapterToObjectPool;
-    bool m_attachToRunningExternalApp;
-    bool m_hasShutdown;
+    QmlEnginePrivate *d;
 };
 
 } // namespace Internal