Skip to content
Snippets Groups Projects
Commit 92018333 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: adding debug view


This view improves debugging of the Qt Quick Designer.

Change-Id: I01a0240fd304c48707021d4445b2c09c9243d868
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
(cherry picked from commit 15f58b16)
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent 3c090f20
No related branches found
No related tags found
No related merge requests found
Showing
with 1060 additions and 54 deletions
/****************************************************************************
**
** 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 <qmldesignerplugin.h>
#include <designersettings.h>
#include <bindingproperty.h>
#include <nodeabstractproperty.h>
#include <variantproperty.h>
namespace {
const QLatin1String lineBreak = QLatin1String("<br>");
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<Import> &addedImports, const QList<Import> &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<AbstractProperty> & /*propertyList*/)
{
}
void DebugView::variantPropertiesChanged(const QList<VariantProperty> &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<BindingProperty> &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<ModelNode> & /*selectedNodeList*/,
const QList<ModelNode> & /*lastSelectedNodeList*/)
{
}
void DebugView::scriptFunctionsChanged(const ModelNode & /*node*/, const QStringList & /*scriptFunctionList*/)
{
}
void DebugView::propertiesRemoved(const QList<AbstractProperty> &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<QPair<ModelNode, PropertyName> > &propertyList)
{
if (isDebugViewEnabled()) {
QTextStream message;
QString string;
message.setString(&string);
typedef QPair<ModelNode, PropertyName> 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<ModelNode> &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<ModelNode, InformationName> &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<ModelNode> & /*nodeList*/)
{
}
void DebugView::instancesPreviewImageChanged(const QVector<ModelNode> & /*nodeList*/)
{
}
void DebugView::instancesChildrenChanged(const QVector<ModelNode> & /*nodeList*/)
{
}
void DebugView::customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &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
/****************************************************************************
**
** 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 <qmlmodelview.h>
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<Import> &addedImports, const QList<Import> &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<AbstractProperty>& propertyList) QTC_OVERRIDE;
void variantPropertiesChanged(const QList<VariantProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void bindingPropertiesChanged(const QList<BindingProperty>& propertyList, PropertyChangeFlags propertyChange) QTC_OVERRIDE;
void rootNodeTypeChanged(const QString &type, int majorVersion, int minorVersion) QTC_OVERRIDE;
void selectedNodesChanged(const QList<ModelNode> &selectedNodeList,
const QList<ModelNode> &lastSelectedNodeList) QTC_OVERRIDE;
void scriptFunctionsChanged(const ModelNode &node, const QStringList &scriptFunctionList) QTC_OVERRIDE;
void propertiesRemoved(const QList<AbstractProperty> &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<QPair<ModelNode, PropertyName> > &propertyList) QTC_OVERRIDE;
void instancesCompleted(const QVector<ModelNode> &completedNodeList) QTC_OVERRIDE;
void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &informationChangeHash) QTC_OVERRIDE;
void instancesRenderImageChanged(const QVector<ModelNode> &nodeList) QTC_OVERRIDE;
void instancesPreviewImageChanged(const QVector<ModelNode> &nodeList) QTC_OVERRIDE;
void instancesChildrenChanged(const QVector<ModelNode> &nodeList) QTC_OVERRIDE;
void customNotification(const AbstractView *view, const QString &identifier, const QList<ModelNode> &nodeList, const QList<QVariant> &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<DebugViewWidget> m_debugViewWidget;
};
} // namespace Internal
} // namespace QmlDesigner
#endif DEBUGVIEW_H
VPATH += $$PWD
INCLUDEPATH += $$PWD
DEPENDPATH += $$PWD
SOURCES += debugview.cpp \
debugviewwidget.cpp
HEADERS += debugview.h \
debugviewwidget.h
FORMS += debugviewwidget.ui
/****************************************************************************
**
** 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 <qmldesignerplugin.h>
#include <designersettings.h>
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("<b><font color=\"blue\">")
+ topic
+ QLatin1String("</b><br>")
+ message);
} else {
m_ui.modelLog->appendHtml(QLatin1String("<b>")
+ topic
+ QLatin1String("</b><br>")
+ message);
}
}
void DebugViewWidget::addErrorMessage(const QString &topic, const QString &message)
{
m_ui.instanceErrorLog->appendHtml(QLatin1String("<b><font color=\"red\">")
+ topic
+ QLatin1String("</font></b><br>")
+ message
);
}
void DebugViewWidget::addLogInstanceMessage(const QString &topic, const QString &message, bool highlight)
{
if (highlight) {
m_ui.instanceLog->appendHtml(QLatin1String("<b><font color=\"blue\">")
+ topic
+ QLatin1String("</b><br>")
+ message);
} else {
m_ui.instanceLog->appendHtml(QLatin1String("<b>")
+ topic
+ QLatin1String("</b><br>")
+ 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
/****************************************************************************
**
** 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 <QWidget>
#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
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DebugViewWidget</class>
<widget class="QWidget" name="DebugViewWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Debug</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>2</number>
</property>
<item row="0" column="0">
<widget class="QTabWidget" name="instanceLog_2">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="tab">
<attribute name="title">
<string>Model Log</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="1" column="0">
<widget class="QPlainTextEdit" name="modelLog">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="frame_2">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="modelClear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>337</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
<attribute name="title">
<string>Instance Notifications</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_4">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="1" column="0">
<widget class="QPlainTextEdit" name="instanceLog">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="instanceLogClear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Instance Errors</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<property name="margin">
<number>2</number>
</property>
<property name="spacing">
<number>2</number>
</property>
<item row="1" column="0">
<widget class="QPlainTextEdit" name="instanceErrorLog">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QFrame" name="frame_3">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="instanceErrorClear">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>337</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item row="1" column="0">
<widget class="QCheckBox" name="enabledCheckBox">
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>modelClear</sender>
<signal>clicked()</signal>
<receiver>modelLog</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>25</x>
<y>38</y>
</hint>
<hint type="destinationlabel">
<x>198</x>
<y>172</y>
</hint>
</hints>
</connection>
<connection>
<sender>instanceLogClear</sender>
<signal>clicked()</signal>
<receiver>instanceLog</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>25</x>
<y>36</y>
</hint>
<hint type="destinationlabel">
<x>198</x>
<y>170</y>
</hint>
</hints>
</connection>
<connection>
<sender>instanceErrorClear</sender>
<signal>clicked()</signal>
<receiver>instanceErrorLog</receiver>
<slot>clear()</slot>
<hints>
<hint type="sourcelabel">
<x>25</x>
<y>38</y>
</hint>
<hint type="destinationlabel">
<x>198</x>
<y>172</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -40,6 +40,7 @@
#include <formeditorview.h>
#include <propertyeditor.h>
#include <componentview.h>
#include <debugview.h>
#include <model/viewlogger.h>
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;
......
......@@ -7,6 +7,7 @@
#include "formeditorwidget.h"
#include "toolbox.h"
#include "designeractionmanager.h"
#include "designersettings.h"
#include <qmldesigner/qmldesignerplugin.h>
......@@ -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<WidgetInfo> 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> &abstractView, m_additionalViews) {
if (abstractView && abstractView->hasWidget())
......
......@@ -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;
}
......@@ -54,6 +54,8 @@ public:
int canvasHeight;
bool warningsInDesigner;
bool designerWarningsInEditor;
bool showDebugView;
bool enableDebugView;
};
inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
......
......@@ -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";
......
......@@ -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
......@@ -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)
{
......
......@@ -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;
};
......
......@@ -6,14 +6,86 @@
<rect>
<x>0</x>
<y>0</y>
<width>574</width>
<height>472</height>
<width>684</width>
<height>607</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0">
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Debugging</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="1">
<widget class="QCheckBox" name="designerShowDebuggerCheckBox">
<property name="toolTip">
<string>Warn about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Show the debugging view</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="designerEnableDebuggerCheckBox">
<property name="toolTip">
<string>Also warn in the code editor about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Enable the debugging view</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Warnings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="1">
<widget class="QCheckBox" name="designerWarningsCheckBox">
<property name="toolTip">
<string>Warn about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Warn about unsupported features in the Qt Quick Designer</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="designerWarningsInEditorCheckBox">
<property name="toolTip">
<string>Also warn in the code editor about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Warn about unsupported features of Qt Quick Designer in the code editor</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox_3">
<property name="title">
......@@ -132,40 +204,7 @@
</layout>
</widget>
</item>
<item row="2" column="0">
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Warnings</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="1">
<widget class="QCheckBox" name="designerWarningsCheckBox">
<property name="toolTip">
<string>Warn about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Warn about unsupported features in the Qt Quick Designer</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="designerWarningsInEditorCheckBox">
<property name="toolTip">
<string>Also warn in the code editor about QML features which are not properly supported by the Qt Quick Designer</string>
</property>
<property name="text">
<string>Warn about unsupported features of Qt Quick Designer in the code editor</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="1">
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment