From 1310c3e8bbcaad9bd52a0faa385bc31ee4582130 Mon Sep 17 00:00:00 2001
From: Tobias Knopff <t.knopff@fz-juelich.de>
Date: Wed, 30 Jun 2021 15:20:39 +0200
Subject: [PATCH] Renamed parameter and member to clarify that model type names
 are meant

---
 .../SampleDesigner/SampleViewFactory.cpp      | 38 +++++++++----------
 GUI/Views/SampleDesigner/SampleViewFactory.h  |  6 +--
 2 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/GUI/Views/SampleDesigner/SampleViewFactory.cpp b/GUI/Views/SampleDesigner/SampleViewFactory.cpp
index dc3f6da0924..06b89cae541 100644
--- a/GUI/Views/SampleDesigner/SampleViewFactory.cpp
+++ b/GUI/Views/SampleDesigner/SampleViewFactory.cpp
@@ -24,7 +24,7 @@
 #include "GUI/Views/SampleDesigner/ParticleView.h"
 #include "GUI/Views/SampleDesigner/TransformationView.h"
 
-QStringList SampleViewFactory::m_valid_item_names = QStringList()
+QStringList SampleViewFactory::m_valid_item_types = QStringList()
                                                     << "MultiLayer"
                                                     << LayerItem::M_TYPE
                                                     << "ParticleLayout"
@@ -40,44 +40,44 @@ QStringList SampleViewFactory::m_valid_item_names = QStringList()
                                                     << "InterferenceHardDisk"
                                                     << "InterferenceRadialParaCrystal";
 
-bool SampleViewFactory::isValidType(const QString& name)
+bool SampleViewFactory::isValidType(const QString& model_type)
 {
-    if (name.startsWith("FormFactor")) {
+    if (model_type.startsWith("FormFactor")) {
         return true;
     } else {
-        return m_valid_item_names.contains(name);
+        return m_valid_item_types.contains(model_type);
     }
 }
 
-IView* SampleViewFactory::createSampleView(const QString& name)
+IView* SampleViewFactory::createSampleView(const QString& model_type)
 {
-    if (name == "MultiLayer") {
+    if (model_type == "MultiLayer") {
         return new MultiLayerView();
-    } else if (name == LayerItem::M_TYPE) {
+    } else if (model_type == LayerItem::M_TYPE) {
         return new LayerView();
-    } else if (name == "ParticleLayout") {
+    } else if (model_type == "ParticleLayout") {
         return new ParticleLayoutView();
-    } else if (name == "Particle") {
+    } else if (model_type == "Particle") {
         return new ParticleView();
-    } else if (name == "Rotation") {
+    } else if (model_type == "Rotation") {
         return new TransformationView();
-    } else if (name == "ParticleCoreShell") {
+    } else if (model_type == "ParticleCoreShell") {
         return new ParticleCoreShellView();
-    } else if (name == "ParticleComposition") {
+    } else if (model_type == "ParticleComposition") {
         return new ParticleCompositionView();
-    } else if (name == "MesoCrystal") {
+    } else if (model_type == "MesoCrystal") {
         return new MesoCrystalView();
-    } else if (name == "Interference1DLattice") {
+    } else if (model_type == "Interference1DLattice") {
         return new InterferenceFunction1DLatticeView();
-    } else if (name == "Interference2DLattice") {
+    } else if (model_type == "Interference2DLattice") {
         return new InterferenceFunction2DLatticeView();
-    } else if (name == "Interference2DParaCrystal") {
+    } else if (model_type == "Interference2DParaCrystal") {
         return new InterferenceFunction2DParaCrystalView();
-    } else if (name == "InterferenceFinite2DLattice") {
+    } else if (model_type == "InterferenceFinite2DLattice") {
         return new InterferenceFunctionFinite2DLatticeView();
-    } else if (name == "InterferenceHardDisk") {
+    } else if (model_type == "InterferenceHardDisk") {
         return new InterferenceFunctionHardDiskView();
-    } else if (name == "InterferenceRadialParaCrystal") {
+    } else if (model_type == "InterferenceRadialParaCrystal") {
         return new InterferenceFunctionRadialParaCrystalView();
     }
     return 0;
diff --git a/GUI/Views/SampleDesigner/SampleViewFactory.h b/GUI/Views/SampleDesigner/SampleViewFactory.h
index c6054d762ae..ecb769fa2f6 100644
--- a/GUI/Views/SampleDesigner/SampleViewFactory.h
+++ b/GUI/Views/SampleDesigner/SampleViewFactory.h
@@ -22,13 +22,13 @@ class IView;
 
 class SampleViewFactory {
 public:
-    static bool isValidType(const QString& name);
-    static IView* createSampleView(const QString& name);
+    static bool isValidType(const QString& model_type);
+    static IView* createSampleView(const QString& model_type);
 
     static bool isValidExampleName();
 
 private:
-    static QStringList m_valid_item_names;
+    static QStringList m_valid_item_types;
 };
 
 #endif // BORNAGAIN_GUI_VIEWS_SAMPLEDESIGNER_SAMPLEVIEWFACTORY_H
-- 
GitLab