Commit 11eca837 authored by Jochen Becher's avatar Jochen Becher

ModelEditor: Apply naming convention to enums

Change-Id: I215214965d4f6196d805b9001cf59d8cbf2c7c64
Reviewed-by: default avatarTobias Hunger <tobias.hunger@theqtcompany.com>
parent 5d3812af
...@@ -136,9 +136,9 @@ Token TextScanner::read() ...@@ -136,9 +136,9 @@ Token TextScanner::read()
} else if (sourceChar.ch == QLatin1Char('#')) { } else if (sourceChar.ch == QLatin1Char('#')) {
return scanColorIdentifier(sourceChar); return scanColorIdentifier(sourceChar);
} else if (sourceChar.ch == QChar::LineFeed || sourceChar.ch == QChar::CarriageReturn) { } else if (sourceChar.ch == QChar::LineFeed || sourceChar.ch == QChar::CarriageReturn) {
return Token(Token::TOKEN_ENDOFLINE, QString(), sourceChar.pos); return Token(Token::TokenEndOfLine, QString(), sourceChar.pos);
} else if (sourceChar.ch.isNull()) { } else if (sourceChar.ch.isNull()) {
return Token(Token::TOKEN_ENDOFINPUT, QString(), sourceChar.pos); return Token(Token::TokenEndOfInput, QString(), sourceChar.pos);
} else if (d->m_operatorFirstCharsSet.contains(sourceChar.ch)) { } else if (d->m_operatorFirstCharsSet.contains(sourceChar.ch)) {
return scanOperator(sourceChar); return scanOperator(sourceChar);
} else { } else {
...@@ -198,7 +198,7 @@ Token TextScanner::scanString(const SourceChar &delimiterChar) ...@@ -198,7 +198,7 @@ Token TextScanner::scanString(const SourceChar &delimiterChar)
for (;;) { for (;;) {
SourceChar sourceChar = readChar(); SourceChar sourceChar = readChar();
if (sourceChar.ch == delimiterChar.ch) { if (sourceChar.ch == delimiterChar.ch) {
return Token(Token::TOKEN_STRING, text, delimiterChar.pos); return Token(Token::TokenString, text, delimiterChar.pos);
} else if (sourceChar.ch == QLatin1Char('\\')) { } else if (sourceChar.ch == QLatin1Char('\\')) {
sourceChar = readChar(); sourceChar = readChar();
if (sourceChar.ch == QLatin1Char('n')) { if (sourceChar.ch == QLatin1Char('n')) {
...@@ -243,10 +243,10 @@ Token TextScanner::scanNumber(const SourceChar &firstDigit) ...@@ -243,10 +243,10 @@ Token TextScanner::scanNumber(const SourceChar &firstDigit)
text += sourceChar.ch; text += sourceChar.ch;
} }
unreadChar(sourceChar); unreadChar(sourceChar);
return Token(Token::TOKEN_FLOAT, text, firstDigit.pos); return Token(Token::TokenFloat, text, firstDigit.pos);
} else { } else {
unreadChar(sourceChar); unreadChar(sourceChar);
return Token(Token::TOKEN_INTEGER, text, firstDigit.pos); return Token(Token::TokenInteger, text, firstDigit.pos);
} }
} }
...@@ -260,9 +260,9 @@ Token TextScanner::scanIdentifier(const SourceChar &firstChar) ...@@ -260,9 +260,9 @@ Token TextScanner::scanIdentifier(const SourceChar &firstChar)
unreadChar(sourceChar); unreadChar(sourceChar);
QString keyword = text.toLower(); QString keyword = text.toLower();
if (d->m_keywordToSubtypeMap.contains(keyword)) { if (d->m_keywordToSubtypeMap.contains(keyword)) {
return Token(Token::TOKEN_KEYWORD, d->m_keywordToSubtypeMap.value(keyword), text, firstChar.pos); return Token(Token::TokenKeyword, d->m_keywordToSubtypeMap.value(keyword), text, firstChar.pos);
} }
return Token(Token::TOKEN_IDENTIFIER, text, firstChar.pos); return Token(Token::TokenIdentifier, text, firstChar.pos);
} }
text += sourceChar.ch; text += sourceChar.ch;
} }
...@@ -277,7 +277,7 @@ Token TextScanner::scanColorIdentifier(const SourceChar &firstChar) ...@@ -277,7 +277,7 @@ Token TextScanner::scanColorIdentifier(const SourceChar &firstChar)
QChar ch = sourceChar.ch.toLower(); QChar ch = sourceChar.ch.toLower();
if (!(ch.isDigit() || (ch >= QLatin1Char('a') && ch <= QLatin1Char('f')))) { if (!(ch.isDigit() || (ch >= QLatin1Char('a') && ch <= QLatin1Char('f')))) {
unreadChar(sourceChar); unreadChar(sourceChar);
return Token(Token::TOKEN_COLOR, text, firstChar.pos); return Token(Token::TokenColor, text, firstChar.pos);
} }
text += sourceChar.ch; text += sourceChar.ch;
} }
...@@ -311,7 +311,7 @@ Token TextScanner::scanOperator(const SourceChar &firstChar) ...@@ -311,7 +311,7 @@ Token TextScanner::scanOperator(const SourceChar &firstChar)
} }
QMT_CHECK(haveOperator); QMT_CHECK(haveOperator);
Q_UNUSED(haveOperator); // avoid warning in release mode Q_UNUSED(haveOperator); // avoid warning in release mode
return Token(Token::TOKEN_OPERATOR, subtype, op, firstChar.pos); return Token(Token::TokenOperator, subtype, op, firstChar.pos);
} }
text += sourceChar.ch; text += sourceChar.ch;
extraChars.push(sourceChar); extraChars.push(sourceChar);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
namespace qmt { namespace qmt {
Token::Token() Token::Token()
: m_type(TOKEN_UNDEFINED), : m_type(TokenUndefined),
m_subtype(0) m_subtype(0)
{ {
} }
......
...@@ -42,16 +42,16 @@ class Token ...@@ -42,16 +42,16 @@ class Token
public: public:
enum Type { enum Type {
TOKEN_UNDEFINED, TokenUndefined,
TOKEN_ENDOFINPUT, TokenEndOfInput,
TOKEN_ENDOFLINE, TokenEndOfLine,
TOKEN_STRING, TokenString,
TOKEN_INTEGER, TokenInteger,
TOKEN_FLOAT, TokenFloat,
TOKEN_IDENTIFIER, TokenIdentifier,
TOKEN_KEYWORD, TokenKeyword,
TOKEN_OPERATOR, TokenOperator,
TOKEN_COLOR TokenColor
}; };
public: public:
......
...@@ -37,7 +37,7 @@ namespace qmt { ...@@ -37,7 +37,7 @@ namespace qmt {
DAnnotation::DAnnotation() DAnnotation::DAnnotation()
: DElement(), : DElement(),
m_visualRole(ROLE_NORMAL), m_visualRole(RoleNormal),
m_autoSized(true) m_autoSized(true)
{ {
} }
......
...@@ -44,12 +44,12 @@ class QMT_EXPORT DAnnotation : ...@@ -44,12 +44,12 @@ class QMT_EXPORT DAnnotation :
public: public:
enum VisualRole { enum VisualRole {
ROLE_NORMAL, RoleNormal,
ROLE_TITLE, RoleTitle,
ROLE_SUBTITLE, RoleSubtitle,
ROLE_EMPHASIZED, RoleEmphasized,
ROLE_SOFTEN, RoleSoften,
ROLE_FOOTNOTE RoleFootnote
}; };
public: public:
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
namespace qmt { namespace qmt {
DAssociationEnd::DAssociationEnd() DAssociationEnd::DAssociationEnd()
: m_kind(MAssociationEnd::ASSOCIATION), : m_kind(MAssociationEnd::Association),
m_navigable(false) m_navigable(false)
{ {
} }
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
namespace qmt { namespace qmt {
DClass::DClass() DClass::DClass()
: m_templateDisplay(TEMPLATE_SMART), : m_templateDisplay(TemplateSmart),
m_showAllMembers(false) m_showAllMembers(false)
{ {
} }
......
...@@ -45,9 +45,9 @@ class QMT_EXPORT DClass : ...@@ -45,9 +45,9 @@ class QMT_EXPORT DClass :
public: public:
enum TemplateDisplay { enum TemplateDisplay {
TEMPLATE_SMART, TemplateSmart,
TEMPLATE_BOX, TemplateBox,
TEMPLATE_NAME TemplateName
}; };
public: public:
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
namespace qmt { namespace qmt {
DDependency::DDependency() DDependency::DDependency()
: m_direction(MDependency::A_TO_B) : m_direction(MDependency::AToB)
{ {
} }
...@@ -47,22 +47,22 @@ DDependency::~DDependency() ...@@ -47,22 +47,22 @@ DDependency::~DDependency()
Uid DDependency::source() const Uid DDependency::source() const
{ {
return m_direction == MDependency::B_TO_A ? endBUid() : endAUid(); return m_direction == MDependency::BToA ? endBUid() : endAUid();
} }
void DDependency::setSource(const Uid &source) void DDependency::setSource(const Uid &source)
{ {
m_direction == MDependency::B_TO_A ? setEndBUid(source) : setEndAUid(source); m_direction == MDependency::BToA ? setEndBUid(source) : setEndAUid(source);
} }
Uid DDependency::target() const Uid DDependency::target() const
{ {
return m_direction == MDependency::B_TO_A ? endAUid() : endBUid(); return m_direction == MDependency::BToA ? endAUid() : endBUid();
} }
void DDependency::setTarget(const Uid &target) void DDependency::setTarget(const Uid &target)
{ {
return m_direction == MDependency::B_TO_A ? setEndAUid(target) : setEndBUid(target); return m_direction == MDependency::BToA ? setEndAUid(target) : setEndBUid(target);
} }
void DDependency::setDirection(MDependency::Direction direction) void DDependency::setDirection(MDependency::Direction direction)
......
...@@ -39,9 +39,9 @@ DObject::DObject() ...@@ -39,9 +39,9 @@ DObject::DObject()
: DElement(), : DElement(),
m_modelUid(Uid::invalidUid()), m_modelUid(Uid::invalidUid()),
m_depth(0), m_depth(0),
m_visualPrimaryRole(PRIMARY_ROLE_NORMAL), m_visualPrimaryRole(PrimaryRoleNormal),
m_visualSecondaryRole(SECONDARY_ROLE_NONE), m_visualSecondaryRole(SecondaryRoleNone),
m_stereotypeDisplay(STEREOTYPE_SMART), m_stereotypeDisplay(StereotypeSmart),
m_autoSized(true), m_autoSized(true),
m_visualEmphasized(false) m_visualEmphasized(false)
{ {
......
...@@ -51,32 +51,32 @@ class QMT_EXPORT DObject : ...@@ -51,32 +51,32 @@ class QMT_EXPORT DObject :
public: public:
enum VisualPrimaryRole { enum VisualPrimaryRole {
PRIMARY_ROLE_NORMAL, PrimaryRoleNormal,
DEPRECATED_PRIMARY_ROLE_LIGHTER, DeprecatedPrimaryRoleLighter,
DEPRECATED_PRIMARY_ROLE_DARKER, DeprecatedPrimaryRoleDarker,
DEPRECATED_PRIMARY_ROLE_SOFTEN, DeprecatedPrimaryRoleSoften,
DEPRECATED_PRIMARY_ROLE_OUTLINE, DeprecatedPrimaryRoleOutline,
PRIMARY_ROLE_CUSTOM1, PrimaryRoleCustom1,
PRIMARY_ROLE_CUSTOM2, PrimaryRoleCustom2,
PRIMARY_ROLE_CUSTOM3, PrimaryRoleCustom3,
PRIMARY_ROLE_CUSTOM4, PrimaryRoleCustom4,
PRIMARY_ROLE_CUSTOM5 PrimaryRoleCustom5
}; };
enum VisualSecondaryRole { enum VisualSecondaryRole {
SECONDARY_ROLE_NONE, SecondaryRoleNone,
SECONDARY_ROLE_LIGHTER, SecondaryRoleLighter,
SECONDARY_ROLE_DARKER, SecondaryRoleDarker,
SECONDARY_ROLE_SOFTEN, SecondaryRoleSoften,
SECONDARY_ROLE_OUTLINE SecondaryRoleOutline
}; };
enum StereotypeDisplay { enum StereotypeDisplay {
STEREOTYPE_NONE, StereotypeNone,
STEREOTYPE_LABEL, StereotypeLabel,
STEREOTYPE_DECORATION, StereotypeDecoration,
STEREOTYPE_ICON, StereotypeIcon,
STEREOTYPE_SMART StereotypeSmart
}; };
public: public:
......
...@@ -131,7 +131,7 @@ public: ...@@ -131,7 +131,7 @@ public:
if (diagramKey() != otherUpdateCommand->diagramKey()) { if (diagramKey() != otherUpdateCommand->diagramKey()) {
return false; return false;
} }
if (m_updateAction == DiagramController::UPDATE_MAJOR || otherUpdateCommand->m_updateAction == DiagramController::UPDATE_MAJOR if (m_updateAction == DiagramController::UpdateMajor || otherUpdateCommand->m_updateAction == DiagramController::UpdateMajor
|| m_updateAction != otherUpdateCommand->m_updateAction) { || m_updateAction != otherUpdateCommand->m_updateAction) {
return false; return false;
} }
......
...@@ -64,9 +64,9 @@ class QMT_EXPORT DiagramController : ...@@ -64,9 +64,9 @@ class QMT_EXPORT DiagramController :
public: public:
enum UpdateAction { enum UpdateAction {
UPDATE_GEOMETRY, // update only position and size of element UpdateGeometry, // update only position and size of element
UPDATE_MAJOR, // a major update of the element which will create a separate undo command UpdateMajor, // a major update of the element which will create a separate undo command
UPDATE_MINOR // a minor update of the element which may be merged with other minor updates in one undo command UpdateMinor // a minor update of the element which may be merged with other minor updates in one undo command
}; };
private: private:
......
...@@ -40,15 +40,15 @@ class IAlignable { ...@@ -40,15 +40,15 @@ class IAlignable {
public: public:
enum AlignType { enum AlignType {
ALIGN_LEFT, AlignLeft,
ALIGN_RIGHT, AlignRight,
ALIGN_TOP, AlignTop,
ALIGN_BOTTOM, AlignBottom,
ALIGN_HCENTER, AlignHcenter,
ALIGN_VCENTER, AlignVcenter,
ALIGN_WIDTH, AlignWidth,
ALIGN_HEIGHT, AlignHeight,
ALIGN_SIZE AlignSize
}; };
public: public:
......
...@@ -39,26 +39,26 @@ class ILatchable { ...@@ -39,26 +39,26 @@ class ILatchable {
public: public:
enum Action { enum Action {
MOVE, Move,
RESIZE_LEFT, ResizeLeft,
RESIZE_TOP, ResizeTop,
RESIZE_RIGHT, ResizeRight,
RESIZE_BOTTOM ResizeBottom
}; };
enum LatchType { enum LatchType {
NONE, None,
LEFT, Left,
TOP, Top,
RIGHT, Right,
BOTTOM, Bottom,
HCENTER, Hcenter,
VCENTER Vcenter
}; };
struct Latch { struct Latch {
Latch() Latch()
: m_latchType(NONE), : m_latchType(None),
m_pos(0.0), m_pos(0.0),
m_otherPos1(0.0), m_otherPos1(0.0),
m_otherPos2(0.0), m_otherPos2(0.0),
......
...@@ -46,9 +46,9 @@ class IResizable { ...@@ -46,9 +46,9 @@ class IResizable {
public: public:
enum Side { enum Side {
SIDE_NONE, SideNone,
SIDE_LEFT_OR_TOP, SideLeftOrTop,
SIDE_RIGHT_OR_BOTTOM SideRightOrBottom
}; };
public: public:
......
...@@ -112,7 +112,7 @@ DiagramSceneModel::DiagramSceneModel(QObject *parent) ...@@ -112,7 +112,7 @@ DiagramSceneModel::DiagramSceneModel(QObject *parent)
m_diagram(0), m_diagram(0),
m_graphicsScene(new DiagramGraphicsScene(this)), m_graphicsScene(new DiagramGraphicsScene(this)),
m_latchController(new LatchController(this)), m_latchController(new LatchController(this)),
m_busy(NOT_BUSY), m_busy(NotBusy),
m_originItem(new OriginItem()), m_originItem(new OriginItem()),
m_focusItem(0) m_focusItem(0)
{ {
...@@ -128,7 +128,7 @@ DiagramSceneModel::DiagramSceneModel(QObject *parent) ...@@ -128,7 +128,7 @@ DiagramSceneModel::DiagramSceneModel(QObject *parent)
DiagramSceneModel::~DiagramSceneModel() DiagramSceneModel::~DiagramSceneModel()
{ {
QMT_CHECK(m_busy == NOT_BUSY); QMT_CHECK(m_busy == NotBusy);
m_latchController->removeFromGraphicsScene(m_graphicsScene); m_latchController->removeFromGraphicsScene(m_graphicsScene);
disconnect(); disconnect();
if (m_diagramController) { if (m_diagramController) {
...@@ -515,7 +515,7 @@ QList<QGraphicsItem *> DiagramSceneModel::collectCollidingObjectItems(const QGra ...@@ -515,7 +515,7 @@ QList<QGraphicsItem *> DiagramSceneModel::collectCollidingObjectItems(const QGra
rect.translate(resizable->pos()); rect.translate(resizable->pos());
switch (collidingMode) { switch (collidingMode) {
case COLLIDING_INNER_ITEMS: case CollidingInnerItems:
foreach (QGraphicsItem *candidate, m_graphicsItems) { foreach (QGraphicsItem *candidate, m_graphicsItems) {
if (const IResizable *candidateResizable = dynamic_cast<const IResizable *>(candidate)) { if (const IResizable *candidateResizable = dynamic_cast<const IResizable *>(candidate)) {
QRectF candidateRect = candidateResizable->rect(); QRectF candidateRect = candidateResizable->rect();
...@@ -527,7 +527,7 @@ QList<QGraphicsItem *> DiagramSceneModel::collectCollidingObjectItems(const QGra ...@@ -527,7 +527,7 @@ QList<QGraphicsItem *> DiagramSceneModel::collectCollidingObjectItems(const QGra
} }
} }
break; break;
case COLLIDING_ITEMS: case CollidingItems:
foreach (QGraphicsItem *candidate, m_graphicsItems) { foreach (QGraphicsItem *candidate, m_graphicsItems) {
if (const IResizable *candidateResizable = dynamic_cast<const IResizable *>(candidate)) { if (const IResizable *candidateResizable = dynamic_cast<const IResizable *>(candidate)) {
QRectF candidateRect = candidateResizable->rect(); QRectF candidateRect = candidateResizable->rect();
...@@ -539,7 +539,7 @@ QList<QGraphicsItem *> DiagramSceneModel::collectCollidingObjectItems(const QGra ...@@ -539,7 +539,7 @@ QList<QGraphicsItem *> DiagramSceneModel::collectCollidingObjectItems(const QGra
} }
} }
break; break;
case COLLIDING_OUTER_ITEMS: case CollidingOuterItems:
foreach (QGraphicsItem *candidate, m_graphicsItems) { foreach (QGraphicsItem *candidate, m_graphicsItems) {
if (const IResizable *candidateResizable = dynamic_cast<const IResizable *>(candidate)) { if (const IResizable *candidateResizable = dynamic_cast<const IResizable *>(candidate)) {
QRectF candidateRect = candidateResizable->rect(); QRectF candidateRect = candidateResizable->rect();
...@@ -653,8 +653,8 @@ void DiagramSceneModel::onEndResetAllDiagrams() ...@@ -653,8 +653,8 @@ void DiagramSceneModel::onEndResetAllDiagrams()
void DiagramSceneModel::onBeginResetDiagram(const MDiagram *diagram) void DiagramSceneModel::onBeginResetDiagram(const MDiagram *diagram)
{ {
QMT_CHECK(m_busy == NOT_BUSY); QMT_CHECK(m_busy == NotBusy);
m_busy = RESET_DIAGRAM; m_busy = ResetDiagram;
if (diagram == m_diagram) { if (diagram == m_diagram) {
clearGraphicsScene(); clearGraphicsScene();
} }
...@@ -662,7 +662,7 @@ void DiagramSceneModel::onBeginResetDiagram(const MDiagram *diagram) ...@@ -662,7 +662,7 @@ void DiagramSceneModel::onBeginResetDiagram(const MDiagram *diagram)
void DiagramSceneModel::onEndResetDiagram(const MDiagram *diagram) void DiagramSceneModel::onEndResetDiagram(const MDiagram *diagram)
{ {
QMT_CHECK(m_busy == RESET_DIAGRAM); QMT_CHECK(m_busy == ResetDiagram);
if (diagram == m_diagram) { if (diagram == m_diagram) {
QMT_CHECK(m_graphicsItems.size() == 0); QMT_CHECK(m_graphicsItems.size() == 0);
// create all items and update graphics item from element initially // create all items and update graphics item from element initially
...@@ -678,39 +678,39 @@ void DiagramSceneModel::onEndResetDiagram(const MDiagram *diagram) ...@@ -678,39 +678,39 @@ void DiagramSceneModel::onEndResetDiagram(const MDiagram *diagram)
updateGraphicsItem(m_elementToItemMap.value(element), element); updateGraphicsItem(