2010-08-18 10:40:10 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2011-01-11 16:28:15 +01:00
|
|
|
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
2010-08-18 10:40:10 +02:00
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** No Commercial Usage
|
2010-08-18 10:40:10 +02:00
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** This file contains pre-release code and may not be distributed.
|
|
|
|
|
** You may use this file in accordance with the terms and conditions
|
|
|
|
|
** contained in the Technology Preview License Agreement accompanying
|
|
|
|
|
** this package.
|
2010-08-18 10:40:10 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
2010-12-17 16:01:08 +01:00
|
|
|
** 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.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
|
|
|
|
** Nokia at qt-info@nokia.com.
|
2010-08-18 10:40:10 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
#include "qmlinspectortoolbar.h"
|
|
|
|
|
#include "qmljsinspectorconstants.h"
|
2010-07-26 12:47:55 +02:00
|
|
|
#include "qmljstoolbarcolorbox.h"
|
2010-07-08 11:34:51 +02:00
|
|
|
|
|
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
|
|
|
|
#include <coreplugin/actionmanager/command.h>
|
2010-11-02 16:53:56 +01:00
|
|
|
#include <coreplugin/uniqueidmanager.h>
|
2010-11-23 09:23:19 +01:00
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
#include <extensionsystem/pluginmanager.h>
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2010-07-08 11:34:51 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
#include <utils/styledbar.h>
|
|
|
|
|
#include <utils/filterlineedit.h>
|
|
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
#include <QAction>
|
2010-07-12 14:32:54 +02:00
|
|
|
#include <QActionGroup>
|
2010-11-23 09:23:19 +01:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QMenu>
|
|
|
|
|
#include <QToolButton>
|
2010-07-08 11:34:51 +02:00
|
|
|
|
|
|
|
|
namespace QmlJSInspector {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
static QToolButton *createToolButton(QAction *action)
|
|
|
|
|
{
|
|
|
|
|
QToolButton *button = new QToolButton;
|
|
|
|
|
button->setDefaultAction(action);
|
|
|
|
|
return button;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QmlInspectorToolbar::QmlInspectorToolbar(QObject *parent) :
|
|
|
|
|
QObject(parent),
|
2010-11-23 09:23:19 +01:00
|
|
|
m_fromQmlAction(0),
|
2010-08-24 16:30:24 +02:00
|
|
|
m_observerModeAction(0),
|
2010-07-08 11:34:51 +02:00
|
|
|
m_playAction(0),
|
|
|
|
|
m_selectAction(0),
|
|
|
|
|
m_zoomAction(0),
|
|
|
|
|
m_colorPickerAction(0),
|
2010-11-23 10:07:09 +01:00
|
|
|
m_showAppOnTopAction(0),
|
2010-07-12 14:32:54 +02:00
|
|
|
m_defaultAnimSpeedAction(0),
|
|
|
|
|
m_halfAnimSpeedAction(0),
|
|
|
|
|
m_fourthAnimSpeedAction(0),
|
|
|
|
|
m_eighthAnimSpeedAction(0),
|
|
|
|
|
m_tenthAnimSpeedAction(0),
|
2010-07-26 12:47:55 +02:00
|
|
|
m_menuPauseAction(0),
|
2010-08-23 15:57:45 +02:00
|
|
|
m_playIcon(QIcon(QLatin1String(":/qml/images/play-small.png"))),
|
|
|
|
|
m_pauseIcon(QIcon(QLatin1String(":/qml/images/pause-small.png"))),
|
2010-07-26 12:47:55 +02:00
|
|
|
m_colorBox(0),
|
2010-07-08 11:34:51 +02:00
|
|
|
m_emitSignals(true),
|
|
|
|
|
m_isRunning(false),
|
2010-07-12 14:32:54 +02:00
|
|
|
m_animationSpeed(1.0f),
|
|
|
|
|
m_previousAnimationSpeed(0.0f),
|
2010-08-18 13:54:12 +02:00
|
|
|
m_activeTool(NoTool),
|
|
|
|
|
m_barWidget(0)
|
2010-07-08 11:34:51 +02:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::setEnabled(bool value)
|
|
|
|
|
{
|
2010-07-26 11:59:59 +02:00
|
|
|
m_fromQmlAction->setEnabled(value);
|
2010-11-23 10:07:09 +01:00
|
|
|
m_showAppOnTopAction->setEnabled(value);
|
2010-11-23 09:23:19 +01:00
|
|
|
m_observerModeAction->setEnabled(value);
|
2010-07-08 11:34:51 +02:00
|
|
|
m_playAction->setEnabled(value);
|
|
|
|
|
m_selectAction->setEnabled(value);
|
|
|
|
|
m_zoomAction->setEnabled(value);
|
|
|
|
|
m_colorPickerAction->setEnabled(value);
|
2010-07-27 11:57:54 +02:00
|
|
|
m_colorBox->setEnabled(value);
|
2010-07-08 11:34:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::enable()
|
|
|
|
|
{
|
|
|
|
|
setEnabled(true);
|
2010-07-12 12:02:35 +02:00
|
|
|
m_emitSignals = false;
|
2010-08-24 16:30:24 +02:00
|
|
|
m_observerModeAction->setChecked(false);
|
2010-08-23 15:57:45 +02:00
|
|
|
setAnimationSpeed(1.0f);
|
2010-07-12 12:02:35 +02:00
|
|
|
activateDesignModeOnClick();
|
|
|
|
|
m_emitSignals = true;
|
2010-07-08 11:34:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::disable()
|
|
|
|
|
{
|
2010-08-23 15:57:45 +02:00
|
|
|
setAnimationSpeed(1.0f);
|
2010-07-08 11:34:51 +02:00
|
|
|
activateSelectTool();
|
|
|
|
|
setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::activateColorPicker()
|
|
|
|
|
{
|
|
|
|
|
m_emitSignals = false;
|
|
|
|
|
activateColorPickerOnClick();
|
|
|
|
|
m_emitSignals = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::activateSelectTool()
|
|
|
|
|
{
|
|
|
|
|
m_emitSignals = false;
|
|
|
|
|
activateSelectToolOnClick();
|
|
|
|
|
m_emitSignals = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::activateZoomTool()
|
|
|
|
|
{
|
|
|
|
|
m_emitSignals = false;
|
|
|
|
|
activateZoomOnClick();
|
|
|
|
|
m_emitSignals = true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-23 15:57:45 +02:00
|
|
|
void QmlInspectorToolbar::setAnimationSpeed(qreal slowdownFactor)
|
2010-07-08 11:34:51 +02:00
|
|
|
{
|
|
|
|
|
m_emitSignals = false;
|
2010-08-23 15:57:45 +02:00
|
|
|
if (slowdownFactor != 0) {
|
2010-07-12 14:32:54 +02:00
|
|
|
m_animationSpeed = slowdownFactor;
|
|
|
|
|
|
|
|
|
|
if (slowdownFactor == 1.0f) {
|
|
|
|
|
m_defaultAnimSpeedAction->setChecked(true);
|
|
|
|
|
} else if (slowdownFactor == 2.0f) {
|
|
|
|
|
m_halfAnimSpeedAction->setChecked(true);
|
|
|
|
|
} else if (slowdownFactor == 4.0f) {
|
|
|
|
|
m_fourthAnimSpeedAction->setChecked(true);
|
|
|
|
|
} else if (slowdownFactor == 8.0f) {
|
|
|
|
|
m_eighthAnimSpeedAction->setChecked(true);
|
|
|
|
|
} else if (slowdownFactor == 10.0f) {
|
|
|
|
|
m_tenthAnimSpeedAction->setChecked(true);
|
|
|
|
|
}
|
2010-08-23 15:57:45 +02:00
|
|
|
updatePlayAction();
|
|
|
|
|
} else {
|
2010-08-24 18:40:57 +02:00
|
|
|
m_menuPauseAction->setChecked(true);
|
2010-08-23 15:57:45 +02:00
|
|
|
updatePauseAction();
|
2010-07-08 11:34:51 +02:00
|
|
|
}
|
2010-08-23 15:57:45 +02:00
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
m_emitSignals = true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:02:35 +02:00
|
|
|
void QmlInspectorToolbar::setDesignModeBehavior(bool inDesignMode)
|
|
|
|
|
{
|
|
|
|
|
m_emitSignals = false;
|
2010-08-24 16:30:24 +02:00
|
|
|
m_observerModeAction->setChecked(inDesignMode);
|
2010-07-12 12:02:35 +02:00
|
|
|
activateDesignModeOnClick();
|
|
|
|
|
m_emitSignals = true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-23 10:07:09 +01:00
|
|
|
void QmlInspectorToolbar::setShowAppOnTop(bool showAppOnTop)
|
|
|
|
|
{
|
|
|
|
|
m_emitSignals = false;
|
|
|
|
|
m_showAppOnTopAction->setChecked(showAppOnTop);
|
|
|
|
|
m_emitSignals = true;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
void QmlInspectorToolbar::createActions(const Core::Context &context)
|
|
|
|
|
{
|
|
|
|
|
Core::ICore *core = Core::ICore::instance();
|
|
|
|
|
Core::ActionManager *am = core->actionManager();
|
|
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
m_fromQmlAction =
|
|
|
|
|
new QAction(QIcon(QLatin1String(":/qml/images/from-qml-small.png")),
|
|
|
|
|
tr("Apply Changes on Save"), this);
|
2010-11-23 10:07:09 +01:00
|
|
|
m_showAppOnTopAction =
|
|
|
|
|
new QAction(QIcon(QLatin1String(":/qml/images/app-on-top.png")),
|
|
|
|
|
tr("Show application on top"), this);
|
2010-11-23 09:23:19 +01:00
|
|
|
m_observerModeAction =
|
|
|
|
|
new QAction(QIcon(QLatin1String(":/qml/images/observermode.png")),
|
|
|
|
|
tr("Observer Mode"), this);
|
|
|
|
|
m_playAction =
|
|
|
|
|
new QAction(m_pauseIcon, tr("Play/Pause Animations"), this);
|
|
|
|
|
m_selectAction =
|
|
|
|
|
new QAction(QIcon(QLatin1String(":/qml/images/select-small.png")),
|
|
|
|
|
tr("Select"), this);
|
|
|
|
|
m_zoomAction =
|
|
|
|
|
new QAction(QIcon(QLatin1String(":/qml/images/zoom-small.png")),
|
|
|
|
|
tr("Zoom"), this);
|
|
|
|
|
m_colorPickerAction =
|
|
|
|
|
new QAction(QIcon(QLatin1String(":/qml/images/color-picker-small.png")),
|
|
|
|
|
tr("Color Picker"), this);
|
2010-07-26 11:59:59 +02:00
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
m_fromQmlAction->setCheckable(true);
|
|
|
|
|
m_fromQmlAction->setChecked(true);
|
2010-11-23 10:07:09 +01:00
|
|
|
m_showAppOnTopAction->setCheckable(true);
|
|
|
|
|
m_showAppOnTopAction->setChecked(false);
|
2010-08-24 16:30:24 +02:00
|
|
|
m_observerModeAction->setCheckable(true);
|
|
|
|
|
m_observerModeAction->setChecked(false);
|
2010-07-08 11:34:51 +02:00
|
|
|
m_selectAction->setCheckable(true);
|
|
|
|
|
m_zoomAction->setCheckable(true);
|
|
|
|
|
m_colorPickerAction->setCheckable(true);
|
|
|
|
|
|
2010-08-24 16:30:24 +02:00
|
|
|
am->registerAction(m_observerModeAction, QmlJSInspector::Constants::DESIGNMODE_ACTION, context);
|
2010-07-08 11:34:51 +02:00
|
|
|
am->registerAction(m_playAction, QmlJSInspector::Constants::PLAY_ACTION, context);
|
|
|
|
|
am->registerAction(m_selectAction, QmlJSInspector::Constants::SELECT_ACTION, context);
|
|
|
|
|
am->registerAction(m_zoomAction, QmlJSInspector::Constants::ZOOM_ACTION, context);
|
|
|
|
|
am->registerAction(m_colorPickerAction, QmlJSInspector::Constants::COLOR_PICKER_ACTION, context);
|
|
|
|
|
am->registerAction(m_fromQmlAction, QmlJSInspector::Constants::FROM_QML_ACTION, context);
|
2010-11-23 10:07:09 +01:00
|
|
|
am->registerAction(m_showAppOnTopAction,
|
|
|
|
|
QmlJSInspector::Constants::SHOW_APP_ON_TOP_ACTION, context);
|
2010-07-08 11:34:51 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
m_barWidget = new Utils::StyledBar;
|
|
|
|
|
m_barWidget->setSingleRow(true);
|
|
|
|
|
m_barWidget->setProperty("topBorder", true);
|
2010-07-08 11:34:51 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QMenu *playSpeedMenu = new QMenu(m_barWidget);
|
2010-07-12 14:32:54 +02:00
|
|
|
QActionGroup *playSpeedMenuActions = new QActionGroup(this);
|
|
|
|
|
playSpeedMenuActions->setExclusive(true);
|
2010-07-26 10:43:16 +02:00
|
|
|
playSpeedMenu->addAction(tr("Animation Speed"));
|
|
|
|
|
playSpeedMenu->addSeparator();
|
2010-11-23 09:23:19 +01:00
|
|
|
m_defaultAnimSpeedAction =
|
|
|
|
|
playSpeedMenu->addAction(tr("1x"), this, SLOT(changeToDefaultAnimSpeed()));
|
2010-07-12 14:32:54 +02:00
|
|
|
m_defaultAnimSpeedAction->setCheckable(true);
|
|
|
|
|
m_defaultAnimSpeedAction->setChecked(true);
|
|
|
|
|
playSpeedMenuActions->addAction(m_defaultAnimSpeedAction);
|
|
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
m_halfAnimSpeedAction =
|
|
|
|
|
playSpeedMenu->addAction(tr("0.5x"), this, SLOT(changeToHalfAnimSpeed()));
|
2010-07-12 14:32:54 +02:00
|
|
|
m_halfAnimSpeedAction->setCheckable(true);
|
|
|
|
|
playSpeedMenuActions->addAction(m_halfAnimSpeedAction);
|
|
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
m_fourthAnimSpeedAction =
|
|
|
|
|
playSpeedMenu->addAction(tr("0.25x"), this, SLOT(changeToFourthAnimSpeed()));
|
2010-07-12 14:32:54 +02:00
|
|
|
m_fourthAnimSpeedAction->setCheckable(true);
|
|
|
|
|
playSpeedMenuActions->addAction(m_fourthAnimSpeedAction);
|
|
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
m_eighthAnimSpeedAction =
|
|
|
|
|
playSpeedMenu->addAction(tr("0.125x"), this, SLOT(changeToEighthAnimSpeed()));
|
2010-07-12 14:32:54 +02:00
|
|
|
m_eighthAnimSpeedAction->setCheckable(true);
|
|
|
|
|
playSpeedMenuActions->addAction(m_eighthAnimSpeedAction);
|
|
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
m_tenthAnimSpeedAction =
|
|
|
|
|
playSpeedMenu->addAction(tr("0.1x"), this, SLOT(changeToTenthAnimSpeed()));
|
2010-07-12 14:32:54 +02:00
|
|
|
m_tenthAnimSpeedAction->setCheckable(true);
|
|
|
|
|
playSpeedMenuActions->addAction(m_tenthAnimSpeedAction);
|
|
|
|
|
|
2010-08-23 15:57:45 +02:00
|
|
|
m_menuPauseAction = playSpeedMenu->addAction(tr("Pause"), this, SLOT(updatePauseAction()));
|
2010-07-26 10:43:16 +02:00
|
|
|
m_menuPauseAction->setCheckable(true);
|
2010-08-23 15:57:45 +02:00
|
|
|
m_menuPauseAction->setIcon(m_pauseIcon);
|
2010-07-26 10:43:16 +02:00
|
|
|
playSpeedMenuActions->addAction(m_menuPauseAction);
|
|
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
QHBoxLayout *configBarLayout = new QHBoxLayout(m_barWidget);
|
|
|
|
|
configBarLayout->setMargin(0);
|
|
|
|
|
configBarLayout->setSpacing(5);
|
|
|
|
|
|
|
|
|
|
configBarLayout->addWidget(
|
|
|
|
|
createToolButton(am->command(QmlJSInspector::Constants::FROM_QML_ACTION)->action()));
|
2010-11-23 10:07:09 +01:00
|
|
|
configBarLayout->addWidget(
|
|
|
|
|
createToolButton(
|
|
|
|
|
am->command(QmlJSInspector::Constants::SHOW_APP_ON_TOP_ACTION)->action()));
|
2010-10-08 10:16:50 +02:00
|
|
|
configBarLayout->addSpacing(10);
|
2010-07-12 14:32:54 +02:00
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
configBarLayout->addWidget(
|
|
|
|
|
createToolButton(
|
|
|
|
|
am->command(QmlJSInspector::Constants::DESIGNMODE_ACTION)->action()));
|
2010-08-23 15:57:45 +02:00
|
|
|
m_playButton = createToolButton(am->command(QmlJSInspector::Constants::PLAY_ACTION)->action());
|
|
|
|
|
m_playButton->setMenu(playSpeedMenu);
|
|
|
|
|
configBarLayout->addWidget(m_playButton);
|
2010-11-23 09:23:19 +01:00
|
|
|
configBarLayout->addWidget(
|
|
|
|
|
createToolButton(am->command(QmlJSInspector::Constants::SELECT_ACTION)->action()));
|
|
|
|
|
configBarLayout->addWidget(
|
|
|
|
|
createToolButton(am->command(QmlJSInspector::Constants::ZOOM_ACTION)->action()));
|
|
|
|
|
configBarLayout->addWidget(
|
|
|
|
|
createToolButton(
|
|
|
|
|
am->command(QmlJSInspector::Constants::COLOR_PICKER_ACTION)->action()));
|
2010-07-08 11:34:51 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
m_colorBox = new ToolBarColorBox(m_barWidget);
|
2010-07-26 12:47:55 +02:00
|
|
|
m_colorBox->setMinimumSize(20, 20);
|
|
|
|
|
m_colorBox->setMaximumSize(20, 20);
|
|
|
|
|
m_colorBox->setInnerBorderColor(QColor(192,192,192));
|
|
|
|
|
m_colorBox->setOuterBorderColor(QColor(58,58,58));
|
|
|
|
|
configBarLayout->addWidget(m_colorBox);
|
2010-07-08 11:34:51 +02:00
|
|
|
configBarLayout->addStretch();
|
|
|
|
|
|
|
|
|
|
setEnabled(false);
|
|
|
|
|
|
2010-11-23 09:23:19 +01:00
|
|
|
connect(m_fromQmlAction, SIGNAL(triggered()), SLOT(activateFromQml()));
|
2010-11-23 10:07:09 +01:00
|
|
|
connect(m_showAppOnTopAction, SIGNAL(triggered()), SLOT(showAppOnTopClick()));
|
2010-08-24 16:30:24 +02:00
|
|
|
connect(m_observerModeAction, SIGNAL(triggered()), SLOT(activateDesignModeOnClick()));
|
2010-07-08 11:34:51 +02:00
|
|
|
connect(m_playAction, SIGNAL(triggered()), SLOT(activatePlayOnClick()));
|
|
|
|
|
connect(m_colorPickerAction, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));
|
|
|
|
|
connect(m_selectAction, SIGNAL(triggered()), SLOT(activateSelectToolOnClick()));
|
2010-11-23 09:23:19 +01:00
|
|
|
connect(m_zoomAction, SIGNAL(triggered()), SLOT(activateZoomOnClick()));
|
|
|
|
|
connect(m_colorPickerAction, SIGNAL(triggered()), SLOT(activateColorPickerOnClick()));
|
2010-07-08 11:34:51 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QWidget *QmlInspectorToolbar::widget() const
|
|
|
|
|
{
|
|
|
|
|
return m_barWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-12 14:32:54 +02:00
|
|
|
void QmlInspectorToolbar::changeToDefaultAnimSpeed()
|
|
|
|
|
{
|
|
|
|
|
m_animationSpeed = 1.0f;
|
2010-08-23 15:57:45 +02:00
|
|
|
updatePlayAction();
|
2010-07-12 14:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::changeToHalfAnimSpeed()
|
|
|
|
|
{
|
|
|
|
|
m_animationSpeed = 2.0f;
|
2010-08-23 15:57:45 +02:00
|
|
|
updatePlayAction();
|
2010-07-12 14:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::changeToFourthAnimSpeed()
|
|
|
|
|
{
|
|
|
|
|
m_animationSpeed = 4.0f;
|
2010-08-23 15:57:45 +02:00
|
|
|
updatePlayAction();
|
2010-07-12 14:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::changeToEighthAnimSpeed()
|
|
|
|
|
{
|
|
|
|
|
m_animationSpeed = 8.0f;
|
2010-08-23 15:57:45 +02:00
|
|
|
updatePlayAction();
|
2010-07-12 14:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::changeToTenthAnimSpeed()
|
|
|
|
|
{
|
|
|
|
|
m_animationSpeed = 10.0f;
|
2010-08-23 15:57:45 +02:00
|
|
|
updatePlayAction();
|
2010-07-12 14:32:54 +02:00
|
|
|
}
|
|
|
|
|
|
2010-07-12 12:02:35 +02:00
|
|
|
void QmlInspectorToolbar::activateDesignModeOnClick()
|
|
|
|
|
{
|
2010-08-24 16:30:24 +02:00
|
|
|
bool checked = m_observerModeAction->isChecked();
|
2010-07-12 12:02:35 +02:00
|
|
|
|
|
|
|
|
m_playAction->setEnabled(checked);
|
|
|
|
|
m_selectAction->setEnabled(checked);
|
|
|
|
|
m_zoomAction->setEnabled(checked);
|
|
|
|
|
m_colorPickerAction->setEnabled(checked);
|
|
|
|
|
|
|
|
|
|
if (m_emitSignals)
|
|
|
|
|
emit designModeSelected(checked);
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
void QmlInspectorToolbar::activatePlayOnClick()
|
|
|
|
|
{
|
2010-08-23 15:57:45 +02:00
|
|
|
if (m_isRunning) {
|
|
|
|
|
updatePauseAction();
|
|
|
|
|
} else {
|
|
|
|
|
updatePlayAction();
|
2010-07-08 11:34:51 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-08-23 15:57:45 +02:00
|
|
|
void QmlInspectorToolbar::updatePlayAction()
|
2010-07-08 11:34:51 +02:00
|
|
|
{
|
2010-08-23 15:57:45 +02:00
|
|
|
m_isRunning = true;
|
2010-08-24 18:40:57 +02:00
|
|
|
m_playAction->setIcon(m_pauseIcon);
|
2010-08-23 15:57:45 +02:00
|
|
|
if (m_animationSpeed != m_previousAnimationSpeed)
|
|
|
|
|
m_previousAnimationSpeed = m_animationSpeed;
|
|
|
|
|
|
|
|
|
|
if (m_emitSignals)
|
|
|
|
|
emit animationSpeedChanged(m_animationSpeed);
|
|
|
|
|
|
|
|
|
|
m_playButton->setDefaultAction(m_playAction);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::updatePauseAction()
|
|
|
|
|
{
|
|
|
|
|
m_isRunning = false;
|
2010-08-24 18:40:57 +02:00
|
|
|
m_playAction->setIcon(m_playIcon);
|
2010-08-23 15:57:45 +02:00
|
|
|
if (m_emitSignals)
|
|
|
|
|
emit animationSpeedChanged(0.0f);
|
|
|
|
|
|
|
|
|
|
m_playButton->setDefaultAction(m_playAction);
|
2010-07-08 11:34:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::activateColorPickerOnClick()
|
|
|
|
|
{
|
|
|
|
|
m_zoomAction->setChecked(false);
|
|
|
|
|
m_selectAction->setChecked(false);
|
|
|
|
|
|
|
|
|
|
m_colorPickerAction->setChecked(true);
|
|
|
|
|
if (m_activeTool != ColorPickerMode) {
|
|
|
|
|
m_activeTool = ColorPickerMode;
|
|
|
|
|
if (m_emitSignals)
|
|
|
|
|
emit colorPickerSelected();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::activateSelectToolOnClick()
|
|
|
|
|
{
|
|
|
|
|
m_zoomAction->setChecked(false);
|
|
|
|
|
m_colorPickerAction->setChecked(false);
|
|
|
|
|
|
|
|
|
|
m_selectAction->setChecked(true);
|
|
|
|
|
if (m_activeTool != SelectionToolMode) {
|
|
|
|
|
m_activeTool = SelectionToolMode;
|
|
|
|
|
if (m_emitSignals)
|
|
|
|
|
emit selectToolSelected();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void QmlInspectorToolbar::activateZoomOnClick()
|
|
|
|
|
{
|
|
|
|
|
m_selectAction->setChecked(false);
|
|
|
|
|
m_colorPickerAction->setChecked(false);
|
|
|
|
|
|
|
|
|
|
m_zoomAction->setChecked(true);
|
|
|
|
|
if (m_activeTool != ZoomMode) {
|
|
|
|
|
m_activeTool = ZoomMode;
|
|
|
|
|
if (m_emitSignals)
|
|
|
|
|
emit zoomToolSelected();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2010-11-23 10:07:09 +01:00
|
|
|
void QmlInspectorToolbar::showAppOnTopClick()
|
|
|
|
|
{
|
|
|
|
|
if (m_emitSignals)
|
|
|
|
|
emit showAppOnTopSelected(m_showAppOnTopAction->isChecked());
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-26 12:47:55 +02:00
|
|
|
void QmlInspectorToolbar::setSelectedColor(const QColor &color)
|
|
|
|
|
{
|
|
|
|
|
m_colorBox->setColor(color);
|
|
|
|
|
}
|
|
|
|
|
|
2010-07-08 11:34:51 +02:00
|
|
|
void QmlInspectorToolbar::activateFromQml()
|
|
|
|
|
{
|
|
|
|
|
if (m_emitSignals)
|
2010-07-26 11:59:59 +02:00
|
|
|
emit applyChangesFromQmlFileTriggered(m_fromQmlAction->isChecked());
|
2010-07-08 11:34:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace QmlJSInspector
|