diff --git a/src/plugins/qmldesigner/components/debugview/debugview.cpp b/src/plugins/qmldesigner/components/debugview/debugview.cpp new file mode 100644 index 00000000000..6e5e377f3e5 --- /dev/null +++ b/src/plugins/qmldesigner/components/debugview/debugview.cpp @@ -0,0 +1,378 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "debugview.h" +#include "debugviewwidget.h" + +#include +#include + +#include +#include +#include + +namespace { +const QLatin1String lineBreak = QLatin1String("
"); + +bool isDebugViewEnabled() +{ + return (QmlDesigner::QmlDesignerPlugin::instance()->settings().enableDebugView); +} + +bool isDebugViewShown() +{ + return (QmlDesigner::QmlDesignerPlugin::instance()->settings().showDebugView); +} + +} + +namespace QmlDesigner { + +namespace Internal { + +DebugView::DebugView(QObject *parent) : QmlModelView(parent), + m_debugViewWidget(new DebugViewWidget) +{ +} + +DebugView::~DebugView() +{ +} + +void DebugView::modelAttached(Model *model) +{ + log(tr("Model attached"), tr("FileName %1").arg(model->fileUrl().toLocalFile())); + m_debugViewWidget->setDebugViewEnabled(isDebugViewEnabled()); + qDebug() << "enabled: " << isDebugViewEnabled(); + QmlModelView::modelAttached(model); +} + +void DebugView::modelAboutToBeDetached(Model *model) +{ + log(tr("Model detached"), tr("FileName %1").arg(model->fileUrl().toLocalFile())); + QmlModelView::modelAboutToBeDetached(model); +} + +void DebugView::importsChanged(const QList &addedImports, const QList &removedImports) +{ + if (isDebugViewEnabled()) { + QString message; + message += tr("Added imports:") += lineBreak; + foreach (const Import &import, addedImports) { + message += import.toString() += lineBreak; + } + + message += tr("Removed imports:") += lineBreak; + foreach (const Import &import, removedImports) { + message += import.toString() += lineBreak; + } + + log(tr("Imports changed:"), message); + } +} + +void DebugView::nodeCreated(const ModelNode &createdNode) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + message << createdNode; + log(tr("Node created:"), message.readAll()); + } +} + +void DebugView::nodeAboutToBeRemoved(const ModelNode &removedNode) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + message << removedNode; + log(tr("Node removed:"), message.readAll()); + } +} + +void DebugView::nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, + const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + message << node; + message << tr("New parent property:"); + message << lineBreak; + message << newPropertyParent; + message << tr("Old parent property:"); + message << lineBreak; + message << oldPropertyParent; + message << tr("PropertyChangeFlag"); + message << lineBreak; + message << propertyChange; + log(tr("Node reparanted:"), message.readAll()); + } +} + +void DebugView::nodeIdChanged(const ModelNode &node, const QString &newId, const QString &oldId) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + message << node; + message << tr("New Id: ") << newId << lineBreak; + message << tr("Old Id: ") << oldId << lineBreak; + log(tr("Node id changed:"), string); + } +} + +void DebugView::propertiesAboutToBeRemoved(const QList & /*propertyList*/) +{ +} + +void DebugView::variantPropertiesChanged(const QList &propertyList, + AbstractView::PropertyChangeFlags /*propertyChange*/) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + foreach (const VariantProperty &property, propertyList) { + message << property; + } + log(tr("VariantProperties changed:"), string); + } +} + +void DebugView::bindingPropertiesChanged(const QList &propertyList, + AbstractView::PropertyChangeFlags /*propertyChange*/) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + foreach (const BindingProperty &property, propertyList) { + message << property; + } + log(tr("BindingProperties changed:"), string); + } +} + +void DebugView::rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) +{ + if (isDebugViewEnabled()) { + QString message; + message += type; + message += QLatin1String(" "); + message += QString::number(majorVersion); + message += QLatin1String(" "); + message += QString::number(minorVersion); + log(tr("Node id changed:"), message); + } +} + +void DebugView::selectedNodesChanged(const QList & /*selectedNodeList*/, + const QList & /*lastSelectedNodeList*/) +{ +} + +void DebugView::scriptFunctionsChanged(const ModelNode & /*node*/, const QStringList & /*scriptFunctionList*/) +{ +} + +void DebugView::propertiesRemoved(const QList &propertyList) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + foreach (const AbstractProperty &property, propertyList) { + message << property; + } + log(tr("Properties removed:"), string); + } +} + +QWidget *DebugView::widget() +{ + return 0; +} + +void DebugView::auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + + message << node; + message << name; + message << data.toString(); + + log(tr("Auxiliary Data Changed:"), string); + } +} + +void DebugView::rewriterBeginTransaction() +{ + if (isDebugViewEnabled()) + log(tr("Begin rewriter transaction"), QString(), true); +} + +void DebugView::rewriterEndTransaction() +{ + if (isDebugViewEnabled()) + log(tr("End rewriter transaction"), QString(), true); +} + +WidgetInfo DebugView::widgetInfo() +{ + return createWidgetInfo(m_debugViewWidget.data(), "DebugView", WidgetInfo::LeftPane, 0, tr("Debug View")); +} + +bool DebugView::hasWidget() const +{ + if (isDebugViewShown()) + return true; + + return false; +} + +void DebugView::instancePropertyChange(const QList > &propertyList) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + + typedef QPair Pair; + + foreach (const Pair &pair, propertyList) { + message << pair.first; + message << lineBreak; + message << pair.second; + } + + logInstance(tr("Instance property change"), string); + } +} + +void DebugView::instancesCompleted(const QVector &completedNodeList) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + + foreach (const ModelNode &modelNode, completedNodeList) { + message << modelNode; + } + + logInstance(tr("Instance Completed"), string); + } +} + +void DebugView::instanceInformationsChange(const QMultiHash &informationChangeHash) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + + foreach (const ModelNode &modelNode, informationChangeHash.keys()) { + message << modelNode; + message << informationChangeHash.value(modelNode); + } + + logInstance(tr("Instance Completed"), string); + } + +} + +void DebugView::instancesRenderImageChanged(const QVector & /*nodeList*/) +{ +} + +void DebugView::instancesPreviewImageChanged(const QVector & /*nodeList*/) +{ +} + +void DebugView::instancesChildrenChanged(const QVector & /*nodeList*/) +{ +} + +void DebugView::customNotification(const AbstractView *view, const QString &identifier, const QList &nodeList, const QList &data) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + + message << view; + message << identifier; + foreach (const ModelNode &node, nodeList) { + message << node; + } + + foreach (const QVariant &variant, data) { + message << variant.toString(); + } + + log(tr("Custom Notification:"), string); + } +} + +void DebugView::nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource) +{ + if (isDebugViewEnabled()) { + QTextStream message; + QString string; + message.setString(&string); + + message << modelNode; + message << newNodeSource; + + log(tr("Node Source Changed:"), string); + } +} + +void DebugView::log(const QString &title, const QString &message, bool highlight) +{ + m_debugViewWidget->addLogMessage(title, message, highlight); +} + +void DebugView::logInstance(const QString &title, const QString &message, bool highlight) +{ + m_debugViewWidget->addLogInstanceMessage(title, message, highlight); +} + +} // namesapce Internal + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/debugview/debugview.h b/src/plugins/qmldesigner/components/debugview/debugview.h new file mode 100644 index 00000000000..2783455f352 --- /dev/null +++ b/src/plugins/qmldesigner/components/debugview/debugview.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef DEBUGVIEW_H +#define DEBUGVIEW_H + +#include + +namespace QmlDesigner { + +namespace Internal { + +class DebugViewWidget; + +class DebugView : public QmlModelView +{ + Q_OBJECT + +public: + DebugView(QObject *parent = 0); + ~DebugView(); + + // AbstractView + void modelAttached(Model *model) QTC_OVERRIDE; + void modelAboutToBeDetached(Model *model) QTC_OVERRIDE; + + void importsChanged(const QList &addedImports, const QList &removedImports) QTC_OVERRIDE; + + void nodeCreated(const ModelNode &createdNode) QTC_OVERRIDE; + void nodeAboutToBeRemoved(const ModelNode &removedNode) QTC_OVERRIDE; + void nodeReparented(const ModelNode &node, const NodeAbstractProperty &newPropertyParent, + const NodeAbstractProperty &oldPropertyParent, AbstractView::PropertyChangeFlags propertyChange) QTC_OVERRIDE; + void nodeIdChanged(const ModelNode& node, const QString& newId, const QString& oldId) QTC_OVERRIDE; + void propertiesAboutToBeRemoved(const QList& propertyList) QTC_OVERRIDE; + void variantPropertiesChanged(const QList& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE; + void bindingPropertiesChanged(const QList& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE; + void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE; + + void selectedNodesChanged(const QList &selectedNodeList, + const QList &lastSelectedNodeList) QTC_OVERRIDE; + void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE; + void propertiesRemoved(const QList &propertyList) QTC_OVERRIDE; + + QWidget *widget() QTC_OVERRIDE; + + void auxiliaryDataChanged(const ModelNode &node, const PropertyName &name, const QVariant &data) QTC_OVERRIDE; + + void rewriterBeginTransaction() QTC_OVERRIDE; + void rewriterEndTransaction() QTC_OVERRIDE; + + WidgetInfo widgetInfo() QTC_OVERRIDE; + bool hasWidget() const QTC_OVERRIDE; + + void instancePropertyChange(const QList > &propertyList) QTC_OVERRIDE; + void instancesCompleted(const QVector &completedNodeList) QTC_OVERRIDE; + void instanceInformationsChange(const QMultiHash &informationChangeHash) QTC_OVERRIDE; + void instancesRenderImageChanged(const QVector &nodeList) QTC_OVERRIDE; + void instancesPreviewImageChanged(const QVector &nodeList) QTC_OVERRIDE; + void instancesChildrenChanged(const QVector &nodeList) QTC_OVERRIDE; + void customNotification(const AbstractView *view, const QString &identifier, const QList &nodeList, const QList &data) QTC_OVERRIDE; + + void nodeSourceChanged(const ModelNode &modelNode, const QString &newNodeSource) QTC_OVERRIDE; + +protected: + void log(const QString &title, const QString &message, bool highlight = false); + void logInstance(const QString &title, const QString &message, bool highlight = false); + +private: //variables + QWeakPointer m_debugViewWidget; +}; + +} // namespace Internal + +} // namespace QmlDesigner + +#endif DEBUGVIEW_H diff --git a/src/plugins/qmldesigner/components/debugview/debugview.pri b/src/plugins/qmldesigner/components/debugview/debugview.pri new file mode 100644 index 00000000000..59d2186abb9 --- /dev/null +++ b/src/plugins/qmldesigner/components/debugview/debugview.pri @@ -0,0 +1,12 @@ +VPATH += $$PWD +INCLUDEPATH += $$PWD +DEPENDPATH += $$PWD + +SOURCES += debugview.cpp \ + debugviewwidget.cpp + +HEADERS += debugview.h \ + debugviewwidget.h + +FORMS += debugviewwidget.ui + diff --git a/src/plugins/qmldesigner/components/debugview/debugviewwidget.cpp b/src/plugins/qmldesigner/components/debugview/debugviewwidget.cpp new file mode 100644 index 00000000000..9269ad20828 --- /dev/null +++ b/src/plugins/qmldesigner/components/debugview/debugviewwidget.cpp @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#include "debugviewwidget.h" + + +#include +#include + +namespace QmlDesigner { + +namespace Internal { + +DebugViewWidget::DebugViewWidget(QWidget *parent) : QWidget(parent) +{ + m_ui.setupUi(this); + connect(m_ui.enabledCheckBox, SIGNAL(toggled(bool)), this, SLOT(enabledCheckBoxToggled(bool))); +} + +void DebugViewWidget::addLogMessage(const QString &topic, const QString &message, bool highlight) +{ + if (highlight) { + m_ui.modelLog->appendHtml(QLatin1String("") + + topic + + QLatin1String("
") + + message); + + } else { + m_ui.modelLog->appendHtml(QLatin1String("") + + topic + + QLatin1String("
") + + message); + } +} + +void DebugViewWidget::addErrorMessage(const QString &topic, const QString &message) +{ + m_ui.instanceErrorLog->appendHtml(QLatin1String("") + + topic + + QLatin1String("
") + + message + ); +} + +void DebugViewWidget::addLogInstanceMessage(const QString &topic, const QString &message, bool highlight) +{ + if (highlight) { + m_ui.instanceLog->appendHtml(QLatin1String("") + + topic + + QLatin1String("
") + + message); + + } else { + m_ui.instanceLog->appendHtml(QLatin1String("") + + topic + + QLatin1String("
") + + message); + } +} + +void DebugViewWidget::setDebugViewEnabled(bool b) +{ + if (m_ui.enabledCheckBox->isChecked() != b) + m_ui.enabledCheckBox->setChecked(b); +} + +void DebugViewWidget::enabledCheckBoxToggled(bool b) +{ + DesignerSettings settings = QmlDesignerPlugin::instance()->settings(); + settings.warningsInDesigner = b; + QmlDesignerPlugin::instance()->setSettings(settings); +} + +} //namespace Internal + +} //namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/debugview/debugviewwidget.h b/src/plugins/qmldesigner/components/debugview/debugviewwidget.h new file mode 100644 index 00000000000..d1b8756240f --- /dev/null +++ b/src/plugins/qmldesigner/components/debugview/debugviewwidget.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef DEBUGVIEWWIDGET_H +#define DEBUGVIEWWIDGET_H + +#include + +#include "ui_debugviewwidget.h" + +namespace QmlDesigner { + +namespace Internal { + +class DebugViewWidget : public QWidget +{ + Q_OBJECT +public: + DebugViewWidget(QWidget *parent = 0); + + void addLogMessage(const QString &topic, const QString &message, bool highlight = false); + void addErrorMessage(const QString &topic, const QString &message); + void addLogInstanceMessage(const QString &topic, const QString &message, bool highlight = false); + + void setDebugViewEnabled(bool b); + +public slots: + void enabledCheckBoxToggled(bool b); + +private: + Ui::DebugViewWidget m_ui; +}; + +} //namespace Internal + +} //namespace QmlDesigner + +#endif //DEBUGVIEWWIDGET_H + diff --git a/src/plugins/qmldesigner/components/debugview/debugviewwidget.ui b/src/plugins/qmldesigner/components/debugview/debugviewwidget.ui new file mode 100644 index 00000000000..aea67645524 --- /dev/null +++ b/src/plugins/qmldesigner/components/debugview/debugviewwidget.ui @@ -0,0 +1,270 @@ + + + DebugViewWidget + + + + 0 + 0 + 400 + 300 + + + + Debug + + + + 2 + + + + + 0 + + + + Model Log + + + + 2 + + + 2 + + + + + true + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + + + Clear + + + + + + + Qt::Horizontal + + + + 337 + 20 + + + + + + + + + + + + Instance Notifications + + + + 2 + + + 2 + + + + + true + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + + + Clear + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Instance Errors + + + + 2 + + + 2 + + + + + true + + + + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 0 + + + + + Clear + + + + + + + Qt::Horizontal + + + + 337 + 20 + + + + + + + + + + + + + + + Enabled + + + + + + + + + modelClear + clicked() + modelLog + clear() + + + 25 + 38 + + + 198 + 172 + + + + + instanceLogClear + clicked() + instanceLog + clear() + + + 25 + 36 + + + 198 + 170 + + + + + instanceErrorClear + clicked() + instanceErrorLog + clear() + + + 25 + 38 + + + 198 + 172 + + + + + diff --git a/src/plugins/qmldesigner/designercore/include/viewmanager.h b/src/plugins/qmldesigner/designercore/include/viewmanager.h index bb3b8b6d6ef..0afe9fc378e 100644 --- a/src/plugins/qmldesigner/designercore/include/viewmanager.h +++ b/src/plugins/qmldesigner/designercore/include/viewmanager.h @@ -40,6 +40,7 @@ #include #include #include +#include #include namespace QmlDesigner { @@ -105,6 +106,7 @@ private: // functions private: // variables QmlModelState m_savedState; Internal::ViewLogger m_viewLogger; + Internal::DebugView m_debugView; ComponentView m_componentView; FormEditorView m_formEditorView; ItemLibraryView m_itemLibraryView; diff --git a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp index 76496d3ed85..cdeca6a1ffb 100644 --- a/src/plugins/qmldesigner/designercore/model/viewmanager.cpp +++ b/src/plugins/qmldesigner/designercore/model/viewmanager.cpp @@ -7,6 +7,7 @@ #include "formeditorwidget.h" #include "toolbox.h" #include "designeractionmanager.h" +#include "designersettings.h" #include @@ -108,6 +109,8 @@ void ViewManager::detachViewsExceptRewriterAndComponetView() currentModel()->detachView(&m_itemLibraryView); currentModel()->detachView(&m_statesEditorView); currentModel()->detachView(&m_propertyEditorView); + if (m_debugView.isAttached()) + currentModel()->detachView(&m_debugView); currentModel()->setNodeInstanceView(0); static bool enableViewLogger = !qgetenv("QTC_ENABLE_QMLDESIGNER_LOGGER").isEmpty(); @@ -151,6 +154,8 @@ void ViewManager::attachViewsExceptRewriterAndComponetView() if (enableViewLogger) currentModel()->attachView(&m_viewLogger); + if (QmlDesignerPlugin::instance()->settings().enableDebugView) + currentModel()->attachView(&m_debugView); attachNodeInstanceView(); currentModel()->attachView(&m_formEditorView); currentModel()->attachView(&m_navigatorView); @@ -191,6 +196,8 @@ QList ViewManager::widgetInfos() widgetInfoList.append(m_navigatorView.widgetInfo()); widgetInfoList.append(m_propertyEditorView.widgetInfo()); widgetInfoList.append(m_statesEditorView.widgetInfo()); + if (m_debugView.hasWidget()) + widgetInfoList.append(m_debugView.widgetInfo()); foreach (const QWeakPointer &abstractView, m_additionalViews) { if (abstractView && abstractView->hasWidget()) diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp index f1e30fb06a6..2193729d5d5 100644 --- a/src/plugins/qmldesigner/designersettings.cpp +++ b/src/plugins/qmldesigner/designersettings.cpp @@ -41,7 +41,9 @@ DesignerSettings::DesignerSettings() canvasWidth(10000), canvasHeight(10000), warningsInDesigner(true), - designerWarningsInEditor(false) + designerWarningsInEditor(false), + showDebugView(false), + enableDebugView(false) {} void DesignerSettings::fromSettings(QSettings *settings) @@ -61,6 +63,10 @@ void DesignerSettings::fromSettings(QSettings *settings) QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY), QVariant(true)).toBool(); designerWarningsInEditor = settings->value( QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY), QVariant(false)).toBool(); + showDebugView = settings->value( + QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), QVariant(false)).toBool(); + enableDebugView = settings->value( + QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), QVariant(false)).toBool(); settings->endGroup(); settings->endGroup(); @@ -77,6 +83,8 @@ void DesignerSettings::toSettings(QSettings *settings) const settings->setValue(QLatin1String(QmlDesigner::Constants::QML_CANVASHEIGHT_KEY), canvasHeight); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY), warningsInDesigner); settings->setValue(QLatin1String(QmlDesigner::Constants::QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY), designerWarningsInEditor); + settings->setValue(QLatin1String(QmlDesigner::Constants::QML_SHOW_DEBUGVIEW), showDebugView); + settings->setValue(QLatin1String(QmlDesigner::Constants::QML_ENABLE_DEBUGVIEW), enableDebugView); settings->endGroup(); settings->endGroup(); @@ -89,5 +97,7 @@ bool DesignerSettings::equals(const DesignerSettings &other) const && canvasWidth == other.canvasWidth && canvasHeight == other.canvasHeight && warningsInDesigner == other.warningsInDesigner - && designerWarningsInEditor == other.designerWarningsInEditor; + && designerWarningsInEditor == other.designerWarningsInEditor + && showDebugView == other.showDebugView + && enableDebugView == other.enableDebugView; } diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h index 3a6e3a8e830..7aaf30e5940 100644 --- a/src/plugins/qmldesigner/designersettings.h +++ b/src/plugins/qmldesigner/designersettings.h @@ -54,6 +54,8 @@ public: int canvasHeight; bool warningsInDesigner; bool designerWarningsInEditor; + bool showDebugView; + bool enableDebugView; }; inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2) diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h index 9853772cac3..53a06252f60 100644 --- a/src/plugins/qmldesigner/qmldesignerconstants.h +++ b/src/plugins/qmldesigner/qmldesignerconstants.h @@ -62,6 +62,8 @@ const char QML_CONTEXTPANE_KEY[] = "ContextPaneEnabled"; const char QML_CONTEXTPANEPIN_KEY[] = "ContextPanePinned"; const char QML_WARNIN_FOR_FEATURES_IN_DESIGNER_KEY[] = "WarnAboutQtQuickFeaturesInDesigner"; const char QML_WARNIN_FOR_DESIGNER_FEATURES_IN_EDITOR_KEY[] = "WarnAboutQtQuickDesignerFeaturesInCodeEditor"; +const char QML_SHOW_DEBUGVIEW[] = "ShowQtQuickDesignerDebugView"; +const char QML_ENABLE_DEBUGVIEW[] = "EnableQtQuickDesignerDebugView"; enum { QML_OPENDESIGNMODE_DEFAULT = 0 }; // 0 for text mode, 1 for design mode const char SETTINGS_CATEGORY_QML_ICON[] = ":/core/images/category_qml.png"; diff --git a/src/plugins/qmldesigner/qmldesignerplugin.pro b/src/plugins/qmldesigner/qmldesignerplugin.pro index a2066c59b77..d86477188e0 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.pro +++ b/src/plugins/qmldesigner/qmldesignerplugin.pro @@ -19,6 +19,7 @@ include(components/navigator/navigator.pri) include(components/pluginmanager/pluginmanager.pri) include(components/stateseditor/stateseditor.pri) include(components/resources/resources.pri) +include(components/debugview/debugview.pri) include(qmldesignerplugin.pri) DEFINES -= QT_NO_CAST_FROM_ASCII diff --git a/src/plugins/qmldesigner/settingspage.cpp b/src/plugins/qmldesigner/settingspage.cpp index 0274cd7c742..4a1ded4092f 100644 --- a/src/plugins/qmldesigner/settingspage.cpp +++ b/src/plugins/qmldesigner/settingspage.cpp @@ -44,29 +44,34 @@ SettingsPageWidget::SettingsPageWidget(QWidget *parent) : QWidget(parent) { m_ui.setupUi(this); + connect(m_ui.designerEnableDebuggerCheckBox, SIGNAL(toggled(bool)), this, SLOT(debugViewEnabledToggled(bool))); } DesignerSettings SettingsPageWidget::settings() const { - DesignerSettings ds; - ds.itemSpacing = m_ui.spinItemSpacing->value(); - ds.snapMargin = m_ui.spinSnapMargin->value(); - ds.canvasWidth = m_ui.spinCanvasWidth->value(); - ds.canvasHeight = m_ui.spinCanvasHeight->value(); - ds.warningsInDesigner = m_ui.designerWarningsCheckBox->isChecked(); - ds.designerWarningsInEditor = m_ui.designerWarningsInEditorCheckBox->isChecked(); + DesignerSettings designerSettings; + designerSettings.itemSpacing = m_ui.spinItemSpacing->value(); + designerSettings.snapMargin = m_ui.spinSnapMargin->value(); + designerSettings.canvasWidth = m_ui.spinCanvasWidth->value(); + designerSettings.canvasHeight = m_ui.spinCanvasHeight->value(); + designerSettings.warningsInDesigner = m_ui.designerWarningsCheckBox->isChecked(); + designerSettings.designerWarningsInEditor = m_ui.designerWarningsInEditorCheckBox->isChecked(); + designerSettings.showDebugView = m_ui.designerShowDebuggerCheckBox->isChecked(); + designerSettings.enableDebugView = m_ui.designerEnableDebuggerCheckBox->isChecked(); - return ds; + return designerSettings; } -void SettingsPageWidget::setSettings(const DesignerSettings &s) +void SettingsPageWidget::setSettings(const DesignerSettings &designerSettings) { - m_ui.spinItemSpacing->setValue(s.itemSpacing); - m_ui.spinSnapMargin->setValue(s.snapMargin); - m_ui.spinCanvasWidth->setValue(s.canvasWidth); - m_ui.spinCanvasHeight->setValue(s.canvasHeight); - m_ui.designerWarningsCheckBox->setChecked(s.warningsInDesigner); - m_ui.designerWarningsInEditorCheckBox->setChecked(s.designerWarningsInEditor); + m_ui.spinItemSpacing->setValue(designerSettings.itemSpacing); + m_ui.spinSnapMargin->setValue(designerSettings.snapMargin); + m_ui.spinCanvasWidth->setValue(designerSettings.canvasWidth); + m_ui.spinCanvasHeight->setValue(designerSettings.canvasHeight); + m_ui.designerWarningsCheckBox->setChecked(designerSettings.warningsInDesigner); + m_ui.designerWarningsInEditorCheckBox->setChecked(designerSettings.designerWarningsInEditor); + m_ui.designerShowDebuggerCheckBox->setChecked(designerSettings.showDebugView); + m_ui.designerEnableDebuggerCheckBox->setChecked(designerSettings.enableDebugView); } QString SettingsPageWidget::searchKeywords() const @@ -81,6 +86,12 @@ QString SettingsPageWidget::searchKeywords() const return rc; } +void SettingsPageWidget::debugViewEnabledToggled(bool b) +{ + if (b && ! m_ui.designerShowDebuggerCheckBox->isChecked()) + m_ui.designerShowDebuggerCheckBox->setChecked(true); +} + SettingsPage::SettingsPage() : m_widget(0) { diff --git a/src/plugins/qmldesigner/settingspage.h b/src/plugins/qmldesigner/settingspage.h index 032ad8ba65b..78a143a0689 100644 --- a/src/plugins/qmldesigner/settingspage.h +++ b/src/plugins/qmldesigner/settingspage.h @@ -55,10 +55,13 @@ public: explicit SettingsPageWidget(QWidget *parent = 0); DesignerSettings settings() const; - void setSettings(const DesignerSettings &); + void setSettings(const DesignerSettings &designerSettings); QString searchKeywords() const; +public slots: + void debugViewEnabledToggled(bool b); + private: Ui::SettingsPage m_ui; }; diff --git a/src/plugins/qmldesigner/settingspage.ui b/src/plugins/qmldesigner/settingspage.ui index 3bbf633e019..153d3230b4d 100644 --- a/src/plugins/qmldesigner/settingspage.ui +++ b/src/plugins/qmldesigner/settingspage.ui @@ -6,14 +6,86 @@ 0 0 - 574 - 472 + 684 + 607 Form + + + + Debugging + + + + + + + + Warn about QML features which are not properly supported by the Qt Quick Designer + + + Show the debugging view + + + + + + + Also warn in the code editor about QML features which are not properly supported by the Qt Quick Designer + + + Enable the debugging view + + + + + + + + + + + + + 0 + 0 + + + + Warnings + + + + + + + + Warn about QML features which are not properly supported by the Qt Quick Designer + + + Warn about unsupported features in the Qt Quick Designer + + + + + + + Also warn in the code editor about QML features which are not properly supported by the Qt Quick Designer + + + Warn about unsupported features of Qt Quick Designer in the code editor + + + + + + + + @@ -132,40 +204,7 @@ - - - - Warnings - - - - - - - - Warn about QML features which are not properly supported by the Qt Quick Designer - - - Warn about unsupported features in the Qt Quick Designer - - - - - - - Also warn in the code editor about QML features which are not properly supported by the Qt Quick Designer - - - Warn about unsupported features of Qt Quick Designer in the code editor - - - - - - - - - + Qt::Vertical