diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-02-08 20:02:23 +0100 |
---|---|---|
committer | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2011-02-09 14:12:18 +0100 |
commit | 3e06015b4dc3075548ffb45b2f0467e56c69356d (patch) | |
tree | c71b73a83f9772eec218f9a1a2d7860bda8a70a7 /src/plugins/qmljsinspector | |
parent | 7bfd08e33966700169b192b4d9deabb96f699688 (diff) | |
download | qt-creator-3e06015b4dc3075548ffb45b2f0467e56c69356d.tar.gz |
QmlJSInspector: Cosmetics
* Renamed Toolbar to ToolBar
* Use mass-disconnect instead of duplicating all connect calls
* Split up setupToolbar(bool)
Diffstat (limited to 'src/plugins/qmljsinspector')
-rw-r--r-- | src/plugins/qmljsinspector/qmlinspectortoolbar.cpp | 54 | ||||
-rw-r--r-- | src/plugins/qmljsinspector/qmlinspectortoolbar.h | 4 | ||||
-rw-r--r-- | src/plugins/qmljsinspector/qmljsclientproxy.h | 2 | ||||
-rw-r--r-- | src/plugins/qmljsinspector/qmljsinspector.cpp | 227 | ||||
-rw-r--r-- | src/plugins/qmljsinspector/qmljsinspector.h | 11 | ||||
-rw-r--r-- | src/plugins/qmljsinspector/qmljsobserverclient.h | 4 |
6 files changed, 134 insertions, 168 deletions
diff --git a/src/plugins/qmljsinspector/qmlinspectortoolbar.cpp b/src/plugins/qmljsinspector/qmlinspectortoolbar.cpp index 6d684a270e..3da545ea30 100644 --- a/src/plugins/qmljsinspector/qmlinspectortoolbar.cpp +++ b/src/plugins/qmljsinspector/qmlinspectortoolbar.cpp @@ -61,7 +61,7 @@ static QToolButton *createToolButton(QAction *action) return button; } -QmlInspectorToolbar::QmlInspectorToolbar(QObject *parent) : +QmlInspectorToolBar::QmlInspectorToolBar(QObject *parent) : QObject(parent), m_fromQmlAction(0), m_observerModeAction(0), @@ -89,7 +89,7 @@ QmlInspectorToolbar::QmlInspectorToolbar(QObject *parent) : { } -void QmlInspectorToolbar::setEnabled(bool value) +void QmlInspectorToolBar::setEnabled(bool value) { m_fromQmlAction->setEnabled(value); m_showAppOnTopAction->setEnabled(value); @@ -102,7 +102,7 @@ void QmlInspectorToolbar::setEnabled(bool value) m_filterExp->setEnabled(value); } -void QmlInspectorToolbar::enable() +void QmlInspectorToolBar::enable() { setEnabled(true); m_emitSignals = false; @@ -112,35 +112,35 @@ void QmlInspectorToolbar::enable() m_emitSignals = true; } -void QmlInspectorToolbar::disable() +void QmlInspectorToolBar::disable() { setAnimationSpeed(1.0f); activateSelectTool(); setEnabled(false); } -void QmlInspectorToolbar::activateColorPicker() +void QmlInspectorToolBar::activateColorPicker() { m_emitSignals = false; activateColorPickerOnClick(); m_emitSignals = true; } -void QmlInspectorToolbar::activateSelectTool() +void QmlInspectorToolBar::activateSelectTool() { m_emitSignals = false; activateSelectToolOnClick(); m_emitSignals = true; } -void QmlInspectorToolbar::activateZoomTool() +void QmlInspectorToolBar::activateZoomTool() { m_emitSignals = false; activateZoomOnClick(); m_emitSignals = true; } -void QmlInspectorToolbar::setAnimationSpeed(qreal slowdownFactor) +void QmlInspectorToolBar::setAnimationSpeed(qreal slowdownFactor) { m_emitSignals = false; if (slowdownFactor != 0) { @@ -166,7 +166,7 @@ void QmlInspectorToolbar::setAnimationSpeed(qreal slowdownFactor) m_emitSignals = true; } -void QmlInspectorToolbar::setDesignModeBehavior(bool inDesignMode) +void QmlInspectorToolBar::setDesignModeBehavior(bool inDesignMode) { m_emitSignals = false; m_observerModeAction->setChecked(inDesignMode); @@ -174,14 +174,14 @@ void QmlInspectorToolbar::setDesignModeBehavior(bool inDesignMode) m_emitSignals = true; } -void QmlInspectorToolbar::setShowAppOnTop(bool showAppOnTop) +void QmlInspectorToolBar::setShowAppOnTop(bool showAppOnTop) { m_emitSignals = false; m_showAppOnTopAction->setChecked(showAppOnTop); m_emitSignals = true; } -void QmlInspectorToolbar::createActions(const Core::Context &context) +void QmlInspectorToolBar::createActions(const Core::Context &context) { Core::ICore *core = Core::ICore::instance(); Core::ActionManager *am = core->actionManager(); @@ -316,42 +316,42 @@ void QmlInspectorToolbar::createActions(const Core::Context &context) connect(m_filterExp, SIGNAL(textChanged(QString)), SIGNAL(filterTextChanged(QString))); } -QWidget *QmlInspectorToolbar::widget() const +QWidget *QmlInspectorToolBar::widget() const { return m_barWidget; } -void QmlInspectorToolbar::changeToDefaultAnimSpeed() +void QmlInspectorToolBar::changeToDefaultAnimSpeed() { m_animationSpeed = 1.0f; updatePlayAction(); } -void QmlInspectorToolbar::changeToHalfAnimSpeed() +void QmlInspectorToolBar::changeToHalfAnimSpeed() { m_animationSpeed = 2.0f; updatePlayAction(); } -void QmlInspectorToolbar::changeToFourthAnimSpeed() +void QmlInspectorToolBar::changeToFourthAnimSpeed() { m_animationSpeed = 4.0f; updatePlayAction(); } -void QmlInspectorToolbar::changeToEighthAnimSpeed() +void QmlInspectorToolBar::changeToEighthAnimSpeed() { m_animationSpeed = 8.0f; updatePlayAction(); } -void QmlInspectorToolbar::changeToTenthAnimSpeed() +void QmlInspectorToolBar::changeToTenthAnimSpeed() { m_animationSpeed = 10.0f; updatePlayAction(); } -void QmlInspectorToolbar::activateDesignModeOnClick() +void QmlInspectorToolBar::activateDesignModeOnClick() { bool checked = m_observerModeAction->isChecked(); @@ -364,7 +364,7 @@ void QmlInspectorToolbar::activateDesignModeOnClick() emit designModeSelected(checked); } -void QmlInspectorToolbar::activatePlayOnClick() +void QmlInspectorToolBar::activatePlayOnClick() { if (m_isRunning) { updatePauseAction(); @@ -373,7 +373,7 @@ void QmlInspectorToolbar::activatePlayOnClick() } } -void QmlInspectorToolbar::updatePlayAction() +void QmlInspectorToolBar::updatePlayAction() { m_isRunning = true; m_playAction->setIcon(m_pauseIcon); @@ -386,7 +386,7 @@ void QmlInspectorToolbar::updatePlayAction() m_playButton->setDefaultAction(m_playAction); } -void QmlInspectorToolbar::updatePauseAction() +void QmlInspectorToolBar::updatePauseAction() { m_isRunning = false; m_playAction->setIcon(m_playIcon); @@ -396,7 +396,7 @@ void QmlInspectorToolbar::updatePauseAction() m_playButton->setDefaultAction(m_playAction); } -void QmlInspectorToolbar::activateColorPickerOnClick() +void QmlInspectorToolBar::activateColorPickerOnClick() { m_zoomAction->setChecked(false); m_selectAction->setChecked(false); @@ -409,7 +409,7 @@ void QmlInspectorToolbar::activateColorPickerOnClick() } } -void QmlInspectorToolbar::activateSelectToolOnClick() +void QmlInspectorToolBar::activateSelectToolOnClick() { m_zoomAction->setChecked(false); m_colorPickerAction->setChecked(false); @@ -422,7 +422,7 @@ void QmlInspectorToolbar::activateSelectToolOnClick() } } -void QmlInspectorToolbar::activateZoomOnClick() +void QmlInspectorToolBar::activateZoomOnClick() { m_selectAction->setChecked(false); m_colorPickerAction->setChecked(false); @@ -435,18 +435,18 @@ void QmlInspectorToolbar::activateZoomOnClick() } } -void QmlInspectorToolbar::showAppOnTopClick() +void QmlInspectorToolBar::showAppOnTopClick() { if (m_emitSignals) emit showAppOnTopSelected(m_showAppOnTopAction->isChecked()); } -void QmlInspectorToolbar::setSelectedColor(const QColor &color) +void QmlInspectorToolBar::setSelectedColor(const QColor &color) { m_colorBox->setColor(color); } -void QmlInspectorToolbar::activateFromQml() +void QmlInspectorToolBar::activateFromQml() { if (m_emitSignals) emit applyChangesFromQmlFileTriggered(m_fromQmlAction->isChecked()); diff --git a/src/plugins/qmljsinspector/qmlinspectortoolbar.h b/src/plugins/qmljsinspector/qmlinspectortoolbar.h index 6575886fa5..e0aedb5992 100644 --- a/src/plugins/qmljsinspector/qmlinspectortoolbar.h +++ b/src/plugins/qmljsinspector/qmlinspectortoolbar.h @@ -57,7 +57,7 @@ class ToolBarColorBox; namespace Internal { -class QmlInspectorToolbar : public QObject +class QmlInspectorToolBar : public QObject { Q_OBJECT public: @@ -71,7 +71,7 @@ public: ZoomMode = 6 }; - explicit QmlInspectorToolbar(QObject *parent = 0); + explicit QmlInspectorToolBar(QObject *parent = 0); void createActions(const Core::Context &context); QWidget *widget() const; diff --git a/src/plugins/qmljsinspector/qmljsclientproxy.h b/src/plugins/qmljsinspector/qmljsclientproxy.h index 413929a60a..535ebe5f01 100644 --- a/src/plugins/qmljsinspector/qmljsclientproxy.h +++ b/src/plugins/qmljsinspector/qmljsclientproxy.h @@ -80,7 +80,7 @@ public: QDeclarativeDebugObjectReference objectReferenceForId(const QString &objectId) const; QDeclarativeDebugObjectReference objectReferenceForLocation(const int line, const int column) const; QList<QDeclarativeDebugObjectReference> rootObjectReference() const; - DebugIdHash debugIdHash() const { return m_debugIdHash; }; + DebugIdHash debugIdHash() const { return m_debugIdHash; } bool isConnected() const; diff --git a/src/plugins/qmljsinspector/qmljsinspector.cpp b/src/plugins/qmljsinspector/qmljsinspector.cpp index df8475b2db..6ac4b92302 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.cpp +++ b/src/plugins/qmljsinspector/qmljsinspector.cpp @@ -124,7 +124,7 @@ QmlJS::ModelManagerInterface *modelManager() InspectorUi::InspectorUi(QObject *parent) : QObject(parent) , m_listeningToEditorManager(false) - , m_toolbar(0) + , m_toolBar(0) , m_crumblePath(0) , m_propertyInspector(0) , m_settings(new InspectorSettings(this)) @@ -135,7 +135,7 @@ InspectorUi::InspectorUi(QObject *parent) , m_selectionCallbackExpected(false) { m_instance = this; - m_toolbar = new QmlInspectorToolbar(this); + m_toolBar = new QmlInspectorToolBar(this); } InspectorUi::~InspectorUi() @@ -161,16 +161,14 @@ void InspectorUi::restoreSettings() void InspectorUi::setDebuggerEngine(QObject *qmlEngine) { if (m_qmlEngine && !qmlEngine) { - disconnect(m_qmlEngine, - SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)), - this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int))); + disconnect(m_qmlEngine, SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)), + this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int))); } m_qmlEngine = qmlEngine; if (m_qmlEngine) { - connect(m_qmlEngine, - SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)), - this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int))); + connect(m_qmlEngine, SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)), + this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int))); } } @@ -288,17 +286,6 @@ void InspectorUi::connected(ClientProxy *clientProxy) it.value()->resetInitialDoc(doc); } - connect(m_clientProxy, SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)), - SLOT(selectItems(QList<QDeclarativeDebugObjectReference>))); - - connect(m_clientProxy, SIGNAL(enginesChanged()), SLOT(updateEngineList())); - connect(m_clientProxy, SIGNAL(serverReloaded()), this, SLOT(serverReloaded())); - connect(m_clientProxy, SIGNAL(propertyChanged(int, QByteArray,QVariant)), - m_propertyInspector, SLOT(propertyValueChanged(int, QByteArray,QVariant))); - connect(m_propertyInspector, SIGNAL(changePropertyValue(int,QString,QString)), - this, SLOT(changePropertyValue(int,QString,QString))); - connect(m_clientProxy,SIGNAL(objectTreeUpdated()),this,SLOT(objectTreeReady())); - m_debugProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject(); if (m_debugProject->activeTarget() && m_debugProject->activeTarget()->activeBuildConfiguration()) @@ -311,7 +298,8 @@ void InspectorUi::connected(ClientProxy *clientProxy) connect(m_debugProject, SIGNAL(destroyed()), SLOT(currentDebugProjectRemoved())); m_projectFinder.setProjectDirectory(m_debugProject->projectDirectory()); - setupToolbar(true); + connectSignals(); + enable(); resetViews(); initializeDocuments(); @@ -322,35 +310,17 @@ void InspectorUi::connected(ClientProxy *clientProxy) iter.value()->setClientProxy(m_clientProxy); iter.value()->updateDebugIds(); } - - -} - -void InspectorUi::objectTreeReady() -{ - // Should only run once, after debugger startup - if (!m_clientProxy->rootObjectReference().isEmpty()) { - selectItems(m_clientProxy->rootObjectReference()); - disconnect(m_clientProxy,SIGNAL(objectTreeUpdated()),this,SLOT(objectTreeReady())); - } } void InspectorUi::disconnected() { - disconnect(m_clientProxy, SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)), - this, SLOT(selectItems(QList<QDeclarativeDebugObjectReference>))); - disconnect(m_clientProxy, SIGNAL(enginesChanged()), this, SLOT(updateEngineList())); - disconnect(m_clientProxy, SIGNAL(serverReloaded()), this, SLOT(serverReloaded())); - disconnect(m_clientProxy, SIGNAL(propertyChanged(int, QByteArray,QVariant)), - m_propertyInspector, SLOT(propertyValueChanged(int, QByteArray,QVariant))); - disconnect(m_propertyInspector, SIGNAL(changePropertyValue(int,QString,QString)), - this, SLOT(changePropertyValue(int,QString,QString))); + disconnectSignals(); + disable(); m_debugProject = 0; m_qmlEngine = 0; resetViews(); - setupToolbar(false); applyChangesToQmlObserverHelper(false); QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews); @@ -363,6 +333,16 @@ void InspectorUi::disconnected() m_pendingPreviewDocumentNames.clear(); } +void InspectorUi::objectTreeReady() +{ + // Should only run once, after debugger startup + if (!m_clientProxy->rootObjectReference().isEmpty()) { + selectItems(m_clientProxy->rootObjectReference()); + disconnect(m_clientProxy, SIGNAL(objectTreeUpdated()), + this, SLOT(objectTreeReady())); + } +} + void InspectorUi::updateEngineList() { QList<QDeclarativeDebugEngineReference> engines = m_clientProxy->engines(); @@ -624,19 +604,19 @@ void InspectorUi::selectItems(const QList<int> &objectIds) void InspectorUi::changePropertyValue(int debugId,const QString &propertyName, const QString &valueExpression) { QString query = propertyName + '=' + valueExpression; - m_clientProxy->queryExpressionResult(debugId,query, this); + m_clientProxy->queryExpressionResult(debugId, query, this); } void InspectorUi::enable() { - m_toolbar->enable(); + m_toolBar->enable(); m_crumblePath->setEnabled(true); m_propertyInspector->setEnabled(true); } void InspectorUi::disable() { - m_toolbar->disable(); + m_toolBar->disable(); m_crumblePath->setEnabled(false); m_propertyInspector->setEnabled(false); } @@ -711,8 +691,8 @@ bool InspectorUi::addQuotesForData(const QVariant &value) const void InspectorUi::setupDockWidgets() { - m_toolbar->createActions(Core::Context(Debugger::Constants::C_QMLDEBUGGER)); - m_toolbar->setObjectName("QmlInspectorToolbar"); + m_toolBar->createActions(Core::Context(Debugger::Constants::C_QMLDEBUGGER)); + m_toolBar->setObjectName("QmlInspectorToolbar"); m_crumblePath = new ContextCrumblePath; m_crumblePath->setObjectName("QmlContextPath"); @@ -729,7 +709,7 @@ void InspectorUi::setupDockWidgets() wlay->setMargin(0); wlay->setSpacing(0); observerWidget->setLayout(wlay); - wlay->addWidget(m_toolbar->widget()); + wlay->addWidget(m_toolBar->widget()); wlay->addWidget(m_propertyInspector); wlay->addWidget(m_crumblePath); @@ -814,9 +794,8 @@ void InspectorUi::updatePendingPreviewDocuments(QmlJS::Document::Ptr doc) QmlJSLiveTextPreview *preview = createPreviewForEditor(editors.first()); editors.removeFirst(); - foreach (Core::IEditor *editor, editors) { + foreach (Core::IEditor *editor, editors) preview->associateEditor(editor); - } } void InspectorUi::disableLivePreview() @@ -824,87 +803,73 @@ void InspectorUi::disableLivePreview() setApplyChangesToQmlObserver(false); } -void InspectorUi::setupToolbar(bool doConnect) -{ - if (doConnect) { - connect(m_clientProxy, SIGNAL(connected()), - this, SLOT(enable())); - connect(m_clientProxy, SIGNAL(disconnected()), - this, SLOT(disable())); - - connect(m_toolbar, SIGNAL(designModeSelected(bool)), - m_clientProxy, SLOT(setDesignModeBehavior(bool))); - connect(m_toolbar, SIGNAL(reloadSelected()), - m_clientProxy, SLOT(reloadQmlViewer())); - connect(m_toolbar, SIGNAL(animationSpeedChanged(qreal)), - m_clientProxy, SLOT(setAnimationSpeed(qreal))); - connect(m_toolbar, SIGNAL(colorPickerSelected()), - m_clientProxy, SLOT(changeToColorPickerTool())); - connect(m_toolbar, SIGNAL(zoomToolSelected()), - m_clientProxy, SLOT(changeToZoomTool())); - connect(m_toolbar, SIGNAL(selectToolSelected()), - m_clientProxy, SLOT(changeToSelectTool())); - connect(m_toolbar, SIGNAL(applyChangesFromQmlFileTriggered(bool)), - this, SLOT(setApplyChangesToQmlObserver(bool))); - connect(m_toolbar, SIGNAL(showAppOnTopSelected(bool)), - m_clientProxy, SLOT(showAppOnTop(bool))); - connect(m_toolbar, SIGNAL(filterTextChanged(QString)), - m_propertyInspector,SLOT(filterBy(QString))); - connect(m_clientProxy, SIGNAL(colorPickerActivated()), - m_toolbar, SLOT(activateColorPicker())); - connect(m_clientProxy, SIGNAL(selectToolActivated()), - m_toolbar, SLOT(activateSelectTool())); - connect(m_clientProxy, SIGNAL(zoomToolActivated()), - m_toolbar, SLOT(activateZoomTool())); - connect(m_clientProxy, SIGNAL(designModeBehaviorChanged(bool)), - m_toolbar, SLOT(setDesignModeBehavior(bool))); - connect(m_clientProxy, SIGNAL(showAppOnTopChanged(bool)), - m_toolbar, SLOT(setShowAppOnTop(bool))); - connect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)), - m_toolbar, SLOT(setSelectedColor(QColor))); - - connect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)), - m_toolbar, SLOT(setAnimationSpeed(qreal))); - - enable(); - } else { - disconnect(m_clientProxy, SIGNAL(connected()), this, SLOT(enable())); - disconnect(m_clientProxy, SIGNAL(disconnected()), this, SLOT(disable())); - - disconnect(m_toolbar, SIGNAL(designModeSelected(bool)), - m_clientProxy, SLOT(setDesignModeBehavior(bool))); - disconnect(m_toolbar, SIGNAL(reloadSelected()), - m_clientProxy, SLOT(reloadQmlViewer())); - disconnect(m_toolbar, SIGNAL(animationSpeedChanged(qreal)), - m_clientProxy, SLOT(setAnimationSpeed(qreal))); - disconnect(m_toolbar, SIGNAL(colorPickerSelected()), - m_clientProxy, SLOT(changeToColorPickerTool())); - disconnect(m_toolbar, SIGNAL(zoomToolSelected()), - m_clientProxy, SLOT(changeToZoomTool())); - disconnect(m_toolbar, SIGNAL(selectToolSelected()), - m_clientProxy, SLOT(changeToSelectTool())); - disconnect(m_toolbar, SIGNAL(applyChangesFromQmlFileTriggered(bool)), - this, SLOT(setApplyChangesToQmlObserver(bool))); - disconnect(m_toolbar, SIGNAL(showAppOnTopSelected(bool)), - m_clientProxy, SLOT(showAppOnTop(bool))); - disconnect(m_toolbar, SIGNAL(filterTextChanged(QString)), - m_propertyInspector,SLOT(filterBy(QString))); - disconnect(m_clientProxy, SIGNAL(colorPickerActivated()), - m_toolbar, SLOT(activateColorPicker())); - disconnect(m_clientProxy, SIGNAL(selectToolActivated()), - m_toolbar, SLOT(activateSelectTool())); - disconnect(m_clientProxy, SIGNAL(zoomToolActivated()), - m_toolbar, SLOT(activateZoomTool())); - disconnect(m_clientProxy, SIGNAL(designModeBehaviorChanged(bool)), - m_toolbar, SLOT(setDesignModeBehavior(bool))); - disconnect(m_clientProxy, SIGNAL(showAppOnTopChanged(bool)), - m_toolbar, SLOT(setShowAppOnTop(bool))); - disconnect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)), - m_toolbar, SLOT(setSelectedColor(QColor))); - - disconnect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)), - m_toolbar, SLOT(setAnimationSpeed(qreal))); - - disable(); - } +void InspectorUi::connectSignals() +{ + connect(m_propertyInspector, SIGNAL(changePropertyValue(int,QString,QString)), + this, SLOT(changePropertyValue(int,QString,QString))); + + connect(m_clientProxy, SIGNAL(propertyChanged(int,QByteArray,QVariant)), + m_propertyInspector, SLOT(propertyValueChanged(int,QByteArray,QVariant))); + + connect(m_clientProxy, SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)), + this, SLOT(selectItems(QList<QDeclarativeDebugObjectReference>))); + connect(m_clientProxy, SIGNAL(enginesChanged()), + this, SLOT(updateEngineList())); + connect(m_clientProxy, SIGNAL(serverReloaded()), + this, SLOT(serverReloaded())); + connect(m_clientProxy, SIGNAL(objectTreeUpdated()), + this, SLOT(objectTreeReady())); + connect(m_clientProxy, SIGNAL(connected()), + this, SLOT(enable())); + connect(m_clientProxy, SIGNAL(disconnected()), + this, SLOT(disable())); + + connect(m_clientProxy, SIGNAL(colorPickerActivated()), + m_toolBar, SLOT(activateColorPicker())); + connect(m_clientProxy, SIGNAL(selectToolActivated()), + m_toolBar, SLOT(activateSelectTool())); + connect(m_clientProxy, SIGNAL(zoomToolActivated()), + m_toolBar, SLOT(activateZoomTool())); + connect(m_clientProxy, SIGNAL(designModeBehaviorChanged(bool)), + m_toolBar, SLOT(setDesignModeBehavior(bool))); + connect(m_clientProxy, SIGNAL(showAppOnTopChanged(bool)), + m_toolBar, SLOT(setShowAppOnTop(bool))); + connect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)), + m_toolBar, SLOT(setSelectedColor(QColor))); + connect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)), + m_toolBar, SLOT(setAnimationSpeed(qreal))); + + connect(m_toolBar, SIGNAL(applyChangesFromQmlFileTriggered(bool)), + this, SLOT(setApplyChangesToQmlObserver(bool))); + + connect(m_toolBar, SIGNAL(designModeSelected(bool)), + m_clientProxy, SLOT(setDesignModeBehavior(bool))); + connect(m_toolBar, SIGNAL(reloadSelected()), + m_clientProxy, SLOT(reloadQmlViewer())); + connect(m_toolBar, SIGNAL(animationSpeedChanged(qreal)), + m_clientProxy, SLOT(setAnimationSpeed(qreal))); + connect(m_toolBar, SIGNAL(colorPickerSelected()), + m_clientProxy, SLOT(changeToColorPickerTool())); + connect(m_toolBar, SIGNAL(zoomToolSelected()), + m_clientProxy, SLOT(changeToZoomTool())); + connect(m_toolBar, SIGNAL(selectToolSelected()), + m_clientProxy, SLOT(changeToSelectTool())); + connect(m_toolBar, SIGNAL(showAppOnTopSelected(bool)), + m_clientProxy, SLOT(showAppOnTop(bool))); + + connect(m_toolBar, SIGNAL(filterTextChanged(QString)), + m_propertyInspector, SLOT(filterBy(QString))); +} + +void InspectorUi::disconnectSignals() +{ + m_propertyInspector->disconnect(this); + + m_clientProxy->disconnect(m_propertyInspector); + m_clientProxy->disconnect(this); + m_clientProxy->disconnect(m_toolBar); + + m_toolBar->disconnect(this); + m_toolBar->disconnect(m_clientProxy); + m_toolBar->disconnect(m_propertyInspector); } diff --git a/src/plugins/qmljsinspector/qmljsinspector.h b/src/plugins/qmljsinspector/qmljsinspector.h index c890ce5371..d38879b35d 100644 --- a/src/plugins/qmljsinspector/qmljsinspector.h +++ b/src/plugins/qmljsinspector/qmljsinspector.h @@ -66,7 +66,7 @@ namespace QmlJS { namespace QmlJSInspector { namespace Internal { -class QmlInspectorToolbar; +class QmlInspectorToolBar; class QmlJSPropertyInspector; class ClientProxy; class InspectorSettings; @@ -83,7 +83,7 @@ public: CppProjectWithQmlEngines, QmlProjectWithCppPlugins }; -public: + InspectorUi(QObject *parent = 0); virtual ~InspectorUi(); @@ -128,7 +128,6 @@ private slots: void updateEngineList(); - void removePreviewForEditor(Core::IEditor *newEditor); QmlJSLiveTextPreview *createPreviewForEditor(Core::IEditor *newEditor); @@ -146,16 +145,18 @@ private: void initializeDocuments(); void applyChangesToQmlObserverHelper(bool applyChanges); - void setupToolbar(bool doConnect); void setupDockWidgets(); QString filenameForShadowBuildFile(const QString &filename) const; void populateCrumblePath(const QDeclarativeDebugObjectReference &objRef); bool isRoot(const QDeclarativeDebugObjectReference &obj) const; QDeclarativeDebugObjectReference objectReferenceForLocation(const QString &fileName, int cursorPosition=-1) const; + void connectSignals(); + void disconnectSignals(); + private: bool m_listeningToEditorManager; - QmlInspectorToolbar *m_toolbar; + QmlInspectorToolBar *m_toolBar; ContextCrumblePath *m_crumblePath; QmlJSPropertyInspector *m_propertyInspector; diff --git a/src/plugins/qmljsinspector/qmljsobserverclient.h b/src/plugins/qmljsinspector/qmljsobserverclient.h index 65bea21a71..4d6c9d6e99 100644 --- a/src/plugins/qmljsinspector/qmljsobserverclient.h +++ b/src/plugins/qmljsinspector/qmljsobserverclient.h @@ -98,8 +98,8 @@ signals: void logActivity(QString client, QString message); protected: - virtual void statusChanged(Status); - virtual void messageReceived(const QByteArray &); + void statusChanged(Status); + void messageReceived(const QByteArray &); private: enum LogDirection { |