Skip to content
Snippets Groups Projects
Commit cdda1e34 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

rename class and sources GUI/Model/Sim/InstrumentsCatalog -> GUI/Model/Sim/InstrumentCatalog

parent 699eb6f3
No related branches found
No related tags found
1 merge request!2678unify names of *Catalog classes: type now always in singular
......@@ -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;
......
......@@ -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;
......
......@@ -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
......@@ -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;
......
......@@ -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);
......
......@@ -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));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment