summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@digia.com>2013-09-17 16:36:48 +0200
committerMarco Bubke <marco.bubke@digia.com>2013-09-18 13:19:44 +0200
commit062f6baca0dfdb0e091a63e115a5dd88d6be474d (patch)
treeb25126d763099155ededca992b2ace2d72d3511f /src/plugins
parent3130aacc82c29b1435de7ec93b5266872b66ce7a (diff)
downloadqt-creator-062f6baca0dfdb0e091a63e115a5dd88d6be474d.tar.gz
AmlDesigner: Refactor DesignerActionManagerView in a extra file
Change-Id: I50a74778f5fa0895110f2157728b9d99b677a6c5 Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qmldesigner/components/componentcore/componentcore.pri2
-rw-r--r--src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp161
-rw-r--r--src/plugins/qmldesigner/components/componentcore/designeractionmanager.h4
-rw-r--r--src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.cpp183
-rw-r--r--src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.h94
5 files changed, 283 insertions, 161 deletions
diff --git a/src/plugins/qmldesigner/components/componentcore/componentcore.pri b/src/plugins/qmldesigner/components/componentcore/componentcore.pri
index 3457791475..725b92415a 100644
--- a/src/plugins/qmldesigner/components/componentcore/componentcore.pri
+++ b/src/plugins/qmldesigner/components/componentcore/componentcore.pri
@@ -1,6 +1,7 @@
VPATH += $$PWD
SOURCES += modelnodecontextmenu.cpp
+SOURCES += designeractionmanagerview.cpp
SOURCES += defaultdesigneraction.cpp
SOURCES += modelnodecontextmenu_helper.cpp
SOURCES += selectioncontext.cpp
@@ -9,6 +10,7 @@ SOURCES += modelnodeoperations.cpp
SOURCES += crumblebar.cpp
HEADERS += modelnodecontextmenu.h
+HEADERS += designeractionmanagerview.h
HEADERS += defaultdesigneraction.h
HEADERS += modelnodecontextmenu_helper.h
HEADERS += selectioncontext.h
diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp
index a60ef2fd7b..f0a979bb53 100644
--- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.cpp
@@ -31,6 +31,7 @@
#include "modelnodecontextmenu_helper.h"
#include <nodeproperty.h>
#include <nodemetainfo.h>
+#include "designeractionmanagerview.h"
namespace QmlDesigner {
@@ -49,163 +50,6 @@ static inline bool contains(const QmlItemNode &node, const QPointF &position)
namespace Internal {
-class DesignerActionManagerView : public AbstractView
-{
-public:
- DesignerActionManagerView() : AbstractView(0), m_isInRewriterTransaction(false), m_setupContextDirty(false)
- {}
-
- void modelAttached(Model *model) QTC_OVERRIDE
- {
- AbstractView::modelAttached(model);
- setupContext();
- }
-
- void modelAboutToBeDetached(Model *model) QTC_OVERRIDE
- {
- AbstractView::modelAboutToBeDetached(model);
- setupContext();
- }
-
- virtual void nodeCreated(const ModelNode &) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void nodeAboutToBeRemoved(const ModelNode &) QTC_OVERRIDE
- {}
-
- virtual void nodeRemoved(const ModelNode &, const NodeAbstractProperty &, PropertyChangeFlags) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void nodeAboutToBeReparented(const ModelNode &,
- const NodeAbstractProperty &,
- const NodeAbstractProperty &,
- AbstractView::PropertyChangeFlags ) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void nodeReparented(const ModelNode &, const NodeAbstractProperty &,
- const NodeAbstractProperty &,
- AbstractView::PropertyChangeFlags) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void nodeIdChanged(const ModelNode&, const QString&, const QString&) QTC_OVERRIDE
- {}
-
- virtual void propertiesAboutToBeRemoved(const QList<AbstractProperty>&) QTC_OVERRIDE
- {}
-
- virtual void propertiesRemoved(const QList<AbstractProperty>&) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void variantPropertiesChanged(const QList<VariantProperty>&, PropertyChangeFlags) QTC_OVERRIDE
- {}
-
- virtual void bindingPropertiesChanged(const QList<BindingProperty>&, PropertyChangeFlags) QTC_OVERRIDE
- {}
-
- virtual void rootNodeTypeChanged(const QString &, int , int ) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &) QTC_OVERRIDE
- {}
-
- virtual void instancesCompleted(const QVector<ModelNode> &) QTC_OVERRIDE
- {}
-
- virtual void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &) QTC_OVERRIDE
- {}
-
- virtual void instancesRenderImageChanged(const QVector<ModelNode> &) QTC_OVERRIDE
- {}
-
- virtual void instancesPreviewImageChanged(const QVector<ModelNode> &) QTC_OVERRIDE
- {}
-
- virtual void instancesChildrenChanged(const QVector<ModelNode> &) QTC_OVERRIDE
- {}
-
- virtual void instancesToken(const QString &, int , const QVector<ModelNode> &) QTC_OVERRIDE
- {}
-
- virtual void nodeSourceChanged(const ModelNode &, const QString &) QTC_OVERRIDE
- {}
-
- virtual void rewriterBeginTransaction() QTC_OVERRIDE
- {
- m_isInRewriterTransaction = true;
- }
-
- virtual void rewriterEndTransaction() QTC_OVERRIDE
- {
- m_isInRewriterTransaction = false;
-
- if (m_setupContextDirty)
- setupContext();
- }
-
- virtual void currentStateChanged(const ModelNode &) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void selectedNodesChanged(const QList<ModelNode> &,
- const QList<ModelNode> &) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void nodeOrderChanged(const NodeListProperty &, const ModelNode &, int ) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void importsChanged(const QList<Import> &, const QList<Import> &) QTC_OVERRIDE
- {
- setupContext();
- }
-
- virtual void scriptFunctionsChanged(const ModelNode &, const QStringList &) QTC_OVERRIDE
- {}
-
- void setDesignerActionList(const QList<AbstractDesignerAction* > &designerActionList)
- {
- m_designerActionList = designerActionList;
- }
-
- void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &/*propertyList*/, PropertyChangeFlags /*propertyChange*/)
- {
- setupContext();
- }
-
-protected:
- void setupContext()
- {
- if (m_isInRewriterTransaction) {
- m_setupContextDirty = true;
- return;
- }
- SelectionContext selectionContext(this);
- foreach (AbstractDesignerAction* action, m_designerActionList) {
- action->currentContextChanged(selectionContext);
- }
- m_setupContextDirty = false;
- }
-
- QList<AbstractDesignerAction* > m_designerActionList;
- bool m_isInRewriterTransaction;
- bool m_setupContextDirty;
-};
} //Internal
@@ -619,7 +463,8 @@ QList<AbstractDesignerAction* > DesignerActionManager::factoriesInternal() const
return list;
}
-DesignerActionManager::DesignerActionManager() : m_view(new Internal::DesignerActionManagerView)
+DesignerActionManager::DesignerActionManager()
+ : m_view(new DesignerActionManagerView)
{
}
diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.h b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.h
index c4164971fa..7f3f34b121 100644
--- a/src/plugins/qmldesigner/components/componentcore/designeractionmanager.h
+++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanager.h
@@ -36,9 +36,7 @@
namespace QmlDesigner {
-namespace Internal {
class DesignerActionManagerView;
-}
class QMLDESIGNERCORE_EXPORT DesignerActionManager {
public:
@@ -58,7 +56,7 @@ protected:
private:
static DesignerActionManager *m_instance;
QList<QSharedPointer<AbstractDesignerAction> > m_designerActions;
- Internal::DesignerActionManagerView *m_view;
+ DesignerActionManagerView *m_view;
};
} //QmlDesigner
diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.cpp b/src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.cpp
new file mode 100644
index 0000000000..518b9e0409
--- /dev/null
+++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** 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 "designeractionmanagerview.h"
+
+#include <selectioncontext.h>
+#include <abstractdesigneraction.h>
+
+namespace QmlDesigner {
+
+DesignerActionManagerView::DesignerActionManagerView()
+ : AbstractView(0),
+ m_isInRewriterTransaction(false),
+ m_setupContextDirty(false)
+{}
+
+void DesignerActionManagerView::modelAttached(Model *model)
+{
+ AbstractView::modelAttached(model);
+ setupContext();
+}
+
+void DesignerActionManagerView::modelAboutToBeDetached(Model *model)
+{
+ AbstractView::modelAboutToBeDetached(model);
+ setupContext();
+}
+
+void DesignerActionManagerView::nodeCreated(const ModelNode &)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::nodeAboutToBeRemoved(const ModelNode &)
+{}
+
+void DesignerActionManagerView::nodeRemoved(const ModelNode &, const NodeAbstractProperty &, AbstractView::PropertyChangeFlags)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::nodeAboutToBeReparented(const ModelNode &, const NodeAbstractProperty &, const NodeAbstractProperty &, AbstractView::PropertyChangeFlags)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::nodeReparented(const ModelNode &, const NodeAbstractProperty &, const NodeAbstractProperty &, AbstractView::PropertyChangeFlags)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::nodeIdChanged(const ModelNode &, const QString &, const QString &)
+{}
+
+void DesignerActionManagerView::propertiesAboutToBeRemoved(const QList<AbstractProperty> &)
+{}
+
+void DesignerActionManagerView::propertiesRemoved(const QList<AbstractProperty> &)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::variantPropertiesChanged(const QList<VariantProperty> &, AbstractView::PropertyChangeFlags)
+{}
+
+void DesignerActionManagerView::bindingPropertiesChanged(const QList<BindingProperty> &, AbstractView::PropertyChangeFlags)
+{}
+
+void DesignerActionManagerView::rootNodeTypeChanged(const QString &, int, int)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &)
+{}
+
+void DesignerActionManagerView::instancesCompleted(const QVector<ModelNode> &)
+{}
+
+void DesignerActionManagerView::instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &)
+{}
+
+void DesignerActionManagerView::instancesRenderImageChanged(const QVector<ModelNode> &)
+{}
+
+void DesignerActionManagerView::instancesPreviewImageChanged(const QVector<ModelNode> &)
+{}
+
+void DesignerActionManagerView::instancesChildrenChanged(const QVector<ModelNode> &)
+{}
+
+void DesignerActionManagerView::instancesToken(const QString &, int, const QVector<ModelNode> &)
+{}
+
+void DesignerActionManagerView::nodeSourceChanged(const ModelNode &, const QString &)
+{}
+
+void DesignerActionManagerView::rewriterBeginTransaction()
+{
+ m_isInRewriterTransaction = true;
+}
+
+void DesignerActionManagerView::rewriterEndTransaction()
+{
+ m_isInRewriterTransaction = false;
+
+ if (m_setupContextDirty)
+ setupContext();
+}
+
+void DesignerActionManagerView::currentStateChanged(const ModelNode &)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::selectedNodesChanged(const QList<ModelNode> &, const QList<ModelNode> &)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::nodeOrderChanged(const NodeListProperty &, const ModelNode &, int)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::importsChanged(const QList<Import> &, const QList<Import> &)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::scriptFunctionsChanged(const ModelNode &, const QStringList &)
+{}
+
+void DesignerActionManagerView::setDesignerActionList(const QList<AbstractDesignerAction *> &designerActionList)
+{
+ m_designerActionList = designerActionList;
+}
+
+void DesignerActionManagerView::signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &, AbstractView::PropertyChangeFlags)
+{
+ setupContext();
+}
+
+void DesignerActionManagerView::setupContext()
+{
+ if (m_isInRewriterTransaction) {
+ m_setupContextDirty = true;
+ return;
+ }
+ SelectionContext selectionContext(this);
+ foreach (AbstractDesignerAction* action, m_designerActionList) {
+ action->currentContextChanged(selectionContext);
+ }
+ m_setupContextDirty = false;
+}
+
+} // namespace QmlDesigner
diff --git a/src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.h b/src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.h
new file mode 100644
index 0000000000..8357200697
--- /dev/null
+++ b/src/plugins/qmldesigner/components/componentcore/designeractionmanagerview.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** 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 QMLDESIGNER_DESIGNERACTIONMANAGERVIEW_H
+#define QMLDESIGNER_DESIGNERACTIONMANAGERVIEW_H
+
+#include <abstractview.h>
+
+namespace QmlDesigner {
+
+class AbstractDesignerAction;
+
+class DesignerActionManagerView : public AbstractView
+{
+ Q_OBJECT
+public:
+ DesignerActionManagerView();
+
+ void modelAttached(Model *model);
+ void modelAboutToBeDetached(Model *model);
+ void nodeCreated(const ModelNode &);
+ void nodeAboutToBeRemoved(const ModelNode &);
+ void nodeRemoved(const ModelNode &, const NodeAbstractProperty &, PropertyChangeFlags);
+ void nodeAboutToBeReparented(const ModelNode &,
+ const NodeAbstractProperty &,
+ const NodeAbstractProperty &,
+ AbstractView::PropertyChangeFlags );
+ void nodeReparented(const ModelNode &, const NodeAbstractProperty &,
+ const NodeAbstractProperty &,
+ AbstractView::PropertyChangeFlags);
+ void nodeIdChanged(const ModelNode&, const QString&, const QString&);
+ void propertiesAboutToBeRemoved(const QList<AbstractProperty>&);
+ void propertiesRemoved(const QList<AbstractProperty>&);
+ void variantPropertiesChanged(const QList<VariantProperty>&, PropertyChangeFlags);
+ void bindingPropertiesChanged(const QList<BindingProperty>&, PropertyChangeFlags);
+ void rootNodeTypeChanged(const QString &, int , int );
+ void instancePropertyChange(const QList<QPair<ModelNode, PropertyName> > &);
+ void instancesCompleted(const QVector<ModelNode> &);
+ void instanceInformationsChange(const QMultiHash<ModelNode, InformationName> &);
+ void instancesRenderImageChanged(const QVector<ModelNode> &);
+ void instancesPreviewImageChanged(const QVector<ModelNode> &);
+ void instancesChildrenChanged(const QVector<ModelNode> &);
+ void instancesToken(const QString &, int , const QVector<ModelNode> &);
+ void nodeSourceChanged(const ModelNode &, const QString &);
+ void rewriterBeginTransaction();
+ void rewriterEndTransaction();
+ void currentStateChanged(const ModelNode &);
+ void selectedNodesChanged(const QList<ModelNode> &,
+ const QList<ModelNode> &);
+ void nodeOrderChanged(const NodeListProperty &, const ModelNode &, int );
+ void importsChanged(const QList<Import> &, const QList<Import> &);
+ void scriptFunctionsChanged(const ModelNode &, const QStringList &);
+ void setDesignerActionList(const QList<AbstractDesignerAction* > &designerActionList);
+ void signalHandlerPropertiesChanged(const QVector<SignalHandlerProperty> &/*propertyList*/, PropertyChangeFlags /*propertyChange*/);
+
+protected:
+ void setupContext();
+
+private:
+ QList<AbstractDesignerAction* > m_designerActionList;
+ bool m_isInRewriterTransaction;
+ bool m_setupContextDirty;
+};
+
+
+} // namespace QmlDesigner
+
+#endif // QMLDESIGNER_DESIGNERACTIONMANAGERVIEW_H