diff --git a/GUI/Model/Descriptor/PolyVector.h b/GUI/Model/Descriptor/PolyVector.h index 4833a34858fb0ee88cb434ba06e1acc160c7dcfb..abb2a6ab0dd8b4b676cbd81aee294db8dd261c1b 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; } diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp index 4e79ea8e80d86237f8cd670b7f41e37dea4f5d51..1a123631984acfb9c693cfea872aa9a0fc7f2a79 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 c9c45869dd73f8ebffaaaac4abfd3b63d42892f9..be370e2cf199ac8f0e2f6be19ec6c49d370ac307 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 e0df185b445169af56287e7f547e061de1150bf8..a00853df36131a5aece087daa0a3d47ce7c3dc68 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 72a0d04b14549c9094e1bc01e7219be02bb7f63a..64786dff4f8ea23e13bc517ac8ab93f36ec13c9f 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.cpp b/GUI/Model/Device/InstrumentsSet.cpp index f42c5f76f14ca96016ece900b44dcb0f23f2545a..ae1aee8bad321ac451f5dde9e7495dcc079db247 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; diff --git a/GUI/Model/Device/InstrumentsSet.h b/GUI/Model/Device/InstrumentsSet.h index f85436aa5e5664f18db5e5941d8840c601438e2a..6c5893ce43a23e17fb7b22fb07707e1ee48764f3 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 e70a00a46479d1aa9304e13892d0123094f61ce0..09034fd518e9a5805634e7bc7189fb41d75f3307 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; diff --git a/GUI/View/Views/InstrumentView.cpp b/GUI/View/Views/InstrumentView.cpp index ee652cc19273cff295253ec2d5122b658fe322ec..74b812428439782018a853f9059d59849c2b4581 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;