From ecda76193d22fe3b92eada50307de9c96c0872d6 Mon Sep 17 00:00:00 2001
From: Walter Van Herck <w.van.herck@fz-juelich.de>
Date: Mon, 12 Jan 2015 14:42:07 +0100
Subject: [PATCH] Rename enumerations and enumerators (5)

---
 GUI/coregui/Models/DomainObjectBuilder.cpp    |  4 +--
 GUI/coregui/Models/GUIObjectBuilder.cpp       |  4 +--
 .../Models/InterferenceFunctionItems.cpp      |  6 ++--
 GUI/coregui/Models/JobItem.h                  | 34 ++++++++++++++-----
 GUI/coregui/Models/LayerItem.cpp              |  2 +-
 GUI/coregui/Models/ParameterizedItem.cpp      |  4 +--
 GUI/coregui/Models/ParameterizedItem.h        | 11 ++++--
 GUI/coregui/Models/ParticleCoreShellItem.cpp  |  6 ++--
 .../Models/ParticleDistributionItem.cpp       |  6 ++--
 GUI/coregui/Models/ParticleItem.cpp           |  4 +--
 GUI/coregui/Models/ParticleLayoutItem.cpp     | 14 ++++----
 GUI/coregui/Models/SessionModel.cpp           |  6 ++--
 GUI/coregui/Models/SessionModel.h             |  4 +--
 GUI/coregui/Models/TransformationItem.cpp     |  2 +-
 14 files changed, 65 insertions(+), 42 deletions(-)

diff --git a/GUI/coregui/Models/DomainObjectBuilder.cpp b/GUI/coregui/Models/DomainObjectBuilder.cpp
index e7708bb9575..08468964764 100644
--- a/GUI/coregui/Models/DomainObjectBuilder.cpp
+++ b/GUI/coregui/Models/DomainObjectBuilder.cpp
@@ -274,10 +274,10 @@ ParticleCoreShell *DomainObjectBuilder::buildParticleCoreShell(const Parameteriz
     for (int i=0; i<children.size(); ++i) {
         double tmp_depth(0), tmp_abundance(0);
         int port = children[i]->getRegisteredProperty(ParameterizedItem::P_PORT).toInt();
-        if(port == ParameterizedItem::PortInfo::Port0) {
+        if(port == ParameterizedItem::PortInfo::PORT_0) {
             coreParticle = buildParticle(*children[i], tmp_depth, tmp_abundance);
         }
-        else if(port == ParameterizedItem::PortInfo::Port1) {
+        else if(port == ParameterizedItem::PortInfo::PORT_1) {
             shellParticle = buildParticle(*children[i], tmp_depth, tmp_abundance);
         }
         else {
diff --git a/GUI/coregui/Models/GUIObjectBuilder.cpp b/GUI/coregui/Models/GUIObjectBuilder.cpp
index 1c42f576c5d..8de04c501f8 100644
--- a/GUI/coregui/Models/GUIObjectBuilder.cpp
+++ b/GUI/coregui/Models/GUIObjectBuilder.cpp
@@ -208,7 +208,7 @@ void GUIObjectBuilder::visit(const Particle *sample)
         if(sample == coreshell->getCoreParticle()) {
             particleItem = m_sampleModel->insertNewItem(Constants::ParticleType,
                 m_sampleModel->indexOfItem(parent), -1,
-                ParameterizedItem::PortInfo::Port0);
+                ParameterizedItem::PortInfo::PORT_0);
             const Geometry::Transform3D *p_transformation =
                     sample->getPTransform3D();
             if (p_transformation) {
@@ -222,7 +222,7 @@ void GUIObjectBuilder::visit(const Particle *sample)
         else if(sample == coreshell->getShellParticle()) {
             particleItem = m_sampleModel->insertNewItem(Constants::ParticleType,
                 m_sampleModel->indexOfItem(parent), -1,
-                ParameterizedItem::PortInfo::Port1);
+                ParameterizedItem::PortInfo::PORT_1);
             const Geometry::Transform3D *p_transformation =
                     sample->getPTransform3D();
             if (p_transformation) {
diff --git a/GUI/coregui/Models/InterferenceFunctionItems.cpp b/GUI/coregui/Models/InterferenceFunctionItems.cpp
index e6c20434801..4fbd89f50b2 100644
--- a/GUI/coregui/Models/InterferenceFunctionItems.cpp
+++ b/GUI/coregui/Models/InterferenceFunctionItems.cpp
@@ -39,7 +39,7 @@ InterferenceFunction1DParaCrystalItem::InterferenceFunction1DParaCrystalItem(
                                 parent)
 {
     setItemName(Constants::InterferenceFunction1DParaCrystalType);
-    setItemPort(ParameterizedItem::PortInfo::Port1);
+    setItemPort(ParameterizedItem::PortInfo::PORT_1);
     registerProperty(P_PEAK_DISTANCE, 20.0*Units::nanometer);
     registerProperty(P_DAMPING_LENGTH, 1000.0*Units::micrometer);
     registerProperty(P_DOMAIN_SIZE, 20.0*Units::micrometer);
@@ -54,7 +54,7 @@ InterferenceFunction2DParaCrystalItem::InterferenceFunction2DParaCrystalItem(
                                 parent)
 {
     setItemName(Constants::InterferenceFunction2DParaCrystalType);
-    setItemPort(ParameterizedItem::PortInfo::Port1);
+    setItemPort(ParameterizedItem::PortInfo::PORT_1);
     registerGroupProperty(P_LATTICE_TYPE, Constants::LatticeGroup);
 
     registerProperty(P_DAMPING_LENGTH, 0.0);
@@ -87,7 +87,7 @@ InterferenceFunction2DLatticeItem::InterferenceFunction2DLatticeItem(
                                 parent)
 {
     setItemName(Constants::InterferenceFunction2DLatticeType);
-    setItemPort(ParameterizedItem::PortInfo::Port1);
+    setItemPort(ParameterizedItem::PortInfo::PORT_1);
     registerGroupProperty(P_LATTICE_TYPE, Constants::LatticeGroup);
 
     registerProperty(P_ROTATION_ANGLE, 0.0);
diff --git a/GUI/coregui/Models/JobItem.h b/GUI/coregui/Models/JobItem.h
index 1e57dc79e10..cc2244bfd04 100644
--- a/GUI/coregui/Models/JobItem.h
+++ b/GUI/coregui/Models/JobItem.h
@@ -33,7 +33,8 @@ public:
     };
 
     JobItem(const QString &name);
-    JobItem(SampleModel *sampleModel, InstrumentModel *instrumentModel, const QString &run_policy = QString());
+    JobItem(SampleModel *sampleModel, InstrumentModel *instrumentModel,
+            const QString &run_policy = QString());
 
     virtual ~JobItem();
 
@@ -82,13 +83,30 @@ signals:
 
 public slots:
     void setName(QString name);
-    void setBeginTime(QString begin_time) { m_begin_time = begin_time; emit modified(this);}
-    void setEndTime(QString end_time) { m_end_time = end_time; emit modified(this);}
-    void setComments(QString comments) { m_comments = comments; emit modified(this);}
-    void setStatus(EJobStatus status) { m_status = status; emit modified(this);}
-    void setProgress(int progress) { m_progress = progress; emit modified(this); }
-
-    void onDataItemModified() { emit modified(this); }
+    void setBeginTime(QString begin_time) {
+        m_begin_time = begin_time;
+        emit modified(this);
+    }
+    void setEndTime(QString end_time) {
+        m_end_time = end_time;
+        emit modified(this);
+    }
+    void setComments(QString comments) {
+        m_comments = comments;
+        emit modified(this);
+    }
+    void setStatus(EJobStatus status) {
+        m_status = status;
+        emit modified(this);
+    }
+    void setProgress(int progress) {
+        m_progress = progress;
+        emit modified(this);
+    }
+
+    void onDataItemModified() {
+        emit modified(this);
+    }
 
 private:
     void clear();
diff --git a/GUI/coregui/Models/LayerItem.cpp b/GUI/coregui/Models/LayerItem.cpp
index 233263e9510..f8625a06058 100644
--- a/GUI/coregui/Models/LayerItem.cpp
+++ b/GUI/coregui/Models/LayerItem.cpp
@@ -29,5 +29,5 @@ LayerItem::LayerItem(ParameterizedItem *parent)
 
     registerGroupProperty(P_ROUGHNESS, Constants::LayerRoughnessGroup);
     setGroupProperty(P_ROUGHNESS, Constants::LayerZeroRoughnessType);
-    addToValidChildren(Constants::ParticleLayoutType, PortInfo::Port0);
+    addToValidChildren(Constants::ParticleLayoutType, PortInfo::PORT_0);
 }
diff --git a/GUI/coregui/Models/ParameterizedItem.cpp b/GUI/coregui/Models/ParameterizedItem.cpp
index ebd2bdb01e6..45de23c3526 100644
--- a/GUI/coregui/Models/ParameterizedItem.cpp
+++ b/GUI/coregui/Models/ParameterizedItem.cpp
@@ -138,7 +138,7 @@ ParameterizedItem *ParameterizedItem::getCandidateForRemoval(ParameterizedItem *
     return 0;
 }
 
-void ParameterizedItem::setItemPort(ParameterizedItem::PortInfo::Keys nport)
+void ParameterizedItem::setItemPort(ParameterizedItem::PortInfo::EPorts nport)
 {
     setRegisteredProperty(P_PORT, nport);
 }
@@ -163,7 +163,7 @@ void ParameterizedItem::onPropertyItemChanged(const QString & /*propertyName*/)
 }
 
 
-void ParameterizedItem::addToValidChildren(const QString &name, PortInfo::Keys nport, int nmax_items)
+void ParameterizedItem::addToValidChildren(const QString &name, PortInfo::EPorts nport, int nmax_items)
 {
     m_valid_children.append(name);
 
diff --git a/GUI/coregui/Models/ParameterizedItem.h b/GUI/coregui/Models/ParameterizedItem.h
index e7a80a5e092..64795b87646 100644
--- a/GUI/coregui/Models/ParameterizedItem.h
+++ b/GUI/coregui/Models/ParameterizedItem.h
@@ -110,13 +110,18 @@ public:
 
     class PortInfo {
     public:
-        enum Keys { PortDef=-1, Port0=0, Port1=1, Port2=2};
+        enum EPorts {
+            DEFAULT = -1,
+            PORT_0 = 0,
+            PORT_1 = 1,
+            PORT_2 = 2
+        };
         PortInfo(const QString &name=QString(), int nmax_items=0) : m_item_names(name), m_item_max_number(nmax_items){}
         QStringList m_item_names;
         int m_item_max_number;
     };
 
-    void setItemPort(PortInfo::Keys nport);
+    void setItemPort(PortInfo::EPorts nport);
 
     virtual QString getItemLabel() const { return QString("no label"); }
 
@@ -134,7 +139,7 @@ signals:
     void propertyItemChanged(const QString &propertyName);
 
 protected:
-    void addToValidChildren(const QString &name, PortInfo::Keys nport = PortInfo::Port0, int nmax_children = 0);
+    void addToValidChildren(const QString &name, PortInfo::EPorts nport = PortInfo::PORT_0, int nmax_children = 0);
     void setPropertyAttribute(const QString &name, const PropertyAttribute &attribute);
 
     QStringList m_registered_properties;
diff --git a/GUI/coregui/Models/ParticleCoreShellItem.cpp b/GUI/coregui/Models/ParticleCoreShellItem.cpp
index 8963dac3625..9df31938f05 100644
--- a/GUI/coregui/Models/ParticleCoreShellItem.cpp
+++ b/GUI/coregui/Models/ParticleCoreShellItem.cpp
@@ -10,14 +10,14 @@ ParticleCoreShellItem::ParticleCoreShellItem(ParameterizedItem *parent)
     : ParameterizedGraphicsItem(Constants::ParticleCoreShellType, parent)
 {
     setItemName(Constants::ParticleCoreShellType);
-    setItemPort(ParameterizedItem::PortInfo::Port0);
+    setItemPort(ParameterizedItem::PortInfo::PORT_0);
     registerProperty(ParticleItem::P_DEPTH, 0.0);
     registerProperty(ParticleItem::P_ABUNDANCE, 1.0, PropertyAttribute(AttLimits::limited(0.0, 1.0),3));
 
     registerGroupProperty(P_CORE_POS, Constants::VectorType);
 
-    addToValidChildren(Constants::ParticleType, PortInfo::Port0, 1);
-    addToValidChildren(Constants::ParticleType, PortInfo::Port1, 1);
+    addToValidChildren(Constants::ParticleType, PortInfo::PORT_0, 1);
+    addToValidChildren(Constants::ParticleType, PortInfo::PORT_1, 1);
 }
 
 void ParticleCoreShellItem::insertChildItem(int row, ParameterizedItem *item)
diff --git a/GUI/coregui/Models/ParticleDistributionItem.cpp b/GUI/coregui/Models/ParticleDistributionItem.cpp
index b3129eb4c8d..57ebdd8bb98 100644
--- a/GUI/coregui/Models/ParticleDistributionItem.cpp
+++ b/GUI/coregui/Models/ParticleDistributionItem.cpp
@@ -30,14 +30,14 @@ ParticleDistributionItem::ParticleDistributionItem(ParameterizedItem *parent)
     : ParameterizedGraphicsItem(Constants::ParticleDistributionType, parent)
 {
     setItemName(Constants::ParticleDistributionType);
-    setItemPort(ParameterizedItem::PortInfo::Port0);
+    setItemPort(ParameterizedItem::PortInfo::PORT_0);
 
     registerGroupProperty(P_DISTRIBUTION, Constants::DistributionGroup);
     registerProperty(P_SAMPLE_NUMBER, 5);
     registerProperty(P_SIGMA_FACTOR, 2.0);
 
-    addToValidChildren(Constants::ParticleType, PortInfo::Port0);
-    addToValidChildren(Constants::ParticleCoreShellType, PortInfo::Port0);
+    addToValidChildren(Constants::ParticleType, PortInfo::PORT_0);
+    addToValidChildren(Constants::ParticleCoreShellType, PortInfo::PORT_0);
 
     registerProperty(P_CACHED_SELECTED_PARAMETER, QString("None"),
                      PropertyAttribute::hiddenProperty());
diff --git a/GUI/coregui/Models/ParticleItem.cpp b/GUI/coregui/Models/ParticleItem.cpp
index 2e4735da3be..626146e78bf 100644
--- a/GUI/coregui/Models/ParticleItem.cpp
+++ b/GUI/coregui/Models/ParticleItem.cpp
@@ -28,7 +28,7 @@ ParticleItem::ParticleItem(ParameterizedItem *parent)
     : ParameterizedGraphicsItem(Constants::ParticleType, parent)
 {
     setItemName(Constants::ParticleType);
-    setItemPort(ParameterizedItem::PortInfo::Port0);
+    setItemPort(ParameterizedItem::PortInfo::PORT_0);
     registerGroupProperty(P_FORM_FACTOR, Constants::FormFactorGroup);
     registerProperty(P_MATERIAL,
                      MaterialUtils::getDefaultMaterialProperty().getVariant());
@@ -36,7 +36,7 @@ ParticleItem::ParticleItem(ParameterizedItem *parent)
     registerProperty(P_ABUNDANCE, 1.0,
                      PropertyAttribute(AttLimits::limited(0.0, 1.0),3));
 
-    addToValidChildren(Constants::TransformationType, PortInfo::Port0, 1);
+    addToValidChildren(Constants::TransformationType, PortInfo::PORT_0, 1);
 
     setPropertyAppearance(ParameterizedItem::P_NAME,
                           PropertyAttribute::VisibleProperty);
diff --git a/GUI/coregui/Models/ParticleLayoutItem.cpp b/GUI/coregui/Models/ParticleLayoutItem.cpp
index ab8cc01fca3..ec3d5ccaa1a 100644
--- a/GUI/coregui/Models/ParticleLayoutItem.cpp
+++ b/GUI/coregui/Models/ParticleLayoutItem.cpp
@@ -24,18 +24,18 @@ ParticleLayoutItem::ParticleLayoutItem(ParameterizedItem *parent)
     : ParameterizedGraphicsItem(Constants::ParticleLayoutType, parent)
 {
     setItemName(Constants::ParticleLayoutType);
-    setItemPort(ParameterizedItem::PortInfo::Port0);
+    setItemPort(ParameterizedItem::PortInfo::PORT_0);
 
     ComboProperty approx;
     approx << "Decoupling Approximation" << "Size Space Coupling Approximation";
     registerProperty(P_APPROX, approx.getVariant());
 
-    addToValidChildren(Constants::ParticleType, PortInfo::Port0);
-    addToValidChildren(Constants::ParticleCoreShellType, PortInfo::Port0);
-    addToValidChildren(Constants::ParticleDistributionType, PortInfo::Port0);
-    addToValidChildren(Constants::InterferenceFunction1DParaCrystalType, PortInfo::Port1, 1);
-    addToValidChildren(Constants::InterferenceFunction2DParaCrystalType, PortInfo::Port1, 1);
-    addToValidChildren(Constants::InterferenceFunction2DLatticeType, PortInfo::Port1, 1);
+    addToValidChildren(Constants::ParticleType, PortInfo::PORT_0);
+    addToValidChildren(Constants::ParticleCoreShellType, PortInfo::PORT_0);
+    addToValidChildren(Constants::ParticleDistributionType, PortInfo::PORT_0);
+    addToValidChildren(Constants::InterferenceFunction1DParaCrystalType, PortInfo::PORT_1, 1);
+    addToValidChildren(Constants::InterferenceFunction2DParaCrystalType, PortInfo::PORT_1, 1);
+    addToValidChildren(Constants::InterferenceFunction2DLatticeType, PortInfo::PORT_1, 1);
 }
 
 ParticleLayoutItem::~ParticleLayoutItem()
diff --git a/GUI/coregui/Models/SessionModel.cpp b/GUI/coregui/Models/SessionModel.cpp
index 286826a14ae..125c54e47cc 100644
--- a/GUI/coregui/Models/SessionModel.cpp
+++ b/GUI/coregui/Models/SessionModel.cpp
@@ -249,7 +249,7 @@ QModelIndex SessionModel::indexOfItem(ParameterizedItem *item) const
 ParameterizedItem *SessionModel::insertNewItem(QString model_type,
                                                const QModelIndex &parent,
                                                int row,
-                                               ParameterizedItem::PortInfo::Keys port)
+                                               ParameterizedItem::PortInfo::EPorts port)
 {
     if (!m_root_item) {
         m_root_item = ItemFactory::createEmptyItem();
@@ -413,7 +413,7 @@ SessionModel *SessionModel::createCopy(ParameterizedItem *parent)
 ParameterizedItem *SessionModel::insertNewItem(QString model_type,
                                                ParameterizedItem *parent,
                                                int row,
-                                               ParameterizedItem::PortInfo::Keys port)
+                                               ParameterizedItem::PortInfo::EPorts port)
 {
     if (!m_root_item) {
         m_root_item = ItemFactory::createEmptyItem();
@@ -427,7 +427,7 @@ ParameterizedItem *SessionModel::insertNewItem(QString model_type,
     }
 
     ParameterizedItem *new_item = ItemFactory::createItem(model_type);
-    if(port != ParameterizedItem::PortInfo::PortDef)
+    if(port != ParameterizedItem::PortInfo::DEFAULT)
         new_item->setItemPort(port);
 
     if(!new_item)
diff --git a/GUI/coregui/Models/SessionModel.h b/GUI/coregui/Models/SessionModel.h
index c051f14cccb..c6c9b8413c9 100644
--- a/GUI/coregui/Models/SessionModel.h
+++ b/GUI/coregui/Models/SessionModel.h
@@ -90,7 +90,7 @@ public:
     QModelIndex indexOfItem(ParameterizedItem *item) const;
     ParameterizedItem *insertNewItem(QString model_type,
                                      const QModelIndex &parent=QModelIndex(),
-                                     int row=-1, ParameterizedItem::PortInfo::Keys port = ParameterizedItem::PortInfo::PortDef);
+                                     int row=-1, ParameterizedItem::PortInfo::EPorts port = ParameterizedItem::PortInfo::DEFAULT);
 
     QString getModelTag() const { return m_model_tag; }
     QString getModelName() const { return m_name; }
@@ -138,7 +138,7 @@ private:
     ParameterizedItem *insertNewItem(QString model_type,
                                      ParameterizedItem *parent,
                                      int row=-1,
-                                     ParameterizedItem::PortInfo::Keys port = ParameterizedItem::PortInfo::PortDef);
+                                     ParameterizedItem::PortInfo::EPorts port = ParameterizedItem::PortInfo::DEFAULT);
     void readItems(QXmlStreamReader *reader, ParameterizedItem *item,
                    int row=-1);
     QString readProperty(QXmlStreamReader *reader, ParameterizedItem *item);
diff --git a/GUI/coregui/Models/TransformationItem.cpp b/GUI/coregui/Models/TransformationItem.cpp
index b3bb5d6aaca..36de07f1ec2 100644
--- a/GUI/coregui/Models/TransformationItem.cpp
+++ b/GUI/coregui/Models/TransformationItem.cpp
@@ -11,7 +11,7 @@ TransformationItem::TransformationItem(ParameterizedItem *parent)
     : ParameterizedGraphicsItem(Constants::TransformationType, parent)
 {
     setItemName(Constants::TransformationType);
-    setItemPort(ParameterizedItem::PortInfo::Port0);
+    setItemPort(ParameterizedItem::PortInfo::PORT_0);
 
     registerGroupProperty(P_POS, Constants::VectorType);
     registerGroupProperty(P_ROT, Constants::RotationGroup );
-- 
GitLab