From 98541057ce244aa072eae4c2d31a174487b01a20 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Tue, 13 Feb 2024 11:55:15 +0100
Subject: [PATCH 1/4] resolve auto

---
 GUI/View/Views/InstrumentView.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/GUI/View/Views/InstrumentView.cpp b/GUI/View/Views/InstrumentView.cpp
index ee652cc1927..74b81242843 100644
--- a/GUI/View/Views/InstrumentView.cpp
+++ b/GUI/View/Views/InstrumentView.cpp
@@ -100,7 +100,7 @@ void InstrumentView::hideEvent(QHideEvent*)
 
 void InstrumentView::createWidgetsForCurrentInstrument()
 {
-    auto* currentInstrument = m_listing->currentInstrumentItem();
+    InstrumentItem* currentInstrument = m_listing->currentInstrumentItem();
     if (!currentInstrument) {
         m_scroll_area->setWidget(new QWidget(m_scroll_area)); // blank widget
         return;
-- 
GitLab


From 11e8c83a8feaa9bf4586ecfa8abf840a50708a36 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Tue, 13 Feb 2024 11:57:49 +0100
Subject: [PATCH 2/4] rename class and sources
 GUI/Model/Device/InstrumentItemCatalog -> GUI/Model/Device/InstrumentsCatalog

---
 GUI/Model/Device/InstrumentItems.cpp               |  6 +++---
 GUI/Model/Device/InstrumentXML.cpp                 | 10 +++++-----
 ...umentItemCatalog.cpp => InstrumentsCatalog.cpp} | 14 +++++++-------
 ...nstrumentItemCatalog.h => InstrumentsCatalog.h} | 12 ++++++------
 GUI/Model/Device/InstrumentsSet.h                  |  4 ++--
 GUI/Model/Job/JobItem.h                            |  4 ++--
 6 files changed, 25 insertions(+), 25 deletions(-)
 rename GUI/Model/Device/{InstrumentItemCatalog.cpp => InstrumentsCatalog.cpp} (79%)
 rename GUI/Model/Device/{InstrumentItemCatalog.h => InstrumentsCatalog.h} (78%)

diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp
index 4e79ea8e80d..1a123631984 100644
--- a/GUI/Model/Device/InstrumentItems.cpp
+++ b/GUI/Model/Device/InstrumentItems.cpp
@@ -34,8 +34,8 @@
 #include "GUI/Model/Detector/OffspecDetectorItem.h"
 #include "GUI/Model/Device/BackgroundItems.h"
 #include "GUI/Model/Device/DatafileItem.h"
-#include "GUI/Model/Device/InstrumentItemCatalog.h"
 #include "GUI/Model/Device/InstrumentItems.h"
+#include "GUI/Model/Device/InstrumentsCatalog.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/XML/Backup.h"
 #include "Param/Distrib/Distributions.h"
@@ -109,8 +109,8 @@ InstrumentItem::InstrumentItem()
 
 InstrumentItem* InstrumentItem::createItemCopy() const
 {
-    const auto type = InstrumentItemCatalog::type(this);
-    auto* copy = InstrumentItemCatalog::create(type);
+    const auto type = InstrumentsCatalog::type(this);
+    auto* copy = InstrumentsCatalog::create(type);
     GUI::Util::copyContents(this, copy);
     return copy;
 }
diff --git a/GUI/Model/Device/InstrumentXML.cpp b/GUI/Model/Device/InstrumentXML.cpp
index c9c45869dd7..be370e2cf19 100644
--- a/GUI/Model/Device/InstrumentXML.cpp
+++ b/GUI/Model/Device/InstrumentXML.cpp
@@ -15,8 +15,8 @@
 #include "GUI/Model/Device/InstrumentXML.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Descriptor/PolyItem.h"
-#include "GUI/Model/Device/InstrumentItemCatalog.h"
 #include "GUI/Model/Device/InstrumentItems.h"
+#include "GUI/Model/Device/InstrumentsCatalog.h"
 #include "GUI/Support/XML/DeserializationException.h"
 #include "GUI/Support/XML/UtilXML.h"
 #include <QFile>
@@ -40,11 +40,11 @@ void InstrumentXML::save(const QString& fname, InstrumentItem* ii)
     w.writeStartDocument();
     w.writeStartElement(XML_ROOT_TAG);
 
-    const uint typeIndex = static_cast<uint>(InstrumentItemCatalog::type(ii));
+    const uint typeIndex = static_cast<uint>(InstrumentsCatalog::type(ii));
     XML::writeAttribute(&w, XML::Attrib::type, typeIndex);
     // The next line allows to see the name of item type in XML. May be skipped while reading.
     XML::writeAttribute(&w, XML::Attrib::name,
-                        InstrumentItemCatalog::uiInfo(InstrumentItemCatalog::type(ii)).menuEntry);
+                        InstrumentsCatalog::uiInfo(InstrumentsCatalog::type(ii)).menuEntry);
 
     ii->writeTo(&w);
     w.writeEndElement();
@@ -77,8 +77,8 @@ InstrumentItem* InstrumentXML::load(const QString& fname)
     if (found_version != 1)
         throw std::runtime_error("Unsupported version of instrument element");
     const uint typeIndex = XML::readUIntAttribute(&r, XML::Attrib::type);
-    const auto type = static_cast<typename InstrumentItemCatalog::Type>(typeIndex);
-    ii = InstrumentItemCatalog::create(type);
+    const auto type = static_cast<typename InstrumentsCatalog::Type>(typeIndex);
+    ii = InstrumentsCatalog::create(type);
     ASSERT(ii);
     ii->readFrom(&r);
 
diff --git a/GUI/Model/Device/InstrumentItemCatalog.cpp b/GUI/Model/Device/InstrumentsCatalog.cpp
similarity index 79%
rename from GUI/Model/Device/InstrumentItemCatalog.cpp
rename to GUI/Model/Device/InstrumentsCatalog.cpp
index e0df185b445..a00853df361 100644
--- a/GUI/Model/Device/InstrumentItemCatalog.cpp
+++ b/GUI/Model/Device/InstrumentsCatalog.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Device/InstrumentItemCatalog.cpp
-//! @brief     Implements class InstrumentItemCatalog.
+//! @file      GUI/Model/Device/InstrumentsCatalog.cpp
+//! @brief     Implements class InstrumentsCatalog.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,11 +12,11 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Device/InstrumentItemCatalog.h"
+#include "GUI/Model/Device/InstrumentsCatalog.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 
-InstrumentItem* InstrumentItemCatalog::create(Type type)
+InstrumentItem* InstrumentsCatalog::create(Type type)
 {
     switch (type) {
     case Type::GISAS:
@@ -31,12 +31,12 @@ InstrumentItem* InstrumentItemCatalog::create(Type type)
     ASSERT_NEVER;
 }
 
-QVector<InstrumentItemCatalog::Type> InstrumentItemCatalog::types()
+QVector<InstrumentsCatalog::Type> InstrumentsCatalog::types()
 {
     return {Type::GISAS, Type::Offspec, Type::Specular, Type::Depthprobe};
 }
 
-UiInfo InstrumentItemCatalog::uiInfo(Type type)
+UiInfo InstrumentsCatalog::uiInfo(Type type)
 {
     switch (type) {
     case Type::GISAS:
@@ -51,7 +51,7 @@ UiInfo InstrumentItemCatalog::uiInfo(Type type)
     ASSERT_NEVER;
 }
 
-InstrumentItemCatalog::Type InstrumentItemCatalog::type(const InstrumentItem* item)
+InstrumentsCatalog::Type InstrumentsCatalog::type(const InstrumentItem* item)
 {
     if (dynamic_cast<const GISASInstrumentItem*>(item))
         return Type::GISAS;
diff --git a/GUI/Model/Device/InstrumentItemCatalog.h b/GUI/Model/Device/InstrumentsCatalog.h
similarity index 78%
rename from GUI/Model/Device/InstrumentItemCatalog.h
rename to GUI/Model/Device/InstrumentsCatalog.h
index 72a0d04b145..64786dff4f8 100644
--- a/GUI/Model/Device/InstrumentItemCatalog.h
+++ b/GUI/Model/Device/InstrumentsCatalog.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Device/InstrumentItemCatalog.h
-//! @brief     Defines class InstrumentItemCatalog.
+//! @file      GUI/Model/Device/InstrumentsCatalog.h
+//! @brief     Defines class InstrumentsCatalog.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,15 +12,15 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTITEMCATALOG_H
-#define BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTITEMCATALOG_H
+#ifndef BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTSCATALOG_H
+#define BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTSCATALOG_H
 
 #include "GUI/Model/Type/UiInfo.h"
 #include <QVector>
 
 class InstrumentItem;
 
-class InstrumentItemCatalog {
+class InstrumentsCatalog {
 public:
     // used in PolyItem<Catalog>
     using BaseType = InstrumentItem;
@@ -41,4 +41,4 @@ public:
     static Type type(const InstrumentItem* item);
 };
 
-#endif // BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTITEMCATALOG_H
+#endif // BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTSCATALOG_H
diff --git a/GUI/Model/Device/InstrumentsSet.h b/GUI/Model/Device/InstrumentsSet.h
index f85436aa5e5..6c5893ce43a 100644
--- a/GUI/Model/Device/InstrumentsSet.h
+++ b/GUI/Model/Device/InstrumentsSet.h
@@ -16,7 +16,7 @@
 #define BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTSSET_H
 
 #include "GUI/Model/Descriptor/PolyVector.h"
-#include "GUI/Model/Device/InstrumentItemCatalog.h"
+#include "GUI/Model/Device/InstrumentsCatalog.h"
 #include <QObject>
 #include <QVector>
 #include <QXmlStreamWriter>
@@ -78,7 +78,7 @@ signals:
     void instrumentNameChanged(const InstrumentItem* instrument) const;
 
 private:
-    PolyVector<InstrumentItemCatalog> m_instruments;
+    PolyVector<InstrumentsCatalog> m_instruments;
     int m_current_index = -1;
 };
 
diff --git a/GUI/Model/Job/JobItem.h b/GUI/Model/Job/JobItem.h
index e70a00a4647..09034fd518e 100644
--- a/GUI/Model/Job/JobItem.h
+++ b/GUI/Model/Job/JobItem.h
@@ -16,7 +16,7 @@
 #define BORNAGAIN_GUI_MODEL_JOB_JOBITEM_H
 
 #include "GUI/Model/Descriptor/PolyItem.h"
-#include "GUI/Model/Device/InstrumentItemCatalog.h"
+#include "GUI/Model/Device/InstrumentsCatalog.h"
 #include <QThread>
 
 class BatchInfo;
@@ -130,7 +130,7 @@ private:
     std::unique_ptr<SimulationOptionsItem> m_simulation_options_item;
     std::unique_ptr<ParameterContainerItem> m_parameter_container;
     std::unique_ptr<SampleItem> m_sample_item;
-    PolyItem<InstrumentItemCatalog> m_instrument;
+    PolyItem<InstrumentsCatalog> m_instrument;
     std::unique_ptr<BatchInfo> m_batch_info;
     QString m_activity;
     std::unique_ptr<DataItem> m_simulated_data_item;
-- 
GitLab


From c5c48d83aa25e7423250f91242a6ecbb2bf686a7 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Tue, 13 Feb 2024 12:02:00 +0100
Subject: [PATCH 3/4] resolve auto

---
 GUI/Model/Device/InstrumentsSet.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/GUI/Model/Device/InstrumentsSet.cpp b/GUI/Model/Device/InstrumentsSet.cpp
index f42c5f76f14..ae1aee8bad3 100644
--- a/GUI/Model/Device/InstrumentsSet.cpp
+++ b/GUI/Model/Device/InstrumentsSet.cpp
@@ -86,7 +86,7 @@ void InstrumentsSet::emplace_back(InstrumentItem* item)
 
 InstrumentItem* InstrumentsSet::insertItemCopy(const InstrumentItem& source)
 {
-    auto* copy = source.createItemCopy();
+    InstrumentItem* copy = source.createItemCopy();
     copy->setId(QUuid::createUuid().toString());
     emplace_back(copy);
     return copy;
-- 
GitLab


From 495e50b3d49d646868387347acd055ea1709b809 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Tue, 13 Feb 2024 12:07:06 +0100
Subject: [PATCH 4/4] std local var name

---
 GUI/Model/Descriptor/PolyVector.h | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/GUI/Model/Descriptor/PolyVector.h b/GUI/Model/Descriptor/PolyVector.h
index 4833a34858f..abb2a6ab0dd 100644
--- a/GUI/Model/Descriptor/PolyVector.h
+++ b/GUI/Model/Descriptor/PolyVector.h
@@ -23,26 +23,26 @@ template <typename Catalog> class PolyVector {
 public:
     using BaseType = typename Catalog::BaseType;
 
-    void delete_element(const BaseType* element)
+    void delete_element(const BaseType* t)
     {
         for (size_t i = 0; i < m_v.size(); i++)
-            if (m_v[i].certainItem() == element)
+            if (m_v[i].certainItem() == t)
                 m_v.erase(m_v.begin() + i);
     }
 
     void delete_polyitem_at(size_t i) { m_v.erase(m_v.begin() + i); }
 
-    void insert_polyitem_at(size_t i, BaseType* element)
+    void insert_polyitem_at(size_t i, BaseType* t)
     {
         PolyItem<Catalog> p;
-        p.setCertainItem(element);
+        p.setCertainItem(t);
         m_v.insert(m_v.begin() + i, std::move(p));
     }
 
-    int index_of(const BaseType* element) const
+    int index_of(const BaseType* t) const
     {
         for (size_t i = 0; i < m_v.size(); i++)
-            if (m_v[i].certainItem() == element)
+            if (m_v[i].certainItem() == t)
                 return int(i);
         return -1;
     }
-- 
GitLab