2016-01-15 14:58:39 +01:00
|
|
|
/****************************************************************************
|
2015-08-16 13:11:15 +02:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** Copyright (C) 2016 Jochen Becher
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2015-08-16 13:11:15 +02:00
|
|
|
**
|
|
|
|
|
** 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
|
2016-01-15 14:58:39 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2015-08-16 13:11:15 +02:00
|
|
|
**
|
2016-01-15 14:58:39 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2015-08-16 13:11:15 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef QMT_PROPERTIESVIEWMVIEW_H
|
|
|
|
|
#define QMT_PROPERTIESVIEWMVIEW_H
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
|
|
|
|
|
#include "propertiesview.h"
|
|
|
|
|
|
|
|
|
|
#include "qmt/model/mconstvisitor.h"
|
|
|
|
|
#include "qmt/diagram/dconstvisitor.h"
|
|
|
|
|
#include "qmt/diagram/dobject.h"
|
|
|
|
|
#include "qmt/stereotype/stereotypeicon.h"
|
|
|
|
|
#include "qmt/style/styleengine.h"
|
|
|
|
|
|
|
|
|
|
#include <QList>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
class QWidget;
|
|
|
|
|
class QLabel;
|
2016-02-13 23:17:57 +01:00
|
|
|
class QLayout;
|
2015-08-16 13:11:15 +02:00
|
|
|
class QFormLayout;
|
|
|
|
|
class QLineEdit;
|
|
|
|
|
class QPushButton;
|
|
|
|
|
class QComboBox;
|
|
|
|
|
class QCheckBox;
|
|
|
|
|
class QFrame;
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
namespace qmt {
|
|
|
|
|
|
|
|
|
|
class StereotypesController;
|
|
|
|
|
class MClassMember;
|
|
|
|
|
class ClassMembersEdit;
|
|
|
|
|
class PaletteBox;
|
|
|
|
|
|
2015-11-14 16:59:30 +01:00
|
|
|
class QMT_EXPORT PropertiesView::MView : public QObject, public MConstVisitor, public DConstVisitor
|
2015-08-16 13:11:15 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2015-11-24 18:29:17 +01:00
|
|
|
explicit MView(PropertiesView *propertiesView);
|
2015-12-01 15:52:31 +01:00
|
|
|
~MView();
|
2015-08-16 13:11:15 +02:00
|
|
|
|
2015-11-04 22:44:41 +01:00
|
|
|
QWidget *topLevelWidget() const { return m_topWidget; }
|
2015-08-16 13:11:15 +02:00
|
|
|
|
2015-11-23 23:21:20 +01:00
|
|
|
void visitMElement(const MElement *element) override;
|
|
|
|
|
void visitMObject(const MObject *object) override;
|
|
|
|
|
void visitMPackage(const MPackage *package) override;
|
|
|
|
|
void visitMClass(const MClass *klass) override;
|
|
|
|
|
void visitMComponent(const MComponent *component) override;
|
|
|
|
|
void visitMDiagram(const MDiagram *diagram) override;
|
|
|
|
|
void visitMCanvasDiagram(const MCanvasDiagram *diagram) override;
|
|
|
|
|
void visitMItem(const MItem *item) override;
|
|
|
|
|
void visitMRelation(const MRelation *relation) override;
|
|
|
|
|
void visitMDependency(const MDependency *dependency) override;
|
|
|
|
|
void visitMInheritance(const MInheritance *inheritance) override;
|
|
|
|
|
void visitMAssociation(const MAssociation *association) override;
|
2015-08-16 13:11:15 +02:00
|
|
|
|
2015-11-23 23:21:20 +01:00
|
|
|
void visitDElement(const DElement *element) override;
|
|
|
|
|
void visitDObject(const DObject *object) override;
|
|
|
|
|
void visitDPackage(const DPackage *package) override;
|
|
|
|
|
void visitDClass(const DClass *klass) override;
|
|
|
|
|
void visitDComponent(const DComponent *component) override;
|
|
|
|
|
void visitDDiagram(const DDiagram *diagram) override;
|
|
|
|
|
void visitDItem(const DItem *item) override;
|
|
|
|
|
void visitDRelation(const DRelation *relation) override;
|
|
|
|
|
void visitDInheritance(const DInheritance *inheritance) override;
|
|
|
|
|
void visitDDependency(const DDependency *dependency) override;
|
|
|
|
|
void visitDAssociation(const DAssociation *association) override;
|
|
|
|
|
void visitDAnnotation(const DAnnotation *annotation) override;
|
|
|
|
|
void visitDBoundary(const DBoundary *boundary) override;
|
2015-08-16 13:11:15 +02:00
|
|
|
|
2015-11-04 07:52:44 +01:00
|
|
|
void update(QList<MElement *> &modelElements);
|
|
|
|
|
void update(QList<DElement *> &diagramElements, MDiagram *diagram);
|
2015-08-16 13:11:15 +02:00
|
|
|
void edit();
|
|
|
|
|
|
2016-02-14 11:02:49 +01:00
|
|
|
protected:
|
2015-08-16 13:11:15 +02:00
|
|
|
void onStereotypesChanged(const QString &stereotypes);
|
|
|
|
|
void onObjectNameChanged(const QString &name);
|
2015-11-12 20:05:49 +01:00
|
|
|
void onNamespaceChanged(const QString ¨Namespace);
|
2015-11-04 07:52:44 +01:00
|
|
|
void onTemplateParametersChanged(const QString &templateParameters);
|
2015-08-16 13:11:15 +02:00
|
|
|
void onClassMembersStatusChanged(bool valid);
|
|
|
|
|
void onParseClassMembers();
|
2015-11-04 07:52:44 +01:00
|
|
|
void onClassMembersChanged(QList<MClassMember> &classMembers);
|
2015-08-16 13:11:15 +02:00
|
|
|
void onItemVarietyChanged(const QString &variety);
|
|
|
|
|
void onRelationNameChanged(const QString &name);
|
2015-11-04 07:52:44 +01:00
|
|
|
void onDependencyDirectionChanged(int directionIndex);
|
2015-08-16 13:11:15 +02:00
|
|
|
void onAssociationEndANameChanged(const QString &name);
|
|
|
|
|
void onAssociationEndACardinalityChanged(const QString &cardinality);
|
|
|
|
|
void onAssociationEndANavigableChanged(bool navigable);
|
2015-11-04 07:52:44 +01:00
|
|
|
void onAssociationEndAKindChanged(int kindIndex);
|
2015-08-16 13:11:15 +02:00
|
|
|
void onAssociationEndBNameChanged(const QString &name);
|
|
|
|
|
void onAssociationEndBCardinalityChanged(const QString &cardinality);
|
|
|
|
|
void onAssociationEndBNavigableChanged(bool navigable);
|
2015-11-04 07:52:44 +01:00
|
|
|
void onAssociationEndBKindChanged(int kindIndex);
|
|
|
|
|
void onAutoSizedChanged(bool autoSized);
|
|
|
|
|
void onVisualPrimaryRoleChanged(int visualRoleIndex);
|
|
|
|
|
void onVisualSecondaryRoleChanged(int visualRoleIndex);
|
|
|
|
|
void onVisualEmphasizedChanged(bool visualEmphasized);
|
|
|
|
|
void onStereotypeDisplayChanged(int stereotypeDisplayIndex);
|
|
|
|
|
void onTemplateDisplayChanged(int templateDisplayIndex);
|
|
|
|
|
void onShowAllMembersChanged(bool showAllMembers);
|
|
|
|
|
void onPlainShapeChanged(bool plainShape);
|
2015-08-16 13:11:15 +02:00
|
|
|
void onItemShapeChanged(const QString &shape);
|
2015-11-04 07:52:44 +01:00
|
|
|
void onAutoWidthChanged(bool autoWidthed);
|
|
|
|
|
void onAnnotationVisualRoleChanged(int visualRoleIndex);
|
2015-08-16 13:11:15 +02:00
|
|
|
|
|
|
|
|
void prepare();
|
2016-02-13 23:17:57 +01:00
|
|
|
void addRow(const QString &label, QLayout *layout, const char *id);
|
|
|
|
|
void addRow(const QString &label, QWidget *widget, const char *id);
|
|
|
|
|
void addRow(QWidget *widget, const char *id);
|
|
|
|
|
void insertRow(const char *before_id, const QString &label, QLayout *layout, const char *id);
|
|
|
|
|
void insertRow(const char *before_id, const QString &label, QWidget *widget, const char *id);
|
|
|
|
|
void insertRow(const char *before_id, QWidget *widget, const char *id);
|
2015-08-16 13:11:15 +02:00
|
|
|
template<class T, class V>
|
2015-11-15 12:23:41 +01:00
|
|
|
void setTitle(const QList<V *> &elements, const QString &singularTitle,
|
|
|
|
|
const QString &pluralTitle);
|
2015-08-16 13:11:15 +02:00
|
|
|
template<class T, class V>
|
2015-11-15 12:23:41 +01:00
|
|
|
void setTitle(const MItem *item, const QList<V *> &elements,
|
|
|
|
|
const QString &singularTitle, const QString &pluralTitle);
|
2015-11-04 07:52:44 +01:00
|
|
|
void setStereotypeIconElement(StereotypeIcon::Element stereotypeElement);
|
|
|
|
|
void setStyleElementType(StyleEngine::ElementType elementType);
|
2015-11-15 12:23:41 +01:00
|
|
|
void setPrimaryRolePalette(StyleEngine::ElementType elementType,
|
|
|
|
|
DObject::VisualPrimaryRole visualPrimaryRole,
|
|
|
|
|
const QColor &baseColor);
|
2015-11-04 07:52:44 +01:00
|
|
|
void setEndAName(const QString &endAName);
|
|
|
|
|
void setEndBName(const QString &endBName);
|
2015-08-16 13:11:15 +02:00
|
|
|
|
2015-11-04 07:52:44 +01:00
|
|
|
QList<QString> splitTemplateParameters(const QString &templateParameters);
|
|
|
|
|
QString formatTemplateParameters(const QList<QString> &templateParametersList);
|
2015-08-16 13:11:15 +02:00
|
|
|
|
|
|
|
|
enum SelectionType {
|
2015-11-04 23:34:44 +01:00
|
|
|
SelectionSingle,
|
|
|
|
|
SelectionMulti
|
2015-08-16 13:11:15 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
template<class T, class V>
|
|
|
|
|
QList<T *> filter(const QList<V *> &elements);
|
|
|
|
|
template<class T, class V, class BASE>
|
2015-11-04 07:52:44 +01:00
|
|
|
bool haveSameValue(const QList<BASE *> &baseElements, V (T::*getter)() const, V *value);
|
2015-08-16 13:11:15 +02:00
|
|
|
template<class T, class V, class BASE>
|
2015-11-15 12:23:41 +01:00
|
|
|
void assignModelElement(const QList<BASE *> &baseElements, SelectionType selectionType,
|
|
|
|
|
const V &value, V (T::*getter)() const, void (T::*setter)(const V &));
|
2015-08-16 13:11:15 +02:00
|
|
|
template<class T, class V, class BASE>
|
2015-11-15 12:23:41 +01:00
|
|
|
void assignModelElement(const QList<BASE *> &baseElements, SelectionType selectionType,
|
|
|
|
|
const V &value, V (T::*getter)() const, void (T::*setter)(V));
|
2015-08-16 13:11:15 +02:00
|
|
|
template<class T, class E, class V, class BASE>
|
2015-11-15 12:23:41 +01:00
|
|
|
void assignEmbeddedModelElement(const QList<BASE *> &baseElements, SelectionType selectionType,
|
|
|
|
|
const V &value, E (T::*getter)() const,
|
|
|
|
|
void (T::*setter)(const E &),
|
|
|
|
|
V (E::*vGetter)() const, void (E::*vSetter)(const V &));
|
2015-08-16 13:11:15 +02:00
|
|
|
template<class T, class E, class V, class BASE>
|
2015-11-15 12:23:41 +01:00
|
|
|
void assignEmbeddedModelElement(const QList<BASE *> &baseElements, SelectionType selectionType,
|
|
|
|
|
const V &value, E (T::*getter)() const,
|
|
|
|
|
void (T::*setter)(const E &),
|
|
|
|
|
V (E::*vGetter)() const, void (E::*vSetter)(V));
|
2015-08-16 13:11:15 +02:00
|
|
|
|
2015-11-03 22:30:46 +01:00
|
|
|
PropertiesView *m_propertiesView;
|
|
|
|
|
QList<MElement *> m_modelElements;
|
|
|
|
|
QList<DElement *> m_diagramElements;
|
|
|
|
|
MDiagram *m_diagram;
|
|
|
|
|
StereotypesController *m_stereotypesController;
|
|
|
|
|
QWidget *m_topWidget;
|
|
|
|
|
QFormLayout *m_topLayout;
|
2016-02-13 23:17:57 +01:00
|
|
|
QList<const char *> m_rowToId;
|
2015-11-03 22:30:46 +01:00
|
|
|
QString m_propertiesTitle;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MElement
|
2015-11-03 22:30:46 +01:00
|
|
|
StereotypeIcon::Element m_stereotypeElement;
|
|
|
|
|
QLabel *m_classNameLabel;
|
|
|
|
|
QComboBox *m_stereotypeComboBox;
|
|
|
|
|
QLabel *m_reverseEngineeredLabel;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MObject
|
2015-11-03 22:30:46 +01:00
|
|
|
QLineEdit *m_elementNameLineEdit;
|
|
|
|
|
QLabel *m_childrenLabel;
|
|
|
|
|
QLabel *m_relationsLabel;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MClass
|
2015-11-03 22:30:46 +01:00
|
|
|
QLineEdit *m_namespaceLineEdit;
|
|
|
|
|
QLineEdit *m_templateParametersLineEdit;
|
|
|
|
|
QLabel *m_classMembersStatusLabel;
|
|
|
|
|
QPushButton *m_classMembersParseButton;
|
|
|
|
|
ClassMembersEdit *m_classMembersEdit;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MDiagram
|
2015-11-03 22:30:46 +01:00
|
|
|
QLabel *m_diagramsLabel;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MItem
|
2015-11-03 22:30:46 +01:00
|
|
|
QLineEdit *m_itemVarietyEdit;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MRelation
|
2015-11-03 22:30:46 +01:00
|
|
|
QString m_endAName;
|
|
|
|
|
QLabel *m_endALabel;
|
|
|
|
|
QString m_endBName;
|
|
|
|
|
QLabel *m_endBLabel;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MDependency
|
2015-11-03 22:30:46 +01:00
|
|
|
QComboBox *m_directionSelector;
|
2015-08-16 13:11:15 +02:00
|
|
|
// MAssociation
|
2015-11-03 22:30:46 +01:00
|
|
|
QLineEdit *m_endAEndName;
|
|
|
|
|
QLineEdit *m_endACardinality;
|
|
|
|
|
QCheckBox *m_endANavigable;
|
|
|
|
|
QComboBox *m_endAKind;
|
|
|
|
|
QLineEdit *m_endBEndName;
|
|
|
|
|
QLineEdit *m_endBCardinality;
|
|
|
|
|
QCheckBox *m_endBNavigable;
|
|
|
|
|
QComboBox *m_endBKind;
|
2015-08-16 13:11:15 +02:00
|
|
|
|
|
|
|
|
// DElement
|
2015-11-03 22:30:46 +01:00
|
|
|
QFrame *m_separatorLine;
|
2015-08-16 13:11:15 +02:00
|
|
|
// DObject
|
2015-11-03 22:30:46 +01:00
|
|
|
StyleEngine::ElementType m_styleElementType;
|
|
|
|
|
QLabel *m_posRectLabel;
|
|
|
|
|
QCheckBox *m_autoSizedCheckbox;
|
|
|
|
|
PaletteBox *m_visualPrimaryRoleSelector;
|
|
|
|
|
QComboBox *m_visualSecondaryRoleSelector;
|
|
|
|
|
QCheckBox *m_visualEmphasizedCheckbox;
|
|
|
|
|
QComboBox *m_stereotypeDisplaySelector;
|
|
|
|
|
QLabel *m_depthLabel;
|
2015-08-16 13:11:15 +02:00
|
|
|
// DClass
|
2015-11-03 22:30:46 +01:00
|
|
|
QComboBox *m_templateDisplaySelector;
|
|
|
|
|
QCheckBox *m_showAllMembersCheckbox;
|
2015-08-16 13:11:15 +02:00
|
|
|
// DComponent
|
2015-11-03 22:30:46 +01:00
|
|
|
QCheckBox *m_plainShapeCheckbox;
|
2015-08-16 13:11:15 +02:00
|
|
|
// DItem
|
2015-11-03 22:30:46 +01:00
|
|
|
QLineEdit *m_itemShapeEdit;
|
2015-08-16 13:11:15 +02:00
|
|
|
// DAnnotation
|
2015-11-03 22:30:46 +01:00
|
|
|
QCheckBox *m_annotationAutoWidthCheckbox;
|
|
|
|
|
QComboBox *m_annotationVisualRoleSelector;
|
2015-08-16 13:11:15 +02:00
|
|
|
};
|
|
|
|
|
|
2015-11-14 16:59:30 +01:00
|
|
|
} // namespace qmt
|
2015-08-16 13:11:15 +02:00
|
|
|
|
|
|
|
|
#endif // QMT_PROPERTIESVIEWMVIEW_H
|