diff options
author | Kai Koehne <kai.koehne@nokia.com> | 2011-10-18 13:13:29 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-10-18 16:23:13 +0200 |
commit | b19d316bff79a0e3a13eaffd9279c1fef5eec674 (patch) | |
tree | 253c78a93862328e45ceab0590329042c3244580 /src/plugins/qmltooling/qmldbg_inspector | |
parent | 1d24a81285cb47b35af2831154ea35e2ec07ef8d (diff) |
Debugger: Remove visual toolbox from inspector
Change-Id: I8847d52a718a20a04cb23d8f0f5affdb7e038c57
Reviewed-by: Christiaan Janssen <christiaan.janssen@nokia.com>
Diffstat (limited to 'src/plugins/qmltooling/qmldbg_inspector')
29 files changed, 0 insertions, 808 deletions
diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp index 8dcc076630..6a157b9cf6 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp +++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.cpp @@ -42,7 +42,6 @@ #include "abstractviewinspector.h" #include "abstracttool.h" -#include "editor/qmltoolbar.h" #include "qdeclarativeinspectorprotocol.h" #include <QtDeclarative/QDeclarativeEngine> @@ -54,53 +53,12 @@ #include <QtGui/QMouseEvent> #include <QtCore/QSettings> -static inline void initEditorResource() { Q_INIT_RESOURCE(editor); } - namespace QmlJSDebugger { -const char * const KEY_TOOLBOX_GEOMETRY = "toolBox/geometry"; - - -class ToolBox : public QWidget -{ - Q_OBJECT - -public: - ToolBox(QWidget *parent = 0); - ~ToolBox(); - - QmlToolBar *toolBar() const { return m_toolBar; } - -private: - QSettings m_settings; - QmlToolBar *m_toolBar; -}; - -ToolBox::ToolBox(QWidget *parent) - : QWidget(parent, Qt::Tool) - , m_settings(QLatin1String("Nokia"), QLatin1String("QmlInspector"), this) - , m_toolBar(new QmlToolBar) -{ - setWindowFlags((windowFlags() & ~Qt::WindowCloseButtonHint) | Qt::CustomizeWindowHint); - setWindowTitle(tr("Qt Quick Toolbox")); - - QVBoxLayout *verticalLayout = new QVBoxLayout; - verticalLayout->setMargin(0); - verticalLayout->addWidget(m_toolBar); - setLayout(verticalLayout); - - restoreGeometry(m_settings.value(QLatin1String(KEY_TOOLBOX_GEOMETRY)).toByteArray()); -} - -ToolBox::~ToolBox() -{ - m_settings.setValue(QLatin1String(KEY_TOOLBOX_GEOMETRY), saveGeometry()); -} AbstractViewInspector::AbstractViewInspector(QObject *parent) : QObject(parent), - m_toolBox(0), m_currentTool(0), m_showAppOnTop(false), m_designModeBehavior(false), @@ -108,8 +66,6 @@ AbstractViewInspector::AbstractViewInspector(QObject *parent) : m_slowDownFactor(1.0), m_debugService(0) { - initEditorResource(); - m_debugService = QDeclarativeInspectorService::instance(); connect(m_debugService, SIGNAL(gotMessage(QByteArray)), this, SLOT(handleMessage(QByteArray))); @@ -216,59 +172,6 @@ void AbstractViewInspector::setShowAppOnTop(bool appOnTop) emit showAppOnTopChanged(appOnTop); } -void AbstractViewInspector::setToolBoxVisible(bool visible) -{ -#if !defined(Q_OS_SYMBIAN) && !defined(Q_WS_MAEMO_5) && !defined(Q_WS_SIMULATOR) - if (!m_toolBox && visible) - createToolBox(); - if (m_toolBox) - m_toolBox->setVisible(visible); -#else - Q_UNUSED(visible) -#endif -} - -void AbstractViewInspector::createToolBox() -{ - m_toolBox = new ToolBox(viewWidget()); - - QmlToolBar *toolBar = m_toolBox->toolBar(); - - QObject::connect(this, SIGNAL(selectedColorChanged(QColor)), - toolBar, SLOT(setColorBoxColor(QColor))); - - QObject::connect(this, SIGNAL(designModeBehaviorChanged(bool)), - toolBar, SLOT(setDesignModeBehavior(bool))); - - QObject::connect(toolBar, SIGNAL(designModeBehaviorChanged(bool)), - this, SLOT(setDesignModeBehavior(bool))); - QObject::connect(toolBar, SIGNAL(animationSpeedChanged(qreal)), this, SLOT(setAnimationSpeed(qreal))); - QObject::connect(toolBar, SIGNAL(animationPausedChanged(bool)), this, SLOT(setAnimationPaused(bool))); - QObject::connect(toolBar, SIGNAL(colorPickerSelected()), this, SLOT(changeToColorPickerTool())); - QObject::connect(toolBar, SIGNAL(zoomToolSelected()), this, SLOT(changeToZoomTool())); - QObject::connect(toolBar, SIGNAL(selectToolSelected()), this, SLOT(changeToSingleSelectTool())); - QObject::connect(toolBar, SIGNAL(marqueeSelectToolSelected()), - this, SLOT(changeToMarqueeSelectTool())); - - QObject::connect(toolBar, SIGNAL(applyChangesFromQmlFileSelected()), - this, SLOT(applyChangesFromClient())); - - QObject::connect(this, SIGNAL(animationSpeedChanged(qreal)), toolBar, SLOT(setAnimationSpeed(qreal))); - QObject::connect(this, SIGNAL(animationPausedChanged(bool)), toolBar, SLOT(setAnimationPaused(bool))); - - QObject::connect(this, SIGNAL(selectToolActivated()), toolBar, SLOT(activateSelectTool())); - - // disabled features - //connect(d->m_toolBar, SIGNAL(applyChangesToQmlFileSelected()), SLOT(applyChangesToClient())); - //connect(q, SIGNAL(resizeToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); - //connect(q, SIGNAL(moveToolActivated()), d->m_toolBar, SLOT(activateSelectTool())); - - QObject::connect(this, SIGNAL(colorPickerActivated()), toolBar, SLOT(activateColorPicker())); - QObject::connect(this, SIGNAL(zoomToolActivated()), toolBar, SLOT(activateZoom())); - QObject::connect(this, SIGNAL(marqueeSelectToolActivated()), - toolBar, SLOT(activateMarqueeSelectTool())); -} - void AbstractViewInspector::changeToColorPickerTool() { changeTool(InspectorProtocol::ColorPickerTool); @@ -609,5 +512,3 @@ QString AbstractViewInspector::idStringForObject(QObject *obj) const } } // namespace QmlJSDebugger - -#include "abstractviewinspector.moc" diff --git a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h index 7202bcca40..14c592ed4c 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h +++ b/src/plugins/qmltooling/qmldbg_inspector/abstractviewinspector.h @@ -157,10 +157,6 @@ private: void animationSpeedChangeRequested(qreal factor); void animationPausedChangeRequested(bool paused); - void setToolBoxVisible(bool visible); - void createToolBox(); - - ToolBox *m_toolBox; AbstractTool *m_currentTool; bool m_showAppOnTop; diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc b/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc deleted file mode 100644 index fb2393caa1..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/editor.qrc +++ /dev/null @@ -1,24 +0,0 @@ -<RCC> - <qresource prefix="/qml"> - <file>images/resize_handle.png</file> - <file>images/select.png</file> - <file>images/select-marquee.png</file> - <file>images/color-picker.png</file> - <file>images/play.png</file> - <file>images/pause.png</file> - <file>images/from-qml.png</file> - <file>images/to-qml.png</file> - <file>images/color-picker-hicontrast.png</file> - <file>images/zoom.png</file> - <file>images/color-picker-24.png</file> - <file>images/from-qml-24.png</file> - <file>images/pause-24.png</file> - <file>images/play-24.png</file> - <file>images/to-qml-24.png</file> - <file>images/zoom-24.png</file> - <file>images/select-24.png</file> - <file>images/select-marquee-24.png</file> - <file>images/inspectormode.png</file> - <file>images/inspectormode-24.png</file> - </qresource> -</RCC> diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png Binary files differdeleted file mode 100644 index cff47212a4..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png Binary files differdeleted file mode 100644 index b953d08a68..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker-hicontrast.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png Binary files differdeleted file mode 100644 index 026c31b3e1..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/color-picker.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png Binary files differdeleted file mode 100644 index 0ad21f3dbb..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png Binary files differdeleted file mode 100644 index 666382c06d..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/from-qml.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png Binary files differdeleted file mode 100644 index 5e74d867c0..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png Binary files differdeleted file mode 100644 index daed21c944..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/inspectormode.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png Binary files differdeleted file mode 100644 index d9a2f6f814..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png Binary files differdeleted file mode 100644 index 114d89b12b..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/pause.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png Binary files differdeleted file mode 100644 index e2b9fbcf51..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/play-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png Binary files differdeleted file mode 100644 index 011598a746..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/play.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png Binary files differdeleted file mode 100644 index 7042bec9ae..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/reload.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png Binary files differdeleted file mode 100644 index 2934f25b74..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/resize_handle.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png Binary files differdeleted file mode 100644 index 5388a9d16a..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png Binary files differdeleted file mode 100644 index 0111ddae45..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png Binary files differdeleted file mode 100644 index 92fe40d1ad..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select-marquee.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png Binary files differdeleted file mode 100644 index 672285582b..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/select.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png Binary files differdeleted file mode 100644 index b72450ddd4..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png Binary files differdeleted file mode 100644 index 2ab951fd08..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/to-qml.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png Binary files differdeleted file mode 100644 index 03462001ec..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom-24.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png b/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png Binary files differdeleted file mode 100644 index 17f0da6d64..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/images/zoom.png +++ /dev/null diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp deleted file mode 100644 index 1f3a1e12c2..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.cpp +++ /dev/null @@ -1,328 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qmltoolbar.h" -#include "toolbarcolorbox.h" - -#include <QtWidgets/QLabel> -#include <QtWidgets/QIcon> -#include <QtWidgets/QAction> -#include <QtWidgets/QMenu> - -#include <QtCore/QDebug> - -namespace QmlJSDebugger { - -QmlToolBar::QmlToolBar(QWidget *parent) - : QToolBar(parent) - , m_emitSignals(true) - , m_paused(false) - , m_animationSpeed(1.0f) - , ui(new Ui) -{ - ui->playIcon = QIcon(QLatin1String(":/qml/images/play-24.png")); - ui->pauseIcon = QIcon(QLatin1String(":/qml/images/pause-24.png")); - - ui->designmode = new QAction(QIcon(QLatin1String(":/qml/images/inspectormode-24.png")), - tr("Inspector Mode"), this); - ui->play = new QAction(ui->pauseIcon, tr("Play/Pause Animations"), this); - ui->select = new QAction(QIcon(QLatin1String(":/qml/images/select-24.png")), tr("Select"), this); - ui->selectMarquee = new QAction(QIcon(QLatin1String(":/qml/images/select-marquee-24.png")), - tr("Select (Marquee)"), this); - ui->zoom = new QAction(QIcon(QLatin1String(":/qml/images/zoom-24.png")), tr("Zoom"), this); - ui->colorPicker = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-24.png")), - tr("Color Picker"), this); - ui->toQml = new QAction(QIcon(QLatin1String(":/qml/images/to-qml-24.png")), - tr("Apply Changes to QML Viewer"), this); - ui->fromQml = new QAction(QIcon(QLatin1String(":/qml/images/from-qml-24.png")), - tr("Apply Changes to Document"), this); - ui->designmode->setCheckable(true); - ui->designmode->setChecked(false); - - ui->play->setCheckable(false); - ui->select->setCheckable(true); - ui->selectMarquee->setCheckable(true); - ui->zoom->setCheckable(true); - ui->colorPicker->setCheckable(true); - - setWindowTitle(tr("Tools")); - - addAction(ui->designmode); - addAction(ui->play); - addSeparator(); - - addAction(ui->select); - // disabled because multi selection does not do anything useful without design mode - //addAction(ui->selectMarquee); - addSeparator(); - addAction(ui->zoom); - addAction(ui->colorPicker); - //addAction(ui->fromQml); - - ui->colorBox = new ToolBarColorBox(this); - ui->colorBox->setMinimumSize(24, 24); - ui->colorBox->setMaximumSize(28, 28); - ui->colorBox->setColor(Qt::black); - addWidget(ui->colorBox); - - setWindowFlags(Qt::Tool); - - QMenu *playSpeedMenu = new QMenu(this); - ui->playSpeedMenuActions = new QActionGroup(this); - ui->playSpeedMenuActions->setExclusive(true); - - QAction *speedAction = playSpeedMenu->addAction(tr("1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setChecked(true); - speedAction->setData(1.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(2.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(4.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(8.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - speedAction = playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeAnimationSpeed())); - speedAction->setCheckable(true); - speedAction->setData(10.0f); - ui->playSpeedMenuActions->addAction(speedAction); - - ui->play->setMenu(playSpeedMenu); - - connect(ui->designmode, SIGNAL(toggled(bool)), SLOT(setDesignModeBehaviorOnClick(bool))); - - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - - connect(ui->play, SIGNAL(triggered()), SLOT(activatePlayOnClick())); - - connect(ui->zoom, SIGNAL(triggered()), SLOT(activateZoomOnClick())); - connect(ui->colorPicker, SIGNAL(triggered()), SLOT(activateColorPickerOnClick())); - connect(ui->select, SIGNAL(triggered()), SLOT(activateSelectToolOnClick())); - connect(ui->selectMarquee, SIGNAL(triggered()), SLOT(activateMarqueeSelectToolOnClick())); - - connect(ui->toQml, SIGNAL(triggered()), SLOT(activateToQml())); - connect(ui->fromQml, SIGNAL(triggered()), SLOT(activateFromQml())); -} - -QmlToolBar::~QmlToolBar() -{ - delete ui; -} - -void QmlToolBar::activateColorPicker() -{ - m_emitSignals = false; - activateColorPickerOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateSelectTool() -{ - m_emitSignals = false; - activateSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateMarqueeSelectTool() -{ - m_emitSignals = false; - activateMarqueeSelectToolOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::activateZoom() -{ - m_emitSignals = false; - activateZoomOnClick(); - m_emitSignals = true; -} - -void QmlToolBar::setAnimationSpeed(qreal slowDownFactor) -{ - if (m_animationSpeed == slowDownFactor) - return; - - m_emitSignals = false; - m_animationSpeed = slowDownFactor; - - foreach (QAction *action, ui->playSpeedMenuActions->actions()) { - if (action->data().toReal() == slowDownFactor) { - action->setChecked(true); - break; - } - } - - m_emitSignals = true; -} - -void QmlToolBar::setAnimationPaused(bool paused) -{ - if (m_paused == paused) - return; - - m_paused = paused; - updatePlayAction(); -} - -void QmlToolBar::changeAnimationSpeed() -{ - QAction *action = qobject_cast<QAction*>(sender()); - m_animationSpeed = action->data().toReal(); - emit animationSpeedChanged(m_animationSpeed); -} - -void QmlToolBar::setDesignModeBehavior(bool inDesignMode) -{ - m_emitSignals = false; - ui->designmode->setChecked(inDesignMode); - setDesignModeBehaviorOnClick(inDesignMode); - m_emitSignals = true; -} - -void QmlToolBar::setDesignModeBehaviorOnClick(bool checked) -{ - ui->select->setEnabled(checked); - ui->selectMarquee->setEnabled(checked); - ui->zoom->setEnabled(checked); - ui->colorPicker->setEnabled(checked); - ui->toQml->setEnabled(checked); - ui->fromQml->setEnabled(checked); - - if (m_emitSignals) - emit designModeBehaviorChanged(checked); -} - -void QmlToolBar::setColorBoxColor(const QColor &color) -{ - ui->colorBox->setColor(color); -} - -void QmlToolBar::activatePlayOnClick() -{ - m_paused = !m_paused; - emit animationPausedChanged(m_paused); - updatePlayAction(); -} - -void QmlToolBar::updatePlayAction() -{ - ui->play->setIcon(m_paused ? ui->playIcon : ui->pauseIcon); -} - -void QmlToolBar::activateColorPickerOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - - ui->colorPicker->setChecked(true); - if (m_activeTool != Constants::ColorPickerMode) { - m_activeTool = Constants::ColorPickerMode; - if (m_emitSignals) - emit colorPickerSelected(); - } -} - -void QmlToolBar::activateSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->select->setChecked(true); - if (m_activeTool != Constants::SelectionToolMode) { - m_activeTool = Constants::SelectionToolMode; - if (m_emitSignals) - emit selectToolSelected(); - } -} - -void QmlToolBar::activateMarqueeSelectToolOnClick() -{ - ui->zoom->setChecked(false); - ui->select->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->selectMarquee->setChecked(true); - if (m_activeTool != Constants::MarqueeSelectionToolMode) { - m_activeTool = Constants::MarqueeSelectionToolMode; - if (m_emitSignals) - emit marqueeSelectToolSelected(); - } -} - -void QmlToolBar::activateZoomOnClick() -{ - ui->select->setChecked(false); - ui->selectMarquee->setChecked(false); - ui->colorPicker->setChecked(false); - - ui->zoom->setChecked(true); - if (m_activeTool != Constants::ZoomMode) { - m_activeTool = Constants::ZoomMode; - if (m_emitSignals) - emit zoomToolSelected(); - } -} - -void QmlToolBar::activateFromQml() -{ - if (m_emitSignals) - emit applyChangesFromQmlFileSelected(); -} - -void QmlToolBar::activateToQml() -{ - if (m_emitSignals) - emit applyChangesToQmlFileSelected(); -} - -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h b/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h deleted file mode 100644 index 177885f700..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/qmltoolbar.h +++ /dev/null @@ -1,132 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMLTOOLBAR_H -#define QMLTOOLBAR_H - -#include <QtWidgets/QToolBar> -#include <QtWidgets/QIcon> - -#include "../qmlinspectorconstants.h" - -QT_FORWARD_DECLARE_CLASS(QActionGroup) - -namespace QmlJSDebugger { - -class ToolBarColorBox; - -class QmlToolBar : public QToolBar -{ - Q_OBJECT - -public: - explicit QmlToolBar(QWidget *parent = 0); - ~QmlToolBar(); - -public slots: - void setDesignModeBehavior(bool inDesignMode); - void setColorBoxColor(const QColor &color); - void activateColorPicker(); - void activateSelectTool(); - void activateMarqueeSelectTool(); - void activateZoom(); - - void setAnimationSpeed(qreal slowDownFactor); - void setAnimationPaused(bool paused); - -signals: - void animationSpeedChanged(qreal factor); - void animationPausedChanged(bool paused); - - void designModeBehaviorChanged(bool inDesignMode); - void colorPickerSelected(); - void selectToolSelected(); - void marqueeSelectToolSelected(); - void zoomToolSelected(); - - void applyChangesToQmlFileSelected(); - void applyChangesFromQmlFileSelected(); - -private slots: - void setDesignModeBehaviorOnClick(bool inDesignMode); - void activatePlayOnClick(); - void activateColorPickerOnClick(); - void activateSelectToolOnClick(); - void activateMarqueeSelectToolOnClick(); - void activateZoomOnClick(); - - void activateFromQml(); - void activateToQml(); - - void changeAnimationSpeed(); - - void updatePlayAction(); - -private: - class Ui { - public: - QAction *designmode; - QAction *play; - QAction *select; - QAction *selectMarquee; - QAction *zoom; - QAction *colorPicker; - QAction *toQml; - QAction *fromQml; - QIcon playIcon; - QIcon pauseIcon; - ToolBarColorBox *colorBox; - - QActionGroup *playSpeedMenuActions; - }; - - bool m_emitSignals; - bool m_paused; - qreal m_animationSpeed; - - Constants::DesignTool m_activeTool; - - Ui *ui; -}; - -} - -#endif // QMLTOOLBAR_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp deleted file mode 100644 index 64d4035d09..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "toolbarcolorbox.h" - -#include "../qmlinspectorconstants.h" - -#include <QtGui/QPixmap> -#include <QtGui/QPainter> -#include <QtWidgets/QMenu> -#include <QtWidgets/QAction> -#include <QtGui/QContextMenuEvent> -#include <QtGui/QClipboard> -#include <QtWidgets/QApplication> -#include <QtWidgets/QColorDialog> -#include <QtGui/QDrag> - -#include <QtCore/QMimeData> -#include <QtCore/QDebug> - -namespace QmlJSDebugger { - -ToolBarColorBox::ToolBarColorBox(QWidget *parent) : - QLabel(parent) -{ - m_copyHexColor = new QAction(QIcon(QLatin1String(":/qml/images/color-picker-hicontrast.png")), - tr("Copy Color"), this); - connect(m_copyHexColor, SIGNAL(triggered()), SLOT(copyColorToClipboard())); - setScaledContents(false); -} - -void ToolBarColorBox::setColor(const QColor &color) -{ - m_color = color; - - QPixmap pix = createDragPixmap(width()); - setPixmap(pix); - update(); -} - -void ToolBarColorBox::mousePressEvent(QMouseEvent *event) -{ - m_dragBeginPoint = event->pos(); - m_dragStarted = false; -} - -void ToolBarColorBox::mouseMoveEvent(QMouseEvent *event) -{ - - if (event->buttons() & Qt::LeftButton - && (QPoint(event->pos() - m_dragBeginPoint).manhattanLength() - > Constants::DragStartDistance) - && !m_dragStarted) - { - m_dragStarted = true; - QDrag *drag = new QDrag(this); - QMimeData *mimeData = new QMimeData; - - mimeData->setText(m_color.name()); - drag->setMimeData(mimeData); - drag->setPixmap(createDragPixmap()); - - drag->exec(); - } -} - -QPixmap ToolBarColorBox::createDragPixmap(int size) const -{ - QPixmap pix(size, size); - QPainter p(&pix); - - QColor borderColor1 = QColor(143, 143 ,143); - QColor borderColor2 = QColor(43, 43, 43); - - p.setBrush(QBrush(m_color)); - p.setPen(QPen(QBrush(borderColor2),1)); - - p.fillRect(0, 0, size, size, borderColor1); - p.drawRect(1,1, size - 3, size - 3); - return pix; -} - -void ToolBarColorBox::contextMenuEvent(QContextMenuEvent *ev) -{ - QMenu contextMenu; - contextMenu.addAction(m_copyHexColor); - contextMenu.exec(ev->globalPos()); -} - -void ToolBarColorBox::copyColorToClipboard() -{ - QClipboard *clipboard = QApplication::clipboard(); - clipboard->setText(m_color.name()); -} - -} // namespace QmlJSDebugger diff --git a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h b/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h deleted file mode 100644 index ce5ecf0e7e..0000000000 --- a/src/plugins/qmltooling/qmldbg_inspector/editor/toolbarcolorbox.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDeclarative module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** 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. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** 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. -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef TOOLBARCOLORBOX_H -#define TOOLBARCOLORBOX_H - -#include <QtWidgets/QLabel> -#include <QtGui/QColor> -#include <QtCore/QPoint> - -QT_FORWARD_DECLARE_CLASS(QContextMenuEvent) -QT_FORWARD_DECLARE_CLASS(QAction) - -namespace QmlJSDebugger { - -class ToolBarColorBox : public QLabel -{ - Q_OBJECT - -public: - explicit ToolBarColorBox(QWidget *parent = 0); - void setColor(const QColor &color); - -protected: - void contextMenuEvent(QContextMenuEvent *ev); - void mousePressEvent(QMouseEvent *ev); - void mouseMoveEvent(QMouseEvent *ev); -private slots: - void copyColorToClipboard(); - -private: - QPixmap createDragPixmap(int size = 24) const; - -private: - bool m_dragStarted; - QPoint m_dragBeginPoint; - QAction *m_copyHexColor; - QColor m_color; -}; - -} // namespace QmlJSDebugger - -#endif // TOOLBARCOLORBOX_H diff --git a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro index c165832013..38358da79b 100644 --- a/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro +++ b/src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro @@ -23,8 +23,6 @@ SOURCES += \ editor/subcomponentmasklayeritem.cpp \ editor/zoomtool.cpp \ editor/colorpickertool.cpp \ - editor/qmltoolbar.cpp \ - editor/toolbarcolorbox.cpp \ abstracttool.cpp \ sgviewinspector.cpp \ sgselectiontool.cpp \ @@ -48,15 +46,11 @@ HEADERS += \ editor/subcomponentmasklayeritem.h \ editor/zoomtool.h \ editor/colorpickertool.h \ - editor/qmltoolbar.h \ - editor/toolbarcolorbox.h \ abstracttool.h \ sgviewinspector.h \ sgselectiontool.h \ sghighlight.h -RESOURCES += editor/editor.qrc - target.path += $$[QT_INSTALL_PLUGINS]/qmltooling INSTALLS += target |