From cdda1e34b36af7444cd70599ecc89ab66f5733dd Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Mon, 22 Jul 2024 10:23:05 +0200 Subject: [PATCH] rename class and sources GUI/Model/Sim/InstrumentsCatalog -> GUI/Model/Sim/InstrumentCatalog --- GUI/Model/Job/JobItem.h | 4 ++-- ...nstrumentsCatalog.cpp => InstrumentCatalog.cpp} | 14 +++++++------- .../{InstrumentsCatalog.h => InstrumentCatalog.h} | 12 ++++++------ GUI/Model/Sim/InstrumentItems.cpp | 6 +++--- GUI/Model/Sim/InstrumentXML.cpp | 10 +++++----- GUI/Model/Sim/InstrumentsSet.cpp | 4 ++-- 6 files changed, 25 insertions(+), 25 deletions(-) rename GUI/Model/Sim/{InstrumentsCatalog.cpp => InstrumentCatalog.cpp} (81%) rename GUI/Model/Sim/{InstrumentsCatalog.h => InstrumentCatalog.h} (80%) diff --git a/GUI/Model/Job/JobItem.h b/GUI/Model/Job/JobItem.h index 99488ed3318..de9789d6627 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/Sim/InstrumentsCatalog.h" +#include "GUI/Model/Sim/InstrumentCatalog.h" #include <QThread> class BatchInfo; @@ -129,7 +129,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<InstrumentsCatalog> m_instrument; + PolyItem<InstrumentCatalog> m_instrument; std::unique_ptr<BatchInfo> m_batch_info; QString m_activity; std::unique_ptr<DataItem> m_simulated_data_item; diff --git a/GUI/Model/Sim/InstrumentsCatalog.cpp b/GUI/Model/Sim/InstrumentCatalog.cpp similarity index 81% rename from GUI/Model/Sim/InstrumentsCatalog.cpp rename to GUI/Model/Sim/InstrumentCatalog.cpp index 879dd2f94e1..61f406e4efa 100644 --- a/GUI/Model/Sim/InstrumentsCatalog.cpp +++ b/GUI/Model/Sim/InstrumentCatalog.cpp @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Model/Sim/InstrumentsCatalog.cpp -//! @brief Implements class InstrumentsCatalog. +//! @file GUI/Model/Sim/InstrumentCatalog.cpp +//! @brief Implements class InstrumentCatalog. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,11 +12,11 @@ // // ************************************************************************************************ -#include "GUI/Model/Sim/InstrumentsCatalog.h" +#include "GUI/Model/Sim/InstrumentCatalog.h" #include "Base/Util/Assert.h" #include "GUI/Model/Sim/InstrumentItems.h" -InstrumentItem* InstrumentsCatalog::create(Type type) +InstrumentItem* InstrumentCatalog::create(Type type) { switch (type) { case Type::Scatter2D: @@ -31,12 +31,12 @@ InstrumentItem* InstrumentsCatalog::create(Type type) ASSERT_NEVER; } -QVector<InstrumentsCatalog::Type> InstrumentsCatalog::types() +QVector<InstrumentCatalog::Type> InstrumentCatalog::types() { return {Type::Scatter2D, Type::Offspec, Type::Specular, Type::Depthprobe}; } -UiInfo InstrumentsCatalog::uiInfo(Type type) +UiInfo InstrumentCatalog::uiInfo(Type type) { switch (type) { case Type::Scatter2D: @@ -51,7 +51,7 @@ UiInfo InstrumentsCatalog::uiInfo(Type type) ASSERT_NEVER; } -InstrumentsCatalog::Type InstrumentsCatalog::type(const InstrumentItem* item) +InstrumentCatalog::Type InstrumentCatalog::type(const InstrumentItem* item) { if (dynamic_cast<const Scatter2DInstrumentItem*>(item)) return Type::Scatter2D; diff --git a/GUI/Model/Sim/InstrumentsCatalog.h b/GUI/Model/Sim/InstrumentCatalog.h similarity index 80% rename from GUI/Model/Sim/InstrumentsCatalog.h rename to GUI/Model/Sim/InstrumentCatalog.h index a78f9cae0c5..7798a9f348f 100644 --- a/GUI/Model/Sim/InstrumentsCatalog.h +++ b/GUI/Model/Sim/InstrumentCatalog.h @@ -2,8 +2,8 @@ // // BornAgain: simulate and fit reflection and scattering // -//! @file GUI/Model/Sim/InstrumentsCatalog.h -//! @brief Defines class InstrumentsCatalog. +//! @file GUI/Model/Sim/InstrumentCatalog.h +//! @brief Defines class InstrumentCatalog. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) @@ -12,15 +12,15 @@ // // ************************************************************************************************ -#ifndef BORNAGAIN_GUI_MODEL_SIM_INSTRUMENTSCATALOG_H -#define BORNAGAIN_GUI_MODEL_SIM_INSTRUMENTSCATALOG_H +#ifndef BORNAGAIN_GUI_MODEL_SIM_INSTRUMENTCATALOG_H +#define BORNAGAIN_GUI_MODEL_SIM_INSTRUMENTCATALOG_H #include "GUI/Model/Type/UiInfo.h" #include <QVector> class InstrumentItem; -class InstrumentsCatalog { +class InstrumentCatalog { public: // used in PolyItem<Catalog> using BaseType = InstrumentItem; @@ -41,4 +41,4 @@ public: static Type type(const InstrumentItem* item); }; -#endif // BORNAGAIN_GUI_MODEL_SIM_INSTRUMENTSCATALOG_H +#endif // BORNAGAIN_GUI_MODEL_SIM_INSTRUMENTCATALOG_H diff --git a/GUI/Model/Sim/InstrumentItems.cpp b/GUI/Model/Sim/InstrumentItems.cpp index 153cec89d39..6e42a68a4d7 100644 --- a/GUI/Model/Sim/InstrumentItems.cpp +++ b/GUI/Model/Sim/InstrumentItems.cpp @@ -36,8 +36,8 @@ #include "GUI/Model/File/DatafileItem.h" #include "GUI/Model/Sample/SampleItem.h" #include "GUI/Model/Sim/BackgroundItems.h" +#include "GUI/Model/Sim/InstrumentCatalog.h" #include "GUI/Model/Sim/InstrumentItems.h" -#include "GUI/Model/Sim/InstrumentsCatalog.h" #include "GUI/Model/Util/Backup.h" #include "Param/Distrib/Distributions.h" #include "Sample/Multilayer/MultiLayer.h" @@ -107,8 +107,8 @@ InstrumentItem::~InstrumentItem() = default; InstrumentItem* InstrumentItem::clone() const { - const auto type = InstrumentsCatalog::type(this); - InstrumentItem* copy = InstrumentsCatalog::create(type); + const auto type = InstrumentCatalog::type(this); + InstrumentItem* copy = InstrumentCatalog::create(type); GUI::Util::copyContents(this, copy); copy->setId(QUuid::createUuid().toString()); return copy; diff --git a/GUI/Model/Sim/InstrumentXML.cpp b/GUI/Model/Sim/InstrumentXML.cpp index 398dae89732..ab8d32a404f 100644 --- a/GUI/Model/Sim/InstrumentXML.cpp +++ b/GUI/Model/Sim/InstrumentXML.cpp @@ -15,8 +15,8 @@ #include "GUI/Model/Sim/InstrumentXML.h" #include "Base/Util/Assert.h" #include "GUI/Model/Descriptor/PolyItem.h" +#include "GUI/Model/Sim/InstrumentCatalog.h" #include "GUI/Model/Sim/InstrumentItems.h" -#include "GUI/Model/Sim/InstrumentsCatalog.h" #include "GUI/Model/Util/UtilXML.h" #include <QFile> @@ -39,11 +39,11 @@ void InstrumentXML::save(const QString& fname, const InstrumentItem* t) w.writeStartDocument(); w.writeStartElement(XML_ROOT_TAG); - const uint typeIndex = static_cast<uint>(InstrumentsCatalog::type(t)); + const uint typeIndex = static_cast<uint>(InstrumentCatalog::type(t)); 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, - InstrumentsCatalog::uiInfo(InstrumentsCatalog::type(t)).menuEntry); + InstrumentCatalog::uiInfo(InstrumentCatalog::type(t)).menuEntry); t->writeTo(&w); w.writeEndElement(); @@ -76,8 +76,8 @@ InstrumentItem* InstrumentXML::load(const QString& fname) if (found_version != 1) throw std::runtime_error("Unsupported version of instrument element"); const uint typeIndex = XML::readUInt(&r, XML::Attrib::type); - const auto type = static_cast<typename InstrumentsCatalog::Type>(typeIndex); - t = InstrumentsCatalog::create(type); + const auto type = static_cast<typename InstrumentCatalog::Type>(typeIndex); + t = InstrumentCatalog::create(type); ASSERT(t); t->readFrom(&r); diff --git a/GUI/Model/Sim/InstrumentsSet.cpp b/GUI/Model/Sim/InstrumentsSet.cpp index ade6b8a1100..512c2777a84 100644 --- a/GUI/Model/Sim/InstrumentsSet.cpp +++ b/GUI/Model/Sim/InstrumentsSet.cpp @@ -13,7 +13,7 @@ // ************************************************************************************************ #include "GUI/Model/Sim/InstrumentsSet.h" -#include "GUI/Model/Sim/InstrumentsCatalog.h" +#include "GUI/Model/Sim/InstrumentCatalog.h" namespace { namespace Tag { @@ -48,7 +48,7 @@ void InstrumentsSet::readFrom(QXmlStreamReader* r) while (r->readNextStartElement()) { QString tag = r->name().toString(); if (tag == Tag::Instrument) { - add_item(PolyItem<InstrumentsCatalog>().readItemFrom(r)); + add_item(PolyItem<InstrumentCatalog>().readItemFrom(r)); XML::gotoEndElementOfTag(r, tag); } else if (tag == Tag::CurrentIndex) setCurrentIndex(XML::readTaggedSize(r, tag)); -- GitLab