forked from qt-creator/qt-creator
QmlJSInspector: Cosmetics
* Renamed Toolbar to ToolBar * Use mass-disconnect instead of duplicating all connect calls * Split up setupToolbar(bool)
This commit is contained in:
@@ -61,7 +61,7 @@ static QToolButton *createToolButton(QAction *action)
|
|||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
QmlInspectorToolbar::QmlInspectorToolbar(QObject *parent) :
|
QmlInspectorToolBar::QmlInspectorToolBar(QObject *parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_fromQmlAction(0),
|
m_fromQmlAction(0),
|
||||||
m_observerModeAction(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_fromQmlAction->setEnabled(value);
|
||||||
m_showAppOnTopAction->setEnabled(value);
|
m_showAppOnTopAction->setEnabled(value);
|
||||||
@@ -102,7 +102,7 @@ void QmlInspectorToolbar::setEnabled(bool value)
|
|||||||
m_filterExp->setEnabled(value);
|
m_filterExp->setEnabled(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::enable()
|
void QmlInspectorToolBar::enable()
|
||||||
{
|
{
|
||||||
setEnabled(true);
|
setEnabled(true);
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
@@ -112,35 +112,35 @@ void QmlInspectorToolbar::enable()
|
|||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::disable()
|
void QmlInspectorToolBar::disable()
|
||||||
{
|
{
|
||||||
setAnimationSpeed(1.0f);
|
setAnimationSpeed(1.0f);
|
||||||
activateSelectTool();
|
activateSelectTool();
|
||||||
setEnabled(false);
|
setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateColorPicker()
|
void QmlInspectorToolBar::activateColorPicker()
|
||||||
{
|
{
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
activateColorPickerOnClick();
|
activateColorPickerOnClick();
|
||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateSelectTool()
|
void QmlInspectorToolBar::activateSelectTool()
|
||||||
{
|
{
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
activateSelectToolOnClick();
|
activateSelectToolOnClick();
|
||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateZoomTool()
|
void QmlInspectorToolBar::activateZoomTool()
|
||||||
{
|
{
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
activateZoomOnClick();
|
activateZoomOnClick();
|
||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::setAnimationSpeed(qreal slowdownFactor)
|
void QmlInspectorToolBar::setAnimationSpeed(qreal slowdownFactor)
|
||||||
{
|
{
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
if (slowdownFactor != 0) {
|
if (slowdownFactor != 0) {
|
||||||
@@ -166,7 +166,7 @@ void QmlInspectorToolbar::setAnimationSpeed(qreal slowdownFactor)
|
|||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::setDesignModeBehavior(bool inDesignMode)
|
void QmlInspectorToolBar::setDesignModeBehavior(bool inDesignMode)
|
||||||
{
|
{
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
m_observerModeAction->setChecked(inDesignMode);
|
m_observerModeAction->setChecked(inDesignMode);
|
||||||
@@ -174,14 +174,14 @@ void QmlInspectorToolbar::setDesignModeBehavior(bool inDesignMode)
|
|||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::setShowAppOnTop(bool showAppOnTop)
|
void QmlInspectorToolBar::setShowAppOnTop(bool showAppOnTop)
|
||||||
{
|
{
|
||||||
m_emitSignals = false;
|
m_emitSignals = false;
|
||||||
m_showAppOnTopAction->setChecked(showAppOnTop);
|
m_showAppOnTopAction->setChecked(showAppOnTop);
|
||||||
m_emitSignals = true;
|
m_emitSignals = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::createActions(const Core::Context &context)
|
void QmlInspectorToolBar::createActions(const Core::Context &context)
|
||||||
{
|
{
|
||||||
Core::ICore *core = Core::ICore::instance();
|
Core::ICore *core = Core::ICore::instance();
|
||||||
Core::ActionManager *am = core->actionManager();
|
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)));
|
connect(m_filterExp, SIGNAL(textChanged(QString)), SIGNAL(filterTextChanged(QString)));
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QmlInspectorToolbar::widget() const
|
QWidget *QmlInspectorToolBar::widget() const
|
||||||
{
|
{
|
||||||
return m_barWidget;
|
return m_barWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::changeToDefaultAnimSpeed()
|
void QmlInspectorToolBar::changeToDefaultAnimSpeed()
|
||||||
{
|
{
|
||||||
m_animationSpeed = 1.0f;
|
m_animationSpeed = 1.0f;
|
||||||
updatePlayAction();
|
updatePlayAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::changeToHalfAnimSpeed()
|
void QmlInspectorToolBar::changeToHalfAnimSpeed()
|
||||||
{
|
{
|
||||||
m_animationSpeed = 2.0f;
|
m_animationSpeed = 2.0f;
|
||||||
updatePlayAction();
|
updatePlayAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::changeToFourthAnimSpeed()
|
void QmlInspectorToolBar::changeToFourthAnimSpeed()
|
||||||
{
|
{
|
||||||
m_animationSpeed = 4.0f;
|
m_animationSpeed = 4.0f;
|
||||||
updatePlayAction();
|
updatePlayAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::changeToEighthAnimSpeed()
|
void QmlInspectorToolBar::changeToEighthAnimSpeed()
|
||||||
{
|
{
|
||||||
m_animationSpeed = 8.0f;
|
m_animationSpeed = 8.0f;
|
||||||
updatePlayAction();
|
updatePlayAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::changeToTenthAnimSpeed()
|
void QmlInspectorToolBar::changeToTenthAnimSpeed()
|
||||||
{
|
{
|
||||||
m_animationSpeed = 10.0f;
|
m_animationSpeed = 10.0f;
|
||||||
updatePlayAction();
|
updatePlayAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateDesignModeOnClick()
|
void QmlInspectorToolBar::activateDesignModeOnClick()
|
||||||
{
|
{
|
||||||
bool checked = m_observerModeAction->isChecked();
|
bool checked = m_observerModeAction->isChecked();
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ void QmlInspectorToolbar::activateDesignModeOnClick()
|
|||||||
emit designModeSelected(checked);
|
emit designModeSelected(checked);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activatePlayOnClick()
|
void QmlInspectorToolBar::activatePlayOnClick()
|
||||||
{
|
{
|
||||||
if (m_isRunning) {
|
if (m_isRunning) {
|
||||||
updatePauseAction();
|
updatePauseAction();
|
||||||
@@ -373,7 +373,7 @@ void QmlInspectorToolbar::activatePlayOnClick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::updatePlayAction()
|
void QmlInspectorToolBar::updatePlayAction()
|
||||||
{
|
{
|
||||||
m_isRunning = true;
|
m_isRunning = true;
|
||||||
m_playAction->setIcon(m_pauseIcon);
|
m_playAction->setIcon(m_pauseIcon);
|
||||||
@@ -386,7 +386,7 @@ void QmlInspectorToolbar::updatePlayAction()
|
|||||||
m_playButton->setDefaultAction(m_playAction);
|
m_playButton->setDefaultAction(m_playAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::updatePauseAction()
|
void QmlInspectorToolBar::updatePauseAction()
|
||||||
{
|
{
|
||||||
m_isRunning = false;
|
m_isRunning = false;
|
||||||
m_playAction->setIcon(m_playIcon);
|
m_playAction->setIcon(m_playIcon);
|
||||||
@@ -396,7 +396,7 @@ void QmlInspectorToolbar::updatePauseAction()
|
|||||||
m_playButton->setDefaultAction(m_playAction);
|
m_playButton->setDefaultAction(m_playAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateColorPickerOnClick()
|
void QmlInspectorToolBar::activateColorPickerOnClick()
|
||||||
{
|
{
|
||||||
m_zoomAction->setChecked(false);
|
m_zoomAction->setChecked(false);
|
||||||
m_selectAction->setChecked(false);
|
m_selectAction->setChecked(false);
|
||||||
@@ -409,7 +409,7 @@ void QmlInspectorToolbar::activateColorPickerOnClick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateSelectToolOnClick()
|
void QmlInspectorToolBar::activateSelectToolOnClick()
|
||||||
{
|
{
|
||||||
m_zoomAction->setChecked(false);
|
m_zoomAction->setChecked(false);
|
||||||
m_colorPickerAction->setChecked(false);
|
m_colorPickerAction->setChecked(false);
|
||||||
@@ -422,7 +422,7 @@ void QmlInspectorToolbar::activateSelectToolOnClick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateZoomOnClick()
|
void QmlInspectorToolBar::activateZoomOnClick()
|
||||||
{
|
{
|
||||||
m_selectAction->setChecked(false);
|
m_selectAction->setChecked(false);
|
||||||
m_colorPickerAction->setChecked(false);
|
m_colorPickerAction->setChecked(false);
|
||||||
@@ -435,18 +435,18 @@ void QmlInspectorToolbar::activateZoomOnClick()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::showAppOnTopClick()
|
void QmlInspectorToolBar::showAppOnTopClick()
|
||||||
{
|
{
|
||||||
if (m_emitSignals)
|
if (m_emitSignals)
|
||||||
emit showAppOnTopSelected(m_showAppOnTopAction->isChecked());
|
emit showAppOnTopSelected(m_showAppOnTopAction->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::setSelectedColor(const QColor &color)
|
void QmlInspectorToolBar::setSelectedColor(const QColor &color)
|
||||||
{
|
{
|
||||||
m_colorBox->setColor(color);
|
m_colorBox->setColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmlInspectorToolbar::activateFromQml()
|
void QmlInspectorToolBar::activateFromQml()
|
||||||
{
|
{
|
||||||
if (m_emitSignals)
|
if (m_emitSignals)
|
||||||
emit applyChangesFromQmlFileTriggered(m_fromQmlAction->isChecked());
|
emit applyChangesFromQmlFileTriggered(m_fromQmlAction->isChecked());
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class ToolBarColorBox;
|
|||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlInspectorToolbar : public QObject
|
class QmlInspectorToolBar : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
ZoomMode = 6
|
ZoomMode = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit QmlInspectorToolbar(QObject *parent = 0);
|
explicit QmlInspectorToolBar(QObject *parent = 0);
|
||||||
void createActions(const Core::Context &context);
|
void createActions(const Core::Context &context);
|
||||||
QWidget *widget() const;
|
QWidget *widget() const;
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
QDeclarativeDebugObjectReference objectReferenceForId(const QString &objectId) const;
|
QDeclarativeDebugObjectReference objectReferenceForId(const QString &objectId) const;
|
||||||
QDeclarativeDebugObjectReference objectReferenceForLocation(const int line, const int column) const;
|
QDeclarativeDebugObjectReference objectReferenceForLocation(const int line, const int column) const;
|
||||||
QList<QDeclarativeDebugObjectReference> rootObjectReference() const;
|
QList<QDeclarativeDebugObjectReference> rootObjectReference() const;
|
||||||
DebugIdHash debugIdHash() const { return m_debugIdHash; };
|
DebugIdHash debugIdHash() const { return m_debugIdHash; }
|
||||||
|
|
||||||
bool isConnected() const;
|
bool isConnected() const;
|
||||||
|
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ QmlJS::ModelManagerInterface *modelManager()
|
|||||||
InspectorUi::InspectorUi(QObject *parent)
|
InspectorUi::InspectorUi(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_listeningToEditorManager(false)
|
, m_listeningToEditorManager(false)
|
||||||
, m_toolbar(0)
|
, m_toolBar(0)
|
||||||
, m_crumblePath(0)
|
, m_crumblePath(0)
|
||||||
, m_propertyInspector(0)
|
, m_propertyInspector(0)
|
||||||
, m_settings(new InspectorSettings(this))
|
, m_settings(new InspectorSettings(this))
|
||||||
@@ -135,7 +135,7 @@ InspectorUi::InspectorUi(QObject *parent)
|
|||||||
, m_selectionCallbackExpected(false)
|
, m_selectionCallbackExpected(false)
|
||||||
{
|
{
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
m_toolbar = new QmlInspectorToolbar(this);
|
m_toolBar = new QmlInspectorToolBar(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
InspectorUi::~InspectorUi()
|
InspectorUi::~InspectorUi()
|
||||||
@@ -161,15 +161,13 @@ void InspectorUi::restoreSettings()
|
|||||||
void InspectorUi::setDebuggerEngine(QObject *qmlEngine)
|
void InspectorUi::setDebuggerEngine(QObject *qmlEngine)
|
||||||
{
|
{
|
||||||
if (m_qmlEngine && !qmlEngine) {
|
if (m_qmlEngine && !qmlEngine) {
|
||||||
disconnect(m_qmlEngine,
|
disconnect(m_qmlEngine, SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)),
|
||||||
SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)),
|
|
||||||
this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int)));
|
this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
m_qmlEngine = qmlEngine;
|
m_qmlEngine = qmlEngine;
|
||||||
if (m_qmlEngine) {
|
if (m_qmlEngine) {
|
||||||
connect(m_qmlEngine,
|
connect(m_qmlEngine, SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)),
|
||||||
SIGNAL(tooltipRequested(QPoint,TextEditor::ITextEditor*,int)),
|
|
||||||
this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int)));
|
this, SLOT(showDebuggerTooltip(QPoint,TextEditor::ITextEditor*,int)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -288,17 +286,6 @@ void InspectorUi::connected(ClientProxy *clientProxy)
|
|||||||
it.value()->resetInitialDoc(doc);
|
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();
|
m_debugProject = ProjectExplorer::ProjectExplorerPlugin::instance()->startupProject();
|
||||||
if (m_debugProject->activeTarget()
|
if (m_debugProject->activeTarget()
|
||||||
&& m_debugProject->activeTarget()->activeBuildConfiguration())
|
&& m_debugProject->activeTarget()->activeBuildConfiguration())
|
||||||
@@ -311,7 +298,8 @@ void InspectorUi::connected(ClientProxy *clientProxy)
|
|||||||
connect(m_debugProject, SIGNAL(destroyed()), SLOT(currentDebugProjectRemoved()));
|
connect(m_debugProject, SIGNAL(destroyed()), SLOT(currentDebugProjectRemoved()));
|
||||||
m_projectFinder.setProjectDirectory(m_debugProject->projectDirectory());
|
m_projectFinder.setProjectDirectory(m_debugProject->projectDirectory());
|
||||||
|
|
||||||
setupToolbar(true);
|
connectSignals();
|
||||||
|
enable();
|
||||||
resetViews();
|
resetViews();
|
||||||
|
|
||||||
initializeDocuments();
|
initializeDocuments();
|
||||||
@@ -322,35 +310,17 @@ void InspectorUi::connected(ClientProxy *clientProxy)
|
|||||||
iter.value()->setClientProxy(m_clientProxy);
|
iter.value()->setClientProxy(m_clientProxy);
|
||||||
iter.value()->updateDebugIds();
|
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()
|
void InspectorUi::disconnected()
|
||||||
{
|
{
|
||||||
disconnect(m_clientProxy, SIGNAL(selectedItemsChanged(QList<QDeclarativeDebugObjectReference>)),
|
disconnectSignals();
|
||||||
this, SLOT(selectItems(QList<QDeclarativeDebugObjectReference>)));
|
disable();
|
||||||
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)));
|
|
||||||
|
|
||||||
m_debugProject = 0;
|
m_debugProject = 0;
|
||||||
m_qmlEngine = 0;
|
m_qmlEngine = 0;
|
||||||
resetViews();
|
resetViews();
|
||||||
|
|
||||||
setupToolbar(false);
|
|
||||||
applyChangesToQmlObserverHelper(false);
|
applyChangesToQmlObserverHelper(false);
|
||||||
|
|
||||||
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
|
QHashIterator<QString, QmlJSLiveTextPreview *> iter(m_textPreviews);
|
||||||
@@ -363,6 +333,16 @@ void InspectorUi::disconnected()
|
|||||||
m_pendingPreviewDocumentNames.clear();
|
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()
|
void InspectorUi::updateEngineList()
|
||||||
{
|
{
|
||||||
QList<QDeclarativeDebugEngineReference> engines = m_clientProxy->engines();
|
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)
|
void InspectorUi::changePropertyValue(int debugId,const QString &propertyName, const QString &valueExpression)
|
||||||
{
|
{
|
||||||
QString query = propertyName + '=' + valueExpression;
|
QString query = propertyName + '=' + valueExpression;
|
||||||
m_clientProxy->queryExpressionResult(debugId,query, this);
|
m_clientProxy->queryExpressionResult(debugId, query, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::enable()
|
void InspectorUi::enable()
|
||||||
{
|
{
|
||||||
m_toolbar->enable();
|
m_toolBar->enable();
|
||||||
m_crumblePath->setEnabled(true);
|
m_crumblePath->setEnabled(true);
|
||||||
m_propertyInspector->setEnabled(true);
|
m_propertyInspector->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::disable()
|
void InspectorUi::disable()
|
||||||
{
|
{
|
||||||
m_toolbar->disable();
|
m_toolBar->disable();
|
||||||
m_crumblePath->setEnabled(false);
|
m_crumblePath->setEnabled(false);
|
||||||
m_propertyInspector->setEnabled(false);
|
m_propertyInspector->setEnabled(false);
|
||||||
}
|
}
|
||||||
@@ -711,8 +691,8 @@ bool InspectorUi::addQuotesForData(const QVariant &value) const
|
|||||||
|
|
||||||
void InspectorUi::setupDockWidgets()
|
void InspectorUi::setupDockWidgets()
|
||||||
{
|
{
|
||||||
m_toolbar->createActions(Core::Context(Debugger::Constants::C_QMLDEBUGGER));
|
m_toolBar->createActions(Core::Context(Debugger::Constants::C_QMLDEBUGGER));
|
||||||
m_toolbar->setObjectName("QmlInspectorToolbar");
|
m_toolBar->setObjectName("QmlInspectorToolbar");
|
||||||
|
|
||||||
m_crumblePath = new ContextCrumblePath;
|
m_crumblePath = new ContextCrumblePath;
|
||||||
m_crumblePath->setObjectName("QmlContextPath");
|
m_crumblePath->setObjectName("QmlContextPath");
|
||||||
@@ -729,7 +709,7 @@ void InspectorUi::setupDockWidgets()
|
|||||||
wlay->setMargin(0);
|
wlay->setMargin(0);
|
||||||
wlay->setSpacing(0);
|
wlay->setSpacing(0);
|
||||||
observerWidget->setLayout(wlay);
|
observerWidget->setLayout(wlay);
|
||||||
wlay->addWidget(m_toolbar->widget());
|
wlay->addWidget(m_toolBar->widget());
|
||||||
wlay->addWidget(m_propertyInspector);
|
wlay->addWidget(m_propertyInspector);
|
||||||
wlay->addWidget(m_crumblePath);
|
wlay->addWidget(m_crumblePath);
|
||||||
|
|
||||||
@@ -814,9 +794,8 @@ void InspectorUi::updatePendingPreviewDocuments(QmlJS::Document::Ptr doc)
|
|||||||
QmlJSLiveTextPreview *preview = createPreviewForEditor(editors.first());
|
QmlJSLiveTextPreview *preview = createPreviewForEditor(editors.first());
|
||||||
editors.removeFirst();
|
editors.removeFirst();
|
||||||
|
|
||||||
foreach (Core::IEditor *editor, editors) {
|
foreach (Core::IEditor *editor, editors)
|
||||||
preview->associateEditor(editor);
|
preview->associateEditor(editor);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::disableLivePreview()
|
void InspectorUi::disableLivePreview()
|
||||||
@@ -824,87 +803,73 @@ void InspectorUi::disableLivePreview()
|
|||||||
setApplyChangesToQmlObserver(false);
|
setApplyChangesToQmlObserver(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InspectorUi::setupToolbar(bool doConnect)
|
void InspectorUi::connectSignals()
|
||||||
{
|
{
|
||||||
if (doConnect) {
|
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()),
|
connect(m_clientProxy, SIGNAL(connected()),
|
||||||
this, SLOT(enable()));
|
this, SLOT(enable()));
|
||||||
connect(m_clientProxy, SIGNAL(disconnected()),
|
connect(m_clientProxy, SIGNAL(disconnected()),
|
||||||
this, SLOT(disable()));
|
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()),
|
connect(m_clientProxy, SIGNAL(colorPickerActivated()),
|
||||||
m_toolbar, SLOT(activateColorPicker()));
|
m_toolBar, SLOT(activateColorPicker()));
|
||||||
connect(m_clientProxy, SIGNAL(selectToolActivated()),
|
connect(m_clientProxy, SIGNAL(selectToolActivated()),
|
||||||
m_toolbar, SLOT(activateSelectTool()));
|
m_toolBar, SLOT(activateSelectTool()));
|
||||||
connect(m_clientProxy, SIGNAL(zoomToolActivated()),
|
connect(m_clientProxy, SIGNAL(zoomToolActivated()),
|
||||||
m_toolbar, SLOT(activateZoomTool()));
|
m_toolBar, SLOT(activateZoomTool()));
|
||||||
connect(m_clientProxy, SIGNAL(designModeBehaviorChanged(bool)),
|
connect(m_clientProxy, SIGNAL(designModeBehaviorChanged(bool)),
|
||||||
m_toolbar, SLOT(setDesignModeBehavior(bool)));
|
m_toolBar, SLOT(setDesignModeBehavior(bool)));
|
||||||
connect(m_clientProxy, SIGNAL(showAppOnTopChanged(bool)),
|
connect(m_clientProxy, SIGNAL(showAppOnTopChanged(bool)),
|
||||||
m_toolbar, SLOT(setShowAppOnTop(bool)));
|
m_toolBar, SLOT(setShowAppOnTop(bool)));
|
||||||
connect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)),
|
connect(m_clientProxy, SIGNAL(selectedColorChanged(QColor)),
|
||||||
m_toolbar, SLOT(setSelectedColor(QColor)));
|
m_toolBar, SLOT(setSelectedColor(QColor)));
|
||||||
|
|
||||||
connect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)),
|
connect(m_clientProxy, SIGNAL(animationSpeedChanged(qreal)),
|
||||||
m_toolbar, SLOT(setAnimationSpeed(qreal)));
|
m_toolBar, SLOT(setAnimationSpeed(qreal)));
|
||||||
|
|
||||||
enable();
|
connect(m_toolBar, SIGNAL(applyChangesFromQmlFileTriggered(bool)),
|
||||||
} 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)));
|
this, SLOT(setApplyChangesToQmlObserver(bool)));
|
||||||
disconnect(m_toolbar, SIGNAL(showAppOnTopSelected(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)));
|
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)),
|
connect(m_toolBar, SIGNAL(filterTextChanged(QString)),
|
||||||
m_toolbar, SLOT(setAnimationSpeed(qreal)));
|
m_propertyInspector, SLOT(filterBy(QString)));
|
||||||
|
}
|
||||||
disable();
|
|
||||||
}
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace QmlJS {
|
|||||||
namespace QmlJSInspector {
|
namespace QmlJSInspector {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class QmlInspectorToolbar;
|
class QmlInspectorToolBar;
|
||||||
class QmlJSPropertyInspector;
|
class QmlJSPropertyInspector;
|
||||||
class ClientProxy;
|
class ClientProxy;
|
||||||
class InspectorSettings;
|
class InspectorSettings;
|
||||||
@@ -83,7 +83,7 @@ public:
|
|||||||
CppProjectWithQmlEngines,
|
CppProjectWithQmlEngines,
|
||||||
QmlProjectWithCppPlugins
|
QmlProjectWithCppPlugins
|
||||||
};
|
};
|
||||||
public:
|
|
||||||
InspectorUi(QObject *parent = 0);
|
InspectorUi(QObject *parent = 0);
|
||||||
virtual ~InspectorUi();
|
virtual ~InspectorUi();
|
||||||
|
|
||||||
@@ -128,7 +128,6 @@ private slots:
|
|||||||
|
|
||||||
void updateEngineList();
|
void updateEngineList();
|
||||||
|
|
||||||
|
|
||||||
void removePreviewForEditor(Core::IEditor *newEditor);
|
void removePreviewForEditor(Core::IEditor *newEditor);
|
||||||
QmlJSLiveTextPreview *createPreviewForEditor(Core::IEditor *newEditor);
|
QmlJSLiveTextPreview *createPreviewForEditor(Core::IEditor *newEditor);
|
||||||
|
|
||||||
@@ -146,16 +145,18 @@ private:
|
|||||||
|
|
||||||
void initializeDocuments();
|
void initializeDocuments();
|
||||||
void applyChangesToQmlObserverHelper(bool applyChanges);
|
void applyChangesToQmlObserverHelper(bool applyChanges);
|
||||||
void setupToolbar(bool doConnect);
|
|
||||||
void setupDockWidgets();
|
void setupDockWidgets();
|
||||||
QString filenameForShadowBuildFile(const QString &filename) const;
|
QString filenameForShadowBuildFile(const QString &filename) const;
|
||||||
void populateCrumblePath(const QDeclarativeDebugObjectReference &objRef);
|
void populateCrumblePath(const QDeclarativeDebugObjectReference &objRef);
|
||||||
bool isRoot(const QDeclarativeDebugObjectReference &obj) const;
|
bool isRoot(const QDeclarativeDebugObjectReference &obj) const;
|
||||||
QDeclarativeDebugObjectReference objectReferenceForLocation(const QString &fileName, int cursorPosition=-1) const;
|
QDeclarativeDebugObjectReference objectReferenceForLocation(const QString &fileName, int cursorPosition=-1) const;
|
||||||
|
|
||||||
|
void connectSignals();
|
||||||
|
void disconnectSignals();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_listeningToEditorManager;
|
bool m_listeningToEditorManager;
|
||||||
QmlInspectorToolbar *m_toolbar;
|
QmlInspectorToolBar *m_toolBar;
|
||||||
ContextCrumblePath *m_crumblePath;
|
ContextCrumblePath *m_crumblePath;
|
||||||
QmlJSPropertyInspector *m_propertyInspector;
|
QmlJSPropertyInspector *m_propertyInspector;
|
||||||
|
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ signals:
|
|||||||
void logActivity(QString client, QString message);
|
void logActivity(QString client, QString message);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void statusChanged(Status);
|
void statusChanged(Status);
|
||||||
virtual void messageReceived(const QByteArray &);
|
void messageReceived(const QByteArray &);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum LogDirection {
|
enum LogDirection {
|
||||||
|
|||||||
Reference in New Issue
Block a user