summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qmldebugger/canvasframerate.h34
-rw-r--r--tools/qmldebugger/creatorplugin/QmlInspector.pluginspec28
-rw-r--r--tools/qmldebugger/creatorplugin/README5
-rw-r--r--tools/qmldebugger/creatorplugin/creatorplugin.pro29
-rw-r--r--tools/qmldebugger/creatorplugin/images/logo.pngbin0 -> 2662 bytes
-rw-r--r--tools/qmldebugger/creatorplugin/inspectoroutputpane.cpp108
-rw-r--r--tools/qmldebugger/creatorplugin/inspectoroutputpane.h55
-rw-r--r--tools/qmldebugger/creatorplugin/qmlinspector.h25
-rw-r--r--tools/qmldebugger/creatorplugin/qmlinspector.qrc6
-rw-r--r--tools/qmldebugger/creatorplugin/qmlinspectormode.cpp495
-rw-r--r--tools/qmldebugger/creatorplugin/qmlinspectormode.h91
-rw-r--r--tools/qmldebugger/creatorplugin/qmlinspectorplugin.cpp138
-rw-r--r--tools/qmldebugger/creatorplugin/qmlinspectorplugin.h50
-rw-r--r--tools/qmldebugger/creatorplugin/runcontrol.cpp135
-rw-r--r--tools/qmldebugger/creatorplugin/runcontrol.h65
-rw-r--r--tools/qmldebugger/qmldebugger.pro14
-rw-r--r--tools/qmldebugger/standalone/canvasframerate.cpp (renamed from tools/qmldebugger/canvasframerate.cpp)65
-rw-r--r--tools/qmldebugger/standalone/canvasframerate.h46
-rw-r--r--tools/qmldebugger/standalone/engine.cpp (renamed from tools/qmldebugger/engine.cpp)0
-rw-r--r--tools/qmldebugger/standalone/engine.h (renamed from tools/qmldebugger/engine.h)0
-rw-r--r--tools/qmldebugger/standalone/engine.png (renamed from tools/qmldebugger/engine.png)bin6394 -> 6394 bytes
-rw-r--r--tools/qmldebugger/standalone/engines.qml (renamed from tools/qmldebugger/engines.qml)0
-rw-r--r--tools/qmldebugger/standalone/expressionquerywidget.cpp (renamed from tools/qmldebugger/expressionquerywidget.cpp)25
-rw-r--r--tools/qmldebugger/standalone/expressionquerywidget.h (renamed from tools/qmldebugger/expressionquerywidget.h)2
-rw-r--r--tools/qmldebugger/standalone/main.cpp (renamed from tools/qmldebugger/main.cpp)0
-rw-r--r--tools/qmldebugger/standalone/objectpropertiesview.cpp (renamed from tools/qmldebugger/objectpropertiesview.cpp)7
-rw-r--r--tools/qmldebugger/standalone/objectpropertiesview.h (renamed from tools/qmldebugger/objectpropertiesview.h)1
-rw-r--r--tools/qmldebugger/standalone/objecttree.cpp (renamed from tools/qmldebugger/objecttree.cpp)3
-rw-r--r--tools/qmldebugger/standalone/objecttree.h (renamed from tools/qmldebugger/objecttree.h)0
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.cpp (renamed from tools/qmldebugger/qmldebugger.cpp)3
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.h (renamed from tools/qmldebugger/qmldebugger.h)0
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.pri (renamed from tools/qmldebugger/qmldebugger.pri)12
-rw-r--r--tools/qmldebugger/standalone/qmldebugger.qrc (renamed from tools/qmldebugger/qmldebugger.qrc)0
-rw-r--r--tools/qmldebugger/standalone/refresh.png (renamed from tools/qmldebugger/refresh.png)bin6169 -> 6169 bytes
-rw-r--r--tools/qmldebugger/standalone/standalone.pro18
-rw-r--r--tools/qmldebugger/standalone/watchtable.cpp (renamed from tools/qmldebugger/watchtable.cpp)18
-rw-r--r--tools/qmldebugger/standalone/watchtable.h (renamed from tools/qmldebugger/watchtable.h)3
-rw-r--r--tools/qmlviewer/main.cpp11
38 files changed, 1406 insertions, 86 deletions
diff --git a/tools/qmldebugger/canvasframerate.h b/tools/qmldebugger/canvasframerate.h
deleted file mode 100644
index aa275aa..0000000
--- a/tools/qmldebugger/canvasframerate.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef CANVASFRAMERATE_H
-#define CANVASFRAMERATE_H
-
-#include <QWidget>
-
-QT_BEGIN_NAMESPACE
-
-class QmlDebugConnection;
-class QTabWidget;
-class QSpinBox;
-class CanvasFrameRate : public QWidget
-{
- Q_OBJECT
-public:
- CanvasFrameRate(QmlDebugConnection *, QWidget *parent = 0);
-
- void setSizeHint(const QSize &);
- virtual QSize sizeHint() const;
-
-private slots:
- void newTab();
- void stateChanged(int);
-
-private:
- QTabWidget *m_tabs;
- QSpinBox *m_spin;
- QObject *m_plugin;
- QSize m_sizeHint;
-};
-
-QT_END_NAMESPACE
-
-#endif // CANVASFRAMERATE_H
-
diff --git a/tools/qmldebugger/creatorplugin/QmlInspector.pluginspec b/tools/qmldebugger/creatorplugin/QmlInspector.pluginspec
new file mode 100644
index 0000000..cdba135
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/QmlInspector.pluginspec
@@ -0,0 +1,28 @@
+<plugin name="QmlInspector" version="1.3.80" compatVersion="1.3.80">
+ <vendor>Nokia Corporation</vendor>
+ <copyright>(C) 2008-2009 Nokia Corporation</copyright>
+ <license>
+Commercial Usage
+
+Licensees holding valid Qt Commercial licenses may use this plugin 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 plugin may be used under the terms of the GNU Lesser
+General Public License version 2.1 as published by the Free Software
+Foundation. 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.</license>
+ <description>Qml support</description>
+ <url>http://qt.nokia.com</url>
+ <dependencyList>
+ <dependency name="QmlProjectManager" version="1.3.80"/>
+ <dependency name="ProjectExplorer" version="1.3.80"/>
+ <dependency name="CppTools" version="1.3.80"/>
+ <dependency name="CppEditor" version="1.3.80"/>
+ <dependency name="Help" version="1.3.80"/>
+ </dependencyList>
+</plugin> \ No newline at end of file
diff --git a/tools/qmldebugger/creatorplugin/README b/tools/qmldebugger/creatorplugin/README
new file mode 100644
index 0000000..e7e205e
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/README
@@ -0,0 +1,5 @@
+To enable this project, qmldebugger.pro requires that these two environment
+variables be defined:
+
+CREATOR_SRC_DIR -> source directory for Qt Creator
+CREATOR_BUILD_DIR -> build directory for Qt Creator
diff --git a/tools/qmldebugger/creatorplugin/creatorplugin.pro b/tools/qmldebugger/creatorplugin/creatorplugin.pro
new file mode 100644
index 0000000..d191a37
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/creatorplugin.pro
@@ -0,0 +1,29 @@
+TEMPLATE = lib
+TARGET = QmlInspector
+
+INCLUDEPATH += .
+DEPENDPATH += .
+
+include(../standalone/qmldebugger.pri)
+
+HEADERS += qmlinspectorplugin.h \
+ qmlinspector.h \
+ qmlinspectormode.h \
+ inspectoroutputpane.h \
+ runcontrol.h
+
+SOURCES += qmlinspectorplugin.cpp \
+ qmlinspectormode.cpp \
+ inspectoroutputpane.cpp \
+ runcontrol.cpp
+
+OTHER_FILES += QmlInspector.pluginspec
+RESOURCES += qmlinspector.qrc
+
+IDE_BUILD_TREE=$$(CREATOR_BUILD_DIR)
+
+include($$(CREATOR_SRC_DIR)/src/qtcreatorplugin.pri)
+include($$(CREATOR_SRC_DIR)/src/plugins/projectexplorer/projectexplorer.pri)
+include($$(CREATOR_SRC_DIR)/src/plugins/coreplugin/coreplugin.pri)
+LIBS += -L$$(CREATOR_BUILD_DIR)/lib/qtcreator
+
diff --git a/tools/qmldebugger/creatorplugin/images/logo.png b/tools/qmldebugger/creatorplugin/images/logo.png
new file mode 100644
index 0000000..5ac14a5
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/images/logo.png
Binary files differ
diff --git a/tools/qmldebugger/creatorplugin/inspectoroutputpane.cpp b/tools/qmldebugger/creatorplugin/inspectoroutputpane.cpp
new file mode 100644
index 0000000..d3f9913
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/inspectoroutputpane.cpp
@@ -0,0 +1,108 @@
+#include <QtGui/qtextedit.h>
+
+#include "inspectoroutputpane.h"
+
+InspectorOutputPane::InspectorOutputPane(QObject *parent)
+ : Core::IOutputPane(parent),
+ m_textEdit(new QTextEdit)
+{
+}
+
+InspectorOutputPane::~InspectorOutputPane()
+{
+ delete m_textEdit;
+}
+
+QWidget *InspectorOutputPane::outputWidget(QWidget *parent)
+{
+ Q_UNUSED(parent);
+ return m_textEdit;
+}
+
+QList<QWidget*> InspectorOutputPane::toolBarWidgets() const
+{
+ return QList<QWidget *>();
+}
+
+QString InspectorOutputPane::name() const
+{
+ return tr("Inspector Output");
+}
+
+int InspectorOutputPane::priorityInStatusBar() const
+{
+ return 1;
+}
+
+void InspectorOutputPane::clearContents()
+{
+ m_textEdit->clear();
+}
+
+void InspectorOutputPane::visibilityChanged(bool visible)
+{
+ Q_UNUSED(visible);
+}
+
+void InspectorOutputPane::setFocus()
+{
+ m_textEdit->setFocus();
+}
+
+bool InspectorOutputPane::hasFocus()
+{
+ return m_textEdit->hasFocus();
+}
+
+bool InspectorOutputPane::canFocus()
+{
+ return true;
+}
+
+bool InspectorOutputPane::canNavigate()
+{
+ return false;
+}
+
+bool InspectorOutputPane::canNext()
+{
+ return false;
+}
+
+bool InspectorOutputPane::canPrevious()
+{
+ return false;
+}
+
+void InspectorOutputPane::goToNext()
+{
+}
+
+void InspectorOutputPane::goToPrev()
+{
+}
+
+void InspectorOutputPane::addOutput(RunControl *, const QString &text)
+{
+ m_textEdit->insertPlainText(text);
+ m_textEdit->moveCursor(QTextCursor::End);
+}
+
+void InspectorOutputPane::addOutputInline(RunControl *, const QString &text)
+{
+ m_textEdit->insertPlainText(text);
+ m_textEdit->moveCursor(QTextCursor::End);
+}
+
+void InspectorOutputPane::addErrorOutput(RunControl *, const QString &text)
+{
+ m_textEdit->append(text);
+ m_textEdit->moveCursor(QTextCursor::End);
+}
+
+void InspectorOutputPane::addInspectorStatus(const QString &text)
+{
+ m_textEdit->append(text);
+ m_textEdit->moveCursor(QTextCursor::End);
+}
+
diff --git a/tools/qmldebugger/creatorplugin/inspectoroutputpane.h b/tools/qmldebugger/creatorplugin/inspectoroutputpane.h
new file mode 100644
index 0000000..60c648a
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/inspectoroutputpane.h
@@ -0,0 +1,55 @@
+#ifndef INSPECTOROUTPUTPANE_H
+#define INSPECTOROUTPUTPANE_H
+
+#include <QtCore/QObject>
+
+#include <coreplugin/ioutputpane.h>
+
+
+QT_BEGIN_NAMESPACE
+
+class QTextEdit;
+
+class RunControl;
+
+class InspectorOutputPane : public Core::IOutputPane
+{
+ Q_OBJECT
+public:
+ InspectorOutputPane(QObject *parent = 0);
+ virtual ~InspectorOutputPane();
+
+ virtual QWidget *outputWidget(QWidget *parent);
+ virtual QList<QWidget*> toolBarWidgets() const;
+ virtual QString name() const;
+
+ virtual int priorityInStatusBar() const;
+
+ virtual void clearContents();
+ virtual void visibilityChanged(bool visible);
+
+ virtual void setFocus();
+ virtual bool hasFocus();
+ virtual bool canFocus();
+
+ virtual bool canNavigate();
+ virtual bool canNext();
+ virtual bool canPrevious();
+ virtual void goToNext();
+ virtual void goToPrev();
+
+public slots:
+ void addOutput(RunControl *, const QString &text);
+ void addOutputInline(RunControl *, const QString &text);
+
+ void addErrorOutput(RunControl *, const QString &text);
+ void addInspectorStatus(const QString &text);
+
+private:
+ QTextEdit *m_textEdit;
+};
+
+QT_END_NAMESPACE
+
+#endif
+
diff --git a/tools/qmldebugger/creatorplugin/qmlinspector.h b/tools/qmldebugger/creatorplugin/qmlinspector.h
new file mode 100644
index 0000000..98b9cbe
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/qmlinspector.h
@@ -0,0 +1,25 @@
+#ifndef QMLINSPECTOR_H
+#define QMLINSPECTOR_H
+
+#include <QString>
+
+namespace QmlInspector {
+ namespace Constants {
+ const char * const RUN = "QmlInspector.Run";
+ const char * const STOP = "QmlInspector.Stop";
+
+ const char * const C_INSPECTOR = "QmlInspector";
+ };
+
+ class StartParameters
+ {
+ public:
+ StartParameters() : port(0) {}
+ ~StartParameters() {}
+
+ QString address;
+ quint16 port;
+ };
+};
+
+#endif
diff --git a/tools/qmldebugger/creatorplugin/qmlinspector.qrc b/tools/qmldebugger/creatorplugin/qmlinspector.qrc
new file mode 100644
index 0000000..45e8dda
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/qmlinspector.qrc
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/qmlinspector" >
+ <file>images/logo.png</file>
+ </qresource>
+</RCC>
+
diff --git a/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp b/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp
new file mode 100644
index 0000000..9367b19
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/qmlinspectormode.cpp
@@ -0,0 +1,495 @@
+#include <QtCore/QStringList>
+#include <QtCore/QtPlugin>
+#include <QtCore/QDebug>
+
+#include <QtGui/qtoolbutton.h>
+#include <QtGui/qtoolbar.h>
+#include <QtGui/qboxlayout.h>
+#include <QtGui/qlabel.h>
+#include <QtGui/qdockwidget.h>
+#include <QtGui/qaction.h>
+#include <QtGui/qlineedit.h>
+#include <QtGui/qlabel.h>
+#include <QtGui/qspinbox.h>
+
+#include <coreplugin/basemode.h>
+#include <coreplugin/findplaceholder.h>
+#include <coreplugin/minisplitter.h>
+#include <coreplugin/outputpane.h>
+#include <coreplugin/rightpane.h>
+#include <coreplugin/navigationwidget.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/uniqueidmanager.h>
+
+#include <coreplugin/editormanager/editormanager.h>
+#include <coreplugin/actionmanager/actionmanager.h>
+
+#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/project.h>
+
+#include <utils/styledbar.h>
+#include <utils/fancymainwindow.h>
+
+#include <QtDeclarative/qmldebug.h>
+#include <QtDeclarative/qmldebugclient.h>
+
+#include "../standalone/objectpropertiesview.h"
+#include "../standalone/objecttree.h"
+#include "../standalone/watchtable.h"
+#include "../standalone/canvasframerate.h"
+#include "../standalone/expressionquerywidget.h"
+
+#include "qmlinspector.h"
+#include "qmlinspectormode.h"
+
+QT_BEGIN_NAMESPACE
+
+
+class EngineSpinBox : public QSpinBox
+{
+ Q_OBJECT
+public:
+ struct EngineInfo
+ {
+ QString name;
+ int id;
+ };
+
+ EngineSpinBox(QWidget *parent = 0);
+
+ void addEngine(int engine, const QString &name);
+ void clearEngines();
+
+protected:
+ virtual QString textFromValue(int value) const;
+ virtual int valueFromText(const QString &text) const;
+
+private:
+ QList<EngineInfo> m_engines;
+};
+
+EngineSpinBox::EngineSpinBox(QWidget *parent)
+ : QSpinBox(parent)
+{
+ setEnabled(false);
+ setReadOnly(true);
+ setRange(0, 0);
+}
+
+void EngineSpinBox::addEngine(int engine, const QString &name)
+{
+ EngineInfo info;
+ info.id = engine;
+ if (name.isEmpty())
+ info.name = tr("Engine %1", "engine number").arg(engine);
+ else
+ info.name = name;
+ m_engines << info;
+
+ setRange(0, m_engines.count()-1);
+}
+
+void EngineSpinBox::clearEngines()
+{
+ m_engines.clear();
+}
+
+QString EngineSpinBox::textFromValue(int value) const
+{
+ for (int i=0; i<m_engines.count(); i++) {
+ if (m_engines[i].id == value)
+ return m_engines[i].name;
+ }
+ return QLatin1String("<None>");
+}
+
+int EngineSpinBox::valueFromText(const QString &text) const
+{
+ for (int i=0; i<m_engines.count(); i++) {
+ if (m_engines[i].name == text)
+ return m_engines[i].id;
+ }
+ return -1;
+}
+
+
+QmlInspectorMode::QmlInspectorMode(QObject *parent)
+ : Core::BaseMode(parent),
+ m_conn(0),
+ m_client(0),
+ m_engineQuery(0),
+ m_contextQuery(0)
+{
+ m_watchTableModel = new WatchTableModel(0, this);
+
+ initActions();
+ setWidget(createModeWindow());
+
+ setName(tr("QML Inspect"));
+ setIcon(QIcon(":/qmlinspector/images/logo.png"));
+ setUniqueModeName("QML_INSPECT_MODE");
+}
+
+quint16 QmlInspectorMode::viewerPort() const
+{
+ return m_portSpinBox->value();
+}
+
+void QmlInspectorMode::connectToViewer()
+{
+ if (m_conn && m_conn->state() != QAbstractSocket::UnconnectedState)
+ return;
+
+ delete m_client; m_client = 0;
+
+ if (m_conn) {
+ m_conn->disconnectFromHost();
+ delete m_conn;
+ }
+
+ m_conn = new QmlDebugConnection(this);
+ connect(m_conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
+ SLOT(connectionStateChanged()));
+ connect(m_conn, SIGNAL(error(QAbstractSocket::SocketError)),
+ SLOT(connectionError()));
+ m_conn->connectToHost(m_addressEdit->text(), m_portSpinBox->value());
+}
+
+void QmlInspectorMode::disconnectFromViewer()
+{
+ m_conn->disconnectFromHost();
+}
+
+void QmlInspectorMode::connectionStateChanged()
+{
+ switch (m_conn->state()) {
+ default:
+ case QAbstractSocket::UnconnectedState:
+ emit statusMessage(tr("[Inspector] disconnected\n\n"));
+ m_addressEdit->setEnabled(true);
+ m_portSpinBox->setEnabled(true);
+ break;
+ case QAbstractSocket::HostLookupState:
+ emit statusMessage(tr("[Inspector] resolving host..."));
+ break;
+ case QAbstractSocket::ConnectingState:
+ emit statusMessage(tr("[Inspector] connecting to debug server..."));
+ break;
+ case QAbstractSocket::ConnectedState:
+ {
+ emit statusMessage(tr("[Inspector] connected\n"));
+ m_addressEdit->setEnabled(false);
+ m_portSpinBox->setEnabled(false);
+
+ if (!m_client) {
+ m_client = new QmlEngineDebug(m_conn, this);
+ m_objectTreeWidget->setEngineDebug(m_client);
+ m_propertiesWidget->setEngineDebug(m_client);
+ m_watchTableModel->setEngineDebug(m_client);
+ m_expressionWidget->setEngineDebug(m_client);
+ }
+
+ m_objectTreeWidget->clear();
+ m_propertiesWidget->clear();
+ m_expressionWidget->clear();
+ m_watchTableModel->removeAllWatches();
+ m_frameRateWidget->reset(m_conn);
+
+ reloadEngines();
+ break;
+ }
+ case QAbstractSocket::ClosingState:
+ emit statusMessage(tr("[Inspector] closing..."));
+ break;
+ }
+}
+
+void QmlInspectorMode::connectionError()
+{
+ emit statusMessage(tr("[Inspector] error: (%1) %2", "%1=error code, %2=error message")
+ .arg(m_conn->error()).arg(m_conn->errorString()));
+}
+
+void QmlInspectorMode::initActions()
+{
+ m_actions.startAction = new QAction(tr("Start Inspector"), this);
+ m_actions.startAction->setIcon(QIcon(ProjectExplorer::Constants::ICON_RUN));
+
+ m_actions.stopAction = new QAction(tr("Stop Inspector"), this);
+ m_actions.stopAction->setIcon(QIcon(ProjectExplorer::Constants::ICON_STOP));
+
+ Core::ICore *core = Core::ICore::instance();
+ Core::ActionManager *am = core->actionManager();
+ Core::UniqueIDManager *uidm = core->uniqueIDManager();
+
+ QList<int> context;
+ context << uidm->uniqueIdentifier(QmlInspector::Constants::C_INSPECTOR);
+
+ am->registerAction(m_actions.startAction, QmlInspector::Constants::RUN, context);
+ connect(m_actions.startAction, SIGNAL(triggered()), SIGNAL(startViewer()));
+
+ am->registerAction(m_actions.stopAction, QmlInspector::Constants::STOP, context);
+ connect(m_actions.stopAction, SIGNAL(triggered()), SIGNAL(stopViewer()));
+}
+
+
+QToolButton *QmlInspectorMode::createToolButton(QAction *action)
+{
+ QToolButton *button = new QToolButton;
+ button->setDefaultAction(action);
+ return button;
+}
+
+QWidget *QmlInspectorMode::createMainView()
+{
+ initWidgets();
+
+ Utils::FancyMainWindow *mainWindow = new Utils::FancyMainWindow;
+ mainWindow->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
+ mainWindow->setDocumentMode(true);
+
+ QBoxLayout *editorHolderLayout = new QVBoxLayout;
+ editorHolderLayout->setMargin(0);
+ editorHolderLayout->setSpacing(0);
+
+ QWidget *editorAndFindWidget = new QWidget;
+ editorAndFindWidget->setLayout(editorHolderLayout);
+ editorHolderLayout->addWidget(new Core::EditorManagerPlaceHolder(this));
+ editorHolderLayout->addWidget(new Core::FindToolBarPlaceHolder(editorAndFindWidget));
+
+ Utils::StyledBar *treeOptionBar = new Utils::StyledBar;
+ QHBoxLayout *treeOptionBarLayout = new QHBoxLayout(treeOptionBar);
+ treeOptionBarLayout->setContentsMargins(5, 0, 5, 0);
+ treeOptionBarLayout->setSpacing(5);
+ treeOptionBarLayout->addWidget(new QLabel(tr("QML engine:")));
+ treeOptionBarLayout->addWidget(m_engineSpinBox);
+
+ QWidget *treeWindow = new QWidget;
+ QVBoxLayout *treeWindowLayout = new QVBoxLayout(treeWindow);
+ treeWindowLayout->setMargin(0);
+ treeWindowLayout->setSpacing(0);
+ treeWindowLayout->addWidget(treeOptionBar);
+ treeWindowLayout->addWidget(m_objectTreeWidget);
+
+ Core::MiniSplitter *documentAndTree = new Core::MiniSplitter;
+ documentAndTree->addWidget(editorAndFindWidget);
+ documentAndTree->addWidget(new Core::RightPanePlaceHolder(this));
+ documentAndTree->addWidget(treeWindow);
+ documentAndTree->setStretchFactor(0, 2);
+ documentAndTree->setStretchFactor(1, 0);
+ documentAndTree->setStretchFactor(2, 0);
+
+ Utils::StyledBar *configBar = new Utils::StyledBar;
+ configBar->setProperty("topBorder", true);
+
+ QHBoxLayout *configBarLayout = new QHBoxLayout(configBar);
+ configBarLayout->setMargin(0);
+ configBarLayout->setSpacing(5);
+
+ Core::ICore *core = Core::ICore::instance();
+ Core::ActionManager *am = core->actionManager();
+ configBarLayout->addWidget(createToolButton(am->command(QmlInspector::Constants::RUN)->action()));
+ configBarLayout->addWidget(createToolButton(am->command(QmlInspector::Constants::STOP)->action()));
+ configBarLayout->addWidget(m_addressEdit);
+ configBarLayout->addWidget(m_portSpinBox);
+ configBarLayout->addStretch();
+
+ QWidget *widgetAboveTabs = new QWidget;
+ QVBoxLayout *widgetAboveTabsLayout = new QVBoxLayout(widgetAboveTabs);
+ widgetAboveTabsLayout->setMargin(0);
+ widgetAboveTabsLayout->setSpacing(0);
+ widgetAboveTabsLayout->addWidget(documentAndTree);
+ widgetAboveTabsLayout->addWidget(configBar);
+
+ Core::MiniSplitter *mainSplitter = new Core::MiniSplitter(Qt::Vertical);
+ mainSplitter->addWidget(widgetAboveTabs);
+ mainSplitter->addWidget(createBottomWindow());
+ mainSplitter->setStretchFactor(0, 3);
+ mainSplitter->setStretchFactor(1, 1);
+
+ QWidget *centralWidget = new QWidget;
+ QVBoxLayout *centralLayout = new QVBoxLayout(centralWidget);
+ centralLayout->setMargin(0);
+ centralLayout->setSpacing(0);
+ centralLayout->addWidget(mainSplitter);
+
+ mainWindow->setCentralWidget(centralWidget);
+
+ return mainWindow;
+}
+
+QWidget *QmlInspectorMode::createBottomWindow()
+{
+ Utils::FancyMainWindow *win = new Utils::FancyMainWindow;
+ win->setTabPosition(Qt::AllDockWidgetAreas, QTabWidget::North);
+ win->setDocumentMode(true);
+ win->setTrackingEnabled(true);
+
+ Core::MiniSplitter *leftSplitter = new Core::MiniSplitter(Qt::Vertical);
+ leftSplitter->addWidget(m_propertiesWidget);
+ leftSplitter->addWidget(m_expressionWidget);
+ leftSplitter->setStretchFactor(0, 2);
+ leftSplitter->setStretchFactor(1, 1);
+
+ Core::MiniSplitter *propSplitter = new Core::MiniSplitter(Qt::Horizontal);
+ propSplitter->addWidget(leftSplitter);
+ propSplitter->addWidget(m_watchTableView);
+ propSplitter->setStretchFactor(0, 2);
+ propSplitter->setStretchFactor(1, 1);
+ propSplitter->setWindowTitle(tr("Properties and Watchers"));
+
+ QDockWidget *propertiesDock = win->addDockForWidget(propSplitter);
+ win->addDockWidget(Qt::TopDockWidgetArea, propertiesDock);
+
+ QDockWidget *frameRateDock = win->addDockForWidget(m_frameRateWidget);
+ win->addDockWidget(Qt::TopDockWidgetArea, frameRateDock);
+
+ // stack the dock widgets as tabs
+ win->tabifyDockWidget(frameRateDock, propertiesDock);
+
+ return win;
+}
+
+QWidget *QmlInspectorMode::createModeWindow()
+{
+ // right-side window with editor, output etc.
+ Core::MiniSplitter *mainWindowSplitter = new Core::MiniSplitter;
+ mainWindowSplitter->addWidget(createMainView());
+ mainWindowSplitter->addWidget(new Core::OutputPanePlaceHolder(this));
+ mainWindowSplitter->setStretchFactor(0, 10);
+ mainWindowSplitter->setStretchFactor(1, 0);
+ mainWindowSplitter->setOrientation(Qt::Vertical);
+
+ // navigation + right-side window
+ Core::MiniSplitter *splitter = new Core::MiniSplitter;
+ splitter->addWidget(new Core::NavigationWidgetPlaceHolder(this));
+ splitter->addWidget(mainWindowSplitter);
+ splitter->setStretchFactor(0, 0);
+ splitter->setStretchFactor(1, 1);
+ return splitter;
+}
+
+void QmlInspectorMode::initWidgets()
+{
+ m_objectTreeWidget = new ObjectTree;
+ m_propertiesWidget = new ObjectPropertiesView;
+ m_watchTableView = new WatchTableView(m_watchTableModel);
+ m_frameRateWidget = new CanvasFrameRate;
+ m_expressionWidget = new ExpressionQueryWidget;
+
+ // FancyMainWindow uses widgets' window titles for tab labels
+ m_objectTreeWidget->setWindowTitle(tr("Object Tree"));
+ m_frameRateWidget->setWindowTitle(tr("Frame rate"));
+
+ m_watchTableView->setModel(m_watchTableModel);
+ WatchTableHeaderView *header = new WatchTableHeaderView(m_watchTableModel);
+ m_watchTableView->setHorizontalHeader(header);
+
+ connect(m_objectTreeWidget, SIGNAL(currentObjectChanged(QmlDebugObjectReference)),
+ m_propertiesWidget, SLOT(reload(QmlDebugObjectReference)));
+ connect(m_objectTreeWidget, SIGNAL(expressionWatchRequested(QmlDebugObjectReference,QString)),
+ m_watchTableModel, SLOT(expressionWatchRequested(QmlDebugObjectReference,QString)));
+
+ connect(m_propertiesWidget, SIGNAL(activated(QmlDebugObjectReference,QmlDebugPropertyReference)),
+ m_watchTableModel, SLOT(togglePropertyWatch(QmlDebugObjectReference,QmlDebugPropertyReference)));
+
+ connect(m_watchTableModel, SIGNAL(watchCreated(QmlDebugWatch*)),
+ m_propertiesWidget, SLOT(watchCreated(QmlDebugWatch*)));
+
+ connect(m_watchTableModel, SIGNAL(rowsInserted(QModelIndex,int,int)),
+ m_watchTableView, SLOT(scrollToBottom()));
+
+ connect(m_watchTableView, SIGNAL(objectActivated(int)),
+ m_objectTreeWidget, SLOT(setCurrentObject(int)));
+
+ connect(m_objectTreeWidget, SIGNAL(currentObjectChanged(QmlDebugObjectReference)),
+ m_expressionWidget, SLOT(setCurrentObject(QmlDebugObjectReference)));
+
+ m_addressEdit = new QLineEdit;
+ m_addressEdit->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
+ m_addressEdit->setText("127.0.0.1");
+
+ m_portSpinBox = new QSpinBox;
+ m_portSpinBox->setMinimum(1024);
+ m_portSpinBox->setMaximum(20000);
+ m_portSpinBox->setValue(3768);
+
+ m_engineSpinBox = new EngineSpinBox;
+ m_engineSpinBox->setEnabled(false);
+ connect(m_engineSpinBox, SIGNAL(valueChanged(int)),
+ SLOT(queryEngineContext(int)));
+}
+
+void QmlInspectorMode::reloadEngines()
+{
+ if (m_engineQuery) {
+ emit statusMessage("[Inspector] Waiting for response to previous engine query");
+ return;
+ }
+
+ m_engineSpinBox->setEnabled(false);
+
+ m_engineQuery = m_client->queryAvailableEngines(this);
+ if (!m_engineQuery->isWaiting())
+ enginesChanged();
+ else
+ QObject::connect(m_engineQuery, SIGNAL(stateChanged(State)),
+ this, SLOT(enginesChanged()));
+}
+
+void QmlInspectorMode::enginesChanged()
+{
+ m_engineSpinBox->clearEngines();
+
+ QList<QmlDebugEngineReference> engines = m_engineQuery->engines();
+ delete m_engineQuery; m_engineQuery = 0;
+
+ if (engines.isEmpty())
+ qWarning("qmldebugger: no engines found!");
+
+ m_engineSpinBox->setEnabled(true);
+
+ for (int i=0; i<engines.count(); i++)
+ m_engineSpinBox->addEngine(engines.at(i).debugId(), engines.at(i).name());
+
+ if (engines.count() > 0) {
+ m_engineSpinBox->setValue(engines.at(0).debugId());
+ queryEngineContext(engines.at(0).debugId());
+ }
+}
+
+void QmlInspectorMode::queryEngineContext(int id)
+{
+ if (id < 0)
+ return;
+
+ if (m_contextQuery) {
+ delete m_contextQuery;
+ m_contextQuery = 0;
+ }
+
+ m_contextQuery = m_client->queryRootContexts(QmlDebugEngineReference(id), this);
+ if (!m_contextQuery->isWaiting())
+ contextChanged();
+ else
+ QObject::connect(m_contextQuery, SIGNAL(stateChanged(State)),
+ this, SLOT(contextChanged()));
+}
+
+void QmlInspectorMode::contextChanged()
+{
+ //dump(m_contextQuery->rootContext(), 0);
+
+ foreach (const QmlDebugObjectReference &object, m_contextQuery->rootContext().objects())
+ m_objectTreeWidget->reload(object.debugId());
+
+ delete m_contextQuery; m_contextQuery = 0;
+}
+
+QT_END_NAMESPACE
+
+#include "qmlinspectormode.moc"
+
diff --git a/tools/qmldebugger/creatorplugin/qmlinspectormode.h b/tools/qmldebugger/creatorplugin/qmlinspectormode.h
new file mode 100644
index 0000000..c70d630
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/qmlinspectormode.h
@@ -0,0 +1,91 @@
+#ifndef QMLINSPECTORMODE_H
+#define QMLINSPECTORMODE_H
+
+#include <QAction>
+
+#include <coreplugin/basemode.h>
+#include <QtCore/QObject>
+
+QT_BEGIN_NAMESPACE
+
+class QToolButton;
+class QLineEdit;
+class QSpinBox;
+class QLabel;
+
+class QmlEngineDebug;
+class QmlDebugConnection;
+class QmlDebugEnginesQuery;
+class QmlDebugRootContextQuery;
+class ObjectTree;
+class WatchTableModel;
+class WatchTableView;
+class ObjectPropertiesView;
+class CanvasFrameRate;
+class ExpressionQueryWidget;
+class EngineSpinBox;
+
+
+class QmlInspectorMode : public Core::BaseMode
+{
+ Q_OBJECT
+
+public:
+ QmlInspectorMode(QObject *parent = 0);
+
+
+ quint16 viewerPort() const;
+
+signals:
+ void startViewer();
+ void stopViewer();
+ void statusMessage(const QString &text);
+
+public slots:
+ void connectToViewer(); // using host, port from widgets
+ void disconnectFromViewer();
+
+private slots:
+ void connectionStateChanged();
+ void connectionError();
+ void reloadEngines();
+ void enginesChanged();
+ void queryEngineContext(int);
+ void contextChanged();
+
+private:
+ struct Actions {
+ QAction *startAction;
+ QAction *stopAction;
+ };
+
+ void initActions();
+ QWidget *createModeWindow();
+ QWidget *createMainView();
+ void initWidgets();
+ QWidget *createBottomWindow();
+ QToolButton *createToolButton(QAction *action);
+
+ Actions m_actions;
+
+ QmlDebugConnection *m_conn;
+ QmlEngineDebug *m_client;
+
+ QmlDebugEnginesQuery *m_engineQuery;
+ QmlDebugRootContextQuery *m_contextQuery;
+
+ ObjectTree *m_objectTreeWidget;
+ ObjectPropertiesView *m_propertiesWidget;
+ WatchTableModel *m_watchTableModel;
+ WatchTableView *m_watchTableView;
+ CanvasFrameRate *m_frameRateWidget;
+ ExpressionQueryWidget *m_expressionWidget;
+
+ QLineEdit *m_addressEdit;
+ QSpinBox *m_portSpinBox;
+ EngineSpinBox *m_engineSpinBox;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/tools/qmldebugger/creatorplugin/qmlinspectorplugin.cpp b/tools/qmldebugger/creatorplugin/qmlinspectorplugin.cpp
new file mode 100644
index 0000000..c743974
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/qmlinspectorplugin.cpp
@@ -0,0 +1,138 @@
+#include <QtCore/QStringList>
+#include <QtCore/QtPlugin>
+#include <QtCore/QDebug>
+
+#include <coreplugin/icore.h>
+
+#include <projectexplorer/runconfiguration.h>
+#include <projectexplorer/projectexplorer.h>
+#include <projectexplorer/projectexplorerconstants.h>
+#include <projectexplorer/project.h>
+
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/uniqueidmanager.h>
+
+#include <extensionsystem/pluginmanager.h>
+
+#include <QtDeclarative/qmldebug.h>
+#include <QtDeclarative/qmldebugclient.h>
+
+#include "runcontrol.h"
+#include "qmlinspector.h"
+#include "qmlinspectormode.h"
+#include "inspectoroutputpane.h"
+#include "qmlinspectorplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+
+QmlInspectorPlugin::QmlInspectorPlugin()
+ : m_inspectMode(0),
+ m_runControl(0)
+{
+}
+
+QmlInspectorPlugin::~QmlInspectorPlugin()
+{
+}
+
+void QmlInspectorPlugin::shutdown()
+{
+ removeObject(m_inspectMode);
+ delete m_inspectMode;
+ m_inspectMode = 0;
+
+ removeObject(m_outputPane);
+ delete m_outputPane;
+ m_outputPane = 0;
+}
+
+bool QmlInspectorPlugin::initialize(const QStringList &arguments, QString *errorString)
+{
+ Q_UNUSED(arguments);
+ Q_UNUSED(errorString);
+
+ Core::ICore *core = Core::ICore::instance();
+ Core::UniqueIDManager *uidm = core->uniqueIDManager();
+
+ QList<int> modeContext;
+ modeContext.append(uidm->uniqueIdentifier(QmlInspector::Constants::C_INSPECTOR));
+
+ QList<int> inspectorContext;
+ inspectorContext.append(uidm->uniqueIdentifier(Core::Constants::C_EDITORMANAGER));
+ inspectorContext.append(uidm->uniqueIdentifier(QmlInspector::Constants::C_INSPECTOR));
+ inspectorContext.append(uidm->uniqueIdentifier(Core::Constants::C_NAVIGATION_PANE));
+
+ m_inspectMode = new QmlInspectorMode(this);
+ connect(m_inspectMode, SIGNAL(startViewer()), SLOT(startViewer()));
+ connect(m_inspectMode, SIGNAL(stopViewer()), SLOT(stopViewer()));
+ m_inspectMode->setContext(modeContext);
+ addObject(m_inspectMode);
+
+ m_outputPane = new InspectorOutputPane;
+ addObject(m_outputPane);
+
+ connect(m_inspectMode, SIGNAL(statusMessage(QString)),
+ m_outputPane, SLOT(addInspectorStatus(QString)));
+
+ m_runControlFactory = new QmlInspectorRunControlFactory(this);
+ addAutoReleasedObject(m_runControlFactory);
+
+ return true;
+}
+
+void QmlInspectorPlugin::extensionsInitialized()
+{
+}
+
+void QmlInspectorPlugin::startViewer()
+{
+ stopViewer();
+
+ ProjectExplorer::Project *project = 0;
+ ProjectExplorer::ProjectExplorerPlugin *plugin = ProjectExplorer::ProjectExplorerPlugin::instance();
+ if (plugin)
+ project = plugin->currentProject();
+ if (!project) {
+ qDebug() << "No project loaded"; // TODO should this just run the debugger without a viewer?
+ return;
+ }
+
+ QSharedPointer<ProjectExplorer::RunConfiguration> rc = project->activeRunConfiguration();
+
+ QmlInspector::StartParameters sp;
+ sp.port = m_inspectMode->viewerPort();
+
+ m_runControl = m_runControlFactory->create(rc, ProjectExplorer::Constants::RUNMODE, sp);
+
+ if (m_runControl) {
+ connect(m_runControl, SIGNAL(started()), m_inspectMode, SLOT(connectToViewer()));
+ connect(m_runControl, SIGNAL(finished()), m_inspectMode, SLOT(disconnectFromViewer()));
+
+ connect(m_runControl, SIGNAL(addToOutputWindow(RunControl*,QString)),
+ m_outputPane, SLOT(addOutput(RunControl*,QString)));
+ connect(m_runControl, SIGNAL(addToOutputWindowInline(RunControl*,QString)),
+ m_outputPane, SLOT(addOutputInline(RunControl*,QString)));
+ connect(m_runControl, SIGNAL(error(RunControl*,QString)),
+ m_outputPane, SLOT(addErrorOutput(RunControl*,QString)));
+
+ m_runControl->start();
+ m_outputPane->popup(false);
+ }
+
+}
+
+void QmlInspectorPlugin::stopViewer()
+{
+ if (m_runControl) {
+ m_runControl->stop();
+ m_runControl->deleteLater();
+ m_runControl = 0;
+ }
+}
+
+
+Q_EXPORT_PLUGIN(QmlInspectorPlugin)
+
+QT_END_NAMESPACE
+
diff --git a/tools/qmldebugger/creatorplugin/qmlinspectorplugin.h b/tools/qmldebugger/creatorplugin/qmlinspectorplugin.h
new file mode 100644
index 0000000..b0237e2
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/qmlinspectorplugin.h
@@ -0,0 +1,50 @@
+#ifndef QMLINSPECTORPLUGIN_H
+#define QMLINSPECTORPLUGIN_H
+
+#include <extensionsystem/iplugin.h>
+
+#include <QtCore/QObject>
+#include <QtCore/QPointer>
+
+QT_BEGIN_NAMESPACE
+
+class QStringList;
+
+
+class QmlInspectorRunControlFactory;
+class QmlInspectorMode;
+class InspectorOutputPane;
+
+namespace ProjectExplorer
+{
+ class RunControl;
+}
+
+class QmlInspectorPlugin : public ExtensionSystem::IPlugin
+{
+ Q_OBJECT
+
+public:
+ QmlInspectorPlugin();
+ ~QmlInspectorPlugin();
+
+ virtual bool initialize(const QStringList &arguments, QString *errorString);
+ virtual void extensionsInitialized();
+ virtual void shutdown();
+
+private slots:
+ void startViewer();
+ void stopViewer();
+
+private:
+ QmlInspectorMode *m_inspectMode;
+ InspectorOutputPane *m_outputPane;
+
+ QmlInspectorRunControlFactory *m_runControlFactory;
+ QPointer<ProjectExplorer::RunControl> m_runControl;
+};
+
+
+QT_END_NAMESPACE
+
+#endif // QMLINSPECTORPLUGIN_H
diff --git a/tools/qmldebugger/creatorplugin/runcontrol.cpp b/tools/qmldebugger/creatorplugin/runcontrol.cpp
new file mode 100644
index 0000000..11c7165
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/runcontrol.cpp
@@ -0,0 +1,135 @@
+#include <QtCore/qdebug.h>
+#include <QtCore/qtimer.h>
+
+#include <projectexplorer/applicationlauncher.h>
+#include <projectexplorer/applicationrunconfiguration.h>
+#include <projectexplorer/projectexplorerconstants.h>
+
+#include "runcontrol.h"
+
+using namespace ProjectExplorer;
+
+
+QmlInspectorRunControlFactory::QmlInspectorRunControlFactory(QObject *parent)
+ : ProjectExplorer::IRunControlFactory(parent)
+{
+}
+
+bool QmlInspectorRunControlFactory::canRun(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode) const
+{
+ Q_UNUSED(runConfiguration);
+ if (mode != ProjectExplorer::Constants::RUNMODE)
+ return false;
+ return true;
+}
+
+ProjectExplorer::RunControl *QmlInspectorRunControlFactory::create(const QSharedPointer<RunConfiguration> &runConfiguration, const QString &mode)
+{
+ Q_UNUSED(mode);
+ return new QmlInspectorRunControl(runConfiguration);
+}
+
+ProjectExplorer::RunControl *QmlInspectorRunControlFactory::create(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
+const QString &mode, const QmlInspector::StartParameters &sp)
+{
+ Q_UNUSED(mode);
+ return new QmlInspectorRunControl(runConfiguration, sp);
+}
+
+QString QmlInspectorRunControlFactory::displayName() const
+{
+ return tr("Qml Inspector");
+}
+
+QWidget *QmlInspectorRunControlFactory::configurationWidget(const QSharedPointer<RunConfiguration> &runConfiguration)
+{
+ Q_UNUSED(runConfiguration);
+ return 0;
+}
+
+
+
+QmlInspectorRunControl::QmlInspectorRunControl(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
+const QmlInspector::StartParameters &sp)
+ : ProjectExplorer::RunControl(runConfiguration),
+ m_running(false),
+ m_viewerLauncher(0),
+ m_startParams(sp)
+{
+}
+
+QmlInspectorRunControl::~QmlInspectorRunControl()
+{
+}
+
+void QmlInspectorRunControl::start()
+{
+ if (m_running || m_viewerLauncher)
+ return;
+
+ m_viewerLauncher = new ProjectExplorer::ApplicationLauncher(this);
+ connect(m_viewerLauncher, SIGNAL(applicationError(QString)), SLOT(applicationError(QString)));
+ connect(m_viewerLauncher, SIGNAL(processExited(int)), SLOT(viewerExited()));
+ connect(m_viewerLauncher, SIGNAL(appendOutput(QString)), SLOT(appendOutput(QString)));
+ connect(m_viewerLauncher, SIGNAL(bringToForegroundRequested(qint64)),
+ this, SLOT(appStarted()));
+
+ QSharedPointer<LocalApplicationRunConfiguration> rc =
+ runConfiguration().objectCast<LocalApplicationRunConfiguration>();
+ if (rc.isNull()) { // TODO
+ return;
+ }
+
+ ProjectExplorer::Environment env = rc->environment();
+ env.set("QML_DEBUG_SERVER_PORT", QString::number(m_startParams.port));
+
+ QStringList arguments = rc->commandLineArguments();
+ arguments << QLatin1String("-stayontop");
+
+ m_viewerLauncher->setEnvironment(env.toStringList());
+ m_viewerLauncher->setWorkingDirectory(rc->workingDirectory());
+
+ m_running = true;
+
+ m_viewerLauncher->start(static_cast<ApplicationLauncher::Mode>(rc->runMode()),
+ rc->executable(), arguments);
+}
+
+void QmlInspectorRunControl::stop()
+{
+ if (m_viewerLauncher->isRunning())
+ m_viewerLauncher->stop();
+}
+
+bool QmlInspectorRunControl::isRunning() const
+{
+ return m_running;
+}
+
+void QmlInspectorRunControl::appStarted()
+{
+ QTimer::singleShot(500, this, SLOT(delayedStart()));
+}
+
+void QmlInspectorRunControl::appendOutput(const QString &s)
+{
+ emit addToOutputWindow(this, s);
+}
+
+void QmlInspectorRunControl::delayedStart()
+{
+ emit started();
+}
+
+void QmlInspectorRunControl::viewerExited()
+{
+ m_running = false;
+ emit finished();
+
+ deleteLater();
+}
+
+void QmlInspectorRunControl::applicationError(const QString &s)
+{
+ emit error(this, s);
+}
diff --git a/tools/qmldebugger/creatorplugin/runcontrol.h b/tools/qmldebugger/creatorplugin/runcontrol.h
new file mode 100644
index 0000000..b2976f6
--- /dev/null
+++ b/tools/qmldebugger/creatorplugin/runcontrol.h
@@ -0,0 +1,65 @@
+#ifndef QMLINSPECTORRUNCONTROL_H
+#define QMLINSPECTORRUNCONTROL_H
+
+#include <QtCore/qobject.h>
+
+#include <projectexplorer/runconfiguration.h>
+
+#include "qmlinspector.h"
+
+namespace ProjectExplorer {
+ class ApplicationLauncher;
+}
+
+class QmlInspectorRunControlFactory : public ProjectExplorer::IRunControlFactory
+{
+ Q_OBJECT
+
+public:
+ explicit QmlInspectorRunControlFactory(QObject *parent);
+
+ virtual bool canRun(
+ const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
+ const QString &mode) const;
+
+ virtual ProjectExplorer::RunControl *create(
+ const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
+ const QString &mode);
+
+ ProjectExplorer::RunControl *create(
+ const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
+ const QString &mode,
+ const QmlInspector::StartParameters &sp);
+
+ virtual QString displayName() const;
+
+ virtual QWidget *configurationWidget(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration);
+};
+
+class QmlInspectorRunControl : public ProjectExplorer::RunControl
+{
+ Q_OBJECT
+
+public:
+ explicit QmlInspectorRunControl(const QSharedPointer<ProjectExplorer::RunConfiguration> &runConfiguration,
+ const QmlInspector::StartParameters &sp = QmlInspector::StartParameters());
+ ~QmlInspectorRunControl();
+
+ virtual void start();
+ virtual void stop();
+ virtual bool isRunning() const;
+
+private slots:
+ void appendOutput(const QString &s);
+ void appStarted();
+ void delayedStart();
+ void viewerExited();
+ void applicationError(const QString &error);
+
+private:
+ bool m_running;
+ ProjectExplorer::ApplicationLauncher *m_viewerLauncher;
+ QmlInspector::StartParameters m_startParams;
+};
+
+#endif
diff --git a/tools/qmldebugger/qmldebugger.pro b/tools/qmldebugger/qmldebugger.pro
index 4cdfd18..2dd353a 100644
--- a/tools/qmldebugger/qmldebugger.pro
+++ b/tools/qmldebugger/qmldebugger.pro
@@ -1,8 +1,10 @@
-DESTDIR = ../../bin
+TEMPLATE = subdirs
+CONFIG += ordered
-include(qmldebugger.pri)
+SUBDIRS = standalone
-target.path=$$[QT_INSTALL_BINS]
-INSTALLS += target
-
-CONFIG += console
+CREATOR_SRC = $$(CREATOR_SRC_DIR)
+CREATOR_BUILD = $$(CREATOR_BUILD_DIR)
+!isEmpty(CREATOR_SRC):!isEmpty(CREATOR_BUILD) {
+ SUBDIRS += creatorplugin
+}
diff --git a/tools/qmldebugger/canvasframerate.cpp b/tools/qmldebugger/standalone/canvasframerate.cpp
index 7c5d089..10c3dbf 100644
--- a/tools/qmldebugger/canvasframerate.cpp
+++ b/tools/qmldebugger/standalone/canvasframerate.cpp
@@ -56,7 +56,7 @@ private:
QLineGraph::QLineGraph(QWidget *parent)
: QWidget(parent), sb(Qt::Horizontal, this), position(-1), samplesPerWidth(99), resolutionForHeight(50), ignoreScroll(false)
{
- setMinimumHeight(180);
+ setMinimumHeight(200);
sb.setMaximum(0);
sb.setMinimum(0);
@@ -178,7 +178,6 @@ void QLineGraph::paintEvent(QPaintEvent *)
QPainter p(this);
p.setRenderHint(QPainter::Antialiasing);
-
QRect r(50, 10, width() - 60, height() - 60);
p.setBrush(QColor("lightsteelblue"));
drawSample(&p, 0, r);
@@ -247,11 +246,10 @@ void CanvasFrameRatePlugin::messageReceived(const QByteArray &data)
ld = d;
}
-CanvasFrameRate::CanvasFrameRate(QmlDebugConnection *client, QWidget *parent)
-: QWidget(parent)
+CanvasFrameRate::CanvasFrameRate(QWidget *parent)
+: QWidget(parent),
+ m_plugin(0)
{
- m_plugin = new CanvasFrameRatePlugin(client);
-
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0,0,0,0);
layout->setSpacing(0);
@@ -261,7 +259,8 @@ CanvasFrameRate::CanvasFrameRate(QmlDebugConnection *client, QWidget *parent)
layout->addWidget(m_tabs);
QHBoxLayout *bottom = new QHBoxLayout;
- bottom->setSpacing(5);
+ bottom->setContentsMargins(5, 0, 5, 0);
+ bottom->setSpacing(10);
layout->addLayout(bottom);
QLabel *label = new QLabel("Resolution", this);
@@ -275,15 +274,51 @@ CanvasFrameRate::CanvasFrameRate(QmlDebugConnection *client, QWidget *parent)
bottom->addStretch(2);
- QCheckBox *check = new QCheckBox("Enable", this);
- bottom->addWidget(check);
- QObject::connect(check, SIGNAL(stateChanged(int)),
- this, SLOT(stateChanged(int)));
+ m_enabledCheckBox = new QCheckBox("Enable", this);
+ bottom->addWidget(m_enabledCheckBox);
+ QObject::connect(m_enabledCheckBox, SIGNAL(stateChanged(int)),
+ this, SLOT(enabledStateChanged(int)));
QPushButton *pb = new QPushButton(tr("New Tab"), this);
QObject::connect(pb, SIGNAL(clicked()), this, SLOT(newTab()));
bottom->addWidget(pb);
+}
+
+void CanvasFrameRate::reset(QmlDebugConnection *conn)
+{
+ delete m_plugin;
+ m_plugin = 0;
+
+ QWidget *w;
+ for (int i=0; i<m_tabs->count(); i++) {
+ w = m_tabs->widget(i);
+ m_tabs->removeTab(i);
+ delete w;
+ }
+ if (conn) {
+ connect(conn, SIGNAL(stateChanged(QAbstractSocket::SocketState)),
+ SLOT(connectionStateChanged(QAbstractSocket::SocketState)));
+ if (conn->state() == QAbstractSocket::ConnectedState)
+ handleConnected(conn);
+ }
+}
+
+void CanvasFrameRate::connectionStateChanged(QAbstractSocket::SocketState state)
+{
+ if (state == QAbstractSocket::UnconnectedState) {
+ delete m_plugin;
+ m_plugin = 0;
+ } else if (state == QAbstractSocket::ConnectedState) {
+ handleConnected(qobject_cast<QmlDebugConnection*>(sender()));
+ }
+}
+
+void CanvasFrameRate::handleConnected(QmlDebugConnection *conn)
+{
+ delete m_plugin;
+ m_plugin = new CanvasFrameRatePlugin(conn);
+ enabledStateChanged(m_enabledCheckBox->checkState());
newTab();
}
@@ -299,6 +334,9 @@ QSize CanvasFrameRate::sizeHint() const
void CanvasFrameRate::newTab()
{
+ if (!m_plugin)
+ return;
+
if (m_tabs->count()) {
QWidget *w = m_tabs->widget(m_tabs->count() - 1);
QObject::disconnect(m_plugin, SIGNAL(sample(int,int,int,bool)),
@@ -317,11 +355,12 @@ void CanvasFrameRate::newTab()
m_tabs->setCurrentIndex(id);
}
-void CanvasFrameRate::stateChanged(int s)
+void CanvasFrameRate::enabledStateChanged(int s)
{
bool checked = s != 0;
- static_cast<QmlDebugClient *>(m_plugin)->setEnabled(checked);
+ if (m_plugin)
+ static_cast<QmlDebugClient *>(m_plugin)->setEnabled(checked);
}
QT_END_NAMESPACE
diff --git a/tools/qmldebugger/standalone/canvasframerate.h b/tools/qmldebugger/standalone/canvasframerate.h
new file mode 100644
index 0000000..6c1ff9f
--- /dev/null
+++ b/tools/qmldebugger/standalone/canvasframerate.h
@@ -0,0 +1,46 @@
+#ifndef CANVASFRAMERATE_H
+#define CANVASFRAMERATE_H
+
+#include <QtCore/qpointer.h>
+#include <QtGui/qwidget.h>
+
+#include <QtDeclarative/qmldebugclient.h>
+
+QT_BEGIN_NAMESPACE
+
+class QTabWidget;
+class QSpinBox;
+class QCheckBox;
+
+class CanvasFrameRatePlugin;
+
+class CanvasFrameRate : public QWidget
+{
+ Q_OBJECT
+public:
+ CanvasFrameRate(QWidget *parent = 0);
+
+ void reset(QmlDebugConnection *conn);
+
+ void setSizeHint(const QSize &);
+ virtual QSize sizeHint() const;
+
+private slots:
+ void newTab();
+ void enabledStateChanged(int);
+ void connectionStateChanged(QAbstractSocket::SocketState state);
+
+private:
+ void handleConnected(QmlDebugConnection *conn);
+
+ QTabWidget *m_tabs;
+ QSpinBox *m_spin;
+ CanvasFrameRatePlugin *m_plugin;
+ QSize m_sizeHint;
+ QCheckBox *m_enabledCheckBox;
+};
+
+QT_END_NAMESPACE
+
+#endif // CANVASFRAMERATE_H
+
diff --git a/tools/qmldebugger/engine.cpp b/tools/qmldebugger/standalone/engine.cpp
index a1fd009..a1fd009 100644
--- a/tools/qmldebugger/engine.cpp
+++ b/tools/qmldebugger/standalone/engine.cpp
diff --git a/tools/qmldebugger/engine.h b/tools/qmldebugger/standalone/engine.h
index a3ebe46..a3ebe46 100644
--- a/tools/qmldebugger/engine.h
+++ b/tools/qmldebugger/standalone/engine.h
diff --git a/tools/qmldebugger/engine.png b/tools/qmldebugger/standalone/engine.png
index a0a8a04..a0a8a04 100644
--- a/tools/qmldebugger/engine.png
+++ b/tools/qmldebugger/standalone/engine.png
Binary files differ
diff --git a/tools/qmldebugger/engines.qml b/tools/qmldebugger/standalone/engines.qml
index 1e9335b..1e9335b 100644
--- a/tools/qmldebugger/engines.qml
+++ b/tools/qmldebugger/standalone/engines.qml
diff --git a/tools/qmldebugger/expressionquerywidget.cpp b/tools/qmldebugger/standalone/expressionquerywidget.cpp
index 53ede3a..f8f5aef 100644
--- a/tools/qmldebugger/expressionquerywidget.cpp
+++ b/tools/qmldebugger/standalone/expressionquerywidget.cpp
@@ -17,28 +17,25 @@ ExpressionQueryWidget::ExpressionQueryWidget(QmlEngineDebug *client, QWidget *pa
m_client(client),
m_query(0),
m_textEdit(new QTextEdit),
- m_lineEdit(0),
- m_button(0)
+ m_lineEdit(0)
{
m_prompt = QLatin1String(">> ");
QVBoxLayout *layout = new QVBoxLayout(this);
layout->setMargin(0);
+ layout->setSpacing(0);
layout->addWidget(m_textEdit);
updateTitle();
if (m_style == Compact) {
- QHBoxLayout *hbox = new QHBoxLayout;
- m_button = new QPushButton(tr("Query"));
- m_button->setEnabled(false);
- connect(m_button, SIGNAL(clicked()), SLOT(executeExpression()));
m_lineEdit = new QLineEdit;
connect(m_lineEdit, SIGNAL(returnPressed()), SLOT(executeExpression()));
- connect(m_lineEdit, SIGNAL(textChanged(QString)), SLOT(lineEditTextChanged(QString)));
+ QHBoxLayout *hbox = new QHBoxLayout;
+ hbox->setMargin(5);
+ hbox->setSpacing(5);
hbox->addWidget(new QLabel(tr("Expression:")));
hbox->addWidget(m_lineEdit);
- hbox->addWidget(m_button);
layout->addLayout(hbox);
m_textEdit->setReadOnly(true);
@@ -53,6 +50,12 @@ void ExpressionQueryWidget::setEngineDebug(QmlEngineDebug *client)
m_client = client;
}
+void ExpressionQueryWidget::clear()
+{
+ m_textEdit->clear();
+ m_lineEdit->clear();
+}
+
void ExpressionQueryWidget::updateTitle()
{
if (m_currObject.debugId() < 0) {
@@ -153,12 +156,6 @@ void ExpressionQueryWidget::showResult()
}
}
-void ExpressionQueryWidget::lineEditTextChanged(const QString &s)
-{
- if (m_button)
- m_button->setEnabled(!s.isEmpty());
-}
-
bool ExpressionQueryWidget::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_textEdit) {
diff --git a/tools/qmldebugger/expressionquerywidget.h b/tools/qmldebugger/standalone/expressionquerywidget.h
index 3d9b580..6fab059 100644
--- a/tools/qmldebugger/expressionquerywidget.h
+++ b/tools/qmldebugger/standalone/expressionquerywidget.h
@@ -24,6 +24,7 @@ public:
ExpressionQueryWidget(QmlEngineDebug *client = 0, QWidget *parent = 0);
void setEngineDebug(QmlEngineDebug *client);
+ void clear();
protected:
bool eventFilter(QObject *obj, QEvent *event);
@@ -34,7 +35,6 @@ public slots:
private slots:
void executeExpression();
void showResult();
- void lineEditTextChanged(const QString &s);
private:
void appendPrompt();
diff --git a/tools/qmldebugger/main.cpp b/tools/qmldebugger/standalone/main.cpp
index c9983cd..c9983cd 100644
--- a/tools/qmldebugger/main.cpp
+++ b/tools/qmldebugger/standalone/main.cpp
diff --git a/tools/qmldebugger/objectpropertiesview.cpp b/tools/qmldebugger/standalone/objectpropertiesview.cpp
index 274552a..ae9e8be 100644
--- a/tools/qmldebugger/objectpropertiesview.cpp
+++ b/tools/qmldebugger/standalone/objectpropertiesview.cpp
@@ -43,6 +43,7 @@ ObjectPropertiesView::ObjectPropertiesView(QmlEngineDebug *client, QWidget *pare
setLayout(layout);
m_tree = new QTreeWidget(this);
+ m_tree->setAlternatingRowColors(true);
m_tree->setExpandsOnDoubleClick(false);
m_tree->setHeaderLabels(QStringList() << tr("Property") << tr("Value"));
QObject::connect(m_tree, SIGNAL(itemActivated(QTreeWidgetItem *, int)),
@@ -58,6 +59,11 @@ void ObjectPropertiesView::setEngineDebug(QmlEngineDebug *client)
m_client = client;
}
+void ObjectPropertiesView::clear()
+{
+ setObject(QmlDebugObjectReference());
+}
+
void ObjectPropertiesView::reload(const QmlDebugObjectReference &obj)
{
if (!m_client)
@@ -105,7 +111,6 @@ void ObjectPropertiesView::setObject(const QmlDebugObjectReference &object)
m_object = object;
m_tree->clear();
-
QList<QmlDebugPropertyReference> properties = object.properties();
for (int i=0; i<properties.count(); i++) {
const QmlDebugPropertyReference &p = properties[i];
diff --git a/tools/qmldebugger/objectpropertiesview.h b/tools/qmldebugger/standalone/objectpropertiesview.h
index d555940..6a1fc03 100644
--- a/tools/qmldebugger/objectpropertiesview.h
+++ b/tools/qmldebugger/standalone/objectpropertiesview.h
@@ -18,6 +18,7 @@ public:
ObjectPropertiesView(QmlEngineDebug *client = 0, QWidget *parent = 0);
void setEngineDebug(QmlEngineDebug *client);
+ void clear();
signals:
void activated(const QmlDebugObjectReference &, const QmlDebugPropertyReference &);
diff --git a/tools/qmldebugger/objecttree.cpp b/tools/qmldebugger/standalone/objecttree.cpp
index 981a80b..4059e77 100644
--- a/tools/qmldebugger/objecttree.cpp
+++ b/tools/qmldebugger/standalone/objecttree.cpp
@@ -68,6 +68,9 @@ void ObjectTree::objectFetched()
void ObjectTree::currentItemChanged(QTreeWidgetItem *item)
{
+ if (!item)
+ return;
+
QmlDebugObjectReference obj = item->data(0, Qt::UserRole).value<QmlDebugObjectReference>();
if (obj.debugId() < 0) {
qWarning("QML Object Tree: bad object id");
diff --git a/tools/qmldebugger/objecttree.h b/tools/qmldebugger/standalone/objecttree.h
index 95820f3..95820f3 100644
--- a/tools/qmldebugger/objecttree.h
+++ b/tools/qmldebugger/standalone/objecttree.h
diff --git a/tools/qmldebugger/qmldebugger.cpp b/tools/qmldebugger/standalone/qmldebugger.cpp
index 2828026..5455878 100644
--- a/tools/qmldebugger/qmldebugger.cpp
+++ b/tools/qmldebugger/standalone/qmldebugger.cpp
@@ -45,7 +45,8 @@ QmlDebugger::QmlDebugger(QWidget *parent)
m_tabs = new QTabWidget(this);
layout->addWidget(m_tabs);
- CanvasFrameRate *cfr = new CanvasFrameRate(&client, this);
+ CanvasFrameRate *cfr = new CanvasFrameRate(this);
+ cfr->reset(&client);
cfr->setSizeHint(QSize(800, 600));
m_tabs->addTab(cfr, tr("Frame Rate"));
diff --git a/tools/qmldebugger/qmldebugger.h b/tools/qmldebugger/standalone/qmldebugger.h
index 9203e33..9203e33 100644
--- a/tools/qmldebugger/qmldebugger.h
+++ b/tools/qmldebugger/standalone/qmldebugger.h
diff --git a/tools/qmldebugger/qmldebugger.pri b/tools/qmldebugger/standalone/qmldebugger.pri
index c49d334..aad5eb1 100644
--- a/tools/qmldebugger/qmldebugger.pri
+++ b/tools/qmldebugger/standalone/qmldebugger.pri
@@ -2,23 +2,15 @@ QT += network declarative
contains(QT_CONFIG, opengles2)|contains(QT_CONFIG, opengles1): QT += opengl
# Input
-HEADERS += $$PWD/qmldebugger.h \
- $$PWD/canvasframerate.h \
+HEADERS += $$PWD/canvasframerate.h \
$$PWD/watchtable.h \
- $$PWD/engine.h \
$$PWD/objecttree.h \
$$PWD/objectpropertiesview.h \
$$PWD/expressionquerywidget.h
-SOURCES += $$PWD/qmldebugger.cpp \
- $$PWD/main.cpp \
- $$PWD/canvasframerate.cpp \
+SOURCES += $$PWD/canvasframerate.cpp \
$$PWD/watchtable.cpp \
- $$PWD/engine.cpp \
$$PWD/objecttree.cpp \
$$PWD/objectpropertiesview.cpp \
$$PWD/expressionquerywidget.cpp
-RESOURCES += $$PWD/qmldebugger.qrc
-
-OTHER_FILES += $$PWD/engines.qml
diff --git a/tools/qmldebugger/qmldebugger.qrc b/tools/qmldebugger/standalone/qmldebugger.qrc
index cb53ad5..cb53ad5 100644
--- a/tools/qmldebugger/qmldebugger.qrc
+++ b/tools/qmldebugger/standalone/qmldebugger.qrc
diff --git a/tools/qmldebugger/refresh.png b/tools/qmldebugger/standalone/refresh.png
index 8befc80..8befc80 100644
--- a/tools/qmldebugger/refresh.png
+++ b/tools/qmldebugger/standalone/refresh.png
Binary files differ
diff --git a/tools/qmldebugger/standalone/standalone.pro b/tools/qmldebugger/standalone/standalone.pro
new file mode 100644
index 0000000..72e3ef5
--- /dev/null
+++ b/tools/qmldebugger/standalone/standalone.pro
@@ -0,0 +1,18 @@
+DESTDIR = ../../bin
+
+include(qmldebugger.pri)
+
+HEADERS += $$PWD/qmldebugger.h \
+ $$PWD/engine.h
+
+SOURCES += $$PWD/qmldebugger.cpp \
+ $$PWD/engine.cpp \
+ $$PWD/main.cpp
+
+RESOURCES += $$PWD/qmldebugger.qrc
+OTHER_FILES += $$PWD/engines.qml
+
+target.path=$$[QT_INSTALL_BINS]
+INSTALLS += target
+
+CONFIG += console
diff --git a/tools/qmldebugger/watchtable.cpp b/tools/qmldebugger/standalone/watchtable.cpp
index 774727b..ee74cfb 100644
--- a/tools/qmldebugger/watchtable.cpp
+++ b/tools/qmldebugger/standalone/watchtable.cpp
@@ -18,7 +18,7 @@ WatchTableModel::WatchTableModel(QmlEngineDebug *client, QObject *parent)
}
WatchTableModel::~WatchTableModel()
-{
+{
for (int i=0; i<m_columns.count(); i++)
delete m_columns[i].watch;
}
@@ -247,7 +247,7 @@ void WatchTableModel::expressionWatchRequested(const QmlDebugObjectReference &ob
}
}
-void WatchTableModel::stopWatching(int column)
+void WatchTableModel::removeWatchAt(int column)
{
if (!m_client)
return;
@@ -260,6 +260,17 @@ void WatchTableModel::stopWatching(int column)
}
}
+void WatchTableModel::removeAllWatches()
+{
+ for (int i=0; i<m_columns.count(); i++) {
+ if (m_client)
+ m_client->removeWatch(m_columns[i].watch);
+ delete m_columns[i].watch;
+ }
+ m_columns.clear();
+ m_values.clear();
+ reset();
+}
//----------------------------------------------
@@ -281,7 +292,7 @@ void WatchTableHeaderView::mousePressEvent(QMouseEvent *me)
QList<QAction *> actions;
actions << &action;
if (QMenu::exec(actions, me->globalPos()))
- m_model->stopWatching(col);
+ m_model->removeWatchAt(col);
}
}
}
@@ -293,6 +304,7 @@ WatchTableView::WatchTableView(WatchTableModel *model, QWidget *parent)
: QTableView(parent),
m_model(model)
{
+ setAlternatingRowColors(true);
connect(model, SIGNAL(watchCreated(QmlDebugWatch*)), SLOT(watchCreated(QmlDebugWatch*)));
connect(this, SIGNAL(activated(QModelIndex)), SLOT(indexActivated(QModelIndex)));
}
diff --git a/tools/qmldebugger/watchtable.h b/tools/qmldebugger/standalone/watchtable.h
index 772142c..67c2565 100644
--- a/tools/qmldebugger/watchtable.h
+++ b/tools/qmldebugger/standalone/watchtable.h
@@ -29,7 +29,8 @@ public:
QmlDebugWatch *findWatch(int column) const;
int columnForWatch(QmlDebugWatch *watch) const;
- void stopWatching(int column);
+ void removeWatchAt(int column);
+ void removeAllWatches();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
diff --git a/tools/qmlviewer/main.cpp b/tools/qmlviewer/main.cpp
index f82867f..3f531e4 100644
--- a/tools/qmlviewer/main.cpp
+++ b/tools/qmlviewer/main.cpp
@@ -28,6 +28,7 @@ void usage()
qWarning(" -frameless ............................... run with no window frame");
qWarning(" -maximized................................ run maximized");
qWarning(" -fullscreen............................... run fullscreen");
+ qWarning(" -stayontop................................ keep viewer window on top");
qWarning(" -skin <qvfbskindir> ...................... run with a skin window frame");
qWarning(" \"list\" for a list of built-ins");
qWarning(" -resizeview .............................. resize the view, not the skin");
@@ -105,6 +106,7 @@ int main(int argc, char ** argv)
QString translationFile;
bool useGL = false;
bool fullScreen = false;
+ bool stayOnTop = false;
bool maximized = false;
for (int i = 1; i < argc; ++i) {
@@ -116,6 +118,8 @@ int main(int argc, char ** argv)
maximized = true;
} else if (arg == "-fullscreen") {
fullScreen = true;
+ } else if (arg == "-stayontop") {
+ stayOnTop = true;
} else if (arg == "-skin") {
if (lastArg) usage();
skin = QString(argv[++i]);
@@ -183,9 +187,12 @@ int main(int argc, char ** argv)
app.installTranslator(&qmlTranslator);
}
- QmlViewer viewer(0, frameless ? Qt::FramelessWindowHint : Qt::Widget);
+ Qt::WFlags wflags = (frameless ? Qt::FramelessWindowHint : Qt::Widget);
+ if (stayOnTop)
+ wflags |= Qt::WindowStaysOnTopHint;
+
+ QmlViewer viewer(0, wflags);
if (!scriptopts.isEmpty()) {
-
QStringList options =
scriptopts.split(QLatin1Char(','), QString::SkipEmptyParts);