From 35ca0bcd2746ea84d6078374488740efbc916e14 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 16:08:12 +0100
Subject: [PATCH 01/31] split BatchInfo from JobItem

---
 GUI/Model/Job/BatchInfo.cpp                   | 152 ++++++++++++++++++
 GUI/Model/Job/BatchInfo.h                     |  66 ++++++++
 GUI/Model/Job/JobItem.cpp                     | 123 ++------------
 GUI/Model/Job/JobItem.h                       |  36 +----
 GUI/Model/Tune/JobModel.cpp                   |  17 +-
 GUI/Model/Tune/JobQueueData.cpp               |  23 +--
 GUI/View/Fit/FitSessionController.cpp         |  13 +-
 GUI/View/JobControl/JobListModel.cpp          |   9 +-
 GUI/View/JobControl/JobListing.cpp            |   4 +-
 GUI/View/JobControl/JobProgressDelegate.cpp   |   5 +-
 .../JobControl/JobPropertiesTableModel.cpp    |  21 +--
 GUI/View/JobControl/JobPropertiesWidget.cpp   |  13 +-
 GUI/View/Tuning/ParameterTuningWidget.cpp     |   3 +-
 Tests/Unit/GUI/TestJobModel.cpp               |   5 +-
 14 files changed, 296 insertions(+), 194 deletions(-)
 create mode 100644 GUI/Model/Job/BatchInfo.cpp
 create mode 100644 GUI/Model/Job/BatchInfo.h

diff --git a/GUI/Model/Job/BatchInfo.cpp b/GUI/Model/Job/BatchInfo.cpp
new file mode 100644
index 00000000000..6e13d1473e1
--- /dev/null
+++ b/GUI/Model/Job/BatchInfo.cpp
@@ -0,0 +1,152 @@
+//  ************************************************************************************************
+//
+//  BornAgain: simulate and fit reflection and scattering
+//
+//! @file      GUI/Model/Job/BatchInfo.cpp
+//! @brief     Implements class BatchInfo.
+//!
+//! @homepage  http://www.bornagainproject.org
+//! @license   GNU General Public License v3 or higher (see COPYING)
+//! @copyright Forschungszentrum Jülich GmbH 2018
+//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
+//
+//  ************************************************************************************************
+
+#include "GUI/Model/Job/BatchInfo.h"
+#include "GUI/Support/XML/UtilXML.h"
+
+namespace {
+namespace Tag {
+
+const QString Name("Name");
+const QString Identifier("Id");
+const QString Comments("Comments");
+const QString Duration("Duration");
+const QString BeginTime("Begin");
+const QString EndTime("End");
+const QString Progress("Progress");
+
+} // namespace Tag
+} // namespace
+
+void BatchInfo::setJobName(const QString& name)
+{
+    m_name = name;
+    emit jobNameChanged(name);
+}
+
+void BatchInfo::setBeginTime(const QDateTime& begin_time)
+{
+    m_begin_time = begin_time;
+    emit jobBeginTimeChanged(begin_time);
+}
+
+void BatchInfo::setEndTime(const QDateTime& end_time)
+{
+    m_end_time = end_time;
+    emit jobEndTimeChanged(end_time);
+}
+
+std::optional<size_t> BatchInfo::duration() const
+{
+    QDateTime begin_time = beginTime();
+    QDateTime end_time = endTime();
+    if (begin_time.isValid() && end_time.isValid() && begin_time < end_time)
+        return begin_time.msecsTo(end_time);
+    return std::nullopt;
+}
+
+void BatchInfo::setComments(const QString& comments)
+{
+    m_comments = comments;
+    emit jobCommentsChanged(comments);
+}
+
+void BatchInfo::setProgress(int progress)
+{
+    m_progress = progress;
+    emit jobProgressChanged(progress);
+}
+
+void BatchInfo::writeTo(QXmlStreamWriter* w) const
+{
+    XML::writeAttribute(w, XML::Attrib::version, uint(2));
+
+    // name
+    w->writeStartElement(Tag::Name);
+    XML::writeAttribute(w, XML::Attrib::value, m_name);
+    w->writeEndElement();
+
+    // identifier
+    w->writeStartElement(Tag::Identifier);
+    XML::writeAttribute(w, XML::Attrib::value, m_identifier);
+    w->writeEndElement();
+
+    // begin time
+    w->writeStartElement(Tag::BeginTime);
+    XML::writeAttribute(w, XML::Attrib::value, m_begin_time.toString(Qt::ISODateWithMs));
+    w->writeEndElement();
+
+    // end time
+    w->writeStartElement(Tag::EndTime);
+    XML::writeAttribute(w, XML::Attrib::value, m_end_time.toString(Qt::ISODateWithMs));
+    w->writeEndElement();
+
+    // progress
+    w->writeStartElement(Tag::Progress);
+    XML::writeAttribute(w, XML::Attrib::value, m_progress);
+    w->writeEndElement();
+
+    // comments
+    w->writeStartElement(Tag::Comments);
+    XML::writeAttribute(w, XML::Attrib::value, m_comments);
+    w->writeEndElement();
+}
+
+void BatchInfo::readFrom(QXmlStreamReader* r)
+{
+    const uint version = XML::readUIntAttribute(r, XML::Attrib::version);
+    Q_UNUSED(version)
+
+    while (r->readNextStartElement()) {
+        QString tag = r->name().toString();
+
+        if (tag == Tag::Comments) {
+            XML::readAttribute(r, XML::Attrib::value, &m_comments);
+            XML::gotoEndElementOfTag(r, tag);
+
+            // progress
+        } else if (tag == Tag::Progress) {
+            QString progress_str;
+            XML::readAttribute(r, XML::Attrib::value, &progress_str);
+            m_progress = progress_str.toInt();
+            XML::gotoEndElementOfTag(r, tag);
+
+            // begin time
+        } else if (tag == Tag::BeginTime) {
+            QString begin_t_str;
+            XML::readAttribute(r, XML::Attrib::value, &begin_t_str);
+            m_begin_time = QDateTime::fromString(begin_t_str, Qt::ISODateWithMs);
+            XML::gotoEndElementOfTag(r, tag);
+
+            // end time
+        } else if (tag == Tag::EndTime) {
+            QString end_t_str;
+            XML::readAttribute(r, XML::Attrib::value, &end_t_str);
+            m_end_time = QDateTime::fromString(end_t_str, Qt::ISODateWithMs);
+            XML::gotoEndElementOfTag(r, tag);
+
+            // identifier
+        } else if (tag == Tag::Identifier) {
+            XML::readAttribute(r, XML::Attrib::value, &m_identifier);
+            XML::gotoEndElementOfTag(r, tag);
+
+            // name
+        } else if (tag == Tag::Name) {
+            XML::readAttribute(r, XML::Attrib::value, &m_name);
+            XML::gotoEndElementOfTag(r, tag);
+
+        } else
+            r->skipCurrentElement();
+    }
+}
diff --git a/GUI/Model/Job/BatchInfo.h b/GUI/Model/Job/BatchInfo.h
new file mode 100644
index 00000000000..90a05722035
--- /dev/null
+++ b/GUI/Model/Job/BatchInfo.h
@@ -0,0 +1,66 @@
+//  ************************************************************************************************
+//
+//  BornAgain: simulate and fit reflection and scattering
+//
+//! @file      GUI/Model/Job/BatchInfo.h
+//! @brief     Defines class BatchInfo.
+//!
+//! @homepage  http://www.bornagainproject.org
+//! @license   GNU General Public License v3 or higher (see COPYING)
+//! @copyright Forschungszentrum Jülich GmbH 2018
+//! @authors   Scientific Computing Group at MLZ (see CITATION, AUTHORS)
+//
+//  ************************************************************************************************
+
+#ifndef BORNAGAIN_GUI_MODEL_JOB_BATCHINFO_H
+#define BORNAGAIN_GUI_MODEL_JOB_BATCHINFO_H
+
+#include <QDateTime>
+#include <QObject>
+#include <QXmlStreamReader>
+#include <QXmlStreamWriter>
+
+class BatchInfo : public QObject {
+    Q_OBJECT
+public:
+    QString identifier() const { return m_identifier; }
+    void setIdentifier(const QString& identifier) { m_identifier = identifier; }
+
+    QString jobName() const { return m_name; }
+    void setJobName(const QString& name);
+
+    QDateTime beginTime() const { return m_begin_time; }
+    void setBeginTime(const QDateTime& begin_time);
+
+    QDateTime endTime() const { return m_end_time; }
+    void setEndTime(const QDateTime& end_time);
+
+    //! if begin and end time are both available the duration in ms, otherwise empty
+    std::optional<size_t> duration() const;
+
+    QString comments() const { return m_comments; }
+    void setComments(const QString& comments);
+
+    int progress() const { return m_progress; }
+    void setProgress(int progress);
+
+    void writeTo(QXmlStreamWriter* w) const;
+    void readFrom(QXmlStreamReader* r);
+
+signals:
+    void jobNameChanged(const QString& name);
+    void jobBeginTimeChanged(const QDateTime& begin_time);
+    void jobEndTimeChanged(const QDateTime& end_time);
+    void jobCommentsChanged(const QString& comments);
+    void jobProgressChanged(int progress);
+
+private:
+    QString m_name;
+    QString m_identifier;
+    QString m_comments;
+    QDateTime m_begin_time;
+    QDateTime m_end_time;
+    int m_progress;
+};
+
+#endif // BORNAGAIN_GUI_MODEL_JOB_BATCHINFO_H
diff --git a/GUI/Model/Job/JobItem.cpp b/GUI/Model/Job/JobItem.cpp
index 11a46c7461b..eb735ae3edd 100644
--- a/GUI/Model/Job/JobItem.cpp
+++ b/GUI/Model/Job/JobItem.cpp
@@ -24,6 +24,7 @@
 #include "GUI/Model/Device/BackgroundItems.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/FitParameterContainerItem.h"
 #include "GUI/Model/Job/FitSuiteItem.h"
 #include "GUI/Model/Job/ParameterTreeBuilder.h"
@@ -45,16 +46,9 @@ const QString SimulationOptions("SimulationOptions");
 const QString ParameterContainer("ParameterContainer");
 const QString Sample("Sample");
 const QString Instrument("Instrument");
-const QString Name("Name");
-const QString Identifier("Id");
-const QString Comments("Comments");
-const QString PresentationType("PresentationType");
+const QString BatchInfo("BatchInfo");
 const QString Activity("Activity");
-const QString Duration("Duration");
-const QString BeginTime("Begin");
-const QString EndTime("End");
 const QString Status("Status");
-const QString Progress("Progress");
 const QString DatafileItem("DatafileItem");
 const QString SimulatedData("SimulatedData");
 const QString FitSuite("FitSuite");
@@ -77,6 +71,7 @@ JobItem::JobItem()
     : m_simulation_options_item(std::make_unique<SimulationOptionsItem>())
     , m_parameter_container(std::make_unique<ParameterContainerItem>())
     , m_sample_item(std::make_unique<SampleItem>())
+    , m_batch_info(std::make_unique<BatchInfo>())
     , m_status(JobStatus::Idle)
     , m_fit_suite_item(std::make_unique<FitSuiteItem>())
 {
@@ -84,13 +79,6 @@ JobItem::JobItem()
 
 JobItem::~JobItem() = default;
 
-void JobItem::setJobName(const QString& name)
-{
-    m_name = name;
-    updateFileName();
-    emit jobNameChanged(name);
-}
-
 void JobItem::setStatus(JobStatus status)
 {
     m_status = status;
@@ -104,39 +92,6 @@ void JobItem::setStatus(JobStatus status)
     emit jobStatusChanged(status);
 }
 
-void JobItem::setBeginTime(const QDateTime& begin_time)
-{
-    m_begin_time = begin_time;
-    emit jobBeginTimeChanged(begin_time);
-}
-
-void JobItem::setEndTime(const QDateTime& end_time)
-{
-    m_end_time = end_time;
-    emit jobEndTimeChanged(end_time);
-}
-
-std::optional<size_t> JobItem::duration() const
-{
-    QDateTime begin_time = beginTime();
-    QDateTime end_time = endTime();
-    if (begin_time.isValid() && end_time.isValid() && begin_time < end_time)
-        return begin_time.msecsTo(end_time);
-    return std::nullopt;
-}
-
-void JobItem::setComments(const QString& comments)
-{
-    m_comments = comments;
-    emit jobCommentsChanged(comments);
-}
-
-void JobItem::setProgress(int progress)
-{
-    m_progress = progress;
-    emit jobProgressChanged(progress);
-}
-
 size_t JobItem::rank() const
 {
     if (instrumentItem()->is<SpecularInstrumentItem>())
@@ -319,14 +274,9 @@ void JobItem::writeTo(QXmlStreamWriter* w) const
     m_parameter_container->writeTo(w);
     w->writeEndElement();
 
-    // data members
-    w->writeStartElement(Tag::Name);
-    XML::writeAttribute(w, XML::Attrib::value, m_name);
-    w->writeEndElement();
-
-    // identifier
-    w->writeStartElement(Tag::Identifier);
-    XML::writeAttribute(w, XML::Attrib::value, m_identifier);
+    // batch info
+    w->writeStartElement(Tag::BatchInfo);
+    m_batch_info->writeTo(w);
     w->writeEndElement();
 
     // activity
@@ -334,31 +284,11 @@ void JobItem::writeTo(QXmlStreamWriter* w) const
     XML::writeAttribute(w, XML::Attrib::value, m_activity);
     w->writeEndElement();
 
-    // begin time
-    w->writeStartElement(Tag::BeginTime);
-    XML::writeAttribute(w, XML::Attrib::value, m_begin_time.toString(Qt::ISODateWithMs));
-    w->writeEndElement();
-
-    // end time
-    w->writeStartElement(Tag::EndTime);
-    XML::writeAttribute(w, XML::Attrib::value, m_end_time.toString(Qt::ISODateWithMs));
-    w->writeEndElement();
-
     // status
     w->writeStartElement(Tag::Status);
     XML::writeAttribute(w, XML::Attrib::value, jobStatusToString(m_status));
     w->writeEndElement();
 
-    // progress
-    w->writeStartElement(Tag::Progress);
-    XML::writeAttribute(w, XML::Attrib::value, m_progress);
-    w->writeEndElement();
-
-    // comments
-    w->writeStartElement(Tag::Comments);
-    XML::writeAttribute(w, XML::Attrib::value, m_comments);
-    w->writeEndElement();
-
     // simulated data
     if (m_simulated_data_item) {
         w->writeStartElement(Tag::SimulatedData);
@@ -416,8 +346,8 @@ void JobItem::readFrom(QXmlStreamReader* r)
             XML::gotoEndElementOfTag(r, tag);
 
             // comments
-        } else if (tag == Tag::Comments) {
-            XML::readAttribute(r, XML::Attrib::value, &m_comments);
+        } else if (tag == Tag::BatchInfo) {
+            m_batch_info->readFrom(r);
             XML::gotoEndElementOfTag(r, tag);
 
             // status
@@ -427,37 +357,6 @@ void JobItem::readFrom(QXmlStreamReader* r)
             m_status = jobStatusFromString(status_str);
             XML::gotoEndElementOfTag(r, tag);
 
-            // progress
-        } else if (tag == Tag::Progress) {
-            QString progress_str;
-            XML::readAttribute(r, XML::Attrib::value, &progress_str);
-            m_progress = progress_str.toInt();
-            XML::gotoEndElementOfTag(r, tag);
-
-            // begin time
-        } else if (tag == Tag::BeginTime) {
-            QString begin_t_str;
-            XML::readAttribute(r, XML::Attrib::value, &begin_t_str);
-            m_begin_time = QDateTime::fromString(begin_t_str, Qt::ISODateWithMs);
-            XML::gotoEndElementOfTag(r, tag);
-
-            // end time
-        } else if (tag == Tag::EndTime) {
-            QString end_t_str;
-            XML::readAttribute(r, XML::Attrib::value, &end_t_str);
-            m_end_time = QDateTime::fromString(end_t_str, Qt::ISODateWithMs);
-            XML::gotoEndElementOfTag(r, tag);
-
-            // identifier
-        } else if (tag == Tag::Identifier) {
-            XML::readAttribute(r, XML::Attrib::value, &m_identifier);
-            XML::gotoEndElementOfTag(r, tag);
-
-            // name
-        } else if (tag == Tag::Name) {
-            XML::readAttribute(r, XML::Attrib::value, &m_name);
-            XML::gotoEndElementOfTag(r, tag);
-
             // simulated data
         } else if (tag == Tag::SimulatedData) {
             createSimulatedDataItem();
@@ -522,7 +421,7 @@ void JobItem::readDatafiles(const QString& projectDir, MessageService* messageSe
     }
 
     if (!errorMessage.isEmpty()) {
-        setComments(errorMessage);
+        m_batch_info->setComments(errorMessage);
         m_status = JobStatus::Failed;
     }
 }
@@ -531,9 +430,9 @@ void JobItem::readDatafiles(const QString& projectDir, MessageService* messageSe
 void JobItem::updateFileName()
 {
     if (DataItem* item = simulatedDataItem())
-        item->setFileName(GUI::Path::intensityDataFileName(jobName(), "jobdata"));
+        item->setFileName(GUI::Path::intensityDataFileName(batchInfo()->jobName(), "jobdata"));
 
     if (m_real_item)
         if (DataItem* item = m_real_item->dataItem())
-            item->setFileName(GUI::Path::intensityDataFileName(jobName(), "refdata"));
+            item->setFileName(GUI::Path::intensityDataFileName(batchInfo()->jobName(), "refdata"));
 }
diff --git a/GUI/Model/Job/JobItem.h b/GUI/Model/Job/JobItem.h
index ae4c171bfe9..1165a54a39a 100644
--- a/GUI/Model/Job/JobItem.h
+++ b/GUI/Model/Job/JobItem.h
@@ -17,11 +17,11 @@
 
 #include "GUI/Model/Descriptor/SelectionProperty.h"
 #include "GUI/Model/Device/InstrumentItemCatalog.h"
-#include <QDateTime>
 #include <optional>
 
 enum class JobStatus;
 
+class BatchInfo;
 class Data2DItem;
 class DataItem;
 class Datafield;
@@ -43,32 +43,14 @@ public:
 
     //... job properties
 
-    QString identifier() const { return m_identifier; }
-    void setIdentifier(const QString& identifier) { m_identifier = identifier; }
-
-    QString jobName() const { return m_name; }
-    void setJobName(const QString& name);
+    const BatchInfo* batchInfo() const { return m_batch_info.get(); }
+    BatchInfo* batchInfo() { return m_batch_info.get(); }
 
     JobStatus status() const { return m_status; }
     void setStatus(JobStatus status);
 
     bool isValidForFitting() const { return bool(m_real_item); }
 
-    QDateTime beginTime() const { return m_begin_time; }
-    void setBeginTime(const QDateTime& begin_time);
-
-    QDateTime endTime() const { return m_end_time; }
-    void setEndTime(const QDateTime& end_time);
-
-    //! if begin and end time are both available the duration in ms, otherwise empty
-    std::optional<size_t> duration() const;
-
-    QString comments() const { return m_comments; }
-    void setComments(const QString& comments);
-
-    int progress() const { return m_progress; }
-    void setProgress(int progress);
-
     QString activity() const { return m_activity; }
     void setActivity(const QString& activity) { m_activity = activity; }
 
@@ -126,12 +108,7 @@ public:
     void readDatafiles(const QString& projectDir, MessageService* messageService);
 
 signals:
-    void jobNameChanged(const QString& name);
     void jobStatusChanged(JobStatus status);
-    void jobBeginTimeChanged(const QDateTime& begin_time);
-    void jobEndTimeChanged(const QDateTime& end_time);
-    void jobCommentsChanged(const QString& comments);
-    void jobProgressChanged(int progress);
 
 private:
     void cropRealData();
@@ -142,14 +119,9 @@ private:
     std::unique_ptr<ParameterContainerItem> m_parameter_container;
     std::unique_ptr<SampleItem> m_sample_item;
     SelectionProperty<InstrumentItemCatalog> m_instrument;
-    QString m_name;
-    QString m_identifier;
+    std::unique_ptr<BatchInfo> m_batch_info;
     JobStatus m_status;
-    QString m_comments;
     QString m_activity;
-    QDateTime m_begin_time;
-    QDateTime m_end_time;
-    int m_progress;
     std::unique_ptr<DataItem> m_simulated_data_item;
     std::unique_ptr<DataItem> m_diff_data_item;
     std::unique_ptr<DatafileItem> m_real_item;
diff --git a/GUI/Model/Tune/JobModel.cpp b/GUI/Model/Tune/JobModel.cpp
index fdaf5cd761e..33d715775da 100644
--- a/GUI/Model/Tune/JobModel.cpp
+++ b/GUI/Model/Tune/JobModel.cpp
@@ -15,6 +15,7 @@
 #include "GUI/Model/Tune/JobModel.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
 #include "GUI/Model/Sample/SampleItem.h"
@@ -44,7 +45,7 @@ JobModel::~JobModel() = default;
 JobItem* JobModel::jobItemForIdentifier(const QString& identifier)
 {
     for (auto* jobItem : jobItems())
-        if (jobItem->identifier() == identifier)
+        if (jobItem->batchInfo()->identifier() == identifier)
             return jobItem;
 
     return nullptr;
@@ -65,8 +66,8 @@ JobItem* JobModel::addJobItem(const SampleItem* sampleItem, const InstrumentItem
     ASSERT(instrumentItem);
 
     JobItem* jobItem = createJobItem();
-    jobItem->setJobName(generateJobName());
-    jobItem->setIdentifier(QUuid::createUuid().toString());
+    jobItem->batchInfo()->setJobName(generateJobName());
+    jobItem->batchInfo()->setIdentifier(QUuid::createUuid().toString());
 
     jobItem->copySampleIntoJob(sampleItem);
     jobItem->copyInstrumentIntoJob(instrumentItem);
@@ -139,7 +140,7 @@ void JobModel::writeTo(QXmlStreamWriter* w) const
     // jobs
     for (const auto* job : m_job_items) {
         w->writeStartElement(Tag::Job);
-        XML::writeAttribute(w, XML::Attrib::name, job->jobName());
+        XML::writeAttribute(w, XML::Attrib::name, job->batchInfo()->jobName());
         job->writeTo(w);
         w->writeEndElement();
     }
@@ -202,13 +203,13 @@ void JobModel::runJob(JobItem* jobItem)
 
 void JobModel::cancelJob(JobItem* jobItem)
 {
-    m_queue_data->cancelJob(jobItem->identifier());
+    m_queue_data->cancelJob(jobItem->batchInfo()->identifier());
 }
 
 void JobModel::removeJob(JobItem* jobItem)
 {
     ASSERT(jobItem);
-    m_queue_data->removeJob(jobItem->identifier());
+    m_queue_data->removeJob(jobItem->batchInfo()->identifier());
     m_job_items.delete_element(jobItem);
 }
 
@@ -216,8 +217,8 @@ QString JobModel::generateJobName()
 {
     int maxJobIndex = 0;
     for (const auto* jobItem : jobItems()) {
-        if (jobItem->jobName().startsWith("job"))
-            maxJobIndex = std::max(maxJobIndex, jobItem->jobName().mid(3).toInt());
+        if (jobItem->batchInfo()->jobName().startsWith("job"))
+            maxJobIndex = std::max(maxJobIndex, jobItem->batchInfo()->jobName().mid(3).toInt());
     }
     return QString("job%1").arg(maxJobIndex + 1);
 }
diff --git a/GUI/Model/Tune/JobQueueData.cpp b/GUI/Model/Tune/JobQueueData.cpp
index 02ba5579d5c..248c2138322 100644
--- a/GUI/Model/Tune/JobQueueData.cpp
+++ b/GUI/Model/Tune/JobQueueData.cpp
@@ -14,6 +14,7 @@
 
 #include "GUI/Model/Tune/JobQueueData.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/ToCore/SimulationToCore.h"
 #include "GUI/Model/Tune/JobModel.h"
@@ -34,7 +35,7 @@ bool JobQueueData::hasUnfinishedJobs()
 
 void JobQueueData::runJob(JobItem* jobItem)
 {
-    QString identifier = jobItem->identifier();
+    QString identifier = jobItem->batchInfo()->identifier();
     if (getThread(identifier))
         return;
 
@@ -50,8 +51,8 @@ void JobQueueData::runJob(JobItem* jobItem)
                         "Attempt to create sample/instrument object from user description "
                         "has failed with following error message.\n\n");
         message += QString::fromStdString(std::string(ex.what()));
-        jobItem->setComments(message);
-        jobItem->setProgress(100);
+        jobItem->batchInfo()->setComments(message);
+        jobItem->batchInfo()->setProgress(100);
         jobItem->setStatus(JobStatus::Failed);
         clearSimulation(identifier);
         emit jobSelected(jobItem);
@@ -104,10 +105,10 @@ void JobQueueData::onStartedJob()
     auto* worker = qobject_cast<JobWorker*>(sender());
 
     auto* jobItem = m_job_model->jobItemForIdentifier(worker->identifier());
-    jobItem->setProgress(0);
+    jobItem->batchInfo()->setProgress(0);
     jobItem->setStatus(JobStatus::Running);
-    jobItem->setBeginTime(worker->simulationStart());
-    jobItem->setEndTime(QDateTime());
+    jobItem->batchInfo()->setBeginTime(worker->simulationStart());
+    jobItem->batchInfo()->setEndTime(QDateTime());
 }
 
 //! Performs necessary actions when job is finished.
@@ -142,7 +143,7 @@ void JobQueueData::onProgressUpdate()
 {
     auto* worker = qobject_cast<JobWorker*>(sender());
     auto* jobItem = m_job_model->jobItemForIdentifier(worker->identifier());
-    jobItem->setProgress(worker->progress());
+    jobItem->batchInfo()->setProgress(worker->progress());
     updateGlobalProgress();
 }
 
@@ -155,7 +156,7 @@ void JobQueueData::updateGlobalProgress()
     int nRunningJobs(0);
     for (auto* jobItem : m_job_model->jobItems())
         if (isRunning(jobItem->status())) {
-            global_progress += jobItem->progress();
+            global_progress += jobItem->batchInfo()->progress();
             nRunningJobs++;
         }
 
@@ -218,11 +219,11 @@ void JobQueueData::clearSimulation(const QString& identifier)
 
 void JobQueueData::processFinishedJob(JobWorker* worker, JobItem* jobItem)
 {
-    jobItem->setEndTime(worker->simulationEnd());
+    jobItem->batchInfo()->setEndTime(worker->simulationEnd());
 
     // propagating status of runner
     if (isFailed(worker->status()))
-        jobItem->setComments(worker->failureMessage());
+        jobItem->batchInfo()->setComments(worker->failureMessage());
     else {
         ASSERT(worker->result());
         jobItem->setResults(*worker->result());
@@ -231,7 +232,7 @@ void JobQueueData::processFinishedJob(JobWorker* worker, JobItem* jobItem)
 
     // fixing job progress (if job was successfull, but due to wrong estimation, progress not 100%)
     if (isCompleted(jobItem->status()))
-        jobItem->setProgress(100);
+        jobItem->batchInfo()->setProgress(100);
 }
 
 //! Returns the thread for given identifier.
diff --git a/GUI/View/Fit/FitSessionController.cpp b/GUI/View/Fit/FitSessionController.cpp
index e858634d05e..d40b9286355 100644
--- a/GUI/View/Fit/FitSessionController.cpp
+++ b/GUI/View/Fit/FitSessionController.cpp
@@ -15,6 +15,7 @@
 #include "GUI/View/Fit/FitSessionController.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Data/Data2DItem.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/FitParameterContainerItem.h"
 #include "GUI/Model/Job/FitSuiteItem.h"
 #include "GUI/Model/Job/JobItem.h"
@@ -117,9 +118,9 @@ void FitSessionController::onFittingStarted()
     m_fitlog->clearLog();
 
     m_job_item->setStatus(JobStatus::Fitting);
-    m_job_item->setProgress(0);
-    m_job_item->setBeginTime(m_run_fit_manager->fitStart());
-    m_job_item->setEndTime(QDateTime());
+    m_job_item->batchInfo()->setProgress(0);
+    m_job_item->batchInfo()->setBeginTime(m_run_fit_manager->fitStart());
+    m_job_item->batchInfo()->setEndTime(QDateTime());
 
     emit fittingStarted();
 }
@@ -128,8 +129,8 @@ void FitSessionController::onFittingFinished()
 {
     if (!isFailed(m_job_item->status()))
         m_job_item->setStatus(JobStatus::Completed);
-    m_job_item->setEndTime(m_run_fit_manager->fitEnd());
-    m_job_item->setProgress(100);
+    m_job_item->batchInfo()->setEndTime(m_run_fit_manager->fitEnd());
+    m_job_item->batchInfo()->setProgress(100);
 
     if (isCompleted(m_job_item->status()))
         m_fitlog->append("Done", FitLogLevel::Success);
@@ -145,7 +146,7 @@ void FitSessionController::onFittingError(const QString& text)
     message.append("Current settings cause fitting failure.\n\n");
     message.append(text);
     m_fitlog->append(message.toStdString(), FitLogLevel::Error);
-    m_job_item->setEndTime(m_run_fit_manager->fitEnd());
+    m_job_item->batchInfo()->setEndTime(m_run_fit_manager->fitEnd());
 
     emit fittingError(message);
 }
diff --git a/GUI/View/JobControl/JobListModel.cpp b/GUI/View/JobControl/JobListModel.cpp
index d11718787c6..5098bb233a6 100644
--- a/GUI/View/JobControl/JobListModel.cpp
+++ b/GUI/View/JobControl/JobListModel.cpp
@@ -13,6 +13,7 @@
 //  ************************************************************************************************
 
 #include "GUI/View/JobControl/JobListModel.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 
@@ -51,7 +52,7 @@ QVariant JobListModel::data(const QModelIndex& index, int role) const
 
     JobItem* item = jobs[index.row()];
     if (role == Qt::DisplayRole)
-        return item->jobName();
+        return item->batchInfo()->jobName();
 
     return {};
 }
@@ -110,8 +111,10 @@ void JobListModel::emitJobListModelChanged(JobItem* job)
 void JobListModel::onJobAdded()
 {
     for (JobItem* job : m_jobs->jobItems()) {
-        connect(job, &JobItem::jobNameChanged, [this, job] { emitJobListModelChanged(job); });
         connect(job, &JobItem::jobStatusChanged, [this, job] { emitJobListModelChanged(job); });
-        connect(job, &JobItem::jobProgressChanged, [this, job] { emitJobListModelChanged(job); });
+        connect(job->batchInfo(), &BatchInfo::jobNameChanged,
+                [this, job] { emitJobListModelChanged(job); });
+        connect(job->batchInfo(), &BatchInfo::jobProgressChanged,
+                [this, job] { emitJobListModelChanged(job); });
     }
 }
diff --git a/GUI/View/JobControl/JobListing.cpp b/GUI/View/JobControl/JobListing.cpp
index b394d71e051..62cdeb7763f 100644
--- a/GUI/View/JobControl/JobListing.cpp
+++ b/GUI/View/JobControl/JobListing.cpp
@@ -15,6 +15,7 @@
 #include "GUI/View/JobControl/JobListing.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Data/Data2DItem.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Support/Data/JobStatus.h"
 #include "GUI/View/JobControl/JobListModel.h"
@@ -218,7 +219,8 @@ void JobListing::showContextMenu(const QPoint&)
         std::sort(indexes.begin(), indexes.end(), row_ascending);
         for (const QModelIndex& index : indexes) {
             JobItem* job = m_model->jobItemForIndex(index);
-            QAction* action = m_equalize_menu->addAction(QString("to ").append(job->jobName()));
+            QAction* action =
+                m_equalize_menu->addAction(QString("to ").append(job->batchInfo()->jobName()));
             connect(action, &QAction::triggered, [this, job] { equalizeSelectedToJob(job); });
         }
         m_equalize_menu->setEnabled(true);
diff --git a/GUI/View/JobControl/JobProgressDelegate.cpp b/GUI/View/JobControl/JobProgressDelegate.cpp
index 7f1bc77329a..779a6476c73 100644
--- a/GUI/View/JobControl/JobProgressDelegate.cpp
+++ b/GUI/View/JobControl/JobProgressDelegate.cpp
@@ -14,6 +14,7 @@
 
 #include "GUI/View/JobControl/JobProgressDelegate.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Support/Data/JobStatus.h"
 #include "GUI/View/JobControl/JobListModel.h"
@@ -49,7 +50,7 @@ void JobProgressDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
     painter->setRenderHint(QPainter::Antialiasing, true);
 
     QRect textRect = getTextRect(option.rect);
-    painter->drawText(textRect, item->jobName());
+    painter->drawText(textRect, item->batchInfo()->jobName());
 
     drawCustomProjectBar(item, painter, option);
 
@@ -104,7 +105,7 @@ bool JobProgressDelegate::editorEvent(QEvent* event, QAbstractItemModel* model,
 void JobProgressDelegate::drawCustomProjectBar(const JobItem* item, QPainter* painter,
                                                const QStyleOptionViewItem& option) const
 {
-    int progress = item->progress();
+    int progress = item->batchInfo()->progress();
     QRect rect = getProgressBarRect(option.rect);
 
     painter->save();
diff --git a/GUI/View/JobControl/JobPropertiesTableModel.cpp b/GUI/View/JobControl/JobPropertiesTableModel.cpp
index 6ef64c9831f..8197bf4ee9f 100644
--- a/GUI/View/JobControl/JobPropertiesTableModel.cpp
+++ b/GUI/View/JobControl/JobPropertiesTableModel.cpp
@@ -14,6 +14,7 @@
 
 #include "GUI/View/JobControl/JobPropertiesTableModel.h"
 #include "GUI/Model/Device/InstrumentItems.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/Data/JobStatus.h"
@@ -75,7 +76,7 @@ QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
     case Column::Value: {
         switch (index.row()) {
         case Row::Name:
-            return m_item->jobName();
+            return m_item->batchInfo()->jobName();
         case Row::Sample:
             return m_item->sampleItem()->sampleName();
         case Row::Instrument:
@@ -84,14 +85,14 @@ QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
             return jobStatusToString(m_item->status());
         case Row::Begin:
             if (role == Qt::ToolTipRole)
-                return QLocale().toString(m_item->beginTime(), QLocale::LongFormat);
-            return m_item->beginTime().toString(ModelDateShortFormat);
+                return QLocale().toString(m_item->batchInfo()->beginTime(), QLocale::LongFormat);
+            return m_item->batchInfo()->beginTime().toString(ModelDateShortFormat);
         case Row::End:
             if (role == Qt::ToolTipRole)
-                return QLocale().toString(m_item->endTime(), QLocale::LongFormat);
-            return m_item->endTime().toString(ModelDateShortFormat);
+                return QLocale().toString(m_item->batchInfo()->endTime(), QLocale::LongFormat);
+            return m_item->batchInfo()->endTime().toString(ModelDateShortFormat);
         case Row::Duration: {
-            std::optional<size_t> duration = m_item->duration();
+            std::optional<size_t> duration = m_item->batchInfo()->duration();
             if (duration)
                 return QString("%1 s").arg(duration.value() / 1000., 0, 'f', 3);
             return {};
@@ -127,7 +128,7 @@ bool JobPropertiesTableModel::setData(const QModelIndex& index, const QVariant&
     if (role != Qt::EditRole || index.column() != Column::Value || index.row() != Row::Name
         || !m_item)
         return false;
-    m_item->setJobName(value.toString());
+    m_item->batchInfo()->setJobName(value.toString());
     return true;
 }
 
@@ -145,7 +146,7 @@ void JobPropertiesTableModel::setJobItem(JobItem* jobItem)
 void JobPropertiesTableModel::notifyJobPropertyChange()
 {
     // name
-    connect(m_item, &JobItem::jobNameChanged, [this](const QString&) {
+    connect(m_item->batchInfo(), &BatchInfo::jobNameChanged, [this](const QString&) {
         emit dataChanged(index(Row::Name, Column::Value), index(Row::Name, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
@@ -157,13 +158,13 @@ void JobPropertiesTableModel::notifyJobPropertyChange()
     });
 
     // begin time
-    connect(m_item, &JobItem::jobBeginTimeChanged, [this](const QDateTime&) {
+    connect(m_item->batchInfo(), &BatchInfo::jobBeginTimeChanged, [this](const QDateTime&) {
         emit dataChanged(index(Row::Begin, Column::Value), index(Row::Begin, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
 
     // end time and duration
-    connect(m_item, &JobItem::jobEndTimeChanged, [this](const QDateTime&) {
+    connect(m_item->batchInfo(), &BatchInfo::jobEndTimeChanged, [this](const QDateTime&) {
         emit dataChanged(index(Row::End, Column::Value), index(Row::Duration, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
diff --git a/GUI/View/JobControl/JobPropertiesWidget.cpp b/GUI/View/JobControl/JobPropertiesWidget.cpp
index 27d78c27f33..8f650a3cc78 100644
--- a/GUI/View/JobControl/JobPropertiesWidget.cpp
+++ b/GUI/View/JobControl/JobPropertiesWidget.cpp
@@ -13,6 +13,7 @@
 //  ************************************************************************************************
 
 #include "GUI/View/JobControl/JobPropertiesWidget.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Support/Data/JobStatus.h"
 #include "GUI/View/JobControl/JobPropertiesTableModel.h"
@@ -87,11 +88,11 @@ void JobPropertiesWidget::setJobItem(JobItem* jobItem)
         else
             m_tab_widget->tabBar()->setTabTextColor(JOB_MESSAGES, Qt::black);
 
-        if (m_job_item->comments().isEmpty())
+        if (m_job_item->batchInfo()->comments().isEmpty())
             m_tab_widget->setCurrentIndex(JOB_PROPERTIES);
         else
             m_tab_widget->setCurrentIndex(JOB_MESSAGES);
-        m_comments_editor->setText(m_job_item->comments());
+        m_comments_editor->setText(m_job_item->batchInfo()->comments());
 
         notifyJobPropertyChange();
     } else
@@ -104,10 +105,10 @@ void JobPropertiesWidget::setJobItem(JobItem* jobItem)
 
 void JobPropertiesWidget::notifyJobPropertyChange()
 {
-    connect(m_job_item, &JobItem::jobCommentsChanged, [this](const QString&) {
-        if (m_job_item && m_job_item->comments() != m_comments_editor->toPlainText()) {
+    connect(m_job_item->batchInfo(), &BatchInfo::jobCommentsChanged, [this](const QString&) {
+        if (m_job_item && m_job_item->batchInfo()->comments() != m_comments_editor->toPlainText()) {
             m_comments_editor->blockSignals(true);
-            m_comments_editor->setPlainText(m_job_item->comments());
+            m_comments_editor->setPlainText(m_job_item->batchInfo()->comments());
             m_comments_editor->blockSignals(false);
         }
     });
@@ -142,7 +143,7 @@ void JobPropertiesWidget::onCommentsEdited()
 {
     if (m_job_item) {
         m_job_item->blockSignals(true);
-        m_job_item->setComments(m_comments_editor->toPlainText());
+        m_job_item->batchInfo()->setComments(m_comments_editor->toPlainText());
         m_job_item->blockSignals(false);
     }
 }
diff --git a/GUI/View/Tuning/ParameterTuningWidget.cpp b/GUI/View/Tuning/ParameterTuningWidget.cpp
index 94c2025aab9..06b2bc66cbe 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.cpp
+++ b/GUI/View/Tuning/ParameterTuningWidget.cpp
@@ -15,6 +15,7 @@
 #include "GUI/View/Tuning/ParameterTuningWidget.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Data/Data2DItem.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
 #include "GUI/Model/Project/ProjectDocument.h"
@@ -289,7 +290,7 @@ void ParameterTuningWidget::updateJobStatus()
     if (isFailed(m_job_item->status())) {
         QString message;
         message.append("Current parameter values cause simulation failure.\n\n");
-        message.append(m_job_item->comments());
+        message.append(m_job_item->batchInfo()->comments());
         m_caution_sign->setCautionMessage(message);
     }
 
diff --git a/Tests/Unit/GUI/TestJobModel.cpp b/Tests/Unit/GUI/TestJobModel.cpp
index 4bb70136400..f195ff1465d 100644
--- a/Tests/Unit/GUI/TestJobModel.cpp
+++ b/Tests/Unit/GUI/TestJobModel.cpp
@@ -6,6 +6,7 @@
 #include "GUI/Model/Detector/DetectorItem.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
@@ -60,7 +61,7 @@ TEST(TestJobModel, saveNonXMLData)
     jobItem->copyDatafileItemIntoJob(&dfi);
 
     // update names
-    jobItem->setJobName("name");
+    jobItem->batchInfo()->setJobName("name");
     jobItem->updateFileName();
 
     // save first time
@@ -95,7 +96,7 @@ TEST(TestJobModel, saveNonXMLData)
     EXPECT_TRUE(UTest::GUI::isTheSame(*dataOnDisk1, *jobItem->simulatedDataItem()->c_field()));
 
     // rename job and check that file on disk changed the name
-    jobItem->setJobName("new_job");
+    jobItem->batchInfo()->setJobName("new_job");
     jobItem->updateFileName();
     jobModel.writeDatafiles(projectDir);
     QTest::qSleep(10);
-- 
GitLab


From 59c6ab3c22fced9454de5f4dc2cdec218df82da2 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 17:27:13 +0100
Subject: [PATCH 02/31] mv status to BatchInfo

---
 GUI/Model/Job/BatchInfo.cpp                   | 31 ++++++++++--
 GUI/Model/Job/BatchInfo.h                     |  9 ++++
 GUI/Model/Job/JobItem.cpp                     | 47 ++++++-------------
 GUI/Model/Job/JobItem.h                       |  9 +---
 GUI/Model/Tune/JobModel.cpp                   |  2 +-
 GUI/Model/Tune/JobQueueData.cpp               | 11 +++--
 GUI/Support/Data/JobStatus.cpp                | 10 ++++
 GUI/Support/Data/JobStatus.h                  |  6 ++-
 GUI/View/Fit/FitSessionController.cpp         | 10 ++--
 GUI/View/FitControl/RunFitControlWidget.cpp   |  5 +-
 GUI/View/JobControl/JobListModel.cpp          |  3 +-
 GUI/View/JobControl/JobListing.cpp            |  2 +-
 GUI/View/JobControl/JobProgressDelegate.cpp   |  6 +--
 .../JobControl/JobPropertiesTableModel.cpp    |  4 +-
 GUI/View/JobControl/JobPropertiesWidget.cpp   |  2 +-
 GUI/View/Tuning/FitParameterWidget.cpp        |  5 +-
 GUI/View/Tuning/JobRealTimeWidget.cpp         |  5 +-
 GUI/View/Tuning/ParameterTuningWidget.cpp     | 11 +++--
 18 files changed, 102 insertions(+), 76 deletions(-)

diff --git a/GUI/Model/Job/BatchInfo.cpp b/GUI/Model/Job/BatchInfo.cpp
index 6e13d1473e1..8acffebd09c 100644
--- a/GUI/Model/Job/BatchInfo.cpp
+++ b/GUI/Model/Job/BatchInfo.cpp
@@ -13,22 +13,29 @@
 //  ************************************************************************************************
 
 #include "GUI/Model/Job/BatchInfo.h"
+#include "GUI/Support/Data/JobStatus.h"
 #include "GUI/Support/XML/UtilXML.h"
 
 namespace {
 namespace Tag {
 
-const QString Name("Name");
-const QString Identifier("Id");
+const QString BeginTime("Begin");
 const QString Comments("Comments");
 const QString Duration("Duration");
-const QString BeginTime("Begin");
 const QString EndTime("End");
+const QString Identifier("Id");
+const QString Name("Name");
 const QString Progress("Progress");
+const QString Status("Status");
 
 } // namespace Tag
 } // namespace
 
+BatchInfo::BatchInfo()
+    : m_status(JobStatus::Idle)
+{
+}
+
 void BatchInfo::setJobName(const QString& name)
 {
     m_name = name;
@@ -68,6 +75,12 @@ void BatchInfo::setProgress(int progress)
     emit jobProgressChanged(progress);
 }
 
+void BatchInfo::setStatus(JobStatus status)
+{
+    m_status = status;
+    emit jobStatusChanged(status);
+}
+
 void BatchInfo::writeTo(QXmlStreamWriter* w) const
 {
     XML::writeAttribute(w, XML::Attrib::version, uint(2));
@@ -101,6 +114,11 @@ void BatchInfo::writeTo(QXmlStreamWriter* w) const
     w->writeStartElement(Tag::Comments);
     XML::writeAttribute(w, XML::Attrib::value, m_comments);
     w->writeEndElement();
+
+    // status
+    w->writeStartElement(Tag::Status);
+    XML::writeAttribute(w, XML::Attrib::value, jobStatusToString(m_status));
+    w->writeEndElement();
 }
 
 void BatchInfo::readFrom(QXmlStreamReader* r)
@@ -146,6 +164,13 @@ void BatchInfo::readFrom(QXmlStreamReader* r)
             XML::readAttribute(r, XML::Attrib::value, &m_name);
             XML::gotoEndElementOfTag(r, tag);
 
+            // status
+        } else if (tag == Tag::Status) {
+            QString status_str;
+            XML::readAttribute(r, XML::Attrib::value, &status_str);
+            m_status = jobStatusFromString(status_str);
+            XML::gotoEndElementOfTag(r, tag);
+
         } else
             r->skipCurrentElement();
     }
diff --git a/GUI/Model/Job/BatchInfo.h b/GUI/Model/Job/BatchInfo.h
index 90a05722035..02d8b7a3c5d 100644
--- a/GUI/Model/Job/BatchInfo.h
+++ b/GUI/Model/Job/BatchInfo.h
@@ -20,9 +20,13 @@
 #include <QXmlStreamReader>
 #include <QXmlStreamWriter>
 
+enum class JobStatus;
+
 class BatchInfo : public QObject {
     Q_OBJECT
 public:
+    BatchInfo();
+
     QString identifier() const { return m_identifier; }
     void setIdentifier(const QString& identifier) { m_identifier = identifier; }
 
@@ -44,6 +48,9 @@ public:
     int progress() const { return m_progress; }
     void setProgress(int progress);
 
+    JobStatus status() const { return m_status; }
+    void setStatus(JobStatus status);
+
     void writeTo(QXmlStreamWriter* w) const;
     void readFrom(QXmlStreamReader* r);
 
@@ -53,6 +60,7 @@ signals:
     void jobEndTimeChanged(const QDateTime& end_time);
     void jobCommentsChanged(const QString& comments);
     void jobProgressChanged(int progress);
+    void jobStatusChanged(JobStatus status);
 
 private:
     QString m_name;
@@ -61,6 +69,7 @@ private:
     QDateTime m_begin_time;
     QDateTime m_end_time;
     int m_progress;
+    JobStatus m_status;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_JOB_BATCHINFO_H
diff --git a/GUI/Model/Job/JobItem.cpp b/GUI/Model/Job/JobItem.cpp
index eb735ae3edd..e4d52755a0e 100644
--- a/GUI/Model/Job/JobItem.cpp
+++ b/GUI/Model/Job/JobItem.cpp
@@ -42,16 +42,15 @@
 namespace {
 namespace Tag {
 
-const QString SimulationOptions("SimulationOptions");
-const QString ParameterContainer("ParameterContainer");
-const QString Sample("Sample");
-const QString Instrument("Instrument");
-const QString BatchInfo("BatchInfo");
 const QString Activity("Activity");
-const QString Status("Status");
+const QString BatchInfo("BatchInfo");
 const QString DatafileItem("DatafileItem");
-const QString SimulatedData("SimulatedData");
 const QString FitSuite("FitSuite");
+const QString Instrument("Instrument");
+const QString ParameterContainer("ParameterContainer");
+const QString Sample("Sample");
+const QString SimulatedData("SimulatedData");
+const QString SimulationOptions("SimulationOptions");
 
 } // namespace Tag
 
@@ -72,24 +71,20 @@ JobItem::JobItem()
     , m_parameter_container(std::make_unique<ParameterContainerItem>())
     , m_sample_item(std::make_unique<SampleItem>())
     , m_batch_info(std::make_unique<BatchInfo>())
-    , m_status(JobStatus::Idle)
     , m_fit_suite_item(std::make_unique<FitSuiteItem>())
 {
 }
 
 JobItem::~JobItem() = default;
 
-void JobItem::setStatus(JobStatus status)
+void JobItem::setFailed()
 {
-    m_status = status;
-    if (isFailed(status)) {
-        if (DataItem* dataItem = simulatedDataItem()) {
-            if (Datafield* df = dataItem->p_field())
-                df->setAllTo(0.0);
-            emit dataItem->datafieldChanged();
-        }
+    if (DataItem* dataItem = simulatedDataItem()) {
+        if (Datafield* df = dataItem->p_field())
+            df->setAllTo(0.0);
+        emit dataItem->datafieldChanged();
     }
-    emit jobStatusChanged(status);
+    batchInfo()->setStatus(JobStatus::Failed);
 }
 
 size_t JobItem::rank() const
@@ -284,11 +279,6 @@ void JobItem::writeTo(QXmlStreamWriter* w) const
     XML::writeAttribute(w, XML::Attrib::value, m_activity);
     w->writeEndElement();
 
-    // status
-    w->writeStartElement(Tag::Status);
-    XML::writeAttribute(w, XML::Attrib::value, jobStatusToString(m_status));
-    w->writeEndElement();
-
     // simulated data
     if (m_simulated_data_item) {
         w->writeStartElement(Tag::SimulatedData);
@@ -350,13 +340,6 @@ void JobItem::readFrom(QXmlStreamReader* r)
             m_batch_info->readFrom(r);
             XML::gotoEndElementOfTag(r, tag);
 
-            // status
-        } else if (tag == Tag::Status) {
-            QString status_str;
-            XML::readAttribute(r, XML::Attrib::value, &status_str);
-            m_status = jobStatusFromString(status_str);
-            XML::gotoEndElementOfTag(r, tag);
-
             // simulated data
         } else if (tag == Tag::SimulatedData) {
             createSimulatedDataItem();
@@ -413,7 +396,7 @@ void JobItem::readDatafiles(const QString& projectDir, MessageService* messageSe
     }
 
     // Handling previous crash of GUI during job run
-    if (isRunning(m_status)) {
+    if (isRunning(batchInfo()->status())) {
         if (errorMessage.isEmpty())
             errorMessage = "Possible GUI crash while job was running";
         else
@@ -421,8 +404,8 @@ void JobItem::readDatafiles(const QString& projectDir, MessageService* messageSe
     }
 
     if (!errorMessage.isEmpty()) {
-        m_batch_info->setComments(errorMessage);
-        m_status = JobStatus::Failed;
+        batchInfo()->setComments(errorMessage);
+        setFailed();
     }
 }
 
diff --git a/GUI/Model/Job/JobItem.h b/GUI/Model/Job/JobItem.h
index 1165a54a39a..111734a6cb5 100644
--- a/GUI/Model/Job/JobItem.h
+++ b/GUI/Model/Job/JobItem.h
@@ -19,8 +19,6 @@
 #include "GUI/Model/Device/InstrumentItemCatalog.h"
 #include <optional>
 
-enum class JobStatus;
-
 class BatchInfo;
 class Data2DItem;
 class DataItem;
@@ -46,8 +44,7 @@ public:
     const BatchInfo* batchInfo() const { return m_batch_info.get(); }
     BatchInfo* batchInfo() { return m_batch_info.get(); }
 
-    JobStatus status() const { return m_status; }
-    void setStatus(JobStatus status);
+    void setFailed();
 
     bool isValidForFitting() const { return bool(m_real_item); }
 
@@ -107,9 +104,6 @@ public:
     void writeDatafiles(const QString& projectDir) const;
     void readDatafiles(const QString& projectDir, MessageService* messageService);
 
-signals:
-    void jobStatusChanged(JobStatus status);
-
 private:
     void cropRealData();
     void importMasksFromDatafileItem();
@@ -120,7 +114,6 @@ private:
     std::unique_ptr<SampleItem> m_sample_item;
     SelectionProperty<InstrumentItemCatalog> m_instrument;
     std::unique_ptr<BatchInfo> m_batch_info;
-    JobStatus m_status;
     QString m_activity;
     std::unique_ptr<DataItem> m_simulated_data_item;
     std::unique_ptr<DataItem> m_diff_data_item;
diff --git a/GUI/Model/Tune/JobModel.cpp b/GUI/Model/Tune/JobModel.cpp
index 33d715775da..05945dbbabd 100644
--- a/GUI/Model/Tune/JobModel.cpp
+++ b/GUI/Model/Tune/JobModel.cpp
@@ -106,7 +106,7 @@ bool JobModel::hasUnfinishedJobs()
         return true;
 
     for (auto* jobItem : jobItems())
-        if (isFitting(jobItem->status()))
+        if (isFitting(jobItem->batchInfo()->status()))
             return true;
 
     return false;
diff --git a/GUI/Model/Tune/JobQueueData.cpp b/GUI/Model/Tune/JobQueueData.cpp
index 248c2138322..c06300daf7d 100644
--- a/GUI/Model/Tune/JobQueueData.cpp
+++ b/GUI/Model/Tune/JobQueueData.cpp
@@ -18,6 +18,7 @@
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/ToCore/SimulationToCore.h"
 #include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Support/Data/JobStatus.h"
 #include "GUI/Support/Data/JobWorker.h"
 #include "Sim/Simulation/ISimulation.h"
 
@@ -53,7 +54,7 @@ void JobQueueData::runJob(JobItem* jobItem)
         message += QString::fromStdString(std::string(ex.what()));
         jobItem->batchInfo()->setComments(message);
         jobItem->batchInfo()->setProgress(100);
-        jobItem->setStatus(JobStatus::Failed);
+        jobItem->setFailed();
         clearSimulation(identifier);
         emit jobSelected(jobItem);
         return;
@@ -106,7 +107,7 @@ void JobQueueData::onStartedJob()
 
     auto* jobItem = m_job_model->jobItemForIdentifier(worker->identifier());
     jobItem->batchInfo()->setProgress(0);
-    jobItem->setStatus(JobStatus::Running);
+    jobItem->batchInfo()->setStatus(JobStatus::Running);
     jobItem->batchInfo()->setBeginTime(worker->simulationStart());
     jobItem->batchInfo()->setEndTime(QDateTime());
 }
@@ -155,7 +156,7 @@ void JobQueueData::updateGlobalProgress()
     int global_progress(0);
     int nRunningJobs(0);
     for (auto* jobItem : m_job_model->jobItems())
-        if (isRunning(jobItem->status())) {
+        if (isRunning(jobItem->batchInfo()->status())) {
             global_progress += jobItem->batchInfo()->progress();
             nRunningJobs++;
         }
@@ -228,10 +229,10 @@ void JobQueueData::processFinishedJob(JobWorker* worker, JobItem* jobItem)
         ASSERT(worker->result());
         jobItem->setResults(*worker->result());
     }
-    jobItem->setStatus(worker->status());
+    jobItem->batchInfo()->setStatus(worker->status());
 
     // fixing job progress (if job was successfull, but due to wrong estimation, progress not 100%)
-    if (isCompleted(jobItem->status()))
+    if (isCompleted(jobItem->batchInfo()->status()))
         jobItem->batchInfo()->setProgress(100);
 }
 
diff --git a/GUI/Support/Data/JobStatus.cpp b/GUI/Support/Data/JobStatus.cpp
index f7c0d662fd9..32a1e4886d8 100644
--- a/GUI/Support/Data/JobStatus.cpp
+++ b/GUI/Support/Data/JobStatus.cpp
@@ -28,6 +28,16 @@ const boost::bimap<JobStatus, QString> status2name(values.begin(), values.end())
 
 } // namespace
 
+bool isActive(JobStatus status)
+{
+    return isRunning(status) || isFitting(status);
+}
+
+bool isOver(JobStatus status)
+{
+    return isCompleted(status) || isCanceled(status) || isFailed(status);
+}
+
 bool isRunning(JobStatus status)
 {
     return status == JobStatus::Running;
diff --git a/GUI/Support/Data/JobStatus.h b/GUI/Support/Data/JobStatus.h
index 2357c7fde0f..67ad3df8354 100644
--- a/GUI/Support/Data/JobStatus.h
+++ b/GUI/Support/Data/JobStatus.h
@@ -28,11 +28,13 @@ enum class JobStatus {
     Failed     //!< the job aborted because it hit an error
 };
 
-bool isRunning(JobStatus status);
-bool isCompleted(JobStatus status);
+bool isActive(JobStatus status);
 bool isCanceled(JobStatus status);
+bool isCompleted(JobStatus status);
 bool isFailed(JobStatus status);
 bool isFitting(JobStatus status);
+bool isRunning(JobStatus status);
+bool isOver(JobStatus status);
 
 //! Returns a string representation of the status
 QString jobStatusToString(JobStatus status);
diff --git a/GUI/View/Fit/FitSessionController.cpp b/GUI/View/Fit/FitSessionController.cpp
index d40b9286355..5dbdf18b85a 100644
--- a/GUI/View/Fit/FitSessionController.cpp
+++ b/GUI/View/Fit/FitSessionController.cpp
@@ -79,7 +79,7 @@ void FitSessionController::onStartFittingRequest()
         m_observer->finishedPlotting();
         m_run_fit_manager->runFitting(m_objective_builder);
     } catch (std::exception& e) {
-        m_job_item->setStatus(JobStatus::Failed);
+        m_job_item->setFailed();
         m_fitlog->append(e.what(), FitLogLevel::Error);
         emit fittingError(QString::fromStdString(e.what()));
     }
@@ -117,7 +117,7 @@ void FitSessionController::onFittingStarted()
 {
     m_fitlog->clearLog();
 
-    m_job_item->setStatus(JobStatus::Fitting);
+    m_job_item->batchInfo()->setStatus(JobStatus::Fitting);
     m_job_item->batchInfo()->setProgress(0);
     m_job_item->batchInfo()->setBeginTime(m_run_fit_manager->fitStart());
     m_job_item->batchInfo()->setEndTime(QDateTime());
@@ -127,12 +127,12 @@ void FitSessionController::onFittingStarted()
 
 void FitSessionController::onFittingFinished()
 {
-    if (!isFailed(m_job_item->status()))
-        m_job_item->setStatus(JobStatus::Completed);
+    if (!isFailed(m_job_item->batchInfo()->status()))
+        m_job_item->batchInfo()->setStatus(JobStatus::Completed);
     m_job_item->batchInfo()->setEndTime(m_run_fit_manager->fitEnd());
     m_job_item->batchInfo()->setProgress(100);
 
-    if (isCompleted(m_job_item->status()))
+    if (isCompleted(m_job_item->batchInfo()->status()))
         m_fitlog->append("Done", FitLogLevel::Success);
 
     // TODO: notify Fit2DFrame/Fit1DFrame in a proper way by fittingFinished();
diff --git a/GUI/View/FitControl/RunFitControlWidget.cpp b/GUI/View/FitControl/RunFitControlWidget.cpp
index e3e3e33d1d5..c03ce1c9ffb 100644
--- a/GUI/View/FitControl/RunFitControlWidget.cpp
+++ b/GUI/View/FitControl/RunFitControlWidget.cpp
@@ -14,6 +14,7 @@
 
 #include "GUI/View/FitControl/RunFitControlWidget.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/FitSuiteItem.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Project/ProjectDocument.h"
@@ -99,7 +100,7 @@ void RunFitControlWidget::setJobItem(JobItem* job_item)
     ASSERT(job_item);
     m_job_item = job_item;
 
-    updateControlElements(m_job_item->status());
+    updateControlElements(m_job_item->batchInfo()->status());
     updateIterationsCountLabel(fitSuiteItem()->iterationCount());
 
     initializeSlider();
@@ -107,7 +108,7 @@ void RunFitControlWidget::setJobItem(JobItem* job_item)
     connect(fitSuiteItem(), &FitSuiteItem::iterationCountChanged, this,
             &RunFitControlWidget::updateIterationsCountLabel, Qt::UniqueConnection);
 
-    connect(m_job_item, &JobItem::jobStatusChanged, this,
+    connect(m_job_item->batchInfo(), &BatchInfo::jobStatusChanged, this,
             &RunFitControlWidget::updateControlElements, Qt::UniqueConnection);
 }
 
diff --git a/GUI/View/JobControl/JobListModel.cpp b/GUI/View/JobControl/JobListModel.cpp
index 5098bb233a6..4d7ea629c86 100644
--- a/GUI/View/JobControl/JobListModel.cpp
+++ b/GUI/View/JobControl/JobListModel.cpp
@@ -111,7 +111,8 @@ void JobListModel::emitJobListModelChanged(JobItem* job)
 void JobListModel::onJobAdded()
 {
     for (JobItem* job : m_jobs->jobItems()) {
-        connect(job, &JobItem::jobStatusChanged, [this, job] { emitJobListModelChanged(job); });
+        connect(job->batchInfo(), &BatchInfo::jobStatusChanged,
+                [this, job] { emitJobListModelChanged(job); });
         connect(job->batchInfo(), &BatchInfo::jobNameChanged,
                 [this, job] { emitJobListModelChanged(job); });
         connect(job->batchInfo(), &BatchInfo::jobProgressChanged,
diff --git a/GUI/View/JobControl/JobListing.cpp b/GUI/View/JobControl/JobListing.cpp
index 62cdeb7763f..a196f4624e8 100644
--- a/GUI/View/JobControl/JobListing.cpp
+++ b/GUI/View/JobControl/JobListing.cpp
@@ -248,7 +248,7 @@ void JobListing::updateActions()
         {
             JobItem* job = m_model->jobItemForIndex(i);
             ASSERT(job);
-            return isRunning(job->status()) || isFitting(job->status());
+            return isActive(job->batchInfo()->status());
         }
     };
 
diff --git a/GUI/View/JobControl/JobProgressDelegate.cpp b/GUI/View/JobControl/JobProgressDelegate.cpp
index 779a6476c73..19635125f51 100644
--- a/GUI/View/JobControl/JobProgressDelegate.cpp
+++ b/GUI/View/JobControl/JobProgressDelegate.cpp
@@ -54,7 +54,7 @@ void JobProgressDelegate::paint(QPainter* painter, const QStyleOptionViewItem& o
 
     drawCustomProjectBar(item, painter, option);
 
-    if (isRunning(item->status())) {
+    if (isRunning(item->batchInfo()->status())) {
         QStyleOptionButton button;
         button.rect = getButtonRect(option.rect);
         button.state = m_button_state | QStyle::State_Enabled;
@@ -82,7 +82,7 @@ bool JobProgressDelegate::editorEvent(QEvent* event, QAbstractItemModel* model,
     const JobItem* item = jqmodel->jobItemForIndex(index);
     ASSERT(item);
 
-    if (!isRunning(item->status()))
+    if (!isRunning(item->batchInfo()->status()))
         return false;
 
     QRect buttonRect = getButtonRect(option.rect);
@@ -120,7 +120,7 @@ void JobProgressDelegate::drawCustomProjectBar(const JobItem* item, QPainter* pa
     painter->save();
     painter->setRenderHint(QPainter::Antialiasing);
     painter->setPen(QColor("transparent"));
-    painter->setBrush(m_status_to_color[item->status()]);
+    painter->setBrush(m_status_to_color[item->batchInfo()->status()]);
     QRect rect5(rect.x(), rect.y(), progBarWidth, rect.height());
     painter->drawRoundedRect(rect5, 2, 2);
     painter->restore();
diff --git a/GUI/View/JobControl/JobPropertiesTableModel.cpp b/GUI/View/JobControl/JobPropertiesTableModel.cpp
index 8197bf4ee9f..e22851529b9 100644
--- a/GUI/View/JobControl/JobPropertiesTableModel.cpp
+++ b/GUI/View/JobControl/JobPropertiesTableModel.cpp
@@ -82,7 +82,7 @@ QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
         case Row::Instrument:
             return m_item->instrumentItem()->instrumentName();
         case Row::Status:
-            return jobStatusToString(m_item->status());
+            return jobStatusToString(m_item->batchInfo()->status());
         case Row::Begin:
             if (role == Qt::ToolTipRole)
                 return QLocale().toString(m_item->batchInfo()->beginTime(), QLocale::LongFormat);
@@ -152,7 +152,7 @@ void JobPropertiesTableModel::notifyJobPropertyChange()
     });
 
     // status
-    connect(m_item, &JobItem::jobStatusChanged, [this](const JobStatus) {
+    connect(m_item->batchInfo(), &BatchInfo::jobStatusChanged, [this](const JobStatus) {
         emit dataChanged(index(Row::Status, Column::Value), index(Row::Status, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
diff --git a/GUI/View/JobControl/JobPropertiesWidget.cpp b/GUI/View/JobControl/JobPropertiesWidget.cpp
index 8f650a3cc78..144f819b928 100644
--- a/GUI/View/JobControl/JobPropertiesWidget.cpp
+++ b/GUI/View/JobControl/JobPropertiesWidget.cpp
@@ -83,7 +83,7 @@ void JobPropertiesWidget::setJobItem(JobItem* jobItem)
     m_job_item = jobItem;
     m_properties_model->setJobItem(m_job_item);
     if (m_job_item) {
-        if (isFailed(m_job_item->status()))
+        if (isFailed(m_job_item->batchInfo()->status()))
             m_tab_widget->tabBar()->setTabTextColor(JOB_MESSAGES, Qt::red);
         else
             m_tab_widget->tabBar()->setTabTextColor(JOB_MESSAGES, Qt::black);
diff --git a/GUI/View/Tuning/FitParameterWidget.cpp b/GUI/View/Tuning/FitParameterWidget.cpp
index 83399d7c1c8..cbbf42b8e56 100644
--- a/GUI/View/Tuning/FitParameterWidget.cpp
+++ b/GUI/View/Tuning/FitParameterWidget.cpp
@@ -14,6 +14,7 @@
 
 #include "GUI/View/Tuning/FitParameterWidget.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/FitParameterContainerItem.h"
 #include "GUI/Model/Job/FitSuiteItem.h"
 #include "GUI/Model/Job/JobItem.h"
@@ -100,7 +101,7 @@ void FitParameterWidget::onTuningWidgetContextMenu(const QPoint& point)
 {
     QMenu menu;
 
-    if (isFitting(m_job_item->status())) {
+    if (isFitting(m_job_item->batchInfo()->status())) {
         setActionsEnabled(false);
         return;
     }
@@ -134,7 +135,7 @@ void FitParameterWidget::onTuningWidgetContextMenu(const QPoint& point)
 
 void FitParameterWidget::onFitParameterTreeContextMenu(const QPoint& point)
 {
-    if (isFitting(m_job_item->status())) {
+    if (isFitting(m_job_item->batchInfo()->status())) {
         setActionsEnabled(false);
         return;
     }
diff --git a/GUI/View/Tuning/JobRealTimeWidget.cpp b/GUI/View/Tuning/JobRealTimeWidget.cpp
index 3e18113ab40..9312be7d97b 100644
--- a/GUI/View/Tuning/JobRealTimeWidget.cpp
+++ b/GUI/View/Tuning/JobRealTimeWidget.cpp
@@ -13,6 +13,7 @@
 //  ************************************************************************************************
 
 #include "GUI/View/Tuning/JobRealTimeWidget.h"
+#include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Tune/JobModel.h"
 #include "GUI/Support/Data/JobStatus.h"
@@ -66,9 +67,7 @@ void JobRealTimeWidget::setJobItem(JobItem* jobItem)
 
 bool JobRealTimeWidget::isValidJobItem(JobItem* item)
 {
-    return item
-           && (isCompleted(item->status()) || isCanceled(item->status())
-               || isFailed(item->status()));
+    return item && isOver(item->batchInfo()->status());
 }
 
 void JobRealTimeWidget::applySettings()
diff --git a/GUI/View/Tuning/ParameterTuningWidget.cpp b/GUI/View/Tuning/ParameterTuningWidget.cpp
index 06b2bc66cbe..1899c3dc50b 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.cpp
+++ b/GUI/View/Tuning/ParameterTuningWidget.cpp
@@ -124,7 +124,8 @@ void ParameterTuningWidget::setJobItem(JobItem* job_item)
     updateParameterModel();
     updateDragAndDropSettings();
 
-    connect(m_job_item, &JobItem::jobStatusChanged, [this](const JobStatus) { updateJobStatus(); });
+    connect(m_job_item->batchInfo(), &BatchInfo::jobStatusChanged,
+            [this](const JobStatus) { updateJobStatus(); });
 
     updateJobStatus();
 }
@@ -157,7 +158,7 @@ void ParameterTuningWidget::onCurrentLinkChanged(ParameterItem* item)
 {
     ASSERT(m_job_item);
 
-    if (isRunning(m_job_item->status()))
+    if (isRunning(m_job_item->batchInfo()->status()))
         return;
 
     if (item)
@@ -216,7 +217,7 @@ void ParameterTuningWidget::restoreModelsOfCurrentJobItem(int index)
     ASSERT(m_job_model);
     ASSERT(m_job_item);
 
-    if (isRunning(m_job_item->status()))
+    if (isRunning(m_job_item->batchInfo()->status()))
         return;
 
     closeActiveEditors();
@@ -249,7 +250,7 @@ void ParameterTuningWidget::contextMenuEvent(QContextMenuEvent*)
 void ParameterTuningWidget::updateDragAndDropSettings()
 {
     ASSERT(m_job_item);
-    if (m_job_item->status() == JobStatus::Fitting) {
+    if (m_job_item->batchInfo()->status() == JobStatus::Fitting) {
         setTuningDelegateEnabled(false);
         m_tree_view->setDragDropMode(QAbstractItemView::NoDragDrop);
     } else {
@@ -287,7 +288,7 @@ void ParameterTuningWidget::updateJobStatus()
 {
     m_caution_sign->clear();
 
-    if (isFailed(m_job_item->status())) {
+    if (isFailed(m_job_item->batchInfo()->status())) {
         QString message;
         message.append("Current parameter values cause simulation failure.\n\n");
         message.append(m_job_item->batchInfo()->comments());
-- 
GitLab


From c6b863e433cd8a11f58247ddaa10c171c964bb8f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 17:51:07 +0100
Subject: [PATCH 03/31] rm Q_OBJECT

---
 GUI/Model/Job/JobItem.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/GUI/Model/Job/JobItem.h b/GUI/Model/Job/JobItem.h
index 111734a6cb5..a76ca010b32 100644
--- a/GUI/Model/Job/JobItem.h
+++ b/GUI/Model/Job/JobItem.h
@@ -34,7 +34,6 @@ class SampleItem;
 class SimulationOptionsItem;
 
 class JobItem : public QObject {
-    Q_OBJECT
 public:
     JobItem();
     ~JobItem();
-- 
GitLab


From 1c938a02c17b557353bc10a53bdd158150d5762a Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 17:54:33 +0100
Subject: [PATCH 04/31] rm include

---
 GUI/Model/Device/InstrumentItems.cpp | 1 +
 GUI/Model/Sample/SampleItem.h        | 1 -
 GUI/Model/Tune/JobModel.cpp          | 1 +
 3 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp
index 1f209bba2e3..47c88e61a90 100644
--- a/GUI/Model/Device/InstrumentItems.cpp
+++ b/GUI/Model/Device/InstrumentItems.cpp
@@ -44,6 +44,7 @@
 #include "Sim/Scan/AlphaScan.h"
 #include "Sim/Simulation/includeSimulations.h"
 #include <numbers>
+#include <QUuid>
 
 using std::numbers::pi;
 
diff --git a/GUI/Model/Sample/SampleItem.h b/GUI/Model/Sample/SampleItem.h
index b668304201c..75c4395b438 100644
--- a/GUI/Model/Sample/SampleItem.h
+++ b/GUI/Model/Sample/SampleItem.h
@@ -20,7 +20,6 @@
 #include "GUI/Model/Sample/Item3D.h"
 #include "GUI/Model/Sample/MaterialModel.h"
 #include <QString>
-#include <QUuid>
 #include <QVector>
 #include <QXmlStreamReader>
 
diff --git a/GUI/Model/Tune/JobModel.cpp b/GUI/Model/Tune/JobModel.cpp
index 05945dbbabd..90293aff8d6 100644
--- a/GUI/Model/Tune/JobModel.cpp
+++ b/GUI/Model/Tune/JobModel.cpp
@@ -21,6 +21,7 @@
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Model/Tune/JobQueueData.h"
 #include "GUI/Support/Data/JobStatus.h"
+#include <QUuid>
 
 namespace {
 namespace Tag {
-- 
GitLab


From 5cbdedaf230be029412ebaa5b489669cfc9db02a Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 17:56:36 +0100
Subject: [PATCH 05/31] rename GUI/Model/Sample/MaterialItem ->
 GUI/Model/Material/

---
 GUI/Model/FromCore/ItemizeSample.cpp            | 2 +-
 GUI/Model/Job/ParameterTreeBuilder.cpp          | 2 +-
 GUI/Model/{Sample => Material}/MaterialItem.cpp | 4 ++--
 GUI/Model/{Sample => Material}/MaterialItem.h   | 8 ++++----
 GUI/Model/Project/ProjectDocument.cpp           | 2 +-
 GUI/Model/Sample/ItemWithMaterial.cpp           | 2 +-
 GUI/Model/Sample/MaterialModel.cpp              | 2 +-
 GUI/Model/Sample/ParticleItem.cpp               | 2 +-
 GUI/Model/ToCore/SampleToCore.cpp               | 2 +-
 GUI/View/Material/MaterialEditorDialog.cpp      | 2 +-
 GUI/View/Material/MaterialTableModel.cpp        | 2 +-
 GUI/View/Realspace/RealspaceWidget.cpp          | 2 +-
 GUI/View/Sample/LayerForm.cpp                   | 2 +-
 GUI/View/Sample/MaterialInplaceForm.cpp         | 2 +-
 Tests/Unit/GUI/TestMaterialItems.cpp            | 2 +-
 15 files changed, 19 insertions(+), 19 deletions(-)
 rename GUI/Model/{Sample => Material}/MaterialItem.cpp (98%)
 rename GUI/Model/{Sample => Material}/MaterialItem.h (93%)

diff --git a/GUI/Model/FromCore/ItemizeSample.cpp b/GUI/Model/FromCore/ItemizeSample.cpp
index 7bd9d0dcd97..c8eb6d376a3 100644
--- a/GUI/Model/FromCore/ItemizeSample.cpp
+++ b/GUI/Model/FromCore/ItemizeSample.cpp
@@ -14,10 +14,10 @@
 
 #include "GUI/Model/FromCore/ItemizeSample.h"
 #include "Base/Const/Units.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/CompoundItem.h"
 #include "GUI/Model/Sample/CoreAndShellItem.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/MesocrystalItem.h"
 #include "GUI/Model/Sample/ParticleItem.h"
 #include "GUI/Model/Sample/ParticleLayoutItem.h"
diff --git a/GUI/Model/Job/ParameterTreeBuilder.cpp b/GUI/Model/Job/ParameterTreeBuilder.cpp
index ee06c888199..e97e780a2f1 100644
--- a/GUI/Model/Job/ParameterTreeBuilder.cpp
+++ b/GUI/Model/Job/ParameterTreeBuilder.cpp
@@ -24,10 +24,10 @@
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/CompoundItem.h"
 #include "GUI/Model/Sample/CoreAndShellItem.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/MesocrystalItem.h"
 #include "GUI/Model/Sample/ParticleItem.h"
 #include "GUI/Model/Sample/ParticleLayoutItem.h"
diff --git a/GUI/Model/Sample/MaterialItem.cpp b/GUI/Model/Material/MaterialItem.cpp
similarity index 98%
rename from GUI/Model/Sample/MaterialItem.cpp
rename to GUI/Model/Material/MaterialItem.cpp
index 437d4ccf2a1..7adcef85a10 100644
--- a/GUI/Model/Sample/MaterialItem.cpp
+++ b/GUI/Model/Material/MaterialItem.cpp
@@ -2,7 +2,7 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Sample/MaterialItem.cpp
+//! @file      GUI/Model/Material/MaterialItem.cpp
 //! @brief     Implements class MaterialItem.
 //!
 //! @homepage  http://www.bornagainproject.org
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Sample/MaterialItem.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Support/XML/DeserializationException.h"
 #include "GUI/Support/XML/UtilXML.h"
diff --git a/GUI/Model/Sample/MaterialItem.h b/GUI/Model/Material/MaterialItem.h
similarity index 93%
rename from GUI/Model/Sample/MaterialItem.h
rename to GUI/Model/Material/MaterialItem.h
index 1f361f1654f..180b06bfab6 100644
--- a/GUI/Model/Sample/MaterialItem.h
+++ b/GUI/Model/Material/MaterialItem.h
@@ -2,7 +2,7 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Sample/MaterialItem.h
+//! @file      GUI/Model/Material/MaterialItem.h
 //! @brief     Defines class MaterialItem.
 //!
 //! @homepage  http://www.bornagainproject.org
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_MATERIALITEM_H
-#define BORNAGAIN_GUI_MODEL_SAMPLE_MATERIALITEM_H
+#ifndef BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALITEM_H
+#define BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALITEM_H
 
 #include "GUI/Model/Descriptor/VectorProperty.h"
 #include <QColor>
@@ -96,4 +96,4 @@ signals:
     void dataChanged() const;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_SAMPLE_MATERIALITEM_H
+#endif // BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALITEM_H
diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp
index 9c920816a92..5a03b9ed68f 100644
--- a/GUI/Model/Project/ProjectDocument.cpp
+++ b/GUI/Model/Project/ProjectDocument.cpp
@@ -16,9 +16,9 @@
 #include "GUI/Model/Device/BackgroundItems.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Project/ProjectUtil.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/Data/ID.h"
 #include "GUI/Support/Util/MessageService.h"
diff --git a/GUI/Model/Sample/ItemWithMaterial.cpp b/GUI/Model/Sample/ItemWithMaterial.cpp
index 2693dd23082..18d220de0a9 100644
--- a/GUI/Model/Sample/ItemWithMaterial.cpp
+++ b/GUI/Model/Sample/ItemWithMaterial.cpp
@@ -14,7 +14,7 @@
 
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "Base/Util/Assert.h"
-#include "GUI/Model/Sample/MaterialItem.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Support/XML/UtilXML.h"
 
diff --git a/GUI/Model/Sample/MaterialModel.cpp b/GUI/Model/Sample/MaterialModel.cpp
index b4171a8f7c6..3a270607d7f 100644
--- a/GUI/Model/Sample/MaterialModel.cpp
+++ b/GUI/Model/Sample/MaterialModel.cpp
@@ -14,7 +14,7 @@
 
 #include "GUI/Model/Sample/MaterialModel.h"
 #include "Base/Util/Assert.h"
-#include "GUI/Model/Sample/MaterialItem.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Support/XML/UtilXML.h"
 #include <QColor>
 #include <QUuid>
diff --git a/GUI/Model/Sample/ParticleItem.cpp b/GUI/Model/Sample/ParticleItem.cpp
index c9422a954a8..5d929a6feab 100644
--- a/GUI/Model/Sample/ParticleItem.cpp
+++ b/GUI/Model/Sample/ParticleItem.cpp
@@ -13,7 +13,7 @@
 //  ************************************************************************************************
 
 #include "GUI/Model/Sample/ParticleItem.h"
-#include "GUI/Model/Sample/MaterialItem.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "Sample/Particle/IFormFactor.h"
 #include "Sample/Particle/Particle.h"
 #include "Sample/Scattering/Rotations.h"
diff --git a/GUI/Model/ToCore/SampleToCore.cpp b/GUI/Model/ToCore/SampleToCore.cpp
index ecc9eff063c..e1c32e3fde6 100644
--- a/GUI/Model/ToCore/SampleToCore.cpp
+++ b/GUI/Model/ToCore/SampleToCore.cpp
@@ -14,11 +14,11 @@
 
 #include "GUI/Model/ToCore/SampleToCore.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/CompoundItem.h"
 #include "GUI/Model/Sample/CoreAndShellItem.h"
 #include "GUI/Model/Sample/InterferenceItems.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/MesocrystalItem.h"
 #include "GUI/Model/Sample/ParticleItem.h"
 #include "GUI/Model/Sample/ParticleLayoutItem.h"
diff --git a/GUI/View/Material/MaterialEditorDialog.cpp b/GUI/View/Material/MaterialEditorDialog.cpp
index b32f5f1ea01..96a62f28351 100644
--- a/GUI/View/Material/MaterialEditorDialog.cpp
+++ b/GUI/View/Material/MaterialEditorDialog.cpp
@@ -13,8 +13,8 @@
 //  ************************************************************************************************
 
 #include "GUI/View/Material/MaterialEditorDialog.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/Style/Style.h"
diff --git a/GUI/View/Material/MaterialTableModel.cpp b/GUI/View/Material/MaterialTableModel.cpp
index 9d43db0343a..f09184bfe3b 100644
--- a/GUI/View/Material/MaterialTableModel.cpp
+++ b/GUI/View/Material/MaterialTableModel.cpp
@@ -13,7 +13,7 @@
 //  ************************************************************************************************
 
 #include "GUI/View/Material/MaterialTableModel.h"
-#include "GUI/Model/Sample/MaterialItem.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/MaterialModel.h"
 #include <QApplication>
 #include <QFontMetrics>
diff --git a/GUI/View/Realspace/RealspaceWidget.cpp b/GUI/View/Realspace/RealspaceWidget.cpp
index c7022126071..389aa0a6dc1 100644
--- a/GUI/View/Realspace/RealspaceWidget.cpp
+++ b/GUI/View/Realspace/RealspaceWidget.cpp
@@ -14,8 +14,8 @@
 
 #include "GUI/View/Realspace/RealspaceWidget.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Project/ProjectDocument.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/View/Info/CautionSign.h"
 #include "GUI/View/Layout/ApplicationSettings.h"
diff --git a/GUI/View/Sample/LayerForm.cpp b/GUI/View/Sample/LayerForm.cpp
index c538249afe7..18f4d12826c 100644
--- a/GUI/View/Sample/LayerForm.cpp
+++ b/GUI/View/Sample/LayerForm.cpp
@@ -14,8 +14,8 @@
 
 #include "GUI/View/Sample/LayerForm.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/View/Numeric/NumWidgetUtil.h"
diff --git a/GUI/View/Sample/MaterialInplaceForm.cpp b/GUI/View/Sample/MaterialInplaceForm.cpp
index 6bf95c3f43f..24275e3b229 100644
--- a/GUI/View/Sample/MaterialInplaceForm.cpp
+++ b/GUI/View/Sample/MaterialInplaceForm.cpp
@@ -14,9 +14,9 @@
 
 #include "GUI/View/Sample/MaterialInplaceForm.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialItem.h"
 #include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/XML/Backup.h"
diff --git a/Tests/Unit/GUI/TestMaterialItems.cpp b/Tests/Unit/GUI/TestMaterialItems.cpp
index 4da8ecb8876..edf84e99635 100644
--- a/Tests/Unit/GUI/TestMaterialItems.cpp
+++ b/Tests/Unit/GUI/TestMaterialItems.cpp
@@ -1,4 +1,4 @@
-#include "GUI/Model/Sample/MaterialItem.h"
+#include "GUI/Model/Material/MaterialItem.h"
 
 #include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Support/XML/Backup.h"
-- 
GitLab


From 902b657a9d45c19c3e8a9968276c7fcb23427c06 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 17:56:41 +0100
Subject: [PATCH 06/31] rename GUI/Model/Sample/MaterialModel. ->
 GUI/Model/Material/

---
 GUI/Model/{Sample => Material}/MaterialModel.cpp | 4 ++--
 GUI/Model/{Sample => Material}/MaterialModel.h   | 8 ++++----
 GUI/Model/Sample/CoreAndShellItem.cpp            | 2 +-
 GUI/Model/Sample/ItemWithMaterial.cpp            | 2 +-
 GUI/Model/Sample/SampleItem.h                    | 2 +-
 GUI/View/Material/MaterialEditorDialog.cpp       | 2 +-
 GUI/View/Material/MaterialTableModel.cpp         | 2 +-
 GUI/View/Sample/LayerForm.cpp                    | 2 +-
 GUI/View/Sample/MaterialInplaceForm.cpp          | 2 +-
 GUI/View/Sample/SampleEditorController.cpp       | 2 +-
 Tests/Unit/GUI/TestMaterialItems.cpp             | 2 +-
 11 files changed, 15 insertions(+), 15 deletions(-)
 rename GUI/Model/{Sample => Material}/MaterialModel.cpp (98%)
 rename GUI/Model/{Sample => Material}/MaterialModel.h (91%)

diff --git a/GUI/Model/Sample/MaterialModel.cpp b/GUI/Model/Material/MaterialModel.cpp
similarity index 98%
rename from GUI/Model/Sample/MaterialModel.cpp
rename to GUI/Model/Material/MaterialModel.cpp
index 3a270607d7f..69719c37e8b 100644
--- a/GUI/Model/Sample/MaterialModel.cpp
+++ b/GUI/Model/Material/MaterialModel.cpp
@@ -2,7 +2,7 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Sample/MaterialModel.cpp
+//! @file      GUI/Model/Material/MaterialModel.cpp
 //! @brief     Implements class MaterialModel.
 //!
 //! @homepage  http://www.bornagainproject.org
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Sample/MaterialModel.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Support/XML/UtilXML.h"
diff --git a/GUI/Model/Sample/MaterialModel.h b/GUI/Model/Material/MaterialModel.h
similarity index 91%
rename from GUI/Model/Sample/MaterialModel.h
rename to GUI/Model/Material/MaterialModel.h
index 7fe0ee517f6..c8a190751d3 100644
--- a/GUI/Model/Sample/MaterialModel.h
+++ b/GUI/Model/Material/MaterialModel.h
@@ -2,7 +2,7 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Sample/MaterialModel.h
+//! @file      GUI/Model/Material/MaterialModel.h
 //! @brief     Defines class MaterialModel.
 //!
 //! @homepage  http://www.bornagainproject.org
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_MATERIALMODEL_H
-#define BORNAGAIN_GUI_MODEL_SAMPLE_MATERIALMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALMODEL_H
+#define BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALMODEL_H
 
 #include <QMap>
 #include <QObject>
@@ -71,4 +71,4 @@ private:
     QVector<MaterialItem*> m_materials; //!< all materials (owned by this class)
 };
 
-#endif // BORNAGAIN_GUI_MODEL_SAMPLE_MATERIALMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALMODEL_H
diff --git a/GUI/Model/Sample/CoreAndShellItem.cpp b/GUI/Model/Sample/CoreAndShellItem.cpp
index 71c1b4bee8a..b4578da1a34 100644
--- a/GUI/Model/Sample/CoreAndShellItem.cpp
+++ b/GUI/Model/Sample/CoreAndShellItem.cpp
@@ -14,7 +14,7 @@
 
 #include "GUI/Model/Sample/CoreAndShellItem.h"
 #include "Base/Util/Assert.h"
-#include "GUI/Model/Sample/MaterialModel.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Model/Sample/ParticleItem.h"
 #include "Sample/Particle/CoreAndShell.h"
 #include "Sample/Particle/Particle.h"
diff --git a/GUI/Model/Sample/ItemWithMaterial.cpp b/GUI/Model/Sample/ItemWithMaterial.cpp
index 18d220de0a9..d5a3daabd8c 100644
--- a/GUI/Model/Sample/ItemWithMaterial.cpp
+++ b/GUI/Model/Sample/ItemWithMaterial.cpp
@@ -15,7 +15,7 @@
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
-#include "GUI/Model/Sample/MaterialModel.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Support/XML/UtilXML.h"
 
 namespace {
diff --git a/GUI/Model/Sample/SampleItem.h b/GUI/Model/Sample/SampleItem.h
index 75c4395b438..8043bbe14dc 100644
--- a/GUI/Model/Sample/SampleItem.h
+++ b/GUI/Model/Sample/SampleItem.h
@@ -17,8 +17,8 @@
 
 #include "Base/Types/OwningVector.h"
 #include "GUI/Model/Descriptor/VectorProperty.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Model/Sample/Item3D.h"
-#include "GUI/Model/Sample/MaterialModel.h"
 #include <QString>
 #include <QVector>
 #include <QXmlStreamReader>
diff --git a/GUI/View/Material/MaterialEditorDialog.cpp b/GUI/View/Material/MaterialEditorDialog.cpp
index 96a62f28351..38099f4a2d3 100644
--- a/GUI/View/Material/MaterialEditorDialog.cpp
+++ b/GUI/View/Material/MaterialEditorDialog.cpp
@@ -14,8 +14,8 @@
 
 #include "GUI/View/Material/MaterialEditorDialog.h"
 #include "GUI/Model/Material/MaterialItem.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
-#include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/Style/Style.h"
 #include "GUI/View/Layout/ApplicationSettings.h"
diff --git a/GUI/View/Material/MaterialTableModel.cpp b/GUI/View/Material/MaterialTableModel.cpp
index f09184bfe3b..a8f6f140dd7 100644
--- a/GUI/View/Material/MaterialTableModel.cpp
+++ b/GUI/View/Material/MaterialTableModel.cpp
@@ -14,7 +14,7 @@
 
 #include "GUI/View/Material/MaterialTableModel.h"
 #include "GUI/Model/Material/MaterialItem.h"
-#include "GUI/Model/Sample/MaterialModel.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include <QApplication>
 #include <QFontMetrics>
 #include <QPixmap>
diff --git a/GUI/View/Sample/LayerForm.cpp b/GUI/View/Sample/LayerForm.cpp
index 18f4d12826c..d164f0088f2 100644
--- a/GUI/View/Sample/LayerForm.cpp
+++ b/GUI/View/Sample/LayerForm.cpp
@@ -15,8 +15,8 @@
 #include "GUI/View/Sample/LayerForm.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/View/Numeric/NumWidgetUtil.h"
 #include "GUI/View/Sample/HeinzFormLayout.h"
diff --git a/GUI/View/Sample/MaterialInplaceForm.cpp b/GUI/View/Sample/MaterialInplaceForm.cpp
index 24275e3b229..e0b5067deca 100644
--- a/GUI/View/Sample/MaterialInplaceForm.cpp
+++ b/GUI/View/Sample/MaterialInplaceForm.cpp
@@ -15,9 +15,9 @@
 #include "GUI/View/Sample/MaterialInplaceForm.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/XML/Backup.h"
 #include "GUI/View/Material/MaterialEditorDialog.h"
diff --git a/GUI/View/Sample/SampleEditorController.cpp b/GUI/View/Sample/SampleEditorController.cpp
index 55a2d920b92..faaa25d7213 100644
--- a/GUI/View/Sample/SampleEditorController.cpp
+++ b/GUI/View/Sample/SampleEditorController.cpp
@@ -14,12 +14,12 @@
 
 #include "GUI/View/Sample/SampleEditorController.h"
 #include "Base/Util/Assert.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Model/Sample/CompoundItem.h"
 #include "GUI/Model/Sample/CoreAndShellItem.h"
 #include "GUI/Model/Sample/InterferenceItems.h"
 #include "GUI/Model/Sample/LayerItem.h"
-#include "GUI/Model/Sample/MaterialModel.h"
 #include "GUI/Model/Sample/MesocrystalItem.h"
 #include "GUI/Model/Sample/ParticleItem.h"
 #include "GUI/Model/Sample/ParticleLayoutItem.h"
diff --git a/Tests/Unit/GUI/TestMaterialItems.cpp b/Tests/Unit/GUI/TestMaterialItems.cpp
index edf84e99635..e7ea1c1b199 100644
--- a/Tests/Unit/GUI/TestMaterialItems.cpp
+++ b/Tests/Unit/GUI/TestMaterialItems.cpp
@@ -1,6 +1,6 @@
 #include "GUI/Model/Material/MaterialItem.h"
 
-#include "GUI/Model/Sample/MaterialModel.h"
+#include "GUI/Model/Material/MaterialModel.h"
 #include "GUI/Support/XML/Backup.h"
 #include "Tests/GTestWrapper/google_test.h"
 #include <memory>
-- 
GitLab


From 8e4e21fd7107e2ec81a2cf1fe78c0f0ffc03cdc3 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:04:02 +0100
Subject: [PATCH 07/31] rename class and sources
 GUI/Model/Material/MaterialModel -> GUI/Model/Material/MaterialsSet

---
 GUI/Model/FromCore/ItemizeSample.cpp          |  8 ++--
 .../{MaterialModel.cpp => MaterialsSet.cpp}   | 42 +++++++++----------
 .../{MaterialModel.h => MaterialsSet.h}       | 16 +++----
 GUI/Model/Sample/CompoundItem.cpp             |  2 +-
 GUI/Model/Sample/CompoundItem.h               |  6 +--
 GUI/Model/Sample/CoreAndShellItem.cpp         |  8 ++--
 GUI/Model/Sample/CoreAndShellItem.h           | 10 ++---
 GUI/Model/Sample/ItemWithMaterial.cpp         |  4 +-
 GUI/Model/Sample/ItemWithMaterial.h           |  6 +--
 GUI/Model/Sample/ItemWithParticlesCatalog.cpp |  2 +-
 GUI/Model/Sample/ItemWithParticlesCatalog.h   |  4 +-
 GUI/Model/Sample/LayerItem.cpp                |  2 +-
 GUI/Model/Sample/LayerItem.h                  |  2 +-
 GUI/Model/Sample/MesocrystalItem.cpp          |  2 +-
 GUI/Model/Sample/MesocrystalItem.h            |  6 +--
 GUI/Model/Sample/ParticleItem.cpp             |  2 +-
 GUI/Model/Sample/ParticleItem.h               |  2 +-
 GUI/Model/Sample/ParticleLayoutItem.cpp       |  2 +-
 GUI/Model/Sample/ParticleLayoutItem.h         |  6 +--
 GUI/Model/Sample/SampleItem.cpp               |  6 +--
 GUI/Model/Sample/SampleItem.h                 |  8 ++--
 GUI/View/Material/MaterialEditorDialog.cpp    |  2 +-
 GUI/View/Material/MaterialTableModel.cpp      |  4 +-
 GUI/View/Material/MaterialTableModel.h        |  6 +--
 GUI/View/Sample/LayerForm.cpp                 |  4 +-
 GUI/View/Sample/MaterialInplaceForm.cpp       |  2 +-
 GUI/View/Sample/SampleEditorController.cpp    |  4 +-
 GUI/View/Sample/SampleEditorController.h      |  4 +-
 Tests/Unit/GUI/TestMaterialItems.cpp          | 26 ++++++------
 29 files changed, 99 insertions(+), 99 deletions(-)
 rename GUI/Model/Material/{MaterialModel.cpp => MaterialsSet.cpp} (77%)
 rename GUI/Model/Material/{MaterialModel.h => MaterialsSet.h} (86%)

diff --git a/GUI/Model/FromCore/ItemizeSample.cpp b/GUI/Model/FromCore/ItemizeSample.cpp
index c8eb6d376a3..1386bb6e306 100644
--- a/GUI/Model/FromCore/ItemizeSample.cpp
+++ b/GUI/Model/FromCore/ItemizeSample.cpp
@@ -525,7 +525,7 @@ void set_FormFactor(std::variant<ParticleItem*, MesocrystalItem*> parent, const
         throw std::runtime_error("Formfactor not supported by GUI importer");
 }
 
-MaterialItem* findMaterialItem(MaterialModel& matItems, const ISampleNode* node)
+MaterialItem* findMaterialItem(MaterialsSet& matItems, const ISampleNode* node)
 {
     const Material* material = node->material();
 
@@ -550,7 +550,7 @@ MaterialItem* findMaterialItem(MaterialModel& matItems, const ISampleNode* node)
     return result;
 }
 
-void copyParticleItem(ParticleItem* parent, MaterialModel& matItems, const Particle* particle)
+void copyParticleItem(ParticleItem* parent, MaterialsSet& matItems, const Particle* particle)
 {
     parent->setAbundance(particle->abundance());
     parent->setPosition(particle->particlePosition());
@@ -559,7 +559,7 @@ void copyParticleItem(ParticleItem* parent, MaterialModel& matItems, const Parti
     set_FormFactor(parent, particle->pFormfactor());
 }
 
-void copyParticle(const IParticle* iparticle, MaterialModel& matItems,
+void copyParticle(const IParticle* iparticle, MaterialsSet& matItems,
                   std::function<void(ItemWithParticles*)> addToParent)
 {
     if (const auto* particle = dynamic_cast<const Particle*>(iparticle)) {
@@ -630,7 +630,7 @@ SampleItem* itemizeSample(const MultiLayer& sample, const QString& nodeName)
     result->setCrossCorLength(sample.crossCorrLength());
     result->setExternalField(sample.externalField());
 
-    MaterialModel& matItems = result->materialModel();
+    MaterialsSet& matItems = result->materialModel();
 
     //  iterate over layers
     for (size_t layerIndex = 0; layerIndex < sample.numberOfLayers(); layerIndex++) {
diff --git a/GUI/Model/Material/MaterialModel.cpp b/GUI/Model/Material/MaterialsSet.cpp
similarity index 77%
rename from GUI/Model/Material/MaterialModel.cpp
rename to GUI/Model/Material/MaterialsSet.cpp
index 69719c37e8b..afdd1819120 100644
--- a/GUI/Model/Material/MaterialModel.cpp
+++ b/GUI/Model/Material/MaterialsSet.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Material/MaterialModel.cpp
-//! @brief     Implements class MaterialModel.
+//! @file      GUI/Model/Material/MaterialsSet.cpp
+//! @brief     Implements class MaterialsSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Support/XML/UtilXML.h"
@@ -58,30 +58,30 @@ const QMap<QString, DefaultMaterials> materialMap = {{"Default", DefaultMaterial
                                                      {"Core", DefaultMaterials::Core},
                                                      {"Substrate", DefaultMaterials::Substrate}};
 
-MaterialModel::MaterialModel() = default;
+MaterialsSet::MaterialsSet() = default;
 
-MaterialModel::~MaterialModel()
+MaterialsSet::~MaterialsSet()
 {
     clear();
 }
 
-void MaterialModel::clear()
+void MaterialsSet::clear()
 {
     qDeleteAll(m_materials);
     m_materials.clear();
 }
 
-MaterialItem* MaterialModel::addMaterialItem(MaterialItem* materialItem)
+MaterialItem* MaterialsSet::addMaterialItem(MaterialItem* materialItem)
 {
     return addMaterialItem(materialItem, true);
 }
 
-MaterialItem* MaterialModel::addMaterialItem()
+MaterialItem* MaterialsSet::addMaterialItem()
 {
     return addMaterialItem(new MaterialItem(), false);
 }
 
-MaterialItem* MaterialModel::addMaterialItem(MaterialItem* materialItem, bool signalAdding)
+MaterialItem* MaterialsSet::addMaterialItem(MaterialItem* materialItem, bool signalAdding)
 {
     ASSERT(materialItem);
     materialItem->disconnect(this);
@@ -94,8 +94,8 @@ MaterialItem* MaterialModel::addMaterialItem(MaterialItem* materialItem, bool si
     return materialItem;
 }
 
-MaterialItem* MaterialModel::addRefractiveMaterialItem(const QString& name, double delta,
-                                                       double beta)
+MaterialItem* MaterialsSet::addRefractiveMaterialItem(const QString& name, double delta,
+                                                      double beta)
 {
     auto* materialItem = new MaterialItem();
     materialItem->setMatItemName(name);
@@ -106,7 +106,7 @@ MaterialItem* MaterialModel::addRefractiveMaterialItem(const QString& name, doub
     return materialItem;
 }
 
-MaterialItem* MaterialModel::addSLDMaterialItem(const QString& name, double sld, double abs_term)
+MaterialItem* MaterialsSet::addSLDMaterialItem(const QString& name, double sld, double abs_term)
 {
     auto* materialItem = new MaterialItem();
     materialItem->setMatItemName(name);
@@ -117,7 +117,7 @@ MaterialItem* MaterialModel::addSLDMaterialItem(const QString& name, double sld,
     return materialItem;
 }
 
-MaterialItem* MaterialModel::materialItemFromName(const QString& name) const
+MaterialItem* MaterialsSet::materialItemFromName(const QString& name) const
 {
     for (auto* materialItem : m_materials)
         if (materialItem->matItemName() == name)
@@ -126,7 +126,7 @@ MaterialItem* MaterialModel::materialItemFromName(const QString& name) const
     return nullptr;
 }
 
-MaterialItem* MaterialModel::materialItemFromIdentifier(const QString& identifier) const
+MaterialItem* MaterialsSet::materialItemFromIdentifier(const QString& identifier) const
 {
     for (auto* materialItem : m_materials)
         if (materialItem->identifier() == identifier)
@@ -135,18 +135,18 @@ MaterialItem* MaterialModel::materialItemFromIdentifier(const QString& identifie
     return nullptr;
 }
 
-const QVector<MaterialItem*>& MaterialModel::materialItems() const
+const QVector<MaterialItem*>& MaterialsSet::materialItems() const
 {
     return m_materials;
 }
 
-MaterialItem* MaterialModel::defaultMaterialItem() const
+MaterialItem* MaterialsSet::defaultMaterialItem() const
 {
     ASSERT(!materialItems().isEmpty());
     return materialItems().front();
 }
 
-MaterialItem* MaterialModel::defaultCoreMaterialItem() const
+MaterialItem* MaterialsSet::defaultCoreMaterialItem() const
 {
     for (auto* material : materialItems())
         if (material->matItemName() == materialMap.key(DefaultMaterials::Core))
@@ -155,7 +155,7 @@ MaterialItem* MaterialModel::defaultCoreMaterialItem() const
     return defaultMaterialItem();
 }
 
-MaterialItem* MaterialModel::defaultParticleMaterialItem() const
+MaterialItem* MaterialsSet::defaultParticleMaterialItem() const
 {
     for (auto* material : materialItems())
         if (material->matItemName() == materialMap.key(DefaultMaterials::Particle))
@@ -164,14 +164,14 @@ MaterialItem* MaterialModel::defaultParticleMaterialItem() const
     return defaultMaterialItem();
 }
 
-void MaterialModel::removeMaterialItem(MaterialItem* materialItem)
+void MaterialsSet::removeMaterialItem(MaterialItem* materialItem)
 {
     m_materials.removeAll(materialItem);
     delete materialItem;
     emit materialAddedOrRemoved();
 }
 
-void MaterialModel::writeTo(QXmlStreamWriter* w) const
+void MaterialsSet::writeTo(QXmlStreamWriter* w) const
 {
     XML::writeAttribute(w, XML::Attrib::version, uint(1));
 
@@ -183,7 +183,7 @@ void MaterialModel::writeTo(QXmlStreamWriter* w) const
     }
 }
 
-void MaterialModel::readFrom(QXmlStreamReader* r)
+void MaterialsSet::readFrom(QXmlStreamReader* r)
 {
     clear();
 
diff --git a/GUI/Model/Material/MaterialModel.h b/GUI/Model/Material/MaterialsSet.h
similarity index 86%
rename from GUI/Model/Material/MaterialModel.h
rename to GUI/Model/Material/MaterialsSet.h
index c8a190751d3..df367419825 100644
--- a/GUI/Model/Material/MaterialModel.h
+++ b/GUI/Model/Material/MaterialsSet.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Material/MaterialModel.h
-//! @brief     Defines class MaterialModel.
+//! @file      GUI/Model/Material/MaterialsSet.h
+//! @brief     Defines class MaterialsSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALMODEL_H
-#define BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALSSET_H
+#define BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALSSET_H
 
 #include <QMap>
 #include <QObject>
@@ -27,11 +27,11 @@ extern const QMap<QString, DefaultMaterials> materialMap;
 
 class MaterialItem;
 
-class MaterialModel : public QObject {
+class MaterialsSet : public QObject {
     Q_OBJECT
 public:
-    MaterialModel();
-    ~MaterialModel();
+    MaterialsSet();
+    ~MaterialsSet();
 
     //! Add the material and take ownership of it.
     MaterialItem* addMaterialItem(MaterialItem* materialItem);
@@ -71,4 +71,4 @@ private:
     QVector<MaterialItem*> m_materials; //!< all materials (owned by this class)
 };
 
-#endif // BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_MATERIAL_MATERIALSSET_H
diff --git a/GUI/Model/Sample/CompoundItem.cpp b/GUI/Model/Sample/CompoundItem.cpp
index 06a300be3c8..c984c1396c3 100644
--- a/GUI/Model/Sample/CompoundItem.cpp
+++ b/GUI/Model/Sample/CompoundItem.cpp
@@ -40,7 +40,7 @@ const QString position_tooltip = "Relative position of the particle's reference
 } // namespace
 
 
-CompoundItem::CompoundItem(const MaterialModel* materials)
+CompoundItem::CompoundItem(const MaterialsSet* materials)
     : ItemWithParticles(abundance_tooltip, position_tooltip)
     , m_material_model(materials)
 {
diff --git a/GUI/Model/Sample/CompoundItem.h b/GUI/Model/Sample/CompoundItem.h
index bbeed7cea34..c82c6476029 100644
--- a/GUI/Model/Sample/CompoundItem.h
+++ b/GUI/Model/Sample/CompoundItem.h
@@ -20,11 +20,11 @@
 #include "Sample/Particle/Compound.h"
 #include <memory>
 
-class MaterialModel;
+class MaterialsSet;
 
 class CompoundItem : public ItemWithParticles {
 public:
-    CompoundItem(const MaterialModel* materials);
+    CompoundItem(const MaterialsSet* materials);
 
     void writeTo(QXmlStreamWriter* w) const override;
     void readFrom(QXmlStreamReader* r) override;
@@ -42,7 +42,7 @@ public:
 
 private:
     SelectionVector<ItemWithParticlesCatalog> m_particles;
-    const MaterialModel* m_material_model;
+    const MaterialsSet* m_material_model;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_COMPOUNDITEM_H
diff --git a/GUI/Model/Sample/CoreAndShellItem.cpp b/GUI/Model/Sample/CoreAndShellItem.cpp
index b4578da1a34..bdee755428b 100644
--- a/GUI/Model/Sample/CoreAndShellItem.cpp
+++ b/GUI/Model/Sample/CoreAndShellItem.cpp
@@ -14,7 +14,7 @@
 
 #include "GUI/Model/Sample/CoreAndShellItem.h"
 #include "Base/Util/Assert.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Model/Sample/ParticleItem.h"
 #include "Sample/Particle/CoreAndShell.h"
 #include "Sample/Particle/Particle.h"
@@ -40,7 +40,7 @@ const QString position_tooltip = "Relative position of the particle's reference
 
 } // namespace
 
-CoreAndShellItem::CoreAndShellItem(const MaterialModel* materials)
+CoreAndShellItem::CoreAndShellItem(const MaterialsSet* materials)
     : ItemWithParticles(abundance_tooltip, position_tooltip)
     , m_material_model(materials)
 {
@@ -152,7 +152,7 @@ ParticleItem* CoreAndShellItem::coreItem() const
     return m_core.get();
 }
 
-ParticleItem* CoreAndShellItem::createCoreItem(const MaterialModel* materials)
+ParticleItem* CoreAndShellItem::createCoreItem(const MaterialsSet* materials)
 {
     m_core = std::make_unique<ParticleItem>(materials);
     m_core->setMaterial(materials->defaultCoreMaterialItem());
@@ -164,7 +164,7 @@ ParticleItem* CoreAndShellItem::shellItem() const
     return m_shell.get();
 }
 
-ParticleItem* CoreAndShellItem::createShellItem(const MaterialModel* materials)
+ParticleItem* CoreAndShellItem::createShellItem(const MaterialsSet* materials)
 {
     m_shell = std::make_unique<ParticleItem>(materials);
     m_shell->setMaterial(materials->defaultParticleMaterialItem());
diff --git a/GUI/Model/Sample/CoreAndShellItem.h b/GUI/Model/Sample/CoreAndShellItem.h
index 2694311c1e0..9dea73817cb 100644
--- a/GUI/Model/Sample/CoreAndShellItem.h
+++ b/GUI/Model/Sample/CoreAndShellItem.h
@@ -19,12 +19,12 @@
 #include <memory>
 
 class CoreAndShell;
-class MaterialModel;
+class MaterialsSet;
 class ParticleItem;
 
 class CoreAndShellItem : public ItemWithParticles {
 public:
-    CoreAndShellItem(const MaterialModel* materials);
+    CoreAndShellItem(const MaterialsSet* materials);
 
     void writeTo(QXmlStreamWriter* w) const override;
     void readFrom(QXmlStreamReader* r) override;
@@ -32,10 +32,10 @@ public:
     std::unique_ptr<CoreAndShell> createCoreAndShell() const;
 
     ParticleItem* coreItem() const;
-    ParticleItem* createCoreItem(const MaterialModel* materials);
+    ParticleItem* createCoreItem(const MaterialsSet* materials);
 
     ParticleItem* shellItem() const;
-    ParticleItem* createShellItem(const MaterialModel* materials);
+    ParticleItem* createShellItem(const MaterialsSet* materials);
 
     QVector<ItemWithParticles*> containedItemsWithParticles() const override;
 
@@ -46,7 +46,7 @@ public:
 private:
     std::unique_ptr<ParticleItem> m_core;
     std::unique_ptr<ParticleItem> m_shell;
-    const MaterialModel* m_material_model;
+    const MaterialsSet* m_material_model;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_COREANDSHELLITEM_H
diff --git a/GUI/Model/Sample/ItemWithMaterial.cpp b/GUI/Model/Sample/ItemWithMaterial.cpp
index d5a3daabd8c..df9e6b9c5f9 100644
--- a/GUI/Model/Sample/ItemWithMaterial.cpp
+++ b/GUI/Model/Sample/ItemWithMaterial.cpp
@@ -15,7 +15,7 @@
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Support/XML/UtilXML.h"
 
 namespace {
@@ -26,7 +26,7 @@ const QString MaterialId("MaterialId");
 } // namespace Tag
 } // namespace
 
-ItemWithMaterial::ItemWithMaterial(const MaterialModel* materialModel)
+ItemWithMaterial::ItemWithMaterial(const MaterialsSet* materialModel)
     : m_material_model(materialModel)
 {
     ASSERT(m_material_model);
diff --git a/GUI/Model/Sample/ItemWithMaterial.h b/GUI/Model/Sample/ItemWithMaterial.h
index 405bbdbab54..d6db6a45284 100644
--- a/GUI/Model/Sample/ItemWithMaterial.h
+++ b/GUI/Model/Sample/ItemWithMaterial.h
@@ -21,14 +21,14 @@
 #include <functional>
 
 class MaterialItem;
-class MaterialModel;
+class MaterialsSet;
 
 //! Base class for all sample components made of some material.
 
 class ItemWithMaterial {
 public:
     //! Overhand the material list where the current material has to be searched for.
-    explicit ItemWithMaterial(const MaterialModel* materialModel);
+    explicit ItemWithMaterial(const MaterialsSet* materialModel);
 
     //! Set the material this item shall use.
     //! Stores the identifier, not the pointer!
@@ -49,7 +49,7 @@ public:
     virtual void readFrom(QXmlStreamReader* r);
 
 protected:
-    const MaterialModel* m_material_model;
+    const MaterialsSet* m_material_model;
     QString m_material_identifier;
 };
 
diff --git a/GUI/Model/Sample/ItemWithParticlesCatalog.cpp b/GUI/Model/Sample/ItemWithParticlesCatalog.cpp
index 78ac6f206fd..16594dd5184 100644
--- a/GUI/Model/Sample/ItemWithParticlesCatalog.cpp
+++ b/GUI/Model/Sample/ItemWithParticlesCatalog.cpp
@@ -19,7 +19,7 @@
 #include "GUI/Model/Sample/MesocrystalItem.h"
 #include "GUI/Model/Sample/ParticleItem.h"
 
-ItemWithParticles* ItemWithParticlesCatalog::create(Type type, const MaterialModel* materials)
+ItemWithParticles* ItemWithParticlesCatalog::create(Type type, const MaterialsSet* materials)
 {
     switch (type) {
     case Type::Particle:
diff --git a/GUI/Model/Sample/ItemWithParticlesCatalog.h b/GUI/Model/Sample/ItemWithParticlesCatalog.h
index ca22f9f76ef..0549f478e68 100644
--- a/GUI/Model/Sample/ItemWithParticlesCatalog.h
+++ b/GUI/Model/Sample/ItemWithParticlesCatalog.h
@@ -19,7 +19,7 @@
 #include <QVector>
 
 class ItemWithParticles;
-class MaterialModel;
+class MaterialsSet;
 
 class ItemWithParticlesCatalog {
 public:
@@ -30,7 +30,7 @@ public:
     enum class Type : uint8_t { Particle = 1, Composition = 2, CoreShell = 3, Mesocrystal = 4 };
 
     //! Creates the item of the given type.
-    static ItemWithParticles* create(Type type, const MaterialModel* materials);
+    static ItemWithParticles* create(Type type, const MaterialsSet* materials);
 
     //! List of available types, sorted as expected in the UI.
     static QVector<Type> types();
diff --git a/GUI/Model/Sample/LayerItem.cpp b/GUI/Model/Sample/LayerItem.cpp
index ed163978b57..f5e44193b66 100644
--- a/GUI/Model/Sample/LayerItem.cpp
+++ b/GUI/Model/Sample/LayerItem.cpp
@@ -66,7 +66,7 @@ QVector<ItemWithMaterial*> layoutItemsWithMaterial(ParticleLayoutItem* layout)
 } // namespace
 
 
-LayerItem::LayerItem(const MaterialModel* materials)
+LayerItem::LayerItem(const MaterialsSet* materials)
     : ItemWithMaterial(materials)
     , m_name("Layer")
 {
diff --git a/GUI/Model/Sample/LayerItem.h b/GUI/Model/Sample/LayerItem.h
index a6abf2dfa6a..38373a10d00 100644
--- a/GUI/Model/Sample/LayerItem.h
+++ b/GUI/Model/Sample/LayerItem.h
@@ -29,7 +29,7 @@ class ParticleLayoutItem;
 
 class LayerItem : public virtual ItemWithMaterial, public virtual Item3D {
 public:
-    explicit LayerItem(const MaterialModel* materials);
+    explicit LayerItem(const MaterialsSet* materials);
     ~LayerItem();
 
     QString layerName() const { return m_name; }
diff --git a/GUI/Model/Sample/MesocrystalItem.cpp b/GUI/Model/Sample/MesocrystalItem.cpp
index 349b9624dbc..d8afbfa0ac1 100644
--- a/GUI/Model/Sample/MesocrystalItem.cpp
+++ b/GUI/Model/Sample/MesocrystalItem.cpp
@@ -45,7 +45,7 @@ const QString position_tooltip = "Relative position of the mesocrystal's referen
 
 } // namespace
 
-MesocrystalItem::MesocrystalItem(const MaterialModel* materials)
+MesocrystalItem::MesocrystalItem(const MaterialsSet* materials)
     : ItemWithParticles(abundance_tooltip, position_tooltip)
     , m_material_model(materials)
 {
diff --git a/GUI/Model/Sample/MesocrystalItem.h b/GUI/Model/Sample/MesocrystalItem.h
index 00eee99b3b3..8659292ad03 100644
--- a/GUI/Model/Sample/MesocrystalItem.h
+++ b/GUI/Model/Sample/MesocrystalItem.h
@@ -26,12 +26,12 @@
 
 class IFormFactor;
 class IParticle;
-class MaterialModel;
+class MaterialsSet;
 class Mesocrystal;
 
 class MesocrystalItem : public ItemWithParticles {
 public:
-    explicit MesocrystalItem(const MaterialModel* materials);
+    explicit MesocrystalItem(const MaterialsSet* materials);
 
     void writeTo(QXmlStreamWriter* w) const override;
     void readFrom(QXmlStreamReader* r) override;
@@ -72,7 +72,7 @@ private:
     VectorProperty m_vectorC;
     SelectionProperty<FormFactorItemCatalog> m_outer_shape;
     SelectionProperty<ItemWithParticlesCatalog> m_basis_particle;
-    const MaterialModel* m_material_model;
+    const MaterialsSet* m_material_model;
 };
 
 template <typename T> T* MesocrystalItem::setOuterShapeType()
diff --git a/GUI/Model/Sample/ParticleItem.cpp b/GUI/Model/Sample/ParticleItem.cpp
index 5d929a6feab..05dd008e703 100644
--- a/GUI/Model/Sample/ParticleItem.cpp
+++ b/GUI/Model/Sample/ParticleItem.cpp
@@ -36,7 +36,7 @@ const QString position_tooltip = "Relative position of the particle's reference
 
 } // namespace
 
-ParticleItem::ParticleItem(const MaterialModel* materials)
+ParticleItem::ParticleItem(const MaterialsSet* materials)
     : ItemWithMaterial(materials)
     , ItemWithParticles(abundance_tooltip, position_tooltip)
 {
diff --git a/GUI/Model/Sample/ParticleItem.h b/GUI/Model/Sample/ParticleItem.h
index d406bdf0f87..76f1660af3c 100644
--- a/GUI/Model/Sample/ParticleItem.h
+++ b/GUI/Model/Sample/ParticleItem.h
@@ -26,7 +26,7 @@ class Particle;
 
 class ParticleItem : public ItemWithMaterial, public ItemWithParticles {
 public:
-    ParticleItem(const MaterialModel* materials);
+    ParticleItem(const MaterialsSet* materials);
 
     void writeTo(QXmlStreamWriter* w) const override;
     void readFrom(QXmlStreamReader* r) override;
diff --git a/GUI/Model/Sample/ParticleLayoutItem.cpp b/GUI/Model/Sample/ParticleLayoutItem.cpp
index 4ab69bd73cb..46041f8fad5 100644
--- a/GUI/Model/Sample/ParticleLayoutItem.cpp
+++ b/GUI/Model/Sample/ParticleLayoutItem.cpp
@@ -31,7 +31,7 @@ const QString ExpandInterferenceGroupbox("ExpandInterferenceGroupbox");
 } // namespace Tag
 } // namespace
 
-ParticleLayoutItem::ParticleLayoutItem(const MaterialModel* materials)
+ParticleLayoutItem::ParticleLayoutItem(const MaterialsSet* materials)
     : m_material_model(materials)
 {
     m_own_density.init("Total particle density (nm^-2)",
diff --git a/GUI/Model/Sample/ParticleLayoutItem.h b/GUI/Model/Sample/ParticleLayoutItem.h
index d6663f95928..2c6aa7a23a4 100644
--- a/GUI/Model/Sample/ParticleLayoutItem.h
+++ b/GUI/Model/Sample/ParticleLayoutItem.h
@@ -25,11 +25,11 @@
 #include <memory>
 
 class ItemWithParticles;
-class MaterialModel;
+class MaterialsSet;
 
 class ParticleLayoutItem : public Item3D {
 public:
-    ParticleLayoutItem(const MaterialModel* materials);
+    ParticleLayoutItem(const MaterialsSet* materials);
 
     //! The density value which belonging only to the layout.
     //!
@@ -81,7 +81,7 @@ private:
     DoubleProperty m_own_density;
     SelectionProperty<InterferenceItemCatalog> m_interference;
     SelectionVector<ItemWithParticlesCatalog> m_particles;
-    const MaterialModel* m_material_model;
+    const MaterialsSet* m_material_model;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLELAYOUTITEM_H
diff --git a/GUI/Model/Sample/SampleItem.cpp b/GUI/Model/Sample/SampleItem.cpp
index 787e3bab3e5..b19bc31187b 100644
--- a/GUI/Model/Sample/SampleItem.cpp
+++ b/GUI/Model/Sample/SampleItem.cpp
@@ -24,7 +24,7 @@ namespace Tag {
 const QString Name("Name");
 const QString Description("Description");
 const QString CrossCorrelationLength("CrossCorrelationLength");
-const QString MaterialModel("MaterialModel");
+const QString MaterialsSet("MaterialsSet");
 const QString Layer("Layer");
 const QString ExternalField("ExternalField");
 const QString ExpandInfoGroupbox("ExpandInfoGroupbox");
@@ -152,7 +152,7 @@ void SampleItem::writeTo(QXmlStreamWriter* w) const
     w->writeEndElement();
 
     // materials
-    w->writeStartElement(Tag::MaterialModel);
+    w->writeStartElement(Tag::MaterialsSet);
     m_materials.writeTo(w);
     w->writeEndElement();
 
@@ -200,7 +200,7 @@ void SampleItem::readFrom(QXmlStreamReader* r)
             XML::gotoEndElementOfTag(r, tag);
 
             // materials
-        } else if (tag == Tag::MaterialModel) {
+        } else if (tag == Tag::MaterialsSet) {
             m_materials.readFrom(r);
             XML::gotoEndElementOfTag(r, tag);
 
diff --git a/GUI/Model/Sample/SampleItem.h b/GUI/Model/Sample/SampleItem.h
index 8043bbe14dc..af5a44e6191 100644
--- a/GUI/Model/Sample/SampleItem.h
+++ b/GUI/Model/Sample/SampleItem.h
@@ -17,7 +17,7 @@
 
 #include "Base/Types/OwningVector.h"
 #include "GUI/Model/Descriptor/VectorProperty.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Model/Sample/Item3D.h"
 #include <QString>
 #include <QVector>
@@ -66,8 +66,8 @@ public:
     void writeTo(QXmlStreamWriter* w) const;
     void readFrom(QXmlStreamReader* r);
 
-    MaterialModel& materialModel() { return m_materials; }
-    const MaterialModel& materialModel() const { return m_materials; }
+    MaterialsSet& materialModel() { return m_materials; }
+    const MaterialsSet& materialModel() const { return m_materials; }
 
     bool expandInfo = true;
 
@@ -77,7 +77,7 @@ private:
     DoubleProperty m_cross_correlation_length;
     VectorProperty m_external_field;
     OwningVector<LayerItem> m_layers;
-    MaterialModel m_materials;
+    MaterialsSet m_materials;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLEITEM_H
diff --git a/GUI/View/Material/MaterialEditorDialog.cpp b/GUI/View/Material/MaterialEditorDialog.cpp
index 38099f4a2d3..e46ccfcde7f 100644
--- a/GUI/View/Material/MaterialEditorDialog.cpp
+++ b/GUI/View/Material/MaterialEditorDialog.cpp
@@ -14,7 +14,7 @@
 
 #include "GUI/View/Material/MaterialEditorDialog.h"
 #include "GUI/Model/Material/MaterialItem.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/Style/Style.h"
diff --git a/GUI/View/Material/MaterialTableModel.cpp b/GUI/View/Material/MaterialTableModel.cpp
index a8f6f140dd7..fc534e8e7f9 100644
--- a/GUI/View/Material/MaterialTableModel.cpp
+++ b/GUI/View/Material/MaterialTableModel.cpp
@@ -14,12 +14,12 @@
 
 #include "GUI/View/Material/MaterialTableModel.h"
 #include "GUI/Model/Material/MaterialItem.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include <QApplication>
 #include <QFontMetrics>
 #include <QPixmap>
 
-MaterialTableModel::MaterialTableModel(MaterialModel& model)
+MaterialTableModel::MaterialTableModel(MaterialsSet& model)
     : m_model(model)
 {
 }
diff --git a/GUI/View/Material/MaterialTableModel.h b/GUI/View/Material/MaterialTableModel.h
index 958014ec4bf..6a2e84ad52e 100644
--- a/GUI/View/Material/MaterialTableModel.h
+++ b/GUI/View/Material/MaterialTableModel.h
@@ -18,7 +18,7 @@
 #include <QAbstractItemModel>
 
 class MaterialItem;
-class MaterialModel;
+class MaterialsSet;
 
 //! Model for list of materials, used in MaterialEditorDialog.
 //!
@@ -27,7 +27,7 @@ class MaterialModel;
 class MaterialTableModel : public QAbstractTableModel {
     Q_OBJECT
 public:
-    MaterialTableModel(MaterialModel& model);
+    MaterialTableModel(MaterialsSet& model);
 
     int rowCount(const QModelIndex& parent = QModelIndex()) const override;
     int columnCount(const QModelIndex& parent = QModelIndex()) const override;
@@ -59,7 +59,7 @@ private:
     //! The columns in the header. PARAMETERS contains delta/beta or Re/Im.
     enum Column { NAME, TYPE, PARAMETERS, MAGNETIZATION, NUM_COLUMNS };
 
-    MaterialModel& m_model;
+    MaterialsSet& m_model;
 };
 
 
diff --git a/GUI/View/Sample/LayerForm.cpp b/GUI/View/Sample/LayerForm.cpp
index d164f0088f2..c4e05ed0955 100644
--- a/GUI/View/Sample/LayerForm.cpp
+++ b/GUI/View/Sample/LayerForm.cpp
@@ -15,7 +15,7 @@
 #include "GUI/View/Sample/LayerForm.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Model/Sample/LayerItem.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/View/Numeric/NumWidgetUtil.h"
@@ -122,7 +122,7 @@ LayerForm::LayerForm(QWidget* parent, LayerItem* layerItem, SampleEditorControll
 
     // listen to changes in materials to update the title (contains the material name). Necessary
     // to reflect e.g. a name change done in the material editor.
-    connect(ec->materialModel(), &MaterialModel::materialChanged, this, &LayerForm::updateTitle);
+    connect(ec->materialModel(), &MaterialsSet::materialChanged, this, &LayerForm::updateTitle);
 
     updateLayerPositionDependentElements();
 }
diff --git a/GUI/View/Sample/MaterialInplaceForm.cpp b/GUI/View/Sample/MaterialInplaceForm.cpp
index e0b5067deca..63a2a3e5a34 100644
--- a/GUI/View/Sample/MaterialInplaceForm.cpp
+++ b/GUI/View/Sample/MaterialInplaceForm.cpp
@@ -15,7 +15,7 @@
 #include "GUI/View/Sample/MaterialInplaceForm.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Material/MaterialItem.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "GUI/Model/Sample/LayerItem.h"
 #include "GUI/Model/Sample/SampleItem.h"
diff --git a/GUI/View/Sample/SampleEditorController.cpp b/GUI/View/Sample/SampleEditorController.cpp
index faaa25d7213..88c2de3e9d7 100644
--- a/GUI/View/Sample/SampleEditorController.cpp
+++ b/GUI/View/Sample/SampleEditorController.cpp
@@ -14,7 +14,7 @@
 
 #include "GUI/View/Sample/SampleEditorController.h"
 #include "Base/Util/Assert.h"
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Model/Sample/CompoundItem.h"
 #include "GUI/Model/Sample/CoreAndShellItem.h"
@@ -346,7 +346,7 @@ void SampleEditorController::setCurrentIndex(ISelectionContainerForm* widget, in
     emit modified();
 }
 
-MaterialModel* SampleEditorController::materialModel() const
+MaterialsSet* SampleEditorController::materialModel() const
 {
     return &m_sample_item->materialModel();
 }
diff --git a/GUI/View/Sample/SampleEditorController.h b/GUI/View/Sample/SampleEditorController.h
index 9515180cbdc..1a70a6d6a3e 100644
--- a/GUI/View/Sample/SampleEditorController.h
+++ b/GUI/View/Sample/SampleEditorController.h
@@ -32,7 +32,7 @@ class ItemWithParticles;
 class LatticeTypeSelectionForm;
 class LayerForm;
 class LayerItem;
-class MaterialModel;
+class MaterialsSet;
 class MesocrystalForm;
 class ParticleLayoutItem;
 class SampleForm;
@@ -61,7 +61,7 @@ public:
     SampleItem* sampleItem() const { return m_sample_item; }
 
     //! The materials of the current document
-    MaterialModel* materialModel() const;
+    MaterialsSet* materialModel() const;
 
     void addLayerItem(LayerItem* before);
     QColor findColor(int atIndex);
diff --git a/Tests/Unit/GUI/TestMaterialItems.cpp b/Tests/Unit/GUI/TestMaterialItems.cpp
index e7ea1c1b199..f84488df781 100644
--- a/Tests/Unit/GUI/TestMaterialItems.cpp
+++ b/Tests/Unit/GUI/TestMaterialItems.cpp
@@ -1,13 +1,13 @@
 #include "GUI/Model/Material/MaterialItem.h"
 
-#include "GUI/Model/Material/MaterialModel.h"
+#include "GUI/Model/Material/MaterialsSet.h"
 #include "GUI/Support/XML/Backup.h"
 #include "Tests/GTestWrapper/google_test.h"
 #include <memory>
 
-TEST(TestMaterialModel, addRefractiveMaterial)
+TEST(TestMaterialsSet, addRefractiveMaterial)
 {
-    std::unique_ptr<MaterialModel> model(new MaterialModel);
+    std::unique_ptr<MaterialsSet> model(new MaterialsSet);
 
     EXPECT_TRUE(model->materialItems().isEmpty());
 
@@ -23,9 +23,9 @@ TEST(TestMaterialModel, addRefractiveMaterial)
     EXPECT_EQ(material->beta(), beta);
 }
 
-TEST(TestMaterialModel, addSLDMaterial)
+TEST(TestMaterialsSet, addSLDMaterial)
 {
-    std::unique_ptr<MaterialModel> model(new MaterialModel);
+    std::unique_ptr<MaterialsSet> model(new MaterialsSet);
 
     EXPECT_TRUE(model->materialItems().isEmpty());
 
@@ -43,9 +43,9 @@ TEST(TestMaterialModel, addSLDMaterial)
 
 //! Checks the method which returns MaterialItem from known identifier.
 
-TEST(TestMaterialModel, materialFromIdentifier)
+TEST(TestMaterialsSet, materialFromIdentifier)
 {
-    MaterialModel model;
+    MaterialsSet model;
     MaterialItem* material1 = model.addRefractiveMaterialItem("aaa", 1.0, 2.0);
     MaterialItem* material2 = model.addRefractiveMaterialItem("bbb", 3.0, 4.0);
     EXPECT_EQ(material1, model.materialItemFromIdentifier(material1->identifier()));
@@ -55,9 +55,9 @@ TEST(TestMaterialModel, materialFromIdentifier)
 
 //! Checks the method which returns MaterialItem from material name.
 
-TEST(TestMaterialModel, materialFromName)
+TEST(TestMaterialsSet, materialFromName)
 {
-    MaterialModel model;
+    MaterialsSet model;
     MaterialItem* material1 = model.addRefractiveMaterialItem("aaa", 1.0, 2.0);
     MaterialItem* material2 = model.addRefractiveMaterialItem("bbb", 3.0, 4.0);
     EXPECT_EQ(material1, model.materialItemFromName(material1->matItemName()));
@@ -67,9 +67,9 @@ TEST(TestMaterialModel, materialFromName)
 
 //! Default MaterialProperty construction.
 
-TEST(TestMaterialModel, defaultMaterialProperty)
+TEST(TestMaterialsSet, defaultMaterialProperty)
 {
-    MaterialModel model;
+    MaterialsSet model;
 
     // should throw in the absence of any materials
     // EXPECT_FAILED_ASSERT(model.defaultMaterialItem()); <--- TODO: restore
@@ -80,7 +80,7 @@ TEST(TestMaterialModel, defaultMaterialProperty)
     EXPECT_EQ(model.defaultMaterialItem(), mat1);
 }
 
-TEST(TestMaterialModel, serializeRefractiveMaterial)
+TEST(TestMaterialsSet, serializeRefractiveMaterial)
 {
     MaterialItem material;
     material.setRefractiveIndex(11, 12);
@@ -103,7 +103,7 @@ TEST(TestMaterialModel, serializeRefractiveMaterial)
     EXPECT_EQ(target.magnetization().r3(), R3(1, 2, 3));
 }
 
-TEST(TestMaterialModel, serializeSLDMaterial)
+TEST(TestMaterialsSet, serializeSLDMaterial)
 {
     MaterialItem material;
     material.setScatteringLengthDensity(complex_t(11, 12));
-- 
GitLab


From 2051625820f8c077244170a5980f79e31f3b0a67 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:04:19 +0100
Subject: [PATCH 08/31] rename class and sources GUI/Model/Tune/JobModel ->
 GUI/Model/Tune/JobsSet

---
 GUI/Model/Project/ProjectDocument.cpp        |  8 ++--
 GUI/Model/Project/ProjectDocument.h          |  6 +--
 GUI/Model/Tune/JobQueueData.cpp              |  4 +-
 GUI/Model/Tune/JobQueueData.h                |  6 +--
 GUI/Model/Tune/{JobModel.cpp => JobsSet.cpp} | 50 ++++++++++----------
 GUI/Model/Tune/{JobModel.h => JobsSet.h}     | 16 +++----
 GUI/View/Job/JobView.cpp                     |  6 +--
 GUI/View/JobControl/JobListModel.cpp         |  4 +-
 GUI/View/JobControl/JobListModel.h           |  6 +--
 GUI/View/JobControl/JobListing.cpp           |  2 +-
 GUI/View/JobControl/JobListing.h             |  4 +-
 GUI/View/JobControl/JobSelector.cpp          |  2 +-
 GUI/View/JobControl/JobSelector.h            |  6 +--
 GUI/View/Main/MainWindow.cpp                 |  2 +-
 GUI/View/Project/SimulationView.cpp          |  4 +-
 GUI/View/Tuning/JobRealTimeWidget.cpp        |  4 +-
 GUI/View/Tuning/JobRealTimeWidget.h          |  6 +--
 GUI/View/Tuning/ParameterTuningWidget.cpp    |  2 +-
 GUI/View/Tuning/ParameterTuningWidget.h      |  4 +-
 Tests/Unit/GUI/TestJobModel.cpp              | 14 +++---
 20 files changed, 78 insertions(+), 78 deletions(-)
 rename GUI/Model/Tune/{JobModel.cpp => JobsSet.cpp} (81%)
 rename GUI/Model/Tune/{JobModel.h => JobsSet.h} (86%)

diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp
index 5a03b9ed68f..3ce0ea0879d 100644
--- a/GUI/Model/Project/ProjectDocument.cpp
+++ b/GUI/Model/Project/ProjectDocument.cpp
@@ -41,7 +41,7 @@ const QString DocumentInfo("DocumentInfo");
 const QString SimulationOptions("SimulationOptions");
 const QString InstrumentModel("InstrumentModel");
 const QString SampleModel("SampleModel");
-const QString JobModel("JobModel");
+const QString JobsSet("JobsSet");
 const QString RealModel("RealModel");
 const QString ActiveView("ActiveView");
 
@@ -116,7 +116,7 @@ DatafilesModel* ProjectDocument::realModel()
     return &m_real_model;
 }
 
-JobModel* ProjectDocument::jobModel()
+JobsSet* ProjectDocument::jobModel()
 {
     return &m_job_model;
 }
@@ -253,7 +253,7 @@ void ProjectDocument::writeProject(QIODevice* device)
     w.writeEndElement();
 
     // job model
-    w.writeStartElement(Tag::JobModel);
+    w.writeStartElement(Tag::JobsSet);
     m_job_model.writeTo(&w);
     w.writeEndElement();
 
@@ -316,7 +316,7 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
                             XML::gotoEndElementOfTag(&r, tag);
 
                             // job model
-                        } else if (tag == Tag::JobModel) {
+                        } else if (tag == Tag::JobsSet) {
                             m_job_model.readFrom(&r);
                             XML::gotoEndElementOfTag(&r, tag);
 
diff --git a/GUI/Model/Project/ProjectDocument.h b/GUI/Model/Project/ProjectDocument.h
index 2e351b6251c..f37b10123b4 100644
--- a/GUI/Model/Project/ProjectDocument.h
+++ b/GUI/Model/Project/ProjectDocument.h
@@ -19,7 +19,7 @@
 #include "GUI/Model/Files/DatafilesModel.h"
 #include "GUI/Model/Project/LinkInstrumentManager.h"
 #include "GUI/Model/Sample/SampleModel.h"
-#include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Model/Tune/JobsSet.h"
 #include "GUI/Support/Data/SimulationOptionsItem.h"
 
 class MessageService;
@@ -58,7 +58,7 @@ public:
     InstrumentModel* instrumentModel();
     SampleModel* sampleModel();
     DatafilesModel* realModel();
-    JobModel* jobModel();
+    JobsSet* jobModel();
     SimulationOptionsItem* simulationOptionsItem();
 
     LinkInstrumentManager* linkInstrumentManager();
@@ -106,7 +106,7 @@ private:
     InstrumentModel m_instrument_model;
     SampleModel m_sample_model;
     DatafilesModel m_real_model;
-    JobModel m_job_model;
+    JobsSet m_job_model;
     int m_last_view_active;
 };
 
diff --git a/GUI/Model/Tune/JobQueueData.cpp b/GUI/Model/Tune/JobQueueData.cpp
index c06300daf7d..9a0ca4dd61e 100644
--- a/GUI/Model/Tune/JobQueueData.cpp
+++ b/GUI/Model/Tune/JobQueueData.cpp
@@ -17,12 +17,12 @@
 #include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/ToCore/SimulationToCore.h"
-#include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Model/Tune/JobsSet.h"
 #include "GUI/Support/Data/JobStatus.h"
 #include "GUI/Support/Data/JobWorker.h"
 #include "Sim/Simulation/ISimulation.h"
 
-JobQueueData::JobQueueData(JobModel* jobModel)
+JobQueueData::JobQueueData(JobsSet* jobModel)
     : m_job_model(jobModel)
 {
 }
diff --git a/GUI/Model/Tune/JobQueueData.h b/GUI/Model/Tune/JobQueueData.h
index 0e507ac8d59..ac3018a3965 100644
--- a/GUI/Model/Tune/JobQueueData.h
+++ b/GUI/Model/Tune/JobQueueData.h
@@ -21,7 +21,7 @@
 
 class ISimulation;
 class JobItem;
-class JobModel;
+class JobsSet;
 class JobWorker;
 
 //! Holds all data and logic for running simulation in a thread.
@@ -29,7 +29,7 @@ class JobWorker;
 class JobQueueData : public QObject {
     Q_OBJECT
 public:
-    JobQueueData(JobModel* jobModel);
+    JobQueueData(JobsSet* jobModel);
 
     bool hasUnfinishedJobs();
 
@@ -65,7 +65,7 @@ private:
     QMap<QString, JobWorker*> m_workers;       //! job identifier to jobWorker
     QMap<QString, ISimulation*> m_simulations; //! job identifier to simulation
 
-    JobModel* m_job_model;
+    JobsSet* m_job_model;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_TUNE_JOBQUEUEDATA_H
diff --git a/GUI/Model/Tune/JobModel.cpp b/GUI/Model/Tune/JobsSet.cpp
similarity index 81%
rename from GUI/Model/Tune/JobModel.cpp
rename to GUI/Model/Tune/JobsSet.cpp
index 90293aff8d6..e41e72c53c9 100644
--- a/GUI/Model/Tune/JobModel.cpp
+++ b/GUI/Model/Tune/JobsSet.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Tune/JobModel.cpp
-//! @brief     Implements class JobModel.
+//! @file      GUI/Model/Tune/JobsSet.cpp
+//! @brief     Implements class JobsSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Model/Tune/JobsSet.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Model/Job/BatchInfo.h"
@@ -32,18 +32,18 @@ const QString SelectedIndex("SelectedIndex");
 } // namespace Tag
 } // namespace
 
-JobModel::JobModel(QObject* parent)
+JobsSet::JobsSet(QObject* parent)
     : QObject(parent)
 {
     m_queue_data = std::make_unique<JobQueueData>(this);
-    connect(m_queue_data.get(), &JobQueueData::jobSelected, this, &JobModel::jobSelected);
-    connect(m_queue_data.get(), &JobQueueData::globalProgress, this, &JobModel::globalProgress);
-    setObjectName("JobModel");
+    connect(m_queue_data.get(), &JobQueueData::jobSelected, this, &JobsSet::jobSelected);
+    connect(m_queue_data.get(), &JobQueueData::globalProgress, this, &JobsSet::globalProgress);
+    setObjectName("JobsSet");
 }
 
-JobModel::~JobModel() = default;
+JobsSet::~JobsSet() = default;
 
-JobItem* JobModel::jobItemForIdentifier(const QString& identifier)
+JobItem* JobsSet::jobItemForIdentifier(const QString& identifier)
 {
     for (auto* jobItem : jobItems())
         if (jobItem->batchInfo()->identifier() == identifier)
@@ -52,7 +52,7 @@ JobItem* JobModel::jobItemForIdentifier(const QString& identifier)
     return nullptr;
 }
 
-JobItem* JobModel::createJobItem()
+JobItem* JobsSet::createJobItem()
 {
     auto* jobItem = new JobItem();
     m_job_items.emplace_back(jobItem);
@@ -60,8 +60,8 @@ JobItem* JobModel::createJobItem()
 }
 
 //! Main method to add a job
-JobItem* JobModel::addJobItem(const SampleItem* sampleItem, const InstrumentItem* instrumentItem,
-                              const DatafileItem* realItem, const SimulationOptionsItem& optionItem)
+JobItem* JobsSet::addJobItem(const SampleItem* sampleItem, const InstrumentItem* instrumentItem,
+                             const DatafileItem* realItem, const SimulationOptionsItem& optionItem)
 {
     ASSERT(sampleItem);
     ASSERT(instrumentItem);
@@ -90,18 +90,18 @@ JobItem* JobModel::addJobItem(const SampleItem* sampleItem, const InstrumentItem
     return jobItem;
 }
 
-QVector<JobItem*> JobModel::jobItems() const
+QVector<JobItem*> JobsSet::jobItems() const
 {
     return QVector<JobItem*>(m_job_items.begin(), m_job_items.end());
 }
 
 //! restore instrument and sample model from backup for given JobItem
-void JobModel::restore(JobItem* jobItem, int index)
+void JobsSet::restore(JobItem* jobItem, int index)
 {
     jobItem->parameterContainerItem()->restoreBackupValues(index);
 }
 
-bool JobModel::hasUnfinishedJobs()
+bool JobsSet::hasUnfinishedJobs()
 {
     if (m_queue_data->hasUnfinishedJobs())
         return true;
@@ -113,13 +113,13 @@ bool JobModel::hasUnfinishedJobs()
     return false;
 }
 
-void JobModel::clear()
+void JobsSet::clear()
 {
     for (auto* job : jobItems())
         removeJob(job);
 }
 
-QVector<DataItem*> JobModel::dataItems() const
+QVector<DataItem*> JobsSet::dataItems() const
 {
     QVector<DataItem*> result;
 
@@ -134,7 +134,7 @@ QVector<DataItem*> JobModel::dataItems() const
     return result;
 }
 
-void JobModel::writeTo(QXmlStreamWriter* w) const
+void JobsSet::writeTo(QXmlStreamWriter* w) const
 {
     XML::writeAttribute(w, XML::Attrib::version, uint(1));
 
@@ -152,7 +152,7 @@ void JobModel::writeTo(QXmlStreamWriter* w) const
     w->writeEndElement();
 }
 
-void JobModel::readFrom(QXmlStreamReader* r)
+void JobsSet::readFrom(QXmlStreamReader* r)
 {
     clear();
 
@@ -181,7 +181,7 @@ void JobModel::readFrom(QXmlStreamReader* r)
         throw std::runtime_error(r->errorString().toLatin1());
 }
 
-void JobModel::writeDatafiles(const QString& projectDir)
+void JobsSet::writeDatafiles(const QString& projectDir)
 {
     for (const auto* job : m_job_items)
         job->writeDatafiles(projectDir);
@@ -189,7 +189,7 @@ void JobModel::writeDatafiles(const QString& projectDir)
     dataFilesCleaner.cleanOldFiles(projectDir, dataItems());
 }
 
-void JobModel::readDatafiles(const QString& projectDir, MessageService* messageService)
+void JobsSet::readDatafiles(const QString& projectDir, MessageService* messageService)
 {
     for (auto* job : m_job_items)
         job->readDatafiles(projectDir, messageService);
@@ -197,24 +197,24 @@ void JobModel::readDatafiles(const QString& projectDir, MessageService* messageS
     dataFilesCleaner.recollectDataNames(dataItems());
 }
 
-void JobModel::runJob(JobItem* jobItem)
+void JobsSet::runJob(JobItem* jobItem)
 {
     m_queue_data->runJob(jobItem);
 }
 
-void JobModel::cancelJob(JobItem* jobItem)
+void JobsSet::cancelJob(JobItem* jobItem)
 {
     m_queue_data->cancelJob(jobItem->batchInfo()->identifier());
 }
 
-void JobModel::removeJob(JobItem* jobItem)
+void JobsSet::removeJob(JobItem* jobItem)
 {
     ASSERT(jobItem);
     m_queue_data->removeJob(jobItem->batchInfo()->identifier());
     m_job_items.delete_element(jobItem);
 }
 
-QString JobModel::generateJobName()
+QString JobsSet::generateJobName()
 {
     int maxJobIndex = 0;
     for (const auto* jobItem : jobItems()) {
diff --git a/GUI/Model/Tune/JobModel.h b/GUI/Model/Tune/JobsSet.h
similarity index 86%
rename from GUI/Model/Tune/JobModel.h
rename to GUI/Model/Tune/JobsSet.h
index 3e9e89f2936..908569807ca 100644
--- a/GUI/Model/Tune/JobModel.h
+++ b/GUI/Model/Tune/JobsSet.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Tune/JobModel.h
-//! @brief     Defines class JobModel.
+//! @file      GUI/Model/Tune/JobsSet.h
+//! @brief     Defines class JobsSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_TUNE_JOBMODEL_H
-#define BORNAGAIN_GUI_MODEL_TUNE_JOBMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_TUNE_JOBSSET_H
+#define BORNAGAIN_GUI_MODEL_TUNE_JOBSSET_H
 
 #include "Base/Types/OwningVector.h"
 #include "GUI/Model/Files/DatafilesCleaner.h"
@@ -30,11 +30,11 @@ class MessageService;
 class SampleItem;
 class SimulationOptionsItem;
 
-class JobModel : public QObject {
+class JobsSet : public QObject {
     Q_OBJECT
 public:
-    explicit JobModel(QObject* parent = nullptr);
-    ~JobModel() override;
+    explicit JobsSet(QObject* parent = nullptr);
+    ~JobsSet() override;
 
     JobItem* jobItemForIdentifier(const QString& identifier);
 
@@ -79,4 +79,4 @@ private:
     int m_selected_index = -1;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_TUNE_JOBMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_TUNE_JOBSSET_H
diff --git a/GUI/View/Job/JobView.cpp b/GUI/View/Job/JobView.cpp
index d2894e53eec..45645d59cf5 100644
--- a/GUI/View/Job/JobView.cpp
+++ b/GUI/View/Job/JobView.cpp
@@ -72,8 +72,8 @@ JobView::JobView(QProgressBar* progressBar)
 
     //... Connects signals related to JobItem
 
-    // Focus request: JobModel -> this
-    connect(gDoc->jobModel(), &JobModel::jobSelected, this, &JobView::onJobSelected);
+    // Focus request: JobsSet -> this
+    connect(gDoc->jobModel(), &JobsSet::jobSelected, this, &JobView::onJobSelected);
 
     // JobItem selection: JobSelector -> this
     connect(m_job_selector, &JobSelector::selectedJobsChanged, this,
@@ -82,7 +82,7 @@ JobView::JobView(QProgressBar* progressBar)
     connect(m_fit_activity_panel, &FitActivityPanel::showLog, m_job_message_panel,
             &JobMessagePanel::setLog);
 
-    connect(gDoc->jobModel(), &JobModel::globalProgress, [pb = progressBar](int progress) {
+    connect(gDoc->jobModel(), &JobsSet::globalProgress, [pb = progressBar](int progress) {
         if (progress < 0 || progress >= 100)
             pb->hide();
         else {
diff --git a/GUI/View/JobControl/JobListModel.cpp b/GUI/View/JobControl/JobListModel.cpp
index 4d7ea629c86..b1d81587b2d 100644
--- a/GUI/View/JobControl/JobListModel.cpp
+++ b/GUI/View/JobControl/JobListModel.cpp
@@ -25,11 +25,11 @@
 // public member functions
 //--------------------------------------------------------------------------------------------------
 
-JobListModel::JobListModel(JobModel* jobs, QObject* parent)
+JobListModel::JobListModel(JobsSet* jobs, QObject* parent)
     : QAbstractListModel(parent)
     , m_jobs(jobs)
 {
-    connect(jobs, &JobModel::jobAdded, this, &JobListModel::onJobAdded);
+    connect(jobs, &JobsSet::jobAdded, this, &JobListModel::onJobAdded);
     onJobAdded();
 }
 
diff --git a/GUI/View/JobControl/JobListModel.h b/GUI/View/JobControl/JobListModel.h
index 078f83eec81..7e9635bd492 100644
--- a/GUI/View/JobControl/JobListModel.h
+++ b/GUI/View/JobControl/JobListModel.h
@@ -18,12 +18,12 @@
 #include <QAbstractListModel>
 
 class JobItem;
-class JobModel;
+class JobsSet;
 
 class JobListModel : public QAbstractListModel {
     Q_OBJECT
 public:
-    JobListModel(JobModel* jobs, QObject* parent = nullptr);
+    JobListModel(JobsSet* jobs, QObject* parent = nullptr);
     ~JobListModel() override;
 
     int rowCount(const QModelIndex& parent = QModelIndex()) const override;
@@ -42,7 +42,7 @@ private slots:
     void onJobAdded();
 
 private:
-    JobModel* m_jobs;
+    JobsSet* m_jobs;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBLISTMODEL_H
diff --git a/GUI/View/JobControl/JobListing.cpp b/GUI/View/JobControl/JobListing.cpp
index a196f4624e8..e8edf867342 100644
--- a/GUI/View/JobControl/JobListing.cpp
+++ b/GUI/View/JobControl/JobListing.cpp
@@ -47,7 +47,7 @@ bool row_ascending(const QModelIndex& idx1, const QModelIndex& idx2)
 // public member functions
 //--------------------------------------------------------------------------------------------------
 
-JobListing::JobListing(JobModel* jobs, QWidget* parent, Qt::WindowFlags f)
+JobListing::JobListing(JobsSet* jobs, QWidget* parent, Qt::WindowFlags f)
     : QWidget(parent, f)
     , m_list_view(new QListView(this))
     , m_list_view_delegate(new JobProgressDelegate(this))
diff --git a/GUI/View/JobControl/JobListing.h b/GUI/View/JobControl/JobListing.h
index 2af7c6358ee..300c5710ef1 100644
--- a/GUI/View/JobControl/JobListing.h
+++ b/GUI/View/JobControl/JobListing.h
@@ -23,7 +23,7 @@
 
 class JobItem;
 class JobListModel;
-class JobModel;
+class JobsSet;
 class JobProgressDelegate;
 
 //! List of jobs on the top left side of JobView.
@@ -31,7 +31,7 @@ class JobProgressDelegate;
 class JobListing : public QWidget {
     Q_OBJECT
 public:
-    JobListing(JobModel* jobs, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
+    JobListing(JobsSet* jobs, QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
     QVector<JobItem*> selectedJobItems() const;
     void selectJob(JobItem* job);
 
diff --git a/GUI/View/JobControl/JobSelector.cpp b/GUI/View/JobControl/JobSelector.cpp
index eb86fd46ee7..7eb0c69deda 100644
--- a/GUI/View/JobControl/JobSelector.cpp
+++ b/GUI/View/JobControl/JobSelector.cpp
@@ -39,7 +39,7 @@ QList<int> qVariantToList(const QVariant& var)
 }
 
 } // namespace
-JobSelector::JobSelector(JobModel* jobModel, QWidget* parent)
+JobSelector::JobSelector(JobsSet* jobModel, QWidget* parent)
     : QWidget(parent)
     , m_splitter(new QSplitter(Qt::Vertical, this))
     , m_job_properties(new JobPropertiesWidget(this))
diff --git a/GUI/View/JobControl/JobSelector.h b/GUI/View/JobControl/JobSelector.h
index a32bc4768e6..394753e5958 100644
--- a/GUI/View/JobControl/JobSelector.h
+++ b/GUI/View/JobControl/JobSelector.h
@@ -20,7 +20,7 @@
 
 class JobItem;
 class JobListing;
-class JobModel;
+class JobsSet;
 class JobPropertiesWidget;
 
 //! The JobSelector class represents left panel of JobView. Contains a tree to select jobs
@@ -29,7 +29,7 @@ class JobPropertiesWidget;
 class JobSelector : public QWidget {
     Q_OBJECT
 public:
-    explicit JobSelector(JobModel* jobModel, QWidget* parent = nullptr);
+    explicit JobSelector(JobsSet* jobModel, QWidget* parent = nullptr);
     ~JobSelector();
 
     void resizeEvent(QResizeEvent* event) override;
@@ -51,7 +51,7 @@ private:
     QSplitter* m_splitter;
     JobListing* m_listing;
     JobPropertiesWidget* m_job_properties;
-    JobModel* m_job_model;
+    JobsSet* m_job_model;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBSELECTOR_H
diff --git a/GUI/View/Main/MainWindow.cpp b/GUI/View/Main/MainWindow.cpp
index f499a53ffeb..5a9f9707fdd 100644
--- a/GUI/View/Main/MainWindow.cpp
+++ b/GUI/View/Main/MainWindow.cpp
@@ -13,7 +13,7 @@
 //  ************************************************************************************************
 
 #include "GUI/View/Main/MainWindow.h"
-#include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Model/Tune/JobsSet.h"
 #include "GUI/Support/Util/Path.h"
 #include "GUI/View/Data/DataView.h"
 #include "GUI/View/Instrument/InstrumentView.h"
diff --git a/GUI/View/Project/SimulationView.cpp b/GUI/View/Project/SimulationView.cpp
index 9d4b5ce99cb..ef27bbd19ca 100644
--- a/GUI/View/Project/SimulationView.cpp
+++ b/GUI/View/Project/SimulationView.cpp
@@ -21,7 +21,7 @@
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Model/Sample/SampleValidator.h"
-#include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Model/Tune/JobsSet.h"
 #include "GUI/Support/Data/SimulationOptionsItem.h"
 #include "GUI/View/Manager/ProjectManager.h"
 #include "GUI/View/Project/PythonScriptWidget.h"
@@ -284,7 +284,7 @@ void SimulationView::simulate()
                              "Cannot run the job with current settings\n\n" + msg);
         return;
     }
-    JobModel* jobModel = gDoc->jobModel();
+    JobsSet* jobModel = gDoc->jobModel();
     JobItem* jobItem = jobModel->addJobItem(selectedSampleItem(), selectedInstrumentItem(),
                                             selectedDatafileItem(), *optionsItem());
     jobModel->runJob(jobItem);
diff --git a/GUI/View/Tuning/JobRealTimeWidget.cpp b/GUI/View/Tuning/JobRealTimeWidget.cpp
index 9312be7d97b..b4562eb87a7 100644
--- a/GUI/View/Tuning/JobRealTimeWidget.cpp
+++ b/GUI/View/Tuning/JobRealTimeWidget.cpp
@@ -15,7 +15,7 @@
 #include "GUI/View/Tuning/JobRealTimeWidget.h"
 #include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
-#include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Model/Tune/JobsSet.h"
 #include "GUI/Support/Data/JobStatus.h"
 #include "GUI/View/Layout/mainwindow_constants.h"
 #include "GUI/View/Tuning/ParameterTuningStackPresenter.h"
@@ -23,7 +23,7 @@
 #include <QSettings>
 #include <QVBoxLayout>
 
-JobRealTimeWidget::JobRealTimeWidget(JobModel* jobModel, QWidget* parent)
+JobRealTimeWidget::JobRealTimeWidget(JobsSet* jobModel, QWidget* parent)
     : QWidget(parent)
     , m_stacked_widget(new ParameterTuningStackPresenter())
     , m_job_model(jobModel)
diff --git a/GUI/View/Tuning/JobRealTimeWidget.h b/GUI/View/Tuning/JobRealTimeWidget.h
index dfd101cd89c..3c956e00cd3 100644
--- a/GUI/View/Tuning/JobRealTimeWidget.h
+++ b/GUI/View/Tuning/JobRealTimeWidget.h
@@ -18,7 +18,7 @@
 #include <QWidget>
 
 class JobItem;
-class JobModel;
+class JobsSet;
 class ParameterTuningStackPresenter;
 class ParameterTuningWidget;
 
@@ -28,7 +28,7 @@ class ParameterTuningWidget;
 class JobRealTimeWidget : public QWidget {
     Q_OBJECT
 public:
-    JobRealTimeWidget(JobModel* jobModel, QWidget* parent = nullptr);
+    JobRealTimeWidget(JobsSet* jobModel, QWidget* parent = nullptr);
 
     ParameterTuningWidget* parameterTuningWidget();
 
@@ -43,7 +43,7 @@ private:
     void applySettings();
 
     ParameterTuningStackPresenter* m_stacked_widget;
-    JobModel* m_job_model;
+    JobsSet* m_job_model;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_TUNING_JOBREALTIMEWIDGET_H
diff --git a/GUI/View/Tuning/ParameterTuningWidget.cpp b/GUI/View/Tuning/ParameterTuningWidget.cpp
index 1899c3dc50b..15200abf05a 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.cpp
+++ b/GUI/View/Tuning/ParameterTuningWidget.cpp
@@ -132,7 +132,7 @@ void ParameterTuningWidget::setJobItem(JobItem* job_item)
 
 void ParameterTuningWidget::setModel(QObject* jobModel)
 {
-    m_job_model = dynamic_cast<JobModel*>(jobModel);
+    m_job_model = dynamic_cast<JobsSet*>(jobModel);
     ASSERT(m_job_model);
 }
 
diff --git a/GUI/View/Tuning/ParameterTuningWidget.h b/GUI/View/Tuning/ParameterTuningWidget.h
index 78be78df5ac..8adcdf28d9f 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.h
+++ b/GUI/View/Tuning/ParameterTuningWidget.h
@@ -21,7 +21,7 @@
 
 class CautionSign;
 class JobItem;
-class JobModel;
+class JobsSet;
 class ParameterBackupWidget;
 class ParameterItem;
 class ParameterTuningDelegate;
@@ -68,7 +68,7 @@ private:
     void applySettings();
 
     JobItem* m_job_item;
-    JobModel* m_job_model;
+    JobsSet* m_job_model;
     ParameterTuningModel* m_parameter_tuning_model;
     ParameterBackupWidget* m_backup_widget;
     SliderSettingsWidget* m_slider_settings_widget;
diff --git a/Tests/Unit/GUI/TestJobModel.cpp b/Tests/Unit/GUI/TestJobModel.cpp
index f195ff1465d..4dbcf059cc7 100644
--- a/Tests/Unit/GUI/TestJobModel.cpp
+++ b/Tests/Unit/GUI/TestJobModel.cpp
@@ -11,14 +11,14 @@
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Model/Mask/MaskeditorListmodel.h"
-#include "GUI/Model/Tune/JobModel.h"
+#include "GUI/Model/Tune/JobsSet.h"
 #include "Tests/GTestWrapper/google_test.h"
 #include "Tests/Unit/GUI/Utils.h"
 #include <QTest>
 
-TEST(TestJobModel, nonXMLData)
+TEST(TestJobsSet, nonXMLData)
 {
-    JobModel jobModel;
+    JobsSet jobModel;
 
     // initial state
     EXPECT_EQ(jobModel.dataItems().size(), 0);
@@ -35,17 +35,17 @@ TEST(TestJobModel, nonXMLData)
     jobItem->copyDatafileItemIntoJob(&dfi);
     EXPECT_EQ(jobModel.dataItems().size(), 2);
 
-    // checking data items of JobModel
+    // checking data items of JobsSet
     EXPECT_EQ(jobModel.dataItems().indexOf(jobItem->simulatedDataItem()), 0);
     EXPECT_EQ(jobModel.dataItems().indexOf(jobItem->realItem()->dataItem()), 1);
 }
 
-TEST(TestJobModel, saveNonXMLData)
+TEST(TestJobsSet, saveNonXMLData)
 {
     const QString projectDir("DatafieldIOService");
     UTest::GUI::create_dir(projectDir);
 
-    JobModel jobModel;
+    JobsSet jobModel;
 
     // adding JobItem with instrument
     auto* jobItem = jobModel.createJobItem();
@@ -112,7 +112,7 @@ TEST(TestJobModel, saveNonXMLData)
     EXPECT_FALSE(QFile::exists(fname2));
 }
 
-TEST(TestJobModel, masksToDetector)
+TEST(TestJobsSet, masksToDetector)
 {
     int nx = 7;
     int ny = 5;
-- 
GitLab


From 6ad4e4bfedb56d415c77110d79ae284c8fcb2057 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:04:35 +0100
Subject: [PATCH 09/31] format

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

diff --git a/GUI/Model/Device/InstrumentItems.cpp b/GUI/Model/Device/InstrumentItems.cpp
index 47c88e61a90..37c2f4c4c4c 100644
--- a/GUI/Model/Device/InstrumentItems.cpp
+++ b/GUI/Model/Device/InstrumentItems.cpp
@@ -43,8 +43,8 @@
 #include "Sim/Background/IBackground.h"
 #include "Sim/Scan/AlphaScan.h"
 #include "Sim/Simulation/includeSimulations.h"
-#include <numbers>
 #include <QUuid>
+#include <numbers>
 
 using std::numbers::pi;
 
-- 
GitLab


From f6a37900d24129fd26bf417387e5ec36218d2f90 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:09:39 +0100
Subject: [PATCH 10/31] rm include

---
 GUI/Model/Mask/MaskItems.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/GUI/Model/Mask/MaskItems.h b/GUI/Model/Mask/MaskItems.h
index a3ce348be61..3dde77e5545 100644
--- a/GUI/Model/Mask/MaskItems.h
+++ b/GUI/Model/Mask/MaskItems.h
@@ -17,7 +17,6 @@
 
 #include "Base/Types/OwningVector.h"
 #include "GUI/Model/Descriptor/DoubleProperty.h"
-#include "GUI/Model/Descriptor/SelectionProperty.h"
 #include "GUI/Model/Mask/OverlayItem.h"
 
 class IShape2D;
-- 
GitLab


From bf81f6105948d4f0a5d2a61b7ac05435f45f18c1 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:15:30 +0100
Subject: [PATCH 11/31] std member var name

---
 .../JobControl/JobPropertiesTableModel.cpp    | 53 ++++++++++---------
 GUI/View/JobControl/JobPropertiesTableModel.h |  2 +-
 2 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/GUI/View/JobControl/JobPropertiesTableModel.cpp b/GUI/View/JobControl/JobPropertiesTableModel.cpp
index e22851529b9..9e2a829a910 100644
--- a/GUI/View/JobControl/JobPropertiesTableModel.cpp
+++ b/GUI/View/JobControl/JobPropertiesTableModel.cpp
@@ -39,26 +39,26 @@ const QString ModelDateShortFormat = "yyyy.MM.dd hh:mm:ss";
 
 JobPropertiesTableModel::JobPropertiesTableModel(QObject* parent)
     : QAbstractTableModel(parent)
-    , m_item(nullptr)
+    , m_job_item(nullptr)
 {
 }
 
 JobPropertiesTableModel::~JobPropertiesTableModel()
 {
-    if (m_item)
-        disconnect(m_item, nullptr, this, nullptr);
+    if (m_job_item)
+        disconnect(m_job_item, nullptr, this, nullptr);
 }
 
 int JobPropertiesTableModel::rowCount(const QModelIndex& parent) const
 {
-    if (!parent.isValid() && m_item)
+    if (!parent.isValid() && m_job_item)
         return NumRows;
     return 0;
 }
 
 int JobPropertiesTableModel::columnCount(const QModelIndex& parent) const
 {
-    if (!parent.isValid() && m_item)
+    if (!parent.isValid() && m_job_item)
         return NumColumns;
     return 0;
 }
@@ -67,7 +67,7 @@ QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
 {
     if ((role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::ToolTipRole)
         || index.column() < 0 || index.column() >= NumColumns || index.row() < 0
-        || index.row() >= NumRows || !m_item)
+        || index.row() >= NumRows || !m_job_item)
         return {};
 
     switch (index.column()) {
@@ -76,23 +76,24 @@ QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
     case Column::Value: {
         switch (index.row()) {
         case Row::Name:
-            return m_item->batchInfo()->jobName();
+            return m_job_item->batchInfo()->jobName();
         case Row::Sample:
-            return m_item->sampleItem()->sampleName();
+            return m_job_item->sampleItem()->sampleName();
         case Row::Instrument:
-            return m_item->instrumentItem()->instrumentName();
+            return m_job_item->instrumentItem()->instrumentName();
         case Row::Status:
-            return jobStatusToString(m_item->batchInfo()->status());
+            return jobStatusToString(m_job_item->batchInfo()->status());
         case Row::Begin:
             if (role == Qt::ToolTipRole)
-                return QLocale().toString(m_item->batchInfo()->beginTime(), QLocale::LongFormat);
-            return m_item->batchInfo()->beginTime().toString(ModelDateShortFormat);
+                return QLocale().toString(m_job_item->batchInfo()->beginTime(),
+                                          QLocale::LongFormat);
+            return m_job_item->batchInfo()->beginTime().toString(ModelDateShortFormat);
         case Row::End:
             if (role == Qt::ToolTipRole)
-                return QLocale().toString(m_item->batchInfo()->endTime(), QLocale::LongFormat);
-            return m_item->batchInfo()->endTime().toString(ModelDateShortFormat);
+                return QLocale().toString(m_job_item->batchInfo()->endTime(), QLocale::LongFormat);
+            return m_job_item->batchInfo()->endTime().toString(ModelDateShortFormat);
         case Row::Duration: {
-            std::optional<size_t> duration = m_item->batchInfo()->duration();
+            std::optional<size_t> duration = m_job_item->batchInfo()->duration();
             if (duration)
                 return QString("%1 s").arg(duration.value() / 1000., 0, 'f', 3);
             return {};
@@ -118,7 +119,7 @@ QVariant JobPropertiesTableModel::headerData(int section, Qt::Orientation orient
 Qt::ItemFlags JobPropertiesTableModel::flags(const QModelIndex& index) const
 {
     Qt::ItemFlags f = QAbstractTableModel::flags(index);
-    if (index.column() == Column::Value && index.row() == Row::Name && m_item)
+    if (index.column() == Column::Value && index.row() == Row::Name && m_job_item)
         f.setFlag(Qt::ItemIsEditable);
     return f;
 }
@@ -126,19 +127,19 @@ Qt::ItemFlags JobPropertiesTableModel::flags(const QModelIndex& index) const
 bool JobPropertiesTableModel::setData(const QModelIndex& index, const QVariant& value, int role)
 {
     if (role != Qt::EditRole || index.column() != Column::Value || index.row() != Row::Name
-        || !m_item)
+        || !m_job_item)
         return false;
-    m_item->batchInfo()->setJobName(value.toString());
+    m_job_item->batchInfo()->setJobName(value.toString());
     return true;
 }
 
 void JobPropertiesTableModel::setJobItem(JobItem* jobItem)
 {
     beginResetModel();
-    if (m_item)
-        disconnect(m_item, nullptr, this, nullptr);
-    m_item = jobItem;
-    if (m_item)
+    if (m_job_item)
+        disconnect(m_job_item, nullptr, this, nullptr);
+    m_job_item = jobItem;
+    if (m_job_item)
         notifyJobPropertyChange();
     endResetModel();
 }
@@ -146,25 +147,25 @@ void JobPropertiesTableModel::setJobItem(JobItem* jobItem)
 void JobPropertiesTableModel::notifyJobPropertyChange()
 {
     // name
-    connect(m_item->batchInfo(), &BatchInfo::jobNameChanged, [this](const QString&) {
+    connect(m_job_item->batchInfo(), &BatchInfo::jobNameChanged, [this](const QString&) {
         emit dataChanged(index(Row::Name, Column::Value), index(Row::Name, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
 
     // status
-    connect(m_item->batchInfo(), &BatchInfo::jobStatusChanged, [this](const JobStatus) {
+    connect(m_job_item->batchInfo(), &BatchInfo::jobStatusChanged, [this](const JobStatus) {
         emit dataChanged(index(Row::Status, Column::Value), index(Row::Status, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
 
     // begin time
-    connect(m_item->batchInfo(), &BatchInfo::jobBeginTimeChanged, [this](const QDateTime&) {
+    connect(m_job_item->batchInfo(), &BatchInfo::jobBeginTimeChanged, [this](const QDateTime&) {
         emit dataChanged(index(Row::Begin, Column::Value), index(Row::Begin, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
 
     // end time and duration
-    connect(m_item->batchInfo(), &BatchInfo::jobEndTimeChanged, [this](const QDateTime&) {
+    connect(m_job_item->batchInfo(), &BatchInfo::jobEndTimeChanged, [this](const QDateTime&) {
         emit dataChanged(index(Row::End, Column::Value), index(Row::Duration, Column::Value),
                          {Qt::DisplayRole, Qt::EditRole});
     });
diff --git a/GUI/View/JobControl/JobPropertiesTableModel.h b/GUI/View/JobControl/JobPropertiesTableModel.h
index 848adf7b8db..0e59a3c2239 100644
--- a/GUI/View/JobControl/JobPropertiesTableModel.h
+++ b/GUI/View/JobControl/JobPropertiesTableModel.h
@@ -39,7 +39,7 @@ public:
 private:
     void notifyJobPropertyChange();
 
-    JobItem* m_item;
+    JobItem* m_job_item;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBPROPERTIESTABLEMODEL_H
-- 
GitLab


From 4472e15cff86baf55c04eeadc1efb5f9dd98cfe4 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:18:45 +0100
Subject: [PATCH 12/31] std arg name

---
 GUI/Model/Tune/JobsSet.cpp | 78 +++++++++++++++++++-------------------
 GUI/Model/Tune/JobsSet.h   |  8 ++--
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/GUI/Model/Tune/JobsSet.cpp b/GUI/Model/Tune/JobsSet.cpp
index e41e72c53c9..2f009ffd87d 100644
--- a/GUI/Model/Tune/JobsSet.cpp
+++ b/GUI/Model/Tune/JobsSet.cpp
@@ -45,18 +45,18 @@ JobsSet::~JobsSet() = default;
 
 JobItem* JobsSet::jobItemForIdentifier(const QString& identifier)
 {
-    for (auto* jobItem : jobItems())
-        if (jobItem->batchInfo()->identifier() == identifier)
-            return jobItem;
+    for (auto* job_item : jobItems())
+        if (job_item->batchInfo()->identifier() == identifier)
+            return job_item;
 
     return nullptr;
 }
 
 JobItem* JobsSet::createJobItem()
 {
-    auto* jobItem = new JobItem();
-    m_job_items.emplace_back(jobItem);
-    return jobItem;
+    auto* job_item = new JobItem();
+    m_job_items.emplace_back(job_item);
+    return job_item;
 }
 
 //! Main method to add a job
@@ -66,28 +66,28 @@ JobItem* JobsSet::addJobItem(const SampleItem* sampleItem, const InstrumentItem*
     ASSERT(sampleItem);
     ASSERT(instrumentItem);
 
-    JobItem* jobItem = createJobItem();
-    jobItem->batchInfo()->setJobName(generateJobName());
-    jobItem->batchInfo()->setIdentifier(QUuid::createUuid().toString());
+    JobItem* job_item = createJobItem();
+    job_item->batchInfo()->setJobName(generateJobName());
+    job_item->batchInfo()->setIdentifier(QUuid::createUuid().toString());
 
-    jobItem->copySampleIntoJob(sampleItem);
-    jobItem->copyInstrumentIntoJob(instrumentItem);
+    job_item->copySampleIntoJob(sampleItem);
+    job_item->copyInstrumentIntoJob(instrumentItem);
 
-    jobItem->createParameterTree();
-    jobItem->parameterContainerItem()->addBackupValues("Initial state");
+    job_item->createParameterTree();
+    job_item->parameterContainerItem()->addBackupValues("Initial state");
 
-    jobItem->copySimulationOptionsIntoJob(optionItem);
-    jobItem->createSimulatedDataItem();
+    job_item->copySimulationOptionsIntoJob(optionItem);
+    job_item->createSimulatedDataItem();
 
     if (realItem) {
-        jobItem->copyDatafileItemIntoJob(realItem);
-        jobItem->adjustReaDataToJobInstrument();
+        job_item->copyDatafileItemIntoJob(realItem);
+        job_item->adjustReaDataToJobInstrument();
 
-        jobItem->createDiffDataItem();
+        job_item->createDiffDataItem();
     }
 
     emit jobAdded();
-    return jobItem;
+    return job_item;
 }
 
 QVector<JobItem*> JobsSet::jobItems() const
@@ -96,9 +96,9 @@ QVector<JobItem*> JobsSet::jobItems() const
 }
 
 //! restore instrument and sample model from backup for given JobItem
-void JobsSet::restore(JobItem* jobItem, int index)
+void JobsSet::restore(JobItem* job_item, int index)
 {
-    jobItem->parameterContainerItem()->restoreBackupValues(index);
+    job_item->parameterContainerItem()->restoreBackupValues(index);
 }
 
 bool JobsSet::hasUnfinishedJobs()
@@ -106,8 +106,8 @@ bool JobsSet::hasUnfinishedJobs()
     if (m_queue_data->hasUnfinishedJobs())
         return true;
 
-    for (auto* jobItem : jobItems())
-        if (isFitting(jobItem->batchInfo()->status()))
+    for (auto* job_item : jobItems())
+        if (isFitting(job_item->batchInfo()->status()))
             return true;
 
     return false;
@@ -123,11 +123,11 @@ QVector<DataItem*> JobsSet::dataItems() const
 {
     QVector<DataItem*> result;
 
-    for (auto* jobItem : jobItems()) {
-        if (auto* dataItem = jobItem->simulatedDataItem())
+    for (auto* job_item : jobItems()) {
+        if (auto* dataItem = job_item->simulatedDataItem())
             result.push_back(dataItem);
 
-        if (const auto* real_data = dynamic_cast<const DatafileItem*>(jobItem->realItem()))
+        if (const auto* real_data = dynamic_cast<const DatafileItem*>(job_item->realItem()))
             if (auto* data_item = real_data->dataItem())
                 result.push_back(data_item);
     }
@@ -164,8 +164,8 @@ void JobsSet::readFrom(QXmlStreamReader* r)
 
         // job
         if (tag == Tag::Job) {
-            auto* jobItem = createJobItem();
-            jobItem->readFrom(r);
+            auto* job_item = createJobItem();
+            job_item->readFrom(r);
             XML::gotoEndElementOfTag(r, tag);
 
             // selected index
@@ -197,29 +197,29 @@ void JobsSet::readDatafiles(const QString& projectDir, MessageService* messageSe
     dataFilesCleaner.recollectDataNames(dataItems());
 }
 
-void JobsSet::runJob(JobItem* jobItem)
+void JobsSet::runJob(JobItem* job_item)
 {
-    m_queue_data->runJob(jobItem);
+    m_queue_data->runJob(job_item);
 }
 
-void JobsSet::cancelJob(JobItem* jobItem)
+void JobsSet::cancelJob(JobItem* job_item)
 {
-    m_queue_data->cancelJob(jobItem->batchInfo()->identifier());
+    m_queue_data->cancelJob(job_item->batchInfo()->identifier());
 }
 
-void JobsSet::removeJob(JobItem* jobItem)
+void JobsSet::removeJob(JobItem* job_item)
 {
-    ASSERT(jobItem);
-    m_queue_data->removeJob(jobItem->batchInfo()->identifier());
-    m_job_items.delete_element(jobItem);
+    ASSERT(job_item);
+    m_queue_data->removeJob(job_item->batchInfo()->identifier());
+    m_job_items.delete_element(job_item);
 }
 
 QString JobsSet::generateJobName()
 {
     int maxJobIndex = 0;
-    for (const auto* jobItem : jobItems()) {
-        if (jobItem->batchInfo()->jobName().startsWith("job"))
-            maxJobIndex = std::max(maxJobIndex, jobItem->batchInfo()->jobName().mid(3).toInt());
+    for (const auto* job_item : jobItems()) {
+        if (job_item->batchInfo()->jobName().startsWith("job"))
+            maxJobIndex = std::max(maxJobIndex, job_item->batchInfo()->jobName().mid(3).toInt());
     }
     return QString("job%1").arg(maxJobIndex + 1);
 }
diff --git a/GUI/Model/Tune/JobsSet.h b/GUI/Model/Tune/JobsSet.h
index 908569807ca..3c1d670a3f0 100644
--- a/GUI/Model/Tune/JobsSet.h
+++ b/GUI/Model/Tune/JobsSet.h
@@ -44,7 +44,7 @@ public:
 
     QVector<JobItem*> jobItems() const;
 
-    void restore(JobItem* jobItem, int index);
+    void restore(JobItem* job_item, int index);
 
     bool hasUnfinishedJobs();
 
@@ -57,9 +57,9 @@ public:
     void writeDatafiles(const QString& projectDir);
     void readDatafiles(const QString& projectDir, MessageService* messageService);
 
-    void runJob(JobItem* jobItem);
-    void cancelJob(JobItem* jobItem);
-    void removeJob(JobItem* jobItem);
+    void runJob(JobItem* job_item);
+    void cancelJob(JobItem* job_item);
+    void removeJob(JobItem* job_item);
 
     int selectedIndex() const { return m_selected_index; }
     void setSelectedIndex(int index) { m_selected_index = index; }
-- 
GitLab


From 7a6b4f7472221aeaba85274043c69392640501ab Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:21:33 +0100
Subject: [PATCH 13/31] sort forward decls

---
 GUI/Model/Tune/JobQueueData.h     | 2 +-
 GUI/View/JobControl/JobListing.h  | 2 +-
 GUI/View/JobControl/JobSelector.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/GUI/Model/Tune/JobQueueData.h b/GUI/Model/Tune/JobQueueData.h
index ac3018a3965..c5ab2aa48e8 100644
--- a/GUI/Model/Tune/JobQueueData.h
+++ b/GUI/Model/Tune/JobQueueData.h
@@ -21,8 +21,8 @@
 
 class ISimulation;
 class JobItem;
-class JobsSet;
 class JobWorker;
+class JobsSet;
 
 //! Holds all data and logic for running simulation in a thread.
 
diff --git a/GUI/View/JobControl/JobListing.h b/GUI/View/JobControl/JobListing.h
index 300c5710ef1..64425b69f91 100644
--- a/GUI/View/JobControl/JobListing.h
+++ b/GUI/View/JobControl/JobListing.h
@@ -23,8 +23,8 @@
 
 class JobItem;
 class JobListModel;
-class JobsSet;
 class JobProgressDelegate;
+class JobsSet;
 
 //! List of jobs on the top left side of JobView.
 
diff --git a/GUI/View/JobControl/JobSelector.h b/GUI/View/JobControl/JobSelector.h
index 394753e5958..d53dc34c5b5 100644
--- a/GUI/View/JobControl/JobSelector.h
+++ b/GUI/View/JobControl/JobSelector.h
@@ -20,8 +20,8 @@
 
 class JobItem;
 class JobListing;
-class JobsSet;
 class JobPropertiesWidget;
+class JobsSet;
 
 //! The JobSelector class represents left panel of JobView. Contains a tree to select jobs
 //! on the top and job property editor at the bottom.
-- 
GitLab


From 2683ae7c4f10748a22fc7492b7265c52998ab0fc Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:22:14 +0100
Subject: [PATCH 14/31] rename class and sources GUI/Model/Files/DatafilesModel
 -> GUI/Model/Files/DatafilesSet

---
 .../{DatafilesModel.cpp => DatafilesSet.cpp}  | 38 +++++++++----------
 .../{DatafilesModel.h => DatafilesSet.h}      | 18 ++++-----
 GUI/Model/Files/DatafilesTree.cpp             |  4 +-
 GUI/Model/Files/DatafilesTree.h               |  8 ++--
 GUI/Model/Project/LinkInstrumentManager.cpp   |  2 +-
 GUI/Model/Project/LinkInstrumentManager.h     |  2 +-
 GUI/Model/Project/ProjectDocument.cpp         |  2 +-
 GUI/Model/Project/ProjectDocument.h           |  6 +--
 GUI/View/Project/SimulationView.cpp           |  2 +-
 Tests/Unit/GUI/TestDatafilesModel.cpp         | 22 +++++------
 Tests/Unit/GUI/TestLinkInstrument.cpp         |  4 +-
 Tests/Unit/GUI/TestProjectDocument.cpp        |  2 +-
 Tests/Unit/GUI/Utils.cpp                      |  6 +--
 Tests/Unit/GUI/Utils.h                        |  6 +--
 14 files changed, 61 insertions(+), 61 deletions(-)
 rename GUI/Model/Files/{DatafilesModel.cpp => DatafilesSet.cpp} (79%)
 rename GUI/Model/Files/{DatafilesModel.h => DatafilesSet.h} (81%)

diff --git a/GUI/Model/Files/DatafilesModel.cpp b/GUI/Model/Files/DatafilesSet.cpp
similarity index 79%
rename from GUI/Model/Files/DatafilesModel.cpp
rename to GUI/Model/Files/DatafilesSet.cpp
index cbff75e7fa9..83be1c3a32e 100644
--- a/GUI/Model/Files/DatafilesModel.cpp
+++ b/GUI/Model/Files/DatafilesSet.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Files/DatafilesModel.cpp
-//! @brief     Implements class DatafilesModel.
+//! @file      GUI/Model/Files/DatafilesSet.cpp
+//! @brief     Implements class DatafilesSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "Base/Util/Assert.h"
 #include "Device/Data/Datafield.h"
 #include "GUI/Model/Device/DatafileItem.h"
@@ -29,14 +29,14 @@ const QString SelectedRank("SelectedRank");
 } // namespace Tag
 } // namespace
 
-DatafilesModel::DatafilesModel()
+DatafilesSet::DatafilesSet()
 {
-    setObjectName("DatafilesModel");
+    setObjectName("DatafilesSet");
 }
 
-DatafilesModel::~DatafilesModel() = default;
+DatafilesSet::~DatafilesSet() = default;
 
-QVector<DataItem*> DatafilesModel::dataItems() const
+QVector<DataItem*> DatafilesSet::dataItems() const
 {
     QVector<DataItem*> result;
     for (auto* realData : realItems())
@@ -46,13 +46,13 @@ QVector<DataItem*> DatafilesModel::dataItems() const
     return result;
 }
 
-void DatafilesModel::clear()
+void DatafilesSet::clear()
 {
     for (auto* realItem : realItems())
         removeDatafileItem(realItem);
 }
 
-void DatafilesModel::writeTo(QXmlStreamWriter* w) const
+void DatafilesSet::writeTo(QXmlStreamWriter* w) const
 {
     XML::writeAttribute(w, XML::Attrib::version, uint(1));
 
@@ -75,7 +75,7 @@ void DatafilesModel::writeTo(QXmlStreamWriter* w) const
     w->writeEndElement();
 }
 
-void DatafilesModel::readFrom(QXmlStreamReader* r)
+void DatafilesSet::readFrom(QXmlStreamReader* r)
 {
     clear();
 
@@ -110,7 +110,7 @@ void DatafilesModel::readFrom(QXmlStreamReader* r)
         throw std::runtime_error(r->errorString().toLatin1());
 }
 
-void DatafilesModel::writeDatafiles(const QString& projectDir)
+void DatafilesSet::writeDatafiles(const QString& projectDir)
 {
     for (const auto* realItem : realItems())
         realItem->writeDatafiles(projectDir);
@@ -118,7 +118,7 @@ void DatafilesModel::writeDatafiles(const QString& projectDir)
     dataFilesCleaner.cleanOldFiles(projectDir, dataItems());
 }
 
-void DatafilesModel::readDatafiles(const QString& projectDir, MessageService* messageService)
+void DatafilesSet::readDatafiles(const QString& projectDir, MessageService* messageService)
 {
     for (auto* realItem : realItems())
         realItem->readDatafiles(projectDir, messageService);
@@ -126,14 +126,14 @@ void DatafilesModel::readDatafiles(const QString& projectDir, MessageService* me
     dataFilesCleaner.recollectDataNames(dataItems());
 }
 
-DatafileItem* DatafilesModel::insertDataItem(const QString& fname, const Datafield& df)
+DatafileItem* DatafilesSet::insertDataItem(const QString& fname, const Datafield& df)
 {
     auto* r = new DatafileItem(QFileInfo(fname).baseName(), df);
     m_real_items.emplace_back(r);
     return r;
 }
 
-QVector<DatafileItem*> DatafilesModel::realItems() const
+QVector<DatafileItem*> DatafilesSet::realItems() const
 {
     QVector<DatafileItem*> items(m_real_items.size());
     for (int i = 0; i < items.size(); i++)
@@ -142,12 +142,12 @@ QVector<DatafileItem*> DatafilesModel::realItems() const
 }
 
 
-QVector<DatafileItem*> DatafilesModel::realItems(int rank) const
+QVector<DatafileItem*> DatafilesSet::realItems(int rank) const
 {
     return rank == 1 ? realItems1D() : realItems2D();
 }
 
-QVector<DatafileItem*> DatafilesModel::realItems1D() const
+QVector<DatafileItem*> DatafilesSet::realItems1D() const
 {
     QVector<DatafileItem*> vec_1d;
 
@@ -158,7 +158,7 @@ QVector<DatafileItem*> DatafilesModel::realItems1D() const
     return vec_1d;
 }
 
-QVector<DatafileItem*> DatafilesModel::realItems2D() const
+QVector<DatafileItem*> DatafilesSet::realItems2D() const
 {
     QVector<DatafileItem*> vec_2d;
 
@@ -169,14 +169,14 @@ QVector<DatafileItem*> DatafilesModel::realItems2D() const
     return vec_2d;
 }
 
-void DatafilesModel::removeDatafileItem(DatafileItem* realItem)
+void DatafilesSet::removeDatafileItem(DatafileItem* realItem)
 {
     ASSERT(realItem);
     int index = realItems().indexOf(realItem);
     m_real_items.erase(m_real_items.begin() + index);
 }
 
-QStringList DatafilesModel::realItemNames() const
+QStringList DatafilesSet::realItemNames() const
 {
     QStringList result;
     for (auto* item : realItems())
diff --git a/GUI/Model/Files/DatafilesModel.h b/GUI/Model/Files/DatafilesSet.h
similarity index 81%
rename from GUI/Model/Files/DatafilesModel.h
rename to GUI/Model/Files/DatafilesSet.h
index f1191ad7b33..f7e78827f05 100644
--- a/GUI/Model/Files/DatafilesModel.h
+++ b/GUI/Model/Files/DatafilesSet.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Files/DatafilesModel.h
-//! @brief     Defines class DatafilesModel.
+//! @file      GUI/Model/Files/DatafilesSet.h
+//! @brief     Defines class DatafilesSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_FILES_DATAFILESMODEL_H
-#define BORNAGAIN_GUI_MODEL_FILES_DATAFILESMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_FILES_DATAFILESSET_H
+#define BORNAGAIN_GUI_MODEL_FILES_DATAFILESSET_H
 
 #include "GUI/Model/Files/DatafilesCleaner.h"
 #include <QObject>
@@ -25,12 +25,12 @@ class DatafileItem;
 class InstrumentModel;
 class MessageService;
 
-//! The DatafilesModel class is a model to store all imported DatafileItem's.
-class DatafilesModel : public QObject {
+//! The DatafilesSet class is a model to store all imported DatafileItem's.
+class DatafilesSet : public QObject {
     Q_OBJECT
 public:
-    explicit DatafilesModel();
-    ~DatafilesModel();
+    explicit DatafilesSet();
+    ~DatafilesSet();
 
     QVector<DataItem*> dataItems() const;
     void clear();
@@ -65,4 +65,4 @@ private:
     int m_selected_rank = -1;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_FILES_DATAFILESMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_FILES_DATAFILESSET_H
diff --git a/GUI/Model/Files/DatafilesTree.cpp b/GUI/Model/Files/DatafilesTree.cpp
index 7195f5293d2..60138835db8 100644
--- a/GUI/Model/Files/DatafilesTree.cpp
+++ b/GUI/Model/Files/DatafilesTree.cpp
@@ -15,12 +15,12 @@
 #include "GUI/Model/Files/DatafilesTree.h"
 #include "Device/Data/Datafield.h"
 #include "GUI/Model/Device/DatafileItem.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include <QApplication>
 #include <QFontMetrics>
 #include <QPalette>
 
-DatafilesTree::DatafilesTree(QObject* parent, DatafilesModel* model)
+DatafilesTree::DatafilesTree(QObject* parent, DatafilesSet* model)
     : QAbstractItemModel(parent)
     , m_model(model)
 {
diff --git a/GUI/Model/Files/DatafilesTree.h b/GUI/Model/Files/DatafilesTree.h
index d8c5ee0890d..d34816d9338 100644
--- a/GUI/Model/Files/DatafilesTree.h
+++ b/GUI/Model/Files/DatafilesTree.h
@@ -19,14 +19,14 @@
 
 class Datafield;
 class DatafileItem;
-class DatafilesModel;
+class DatafilesSet;
 
-//! Tree representation of DatafilesModel, for use in DatafilesSelector.
+//! Tree representation of DatafilesSet, for use in DatafilesSelector.
 
 class DatafilesTree : public QAbstractItemModel {
     Q_OBJECT
 public:
-    explicit DatafilesTree(QObject* parent, DatafilesModel* model);
+    explicit DatafilesTree(QObject* parent, DatafilesSet* model);
 
     QModelIndex index(int row, int column,
                       const QModelIndex& parent = QModelIndex()) const override;
@@ -52,7 +52,7 @@ public:
     bool isHeadline(const QModelIndex& index) const;
 
 private:
-    DatafilesModel* const m_model;
+    DatafilesSet* const m_model;
     QVector<DatafileItem*> m_items[2]; //< Items borrowed from model. Never delete the ptrs!
 };
 
diff --git a/GUI/Model/Project/LinkInstrumentManager.cpp b/GUI/Model/Project/LinkInstrumentManager.cpp
index b899e279a9b..7ed8bec6e19 100644
--- a/GUI/Model/Project/LinkInstrumentManager.cpp
+++ b/GUI/Model/Project/LinkInstrumentManager.cpp
@@ -15,7 +15,7 @@
 #include "GUI/Model/Project/LinkInstrumentManager.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include <QMessageBox>
 #include <QPushButton>
diff --git a/GUI/Model/Project/LinkInstrumentManager.h b/GUI/Model/Project/LinkInstrumentManager.h
index 7da3ccfd33a..822260148b8 100644
--- a/GUI/Model/Project/LinkInstrumentManager.h
+++ b/GUI/Model/Project/LinkInstrumentManager.h
@@ -25,7 +25,7 @@ class InstrumentItem;
 class ProjectDocument;
 
 //! The LinkInstrumentManager class provides communication between InstrumentModel and
-//! DatafilesModel. Particularly, it notifies DatafileItem about changes in linked instruments
+//! DatafilesSet. Particularly, it notifies DatafileItem about changes in linked instruments
 //! to adjust axes of Data2DItem.
 
 class LinkInstrumentManager : public QObject {
diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp
index 3ce0ea0879d..b8c2ed983b7 100644
--- a/GUI/Model/Project/ProjectDocument.cpp
+++ b/GUI/Model/Project/ProjectDocument.cpp
@@ -111,7 +111,7 @@ SampleModel* ProjectDocument::sampleModel()
     return &m_sample_model;
 }
 
-DatafilesModel* ProjectDocument::realModel()
+DatafilesSet* ProjectDocument::realModel()
 {
     return &m_real_model;
 }
diff --git a/GUI/Model/Project/ProjectDocument.h b/GUI/Model/Project/ProjectDocument.h
index f37b10123b4..4756804448f 100644
--- a/GUI/Model/Project/ProjectDocument.h
+++ b/GUI/Model/Project/ProjectDocument.h
@@ -16,7 +16,7 @@
 #define BORNAGAIN_GUI_MODEL_PROJECT_PROJECTDOCUMENT_H
 
 #include "GUI/Model/Device/MultiInstrumentNotifier.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "GUI/Model/Project/LinkInstrumentManager.h"
 #include "GUI/Model/Sample/SampleModel.h"
 #include "GUI/Model/Tune/JobsSet.h"
@@ -57,7 +57,7 @@ public:
 
     InstrumentModel* instrumentModel();
     SampleModel* sampleModel();
-    DatafilesModel* realModel();
+    DatafilesSet* realModel();
     JobsSet* jobModel();
     SimulationOptionsItem* simulationOptionsItem();
 
@@ -105,7 +105,7 @@ private:
     MultiInstrumentNotifier m_instrument_edit_controller;
     InstrumentModel m_instrument_model;
     SampleModel m_sample_model;
-    DatafilesModel m_real_model;
+    DatafilesSet m_real_model;
     JobsSet m_job_model;
     int m_last_view_active;
 };
diff --git a/GUI/View/Project/SimulationView.cpp b/GUI/View/Project/SimulationView.cpp
index ef27bbd19ca..29f41267cf4 100644
--- a/GUI/View/Project/SimulationView.cpp
+++ b/GUI/View/Project/SimulationView.cpp
@@ -16,7 +16,7 @@
 #include "GUI/Model/Data/DataItem.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Model/Sample/SampleItem.h"
diff --git a/Tests/Unit/GUI/TestDatafilesModel.cpp b/Tests/Unit/GUI/TestDatafilesModel.cpp
index adf59ddf40f..e989389f6eb 100644
--- a/Tests/Unit/GUI/TestDatafilesModel.cpp
+++ b/Tests/Unit/GUI/TestDatafilesModel.cpp
@@ -7,15 +7,15 @@
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Model/Device/InstrumentModel.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "Tests/GTestWrapper/google_test.h"
 #include "Tests/Unit/GUI/Utils.h"
 #include <QTest>
 #include <fstream>
 
-const QString dir_test_real_model = "TestDatafilesModel";
+const QString dir_test_real_model = "TestDatafilesSet";
 
-TEST(TestDatafilesModel, saveNonXMLData)
+TEST(TestDatafilesSet, saveNonXMLData)
 {
     if (!QFile::exists(dir_test_real_model))
         QDir(".").mkdir(dir_test_real_model);
@@ -23,7 +23,7 @@ TEST(TestDatafilesModel, saveNonXMLData)
     const QString dir = dir_test_real_model + "/saveNonXMLData";
     UTest::GUI::create_dir(dir);
 
-    DatafilesModel model;
+    DatafilesSet model;
     DatafileItem* item1 = UTest::GUI::createRealData2D("data1", model, 101.);
     DatafileItem* item2 = UTest::GUI::createRealData2D("data2", model, 102.);
 
@@ -69,7 +69,7 @@ TEST(TestDatafilesModel, saveNonXMLData)
     EXPECT_FALSE(QFile::exists(fname2));
 }
 
-TEST(TestDatafilesModel, saveXMLData)
+TEST(TestDatafilesSet, saveXMLData)
 {
     if (!QFile::exists(dir_test_real_model))
         QDir(".").mkdir(dir_test_real_model);
@@ -78,7 +78,7 @@ TEST(TestDatafilesModel, saveXMLData)
     UTest::GUI::create_dir(dir);
 
     InstrumentModel instrument_model;
-    DatafilesModel model1;
+    DatafilesSet model1;
 
     Datafield df1 = UTest::GUI::makeData1D(201.);
     Datafield df2 = UTest::GUI::makeData1D(202.);
@@ -105,16 +105,16 @@ TEST(TestDatafilesModel, saveXMLData)
     const QString file2 = dir + "/Project_2.ba";
 
     // write changed model to disk
-    const QString tag = "DatafilesModel";
-    UTest::GUI::writeXMLFile<DatafilesModel>(file1, model1, tag);
+    const QString tag = "DatafilesSet";
+    UTest::GUI::writeXMLFile<DatafilesSet>(file1, model1, tag);
     EXPECT_TRUE(QFile::exists(file1));
 
     // read data to the second model
-    DatafilesModel model2;
-    UTest::GUI::readXMLFile<DatafilesModel>(file1, model2, tag);
+    DatafilesSet model2;
+    UTest::GUI::readXMLFile<DatafilesSet>(file1, model2, tag);
 
     // write the second model back to disk
-    UTest::GUI::writeXMLFile<DatafilesModel>(file2, model2, tag);
+    UTest::GUI::writeXMLFile<DatafilesSet>(file2, model2, tag);
     EXPECT_TRUE(QFile::exists(file2));
 
     // compare files byte-by-byte
diff --git a/Tests/Unit/GUI/TestLinkInstrument.cpp b/Tests/Unit/GUI/TestLinkInstrument.cpp
index cde3c2a557a..7cc50db7131 100644
--- a/Tests/Unit/GUI/TestLinkInstrument.cpp
+++ b/Tests/Unit/GUI/TestLinkInstrument.cpp
@@ -8,7 +8,7 @@
 #include "GUI/Model/Detector/DetectorItem.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "GUI/Model/Project/LinkInstrumentManager.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "Tests/GTestWrapper/google_test.h"
@@ -16,7 +16,7 @@
 #include <QSignalSpy>
 #include <QTest>
 
-QList<DatafileItem*> linkedRealDataItems(DatafilesModel& realModel,
+QList<DatafileItem*> linkedRealDataItems(DatafilesSet& realModel,
                                          const InstrumentItem* instrumentItem)
 {
     ASSERT(instrumentItem);
diff --git a/Tests/Unit/GUI/TestProjectDocument.cpp b/Tests/Unit/GUI/TestProjectDocument.cpp
index 73853273f2f..92c5ba5351b 100644
--- a/Tests/Unit/GUI/TestProjectDocument.cpp
+++ b/Tests/Unit/GUI/TestProjectDocument.cpp
@@ -4,7 +4,7 @@
 #include "GUI/Model/Data/Data2DItem.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Model/Project/ProjectUtil.h"
 #include "GUI/Support/Util/Path.h"
diff --git a/Tests/Unit/GUI/Utils.cpp b/Tests/Unit/GUI/Utils.cpp
index 772f1712773..126a1886740 100644
--- a/Tests/Unit/GUI/Utils.cpp
+++ b/Tests/Unit/GUI/Utils.cpp
@@ -19,7 +19,7 @@
 #include "Device/IO/IOFactory.h"
 #include "GUI/Model/Data/DataItem.h"
 #include "GUI/Model/Device/DatafileItem.h"
-#include "GUI/Model/Files/DatafilesModel.h"
+#include "GUI/Model/Files/DatafilesSet.h"
 #include "GUI/Model/Project/ProjectUtil.h"
 
 void UTest::GUI::create_dir(const QString& dir_name)
@@ -54,12 +54,12 @@ Datafield UTest::GUI::makeData2D(double value, int nx, double x_min, double x_ma
     return result;
 }
 
-DatafileItem* UTest::GUI::createRealData1D(const QString& name, DatafilesModel& model, double value)
+DatafileItem* UTest::GUI::createRealData1D(const QString& name, DatafilesSet& model, double value)
 {
     return model.insertDataItem(name, makeData1D(value));
 }
 
-DatafileItem* UTest::GUI::createRealData2D(const QString& name, DatafilesModel& model, double value)
+DatafileItem* UTest::GUI::createRealData2D(const QString& name, DatafilesSet& model, double value)
 {
     return model.insertDataItem(name, makeData2D(value));
 }
diff --git a/Tests/Unit/GUI/Utils.h b/Tests/Unit/GUI/Utils.h
index 47f0631ec5f..5ebe0b224df 100644
--- a/Tests/Unit/GUI/Utils.h
+++ b/Tests/Unit/GUI/Utils.h
@@ -20,7 +20,7 @@
 
 class Datafield;
 class DatafileItem;
-class DatafilesModel;
+class DatafilesSet;
 
 namespace UTest::GUI {
 
@@ -36,10 +36,10 @@ Datafield makeData2D(double value, int nx = 5, double x_min = -1.0, double x_max
                      double y_min = 0.0, double y_max = 2.0);
 
 //! Creates real 1D data item initialized with Datafield
-DatafileItem* createRealData1D(const QString& name, DatafilesModel& model, double value);
+DatafileItem* createRealData1D(const QString& name, DatafilesSet& model, double value);
 
 //! Creates real 2D data item initialized with Datafield
-DatafileItem* createRealData2D(const QString& name, DatafilesModel& model, double value);
+DatafileItem* createRealData2D(const QString& name, DatafilesSet& model, double value);
 
 //! Helper function to test if data are the same.
 bool isTheSame(const Datafield& data1, const Datafield& data2);
-- 
GitLab


From 48c7d0c77f718d24a4e4ebf3921649824fa993c9 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:27:32 +0100
Subject: [PATCH 15/31] restore compatibility for tag 'MaterialModel'

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

diff --git a/GUI/Model/Sample/SampleItem.cpp b/GUI/Model/Sample/SampleItem.cpp
index b19bc31187b..86d6e5a666b 100644
--- a/GUI/Model/Sample/SampleItem.cpp
+++ b/GUI/Model/Sample/SampleItem.cpp
@@ -200,7 +200,7 @@ void SampleItem::readFrom(QXmlStreamReader* r)
             XML::gotoEndElementOfTag(r, tag);
 
             // materials
-        } else if (tag == Tag::MaterialsSet) {
+        } else if (tag == Tag::MaterialsSet || tag == "MaterialModel" /*v<=21*/) {
             m_materials.readFrom(r);
             XML::gotoEndElementOfTag(r, tag);
 
-- 
GitLab


From 2909b20da61b37da3c0a2e757ae77fffc090f706 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:33:49 +0100
Subject: [PATCH 16/31] rename class and sources
 GUI/Model/Device/InstrumentModel -> GUI/Model/Device/InstrumentsSet

---
 GUI/Model/Descriptor/SelectionProperty.h      |  2 +-
 GUI/Model/Device/InstrumentLibrary.cpp        |  2 +-
 GUI/Model/Device/InstrumentLibrary.h          |  6 ++--
 ...InstrumentModel.cpp => InstrumentsSet.cpp} | 36 +++++++++----------
 .../{InstrumentModel.h => InstrumentsSet.h}   | 14 ++++----
 GUI/Model/Device/MultiInstrumentNotifier.cpp  |  2 +-
 GUI/Model/Device/MultiInstrumentNotifier.h    | 12 +++----
 GUI/Model/Files/DatafilesSet.h                |  2 +-
 GUI/Model/FromCore/ItemizeSimulation.cpp      |  2 +-
 GUI/Model/Project/LinkInstrumentManager.h     |  2 +-
 GUI/Model/Project/ProjectDocument.cpp         |  8 ++---
 GUI/Model/Project/ProjectDocument.h           |  4 +--
 GUI/View/Instrument/InstrumentsTreeModel.cpp  |  4 +--
 GUI/View/Instrument/InstrumentsTreeModel.h    |  6 ++--
 Tests/Unit/GUI/TestDatafilesModel.cpp         |  4 +--
 15 files changed, 53 insertions(+), 53 deletions(-)
 rename GUI/Model/Device/{InstrumentModel.cpp => InstrumentsSet.cpp} (73%)
 rename GUI/Model/Device/{InstrumentModel.h => InstrumentsSet.h} (87%)

diff --git a/GUI/Model/Descriptor/SelectionProperty.h b/GUI/Model/Descriptor/SelectionProperty.h
index fa2bed2e96a..05ebd9e8b54 100644
--- a/GUI/Model/Descriptor/SelectionProperty.h
+++ b/GUI/Model/Descriptor/SelectionProperty.h
@@ -217,7 +217,7 @@ private:
 
 //! A special kind of owning vector, providing "standard" interfaces for
 //! 'std::vector<SelectionProperty<Catalog>>', used in classes that work not just with single
-//! SelectionProperty but with the set of them, for example 'InstrumentModel', 'CompoundItem',
+//! SelectionProperty but with the set of them, for example 'InstrumentsSet', 'CompoundItem',
 //! 'ParticleLayoutItems', 'MaskItems'
 
 template <typename Catalog> class SelectionVector {
diff --git a/GUI/Model/Device/InstrumentLibrary.cpp b/GUI/Model/Device/InstrumentLibrary.cpp
index 710cb0fec5d..db9a8f783ee 100644
--- a/GUI/Model/Device/InstrumentLibrary.cpp
+++ b/GUI/Model/Device/InstrumentLibrary.cpp
@@ -142,7 +142,7 @@ bool InstrumentLibrary::load()
     }
 }
 
-InstrumentModel* InstrumentLibrary::instrumentModel()
+InstrumentsSet* InstrumentLibrary::instrumentModel()
 {
     return &m_instrument_model;
 }
diff --git a/GUI/Model/Device/InstrumentLibrary.h b/GUI/Model/Device/InstrumentLibrary.h
index 68943960492..3e56ca8279e 100644
--- a/GUI/Model/Device/InstrumentLibrary.h
+++ b/GUI/Model/Device/InstrumentLibrary.h
@@ -15,7 +15,7 @@
 #ifndef BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTLIBRARY_H
 #define BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTLIBRARY_H
 
-#include "GUI/Model/Device/InstrumentModel.h"
+#include "GUI/Model/Device/InstrumentsSet.h"
 #include "GUI/Model/Device/MultiInstrumentNotifier.h"
 
 class InstrumentLibrary {
@@ -32,12 +32,12 @@ public:
     bool saveIfModified();
     bool load();
 
-    InstrumentModel* instrumentModel();
+    InstrumentsSet* instrumentModel();
 
     MultiInstrumentNotifier* editController();
 
 private:
-    InstrumentModel m_instrument_model;
+    InstrumentsSet m_instrument_model;
     MultiInstrumentNotifier m_ec;
     bool m_modified;
 };
diff --git a/GUI/Model/Device/InstrumentModel.cpp b/GUI/Model/Device/InstrumentsSet.cpp
similarity index 73%
rename from GUI/Model/Device/InstrumentModel.cpp
rename to GUI/Model/Device/InstrumentsSet.cpp
index 080b55c1a49..be696b01e83 100644
--- a/GUI/Model/Device/InstrumentModel.cpp
+++ b/GUI/Model/Device/InstrumentsSet.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Device/InstrumentModel.cpp
-//! @brief     Implement class InstrumentModel
+//! @file      GUI/Model/Device/InstrumentsSet.cpp
+//! @brief     Implement class InstrumentsSet
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Device/InstrumentModel.h"
+#include "GUI/Model/Device/InstrumentsSet.h"
 #include "GUI/Model/Device/BackgroundItems.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Support/Util/String.h"
@@ -27,14 +27,14 @@ const QString SelectedIndex("SelectedIndex");
 } // namespace Tag
 } // namespace
 
-InstrumentModel::~InstrumentModel() = default;
+InstrumentsSet::~InstrumentsSet() = default;
 
-void InstrumentModel::clear()
+void InstrumentsSet::clear()
 {
     m_instruments.clear();
 }
 
-void InstrumentModel::writeTo(QXmlStreamWriter* w) const
+void InstrumentsSet::writeTo(QXmlStreamWriter* w) const
 {
     XML::writeAttribute(w, XML::Attrib::version, uint(1));
 
@@ -51,7 +51,7 @@ void InstrumentModel::writeTo(QXmlStreamWriter* w) const
     w->writeEndElement();
 }
 
-void InstrumentModel::readFrom(QXmlStreamReader* r)
+void InstrumentsSet::readFrom(QXmlStreamReader* r)
 {
     m_instruments.clear();
 
@@ -76,12 +76,12 @@ void InstrumentModel::readFrom(QXmlStreamReader* r)
     }
 }
 
-void InstrumentModel::emplace_back(InstrumentItem* item)
+void InstrumentsSet::emplace_back(InstrumentItem* item)
 {
     addEmptyInstrumentSelection().setCurrentItem(item);
 }
 
-InstrumentItem* InstrumentModel::insertItemCopy(const InstrumentItem& source)
+InstrumentItem* InstrumentsSet::insertItemCopy(const InstrumentItem& source)
 {
     auto* copy = source.createItemCopy();
     copy->setId(QUuid::createUuid().toString());
@@ -89,7 +89,7 @@ InstrumentItem* InstrumentModel::insertItemCopy(const InstrumentItem& source)
     return copy;
 }
 
-QVector<InstrumentItem*> InstrumentModel::instrumentItems() const
+QVector<InstrumentItem*> InstrumentsSet::instrumentItems() const
 {
     QVector<InstrumentItem*> output;
     for (const auto& sel : m_instruments)
@@ -97,7 +97,7 @@ QVector<InstrumentItem*> InstrumentModel::instrumentItems() const
     return output;
 }
 
-QStringList InstrumentModel::instrumentNames() const
+QStringList InstrumentsSet::instrumentNames() const
 {
     QStringList existingNames;
     for (const auto* item : instrumentItems())
@@ -105,19 +105,19 @@ QStringList InstrumentModel::instrumentNames() const
     return existingNames;
 }
 
-SelectionProperty<InstrumentItemCatalog>& InstrumentModel::addEmptyInstrumentSelection()
+SelectionProperty<InstrumentItemCatalog>& InstrumentsSet::addEmptyInstrumentSelection()
 {
     m_instruments.push_back(nullptr);
     return m_instruments.back();
 }
 
-QString InstrumentModel::suggestInstrumentName(const QString& baseName) const
+QString InstrumentsSet::suggestInstrumentName(const QString& baseName) const
 {
     return GUI::Util::String::suggestName(instrumentNames(), baseName);
 }
 
 QVector<InstrumentItem*>
-InstrumentModel::instrumentItems(const std::function<bool(const InstrumentItem*)>& accept) const
+InstrumentsSet::instrumentItems(const std::function<bool(const InstrumentItem*)>& accept) const
 {
     QVector<InstrumentItem*> result;
     for (auto* p : instrumentItems())
@@ -127,7 +127,7 @@ InstrumentModel::instrumentItems(const std::function<bool(const InstrumentItem*)
     return result;
 }
 
-QVector<InstrumentItem*> InstrumentModel::instrument2DItems() const
+QVector<InstrumentItem*> InstrumentsSet::instrument2DItems() const
 {
     QVector<InstrumentItem*> result;
     for (auto* p : instrumentItems())
@@ -137,7 +137,7 @@ QVector<InstrumentItem*> InstrumentModel::instrument2DItems() const
     return result;
 }
 
-InstrumentItem* InstrumentModel::findInstrumentItemById(const QString& instrumentId) const
+InstrumentItem* InstrumentsSet::findInstrumentItemById(const QString& instrumentId) const
 {
     for (auto* instrument : instrumentItems())
         if (instrument->id() == instrumentId)
@@ -146,12 +146,12 @@ InstrumentItem* InstrumentModel::findInstrumentItemById(const QString& instrumen
     return nullptr;
 }
 
-bool InstrumentModel::instrumentExists(const QString& instrumentId) const
+bool InstrumentsSet::instrumentExists(const QString& instrumentId) const
 {
     return findInstrumentItemById(instrumentId) != nullptr;
 }
 
-void InstrumentModel::removeInstrument(InstrumentItem* instrument)
+void InstrumentsSet::removeInstrument(InstrumentItem* instrument)
 {
     m_instruments.delete_element(instrument);
 }
diff --git a/GUI/Model/Device/InstrumentModel.h b/GUI/Model/Device/InstrumentsSet.h
similarity index 87%
rename from GUI/Model/Device/InstrumentModel.h
rename to GUI/Model/Device/InstrumentsSet.h
index 3fad5992257..e4040af39a1 100644
--- a/GUI/Model/Device/InstrumentModel.h
+++ b/GUI/Model/Device/InstrumentsSet.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Device/InstrumentModel.h
-//! @brief     Defines class InstrumentModel.
+//! @file      GUI/Model/Device/InstrumentsSet.h
+//! @brief     Defines class InstrumentsSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTMODEL_H
-#define BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTSSET_H
+#define BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTSSET_H
 
 #include "GUI/Model/Descriptor/SelectionProperty.h"
 #include "GUI/Model/Device/InstrumentItemCatalog.h"
@@ -25,9 +25,9 @@
 
 class InstrumentItem;
 
-class InstrumentModel {
+class InstrumentsSet {
 public:
-    ~InstrumentModel();
+    ~InstrumentsSet();
 
     template <typename T> T* addInstrumentItem()
     {
@@ -69,4 +69,4 @@ private:
     int m_selected_index = -1;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_DEVICE_INSTRUMENTSSET_H
diff --git a/GUI/Model/Device/MultiInstrumentNotifier.cpp b/GUI/Model/Device/MultiInstrumentNotifier.cpp
index 100406df592..42b7569dfa0 100644
--- a/GUI/Model/Device/MultiInstrumentNotifier.cpp
+++ b/GUI/Model/Device/MultiInstrumentNotifier.cpp
@@ -15,7 +15,7 @@
 #include "GUI/Model/Device/MultiInstrumentNotifier.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 
-MultiInstrumentNotifier::MultiInstrumentNotifier(InstrumentModel* instruments)
+MultiInstrumentNotifier::MultiInstrumentNotifier(InstrumentsSet* instruments)
     : m_instruments(instruments)
 {
 }
diff --git a/GUI/Model/Device/MultiInstrumentNotifier.h b/GUI/Model/Device/MultiInstrumentNotifier.h
index 3c03f1e27ec..1a126572f80 100644
--- a/GUI/Model/Device/MultiInstrumentNotifier.h
+++ b/GUI/Model/Device/MultiInstrumentNotifier.h
@@ -15,12 +15,12 @@
 #ifndef BORNAGAIN_GUI_MODEL_DEVICE_MULTIINSTRUMENTNOTIFIER_H
 #define BORNAGAIN_GUI_MODEL_DEVICE_MULTIINSTRUMENTNOTIFIER_H
 
-#include "GUI/Model/Device/InstrumentModel.h"
+#include "GUI/Model/Device/InstrumentsSet.h"
 #include <QObject>
 
 class DatafileItem;
 class InstrumentItem;
-class InstrumentModel;
+class InstrumentsSet;
 
 //! Class to modify the instruments list or a single instrument and provide the necessary signaling
 //! within BornAgain.
@@ -40,10 +40,10 @@ class InstrumentModel;
 class MultiInstrumentNotifier : public QObject {
     Q_OBJECT
 public:
-    MultiInstrumentNotifier(InstrumentModel* instruments);
+    MultiInstrumentNotifier(InstrumentsSet* instruments);
 
     //! The list of existing instruments.
-    InstrumentModel* instrumentModel() { return m_instruments; }
+    InstrumentsSet* instrumentModel() { return m_instruments; }
 
     //! Add an instrument and emit the respective signal.
     template <typename T> T* addInstrumentItem();
@@ -80,8 +80,8 @@ signals:
     void instrumentNameChanged(const InstrumentItem* instrument);
 
 private:
-    InstrumentModel* m_instruments; //!< The edited/controlled instruments. This pointer is
-                                    //!< borrowed, not owned.
+    InstrumentsSet* m_instruments; //!< The edited/controlled instruments. This pointer is
+                                   //!< borrowed, not owned.
 };
 
 template <typename T> T* MultiInstrumentNotifier::addInstrumentItem()
diff --git a/GUI/Model/Files/DatafilesSet.h b/GUI/Model/Files/DatafilesSet.h
index f7e78827f05..66b19b0ddce 100644
--- a/GUI/Model/Files/DatafilesSet.h
+++ b/GUI/Model/Files/DatafilesSet.h
@@ -22,7 +22,7 @@
 class DataItem;
 class Datafield;
 class DatafileItem;
-class InstrumentModel;
+class InstrumentsSet;
 class MessageService;
 
 //! The DatafilesSet class is a model to store all imported DatafileItem's.
diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp
index 335c9772f8b..69a44b8a373 100644
--- a/GUI/Model/FromCore/ItemizeSimulation.cpp
+++ b/GUI/Model/FromCore/ItemizeSimulation.cpp
@@ -37,7 +37,7 @@
 #include "GUI/Model/Detector/ResolutionFunctionItems.h"
 #include "GUI/Model/Device/BackgroundItems.h"
 #include "GUI/Model/Device/InstrumentItems.h"
-#include "GUI/Model/Device/InstrumentModel.h"
+#include "GUI/Model/Device/InstrumentsSet.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Support/Data/SimulationOptionsItem.h"
diff --git a/GUI/Model/Project/LinkInstrumentManager.h b/GUI/Model/Project/LinkInstrumentManager.h
index 822260148b8..b31fbf4abed 100644
--- a/GUI/Model/Project/LinkInstrumentManager.h
+++ b/GUI/Model/Project/LinkInstrumentManager.h
@@ -24,7 +24,7 @@ class DatafileItem;
 class InstrumentItem;
 class ProjectDocument;
 
-//! The LinkInstrumentManager class provides communication between InstrumentModel and
+//! The LinkInstrumentManager class provides communication between InstrumentsSet and
 //! DatafilesSet. Particularly, it notifies DatafileItem about changes in linked instruments
 //! to adjust axes of Data2DItem.
 
diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp
index b8c2ed983b7..47a1d8e05a1 100644
--- a/GUI/Model/Project/ProjectDocument.cpp
+++ b/GUI/Model/Project/ProjectDocument.cpp
@@ -39,7 +39,7 @@ namespace Tag {
 const QString BornAgain("BornAgain");
 const QString DocumentInfo("DocumentInfo");
 const QString SimulationOptions("SimulationOptions");
-const QString InstrumentModel("InstrumentModel");
+const QString InstrumentsSet("InstrumentsSet");
 const QString SampleModel("SampleModel");
 const QString JobsSet("JobsSet");
 const QString RealModel("RealModel");
@@ -101,7 +101,7 @@ void ProjectDocument::setProjectFullPath(const QString& fullPath)
     setProjectDir(GUI::Project::Util::projectDir(fullPath));
 }
 
-InstrumentModel* ProjectDocument::instrumentModel()
+InstrumentsSet* ProjectDocument::instrumentModel()
 {
     return &m_instrument_model;
 }
@@ -238,7 +238,7 @@ void ProjectDocument::writeProject(QIODevice* device)
     w.writeEndElement();
 
     // instruments
-    w.writeStartElement(Tag::InstrumentModel);
+    w.writeStartElement(Tag::InstrumentsSet);
     m_instrument_model.writeTo(&w);
     w.writeEndElement();
 
@@ -300,7 +300,7 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
                             XML::gotoEndElementOfTag(&r, tag);
 
                             // instruments
-                        } else if (tag == Tag::InstrumentModel) {
+                        } else if (tag == Tag::InstrumentsSet) {
                             m_instrument_model.readFrom(&r);
                             XML::gotoEndElementOfTag(&r, tag);
 
diff --git a/GUI/Model/Project/ProjectDocument.h b/GUI/Model/Project/ProjectDocument.h
index 4756804448f..2a44cf1868e 100644
--- a/GUI/Model/Project/ProjectDocument.h
+++ b/GUI/Model/Project/ProjectDocument.h
@@ -55,7 +55,7 @@ public:
     QString projectFullPath() const;
     void setProjectFullPath(const QString& fullPath);
 
-    InstrumentModel* instrumentModel();
+    InstrumentsSet* instrumentModel();
     SampleModel* sampleModel();
     DatafilesSet* realModel();
     JobsSet* jobModel();
@@ -103,7 +103,7 @@ private:
     std::unique_ptr<LinkInstrumentManager> m_link_manager;
     SimulationOptionsItem m_simulation_options_item;
     MultiInstrumentNotifier m_instrument_edit_controller;
-    InstrumentModel m_instrument_model;
+    InstrumentsSet m_instrument_model;
     SampleModel m_sample_model;
     DatafilesSet m_real_model;
     JobsSet m_job_model;
diff --git a/GUI/View/Instrument/InstrumentsTreeModel.cpp b/GUI/View/Instrument/InstrumentsTreeModel.cpp
index 7397c0d884b..b78c5e536ee 100644
--- a/GUI/View/Instrument/InstrumentsTreeModel.cpp
+++ b/GUI/View/Instrument/InstrumentsTreeModel.cpp
@@ -15,7 +15,7 @@
 #include "GUI/View/Instrument/InstrumentsTreeModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Device/InstrumentItems.h"
-#include "GUI/Model/Device/InstrumentModel.h"
+#include "GUI/Model/Device/InstrumentsSet.h"
 #include <QApplication>
 #include <QtGui>
 
@@ -28,7 +28,7 @@ const auto types = {IType::Gisas, IType::Offspec, IType::Specular, IType::Depthp
 } // namespace
 
 
-InstrumentsTreeModel::InstrumentsTreeModel(QObject* parent, InstrumentModel* model)
+InstrumentsTreeModel::InstrumentsTreeModel(QObject* parent, InstrumentsSet* model)
     : QAbstractItemModel(parent)
     , m_model(model)
     , m_names_are_editable(false)
diff --git a/GUI/View/Instrument/InstrumentsTreeModel.h b/GUI/View/Instrument/InstrumentsTreeModel.h
index 8dfb9fd4a78..3c8c5429f5a 100644
--- a/GUI/View/Instrument/InstrumentsTreeModel.h
+++ b/GUI/View/Instrument/InstrumentsTreeModel.h
@@ -18,13 +18,13 @@
 #include <QAbstractItemModel>
 
 class InstrumentItem;
-class InstrumentModel;
+class InstrumentsSet;
 
 //! Tree model for instrument item selection. Used e.g. for the instrument library.
 class InstrumentsTreeModel : public QAbstractItemModel {
     Q_OBJECT
 public:
-    InstrumentsTreeModel(QObject* parent, InstrumentModel* model);
+    InstrumentsTreeModel(QObject* parent, InstrumentsSet* model);
 
     enum InstrumentType {
         None = 0x0,
@@ -64,7 +64,7 @@ private:
     void clear();
     QVector<InstrumentItem*> instrumentItemsOfType(InstrumentType type) const;
 
-    InstrumentModel* m_model = nullptr;
+    InstrumentsSet* m_model = nullptr;
     bool m_names_are_editable;
     bool m_enable_empty_headlines;
     InstrumentItem* m_new_instrument = nullptr;
diff --git a/Tests/Unit/GUI/TestDatafilesModel.cpp b/Tests/Unit/GUI/TestDatafilesModel.cpp
index e989389f6eb..3afdd05a142 100644
--- a/Tests/Unit/GUI/TestDatafilesModel.cpp
+++ b/Tests/Unit/GUI/TestDatafilesModel.cpp
@@ -6,7 +6,7 @@
 #include "GUI/Model/Device/BackgroundItems.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Device/InstrumentItems.h"
-#include "GUI/Model/Device/InstrumentModel.h"
+#include "GUI/Model/Device/InstrumentsSet.h"
 #include "GUI/Model/Files/DatafilesSet.h"
 #include "Tests/GTestWrapper/google_test.h"
 #include "Tests/Unit/GUI/Utils.h"
@@ -77,7 +77,7 @@ TEST(TestDatafilesSet, saveXMLData)
     const QString dir = dir_test_real_model + "/saveXMLData";
     UTest::GUI::create_dir(dir);
 
-    InstrumentModel instrument_model;
+    InstrumentsSet instrument_model;
     DatafilesSet model1;
 
     Datafield df1 = UTest::GUI::makeData1D(201.);
-- 
GitLab


From 7d16721946e0fe1673c42a191c061f04d4021e0d Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:38:10 +0100
Subject: [PATCH 17/31] rename class and sources
 GUI/View/Tuning/SliderSettingsWidget -> GUI/View/Tuning/SliderEditor

---
 GUI/View/Tuning/ParameterTuningWidget.cpp     |  8 +++---
 GUI/View/Tuning/ParameterTuningWidget.h       |  4 +--
 ...derSettingsWidget.cpp => SliderEditor.cpp} | 27 +++++++++----------
 ...{SliderSettingsWidget.h => SliderEditor.h} | 14 +++++-----
 4 files changed, 26 insertions(+), 27 deletions(-)
 rename GUI/View/Tuning/{SliderSettingsWidget.cpp => SliderEditor.cpp} (77%)
 rename GUI/View/Tuning/{SliderSettingsWidget.h => SliderEditor.h} (75%)

diff --git a/GUI/View/Tuning/ParameterTuningWidget.cpp b/GUI/View/Tuning/ParameterTuningWidget.cpp
index 15200abf05a..222a4c87ab1 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.cpp
+++ b/GUI/View/Tuning/ParameterTuningWidget.cpp
@@ -25,7 +25,7 @@
 #include "GUI/View/Layout/mainwindow_constants.h"
 #include "GUI/View/ParEdit/ParameterTuningDelegate.h"
 #include "GUI/View/Tuning/ParameterBackupWidget.h"
-#include "GUI/View/Tuning/SliderSettingsWidget.h"
+#include "GUI/View/Tuning/SliderEditor.h"
 #include "GUI/View/Widget/StyledToolbar.h"
 #include <QAction>
 #include <QHeaderView>
@@ -54,7 +54,7 @@ ParameterTuningWidget::ParameterTuningWidget()
     : m_job_model(nullptr)
     , m_parameter_tuning_model(nullptr)
     , m_backup_widget(new ParameterBackupWidget)
-    , m_slider_settings_widget(new SliderSettingsWidget)
+    , m_slider_settings_widget(new SliderEditor)
     , m_tree_view(new QTreeView)
     , m_delegate(new ParameterTuningDelegate)
     , m_caution_sign(new CautionSign(m_tree_view))
@@ -75,9 +75,9 @@ ParameterTuningWidget::ParameterTuningWidget()
     mainLayout->addWidget(m_tree_view);
     setLayout(mainLayout);
 
-    connect(m_slider_settings_widget, &SliderSettingsWidget::sliderRangeFactorChanged, this,
+    connect(m_slider_settings_widget, &SliderEditor::sliderRangeFactorChanged, this,
             &ParameterTuningWidget::onSliderRangeChanged);
-    connect(m_slider_settings_widget, &SliderSettingsWidget::lockzChanged, this,
+    connect(m_slider_settings_widget, &SliderEditor::lockzChanged, this,
             &ParameterTuningWidget::onLockZValueChanged);
     connect(m_delegate, &ParameterTuningDelegate::currentLinkChanged, this,
             &ParameterTuningWidget::onCurrentLinkChanged);
diff --git a/GUI/View/Tuning/ParameterTuningWidget.h b/GUI/View/Tuning/ParameterTuningWidget.h
index 8adcdf28d9f..a9f39e6fbe1 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.h
+++ b/GUI/View/Tuning/ParameterTuningWidget.h
@@ -26,7 +26,7 @@ class ParameterBackupWidget;
 class ParameterItem;
 class ParameterTuningDelegate;
 class ParameterTuningModel;
-class SliderSettingsWidget;
+class SliderEditor;
 
 //! Main widget for real time parameter tuning.
 //! Contains a tree for parameter tuning and the model to provide drag-and-drop in FitActivityPanel.
@@ -71,7 +71,7 @@ private:
     JobsSet* m_job_model;
     ParameterTuningModel* m_parameter_tuning_model;
     ParameterBackupWidget* m_backup_widget;
-    SliderSettingsWidget* m_slider_settings_widget;
+    SliderEditor* m_slider_settings_widget;
     QTreeView* m_tree_view;
     ParameterTuningDelegate* m_delegate;
     CautionSign* m_caution_sign;
diff --git a/GUI/View/Tuning/SliderSettingsWidget.cpp b/GUI/View/Tuning/SliderEditor.cpp
similarity index 77%
rename from GUI/View/Tuning/SliderSettingsWidget.cpp
rename to GUI/View/Tuning/SliderEditor.cpp
index 6c1cd2000c3..7b9ce97d722 100644
--- a/GUI/View/Tuning/SliderSettingsWidget.cpp
+++ b/GUI/View/Tuning/SliderEditor.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Tuning/SliderSettingsWidget.cpp
-//! @brief     Implements class SliderSettingsWidget.
+//! @file      GUI/View/Tuning/SliderEditor.cpp
+//! @brief     Implements class SliderEditor.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,14 +12,14 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/Tuning/SliderSettingsWidget.h"
+#include "GUI/View/Tuning/SliderEditor.h"
 #include "GUI/Model/Data/Data2DItem.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include <QLabel>
 #include <QVBoxLayout>
 
-SliderSettingsWidget::SliderSettingsWidget()
+SliderEditor::SliderEditor()
     : m_radio1(nullptr)
     , m_radio2(nullptr)
     , m_radio3(nullptr)
@@ -35,25 +35,24 @@ SliderSettingsWidget::SliderSettingsWidget()
     m_radio1 = new QRadioButton("10%");
     m_radio1->setAutoExclusive(true);
     m_radio1->setToolTip(tooltip);
-    connect(m_radio1, &QRadioButton::clicked, this, &SliderSettingsWidget::rangeChanged);
+    connect(m_radio1, &QRadioButton::clicked, this, &SliderEditor::rangeChanged);
 
     m_radio2 = new QRadioButton("100%");
     m_radio2->setChecked(true);
     m_radio2->setAutoExclusive(true);
     m_radio2->setToolTip(tooltip);
-    connect(m_radio2, &QRadioButton::clicked, this, &SliderSettingsWidget::rangeChanged);
+    connect(m_radio2, &QRadioButton::clicked, this, &SliderEditor::rangeChanged);
 
     m_radio3 = new QRadioButton("1000%");
     m_radio3->setAutoExclusive(true);
     m_radio3->setToolTip(tooltip);
-    connect(m_radio3, &QRadioButton::clicked, this, &SliderSettingsWidget::rangeChanged);
+    connect(m_radio3, &QRadioButton::clicked, this, &SliderEditor::rangeChanged);
 
     // Fix z-axis
     m_lockz_check_box = new QCheckBox("Lock-Z");
     m_lockz_check_box->setToolTip(
         "Preserve (min, max) range of intensity axis during parameter tuning.");
-    connect(m_lockz_check_box, &QCheckBox::stateChanged, this,
-            &SliderSettingsWidget::onLockZChanged);
+    connect(m_lockz_check_box, &QCheckBox::stateChanged, this, &SliderEditor::onLockZChanged);
 
     auto* hbox = new QHBoxLayout;
 
@@ -67,7 +66,7 @@ SliderSettingsWidget::SliderSettingsWidget()
     setLayout(hbox);
 }
 
-void SliderSettingsWidget::setJobItem(JobItem* job_item)
+void SliderEditor::setJobItem(JobItem* job_item)
 {
     m_job_item = job_item;
 
@@ -75,7 +74,7 @@ void SliderSettingsWidget::setJobItem(JobItem* job_item)
     initZlock();
 }
 
-void SliderSettingsWidget::rangeChanged()
+void SliderEditor::rangeChanged()
 {
     if (!m_job_item)
         return;
@@ -91,7 +90,7 @@ void SliderSettingsWidget::rangeChanged()
     gDoc->setModified();
 }
 
-void SliderSettingsWidget::onLockZChanged(int state)
+void SliderEditor::onLockZChanged(int state)
 {
     if (state == Qt::Unchecked)
         emit lockzChanged(false);
@@ -100,7 +99,7 @@ void SliderSettingsWidget::onLockZChanged(int state)
     gDoc->setModified();
 }
 
-void SliderSettingsWidget::initSlider()
+void SliderEditor::initSlider()
 {
     if (!m_job_item)
         return;
@@ -116,7 +115,7 @@ void SliderSettingsWidget::initSlider()
     emit sliderRangeFactorChanged(m_slider_range);
 }
 
-void SliderSettingsWidget::initZlock()
+void SliderEditor::initZlock()
 {
     if (!m_job_item)
         return;
diff --git a/GUI/View/Tuning/SliderSettingsWidget.h b/GUI/View/Tuning/SliderEditor.h
similarity index 75%
rename from GUI/View/Tuning/SliderSettingsWidget.h
rename to GUI/View/Tuning/SliderEditor.h
index 55274482c6a..46b21dac65e 100644
--- a/GUI/View/Tuning/SliderSettingsWidget.h
+++ b/GUI/View/Tuning/SliderEditor.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Tuning/SliderSettingsWidget.h
-//! @brief     Defines class SliderSettingsWidget.
+//! @file      GUI/View/Tuning/SliderEditor.h
+//! @brief     Defines class SliderEditor.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_TUNING_SLIDERSETTINGSWIDGET_H
-#define BORNAGAIN_GUI_VIEW_TUNING_SLIDERSETTINGSWIDGET_H
+#ifndef BORNAGAIN_GUI_VIEW_TUNING_SLIDEREDITOR_H
+#define BORNAGAIN_GUI_VIEW_TUNING_SLIDEREDITOR_H
 
 #include <QCheckBox>
 #include <QRadioButton>
@@ -21,10 +21,10 @@
 
 class JobItem;
 
-class SliderSettingsWidget : public QWidget {
+class SliderEditor : public QWidget {
     Q_OBJECT
 public:
-    SliderSettingsWidget();
+    SliderEditor();
 
     void setJobItem(JobItem* job_item);
 
@@ -49,4 +49,4 @@ private:
     int m_slider_range = 100;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_TUNING_SLIDERSETTINGSWIDGET_H
+#endif // BORNAGAIN_GUI_VIEW_TUNING_SLIDEREDITOR_H
-- 
GitLab


From 4b67f7bcaabc23343df34d7694069399e925e0be Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:38:17 +0100
Subject: [PATCH 18/31] rename class and sources
 GUI/View/FitControl/RunFitControlWidget -> GUI/View/FitControl/FitEditor

---
 GUI/View/Fit/FitActivityPanel.cpp             |  2 +-
 GUI/View/Fit/FitSessionWidget.cpp             | 12 +++----
 GUI/View/Fit/FitSessionWidget.h               |  4 +--
 ...{RunFitControlWidget.cpp => FitEditor.cpp} | 34 +++++++++----------
 .../{RunFitControlWidget.h => FitEditor.h}    | 16 ++++-----
 5 files changed, 34 insertions(+), 34 deletions(-)
 rename GUI/View/FitControl/{RunFitControlWidget.cpp => FitEditor.cpp} (85%)
 rename GUI/View/FitControl/{RunFitControlWidget.h => FitEditor.h} (77%)

diff --git a/GUI/View/Fit/FitActivityPanel.cpp b/GUI/View/Fit/FitActivityPanel.cpp
index d54e0819a69..3184b9c7a2f 100644
--- a/GUI/View/Fit/FitActivityPanel.cpp
+++ b/GUI/View/Fit/FitActivityPanel.cpp
@@ -18,7 +18,7 @@
 #include "GUI/View/Fit/FitSessionController.h"
 #include "GUI/View/Fit/FitSessionManager.h"
 #include "GUI/View/Fit/FitSessionWidget.h"
-#include "GUI/View/FitControl/RunFitControlWidget.h"
+#include "GUI/View/FitControl/FitEditor.h"
 #include "GUI/View/Layout/mainwindow_constants.h"
 #include "GUI/View/Tuning/JobRealTimeWidget.h"
 #include "GUI/View/Tuning/ParameterTuningWidget.h"
diff --git a/GUI/View/Fit/FitSessionWidget.cpp b/GUI/View/Fit/FitSessionWidget.cpp
index 700d11b183c..72d9569cc9d 100644
--- a/GUI/View/Fit/FitSessionWidget.cpp
+++ b/GUI/View/Fit/FitSessionWidget.cpp
@@ -16,8 +16,8 @@
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/View/Fit/FitSessionController.h"
+#include "GUI/View/FitControl/FitEditor.h"
 #include "GUI/View/FitControl/MinimizerSettingsWidget.h"
-#include "GUI/View/FitControl/RunFitControlWidget.h"
 #include "GUI/View/Layout/mainwindow_constants.h"
 #include "GUI/View/Tuning/FitParameterWidget.h"
 #include <QSettings>
@@ -26,7 +26,7 @@
 FitSessionWidget::FitSessionWidget(QWidget* parent)
     : QWidget(parent)
     , m_tab_widget(new QTabWidget(this))
-    , m_control_widget(new RunFitControlWidget)
+    , m_control_widget(new FitEditor)
     , m_fit_parameters_widget(new FitParameterWidget)
     , m_minimizer_settings_widget(new MinimizerSettingsWidget)
     , m_session_controller(nullptr)
@@ -40,7 +40,7 @@ FitSessionWidget::FitSessionWidget(QWidget* parent)
     layout->addWidget(m_tab_widget);
     layout->addWidget(m_control_widget);
 
-    connect(m_control_widget, &RunFitControlWidget::updFromTreePushed, m_fit_parameters_widget,
+    connect(m_control_widget, &FitEditor::updFromTreePushed, m_fit_parameters_widget,
             &FitParameterWidget::updateView);
 
     applySettings();
@@ -80,11 +80,11 @@ void FitSessionWidget::setSessionController(FitSessionController* sessionControl
                 &FitSessionWidget::onFittingError);
         connect(m_session_controller, &QObject::destroyed,
                 [this] { m_session_controller = nullptr; });
-        connect(m_control_widget, &RunFitControlWidget::startFittingPushed, m_session_controller,
+        connect(m_control_widget, &FitEditor::startFittingPushed, m_session_controller,
                 &FitSessionController::onStartFittingRequest);
-        connect(m_control_widget, &RunFitControlWidget::stopFittingPushed, m_session_controller,
+        connect(m_control_widget, &FitEditor::stopFittingPushed, m_session_controller,
                 &FitSessionController::onStopFittingRequest);
-        connect(m_control_widget, &RunFitControlWidget::updFromTreePushed, m_session_controller,
+        connect(m_control_widget, &FitEditor::updFromTreePushed, m_session_controller,
                 &FitSessionController::updateStartValuesFromTree);
     }
 }
diff --git a/GUI/View/Fit/FitSessionWidget.h b/GUI/View/Fit/FitSessionWidget.h
index 62fc784831d..aef0fcb42f1 100644
--- a/GUI/View/Fit/FitSessionWidget.h
+++ b/GUI/View/Fit/FitSessionWidget.h
@@ -23,7 +23,7 @@ class FitSessionController;
 class JobItem;
 class MinimizerSettingsWidget;
 class ParameterTuningWidget;
-class RunFitControlWidget;
+class FitEditor;
 
 //! Contains all fit settings for given JobItem (fit parameters,
 //! minimizer settings). Controlled by FitActivityPanel.
@@ -45,7 +45,7 @@ private:
     void saveSettings();
 
     QTabWidget* m_tab_widget;
-    RunFitControlWidget* m_control_widget;
+    FitEditor* m_control_widget;
     FitParameterWidget* m_fit_parameters_widget;
     MinimizerSettingsWidget* m_minimizer_settings_widget;
     FitSessionController* m_session_controller;
diff --git a/GUI/View/FitControl/RunFitControlWidget.cpp b/GUI/View/FitControl/FitEditor.cpp
similarity index 85%
rename from GUI/View/FitControl/RunFitControlWidget.cpp
rename to GUI/View/FitControl/FitEditor.cpp
index c03ce1c9ffb..9c1c5276e02 100644
--- a/GUI/View/FitControl/RunFitControlWidget.cpp
+++ b/GUI/View/FitControl/FitEditor.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/FitControl/RunFitControlWidget.cpp
-//! @brief     Implements class RunFitControlWidget.
+//! @file      GUI/View/FitControl/FitEditor.cpp
+//! @brief     Implements class FitEditor.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/FitControl/RunFitControlWidget.h"
+#include "GUI/View/FitControl/FitEditor.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/FitSuiteItem.h"
@@ -33,7 +33,7 @@ const QString slider_tooltip = "Updates fit progress every Nth iteration";
 
 } // namespace
 
-RunFitControlWidget::RunFitControlWidget()
+FitEditor::FitEditor()
     : m_start_button(new QPushButton)
     , m_stop_button(new QPushButton)
     , m_upd_button(new QPushButton)
@@ -95,7 +95,7 @@ RunFitControlWidget::RunFitControlWidget()
     setEnabled(false);
 }
 
-void RunFitControlWidget::setJobItem(JobItem* job_item)
+void FitEditor::setJobItem(JobItem* job_item)
 {
     ASSERT(job_item);
     m_job_item = job_item;
@@ -106,20 +106,20 @@ void RunFitControlWidget::setJobItem(JobItem* job_item)
     initializeSlider();
 
     connect(fitSuiteItem(), &FitSuiteItem::iterationCountChanged, this,
-            &RunFitControlWidget::updateIterationsCountLabel, Qt::UniqueConnection);
+            &FitEditor::updateIterationsCountLabel, Qt::UniqueConnection);
 
     connect(m_job_item->batchInfo(), &BatchInfo::jobStatusChanged, this,
-            &RunFitControlWidget::updateControlElements, Qt::UniqueConnection);
+            &FitEditor::updateControlElements, Qt::UniqueConnection);
 }
 
-void RunFitControlWidget::onFittingError(const QString& what)
+void FitEditor::onFittingError(const QString& what)
 {
     m_caution_sign->clear();
     m_iterations_count_label->setText("");
     m_caution_sign->setCautionMessage(what);
 }
 
-void RunFitControlWidget::onSliderValueChanged(int value)
+void FitEditor::onSliderValueChanged(int value)
 {
     int interval = sliderValueToUpdateInterval(value);
     m_update_interval_label->setText(QString::number(interval));
@@ -128,20 +128,20 @@ void RunFitControlWidget::onSliderValueChanged(int value)
     gDoc->setModified();
 }
 
-int RunFitControlWidget::sliderUpdateInterval()
+int FitEditor::sliderUpdateInterval()
 {
     return sliderValueToUpdateInterval(m_interval_slider->value());
 }
 
 //! converts slider value (1-15) to update interval to be propagated to FitSuiteWidget
 
-int RunFitControlWidget::sliderValueToUpdateInterval(int value)
+int FitEditor::sliderValueToUpdateInterval(int value)
 {
     auto svalue = static_cast<qsizetype>(value);
     return svalue < slider_to_interval.size() ? slider_to_interval[svalue] : default_interval;
 }
 
-int RunFitControlWidget::updateIntervalToSliderValue(int updInterval)
+int FitEditor::updateIntervalToSliderValue(int updInterval)
 {
     if (slider_to_interval.contains(updInterval))
         return slider_to_interval.indexOf(updInterval);
@@ -149,7 +149,7 @@ int RunFitControlWidget::updateIntervalToSliderValue(int updInterval)
         return slider_to_interval.indexOf(default_interval);
 }
 
-void RunFitControlWidget::initializeSlider()
+void FitEditor::initializeSlider()
 {
     if (fitSuiteItem()) {
         int updInterval = fitSuiteItem()->updateInterval();
@@ -162,7 +162,7 @@ void RunFitControlWidget::initializeSlider()
 
 //! Updates button "enabled" status and caution status depending on current job conditions.
 
-void RunFitControlWidget::updateControlElements(JobStatus status)
+void FitEditor::updateControlElements(JobStatus status)
 {
     setEnabled(isValidJobItem());
 
@@ -176,17 +176,17 @@ void RunFitControlWidget::updateControlElements(JobStatus status)
     }
 }
 
-FitSuiteItem* RunFitControlWidget::fitSuiteItem()
+FitSuiteItem* FitEditor::fitSuiteItem()
 {
     return m_job_item ? m_job_item->fitSuiteItem() : nullptr;
 }
 
-bool RunFitControlWidget::isValidJobItem()
+bool FitEditor::isValidJobItem()
 {
     return m_job_item ? m_job_item->isValidForFitting() : false;
 }
 
-void RunFitControlWidget::updateIterationsCountLabel(int iter)
+void FitEditor::updateIterationsCountLabel(int iter)
 {
     m_iterations_count_label->setText(QString::number(iter));
 }
diff --git a/GUI/View/FitControl/RunFitControlWidget.h b/GUI/View/FitControl/FitEditor.h
similarity index 77%
rename from GUI/View/FitControl/RunFitControlWidget.h
rename to GUI/View/FitControl/FitEditor.h
index 4808347f5ba..003f68b012a 100644
--- a/GUI/View/FitControl/RunFitControlWidget.h
+++ b/GUI/View/FitControl/FitEditor.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/FitControl/RunFitControlWidget.h
-//! @brief     Defines class RunFitControlWidget.
+//! @file      GUI/View/FitControl/FitEditor.h
+//! @brief     Defines class FitEditor.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_FITCONTROL_RUNFITCONTROLWIDGET_H
-#define BORNAGAIN_GUI_VIEW_FITCONTROL_RUNFITCONTROLWIDGET_H
+#ifndef BORNAGAIN_GUI_VIEW_FITCONTROL_FITEDITOR_H
+#define BORNAGAIN_GUI_VIEW_FITCONTROL_FITEDITOR_H
 
 #include <QLabel>
 #include <QPushButton>
@@ -26,13 +26,13 @@ class CautionSign;
 class FitSuiteItem;
 class JobItem;
 
-//! The RunFitControlWidget contains elements to start/stop fitting and to provide minimal
+//! The FitEditor contains elements to start/stop fitting and to provide minimal
 //! diagnostic. Part of FitSuiteWidget.
 
-class RunFitControlWidget : public QWidget {
+class FitEditor : public QWidget {
     Q_OBJECT
 public:
-    RunFitControlWidget();
+    FitEditor();
 
     void setJobItem(JobItem* job_item);
 
@@ -66,4 +66,4 @@ private:
     JobItem* m_job_item;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_FITCONTROL_RUNFITCONTROLWIDGET_H
+#endif // BORNAGAIN_GUI_VIEW_FITCONTROL_FITEDITOR_H
-- 
GitLab


From 125fec3c4b1de3138714f08c99b143c5a08af69f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:38:44 +0100
Subject: [PATCH 19/31] rename class and sources
 GUI/View/FitControl/MinimizerSettingsWidget ->
 GUI/View/FitControl/MinimizerEditor

---
 GUI/View/Fit/FitSessionWidget.cpp             |  4 +--
 GUI/View/Fit/FitSessionWidget.h               |  4 +--
 ...SettingsWidget.cpp => MinimizerEditor.cpp} | 28 +++++++++----------
 ...izerSettingsWidget.h => MinimizerEditor.h} | 16 +++++------
 4 files changed, 26 insertions(+), 26 deletions(-)
 rename GUI/View/FitControl/{MinimizerSettingsWidget.cpp => MinimizerEditor.cpp} (95%)
 rename GUI/View/FitControl/{MinimizerSettingsWidget.h => MinimizerEditor.h} (71%)

diff --git a/GUI/View/Fit/FitSessionWidget.cpp b/GUI/View/Fit/FitSessionWidget.cpp
index 72d9569cc9d..c8dc11a53a9 100644
--- a/GUI/View/Fit/FitSessionWidget.cpp
+++ b/GUI/View/Fit/FitSessionWidget.cpp
@@ -17,7 +17,7 @@
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/View/Fit/FitSessionController.h"
 #include "GUI/View/FitControl/FitEditor.h"
-#include "GUI/View/FitControl/MinimizerSettingsWidget.h"
+#include "GUI/View/FitControl/MinimizerEditor.h"
 #include "GUI/View/Layout/mainwindow_constants.h"
 #include "GUI/View/Tuning/FitParameterWidget.h"
 #include <QSettings>
@@ -28,7 +28,7 @@ FitSessionWidget::FitSessionWidget(QWidget* parent)
     , m_tab_widget(new QTabWidget(this))
     , m_control_widget(new FitEditor)
     , m_fit_parameters_widget(new FitParameterWidget)
-    , m_minimizer_settings_widget(new MinimizerSettingsWidget)
+    , m_minimizer_settings_widget(new MinimizerEditor)
     , m_session_controller(nullptr)
 {
     auto* layout = new QVBoxLayout(this);
diff --git a/GUI/View/Fit/FitSessionWidget.h b/GUI/View/Fit/FitSessionWidget.h
index aef0fcb42f1..56e317f49fb 100644
--- a/GUI/View/Fit/FitSessionWidget.h
+++ b/GUI/View/Fit/FitSessionWidget.h
@@ -21,7 +21,7 @@
 class FitParameterWidget;
 class FitSessionController;
 class JobItem;
-class MinimizerSettingsWidget;
+class MinimizerEditor;
 class ParameterTuningWidget;
 class FitEditor;
 
@@ -47,7 +47,7 @@ private:
     QTabWidget* m_tab_widget;
     FitEditor* m_control_widget;
     FitParameterWidget* m_fit_parameters_widget;
-    MinimizerSettingsWidget* m_minimizer_settings_widget;
+    MinimizerEditor* m_minimizer_settings_widget;
     FitSessionController* m_session_controller;
 };
 
diff --git a/GUI/View/FitControl/MinimizerSettingsWidget.cpp b/GUI/View/FitControl/MinimizerEditor.cpp
similarity index 95%
rename from GUI/View/FitControl/MinimizerSettingsWidget.cpp
rename to GUI/View/FitControl/MinimizerEditor.cpp
index fa11a4e6a2c..b8c738d840d 100644
--- a/GUI/View/FitControl/MinimizerSettingsWidget.cpp
+++ b/GUI/View/FitControl/MinimizerEditor.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/FitControl/MinimizerSettingsWidget.cpp
-//! @brief     Implements class MinimizerSettingsWidget.
+//! @file      GUI/View/FitControl/MinimizerEditor.cpp
+//! @brief     Implements class MinimizerEditor.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/FitControl/MinimizerSettingsWidget.h"
+#include "GUI/View/FitControl/MinimizerEditor.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Job/FitSuiteItem.h"
 #include "GUI/Model/Job/JobItem.h"
@@ -23,7 +23,7 @@
 #include <QSpinBox>
 #include <QStandardItemModel>
 
-MinimizerSettingsWidget::MinimizerSettingsWidget(QWidget* parent)
+MinimizerEditor::MinimizerEditor(QWidget* parent)
     : QWidget(parent)
     , m_container_item(nullptr)
     , m_main_layout(new QFormLayout(this))
@@ -34,13 +34,13 @@ MinimizerSettingsWidget::MinimizerSettingsWidget(QWidget* parent)
     m_main_layout->setSpacing(5);
 }
 
-void MinimizerSettingsWidget::setJobItem(JobItem* jobItem)
+void MinimizerEditor::setJobItem(JobItem* jobItem)
 {
     ASSERT(jobItem);
     setMinContainerItem(jobItem->fitSuiteItem()->minimizerContainerItem());
 }
 
-void MinimizerSettingsWidget::setMinContainerItem(MinimizerContainerItem* containerItem)
+void MinimizerEditor::setMinContainerItem(MinimizerContainerItem* containerItem)
 {
     ASSERT(containerItem);
 
@@ -82,7 +82,7 @@ void MinimizerSettingsWidget::setMinContainerItem(MinimizerContainerItem* contai
     updateUIValues();
 }
 
-void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
+void MinimizerEditor::createGroupedAlgorithmsCombo()
 {
     auto* comboBox = new QComboBox;
     QStringList list = m_container_item->commonAlgorithmCombo().values();
@@ -154,7 +154,7 @@ void MinimizerSettingsWidget::createGroupedAlgorithmsCombo()
     m_main_layout->addRow("Algorithm:", comboBox);
 }
 
-void MinimizerSettingsWidget::createMimimizerEdits()
+void MinimizerEditor::createMimimizerEdits()
 {
     GUI::Util::Layout::clearLayout(m_minimizer_layout);
 
@@ -179,7 +179,7 @@ void MinimizerSettingsWidget::createMimimizerEdits()
         createGSLLevMarEdits();
 }
 
-void MinimizerSettingsWidget::createMinuitEdits()
+void MinimizerEditor::createMinuitEdits()
 {
     MinuitMinimizerItem* minItem = m_container_item->minimizerItemMinuit();
 
@@ -236,7 +236,7 @@ void MinimizerSettingsWidget::createMinuitEdits()
                                                            &m_updaters, true /*easy scroll*/));
 }
 
-void MinimizerSettingsWidget::createGSLMultiMinEdits()
+void MinimizerEditor::createGSLMultiMinEdits()
 {
     GSLMultiMinimizerItem* minItem = m_container_item->minimizerItemGSLMulti();
 
@@ -251,7 +251,7 @@ void MinimizerSettingsWidget::createGSLMultiMinEdits()
                                                            &m_updaters, true /*easy scroll*/));
 }
 
-void MinimizerSettingsWidget::createTMVAGeneticEdits()
+void MinimizerEditor::createTMVAGeneticEdits()
 {
     GeneticMinimizerItem* minItem = m_container_item->minimizerItemGenetic();
 
@@ -296,7 +296,7 @@ void MinimizerSettingsWidget::createTMVAGeneticEdits()
                                     true /*easy scroll*/));
 }
 
-void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits()
+void MinimizerEditor::createGSLSimulatedAnnealingEdits()
 {
     SimAnMinimizerItem* minItem = m_container_item->minimizerItemSimAn();
 
@@ -365,7 +365,7 @@ void MinimizerSettingsWidget::createGSLSimulatedAnnealingEdits()
                                                  RealLimits::nonnegative()));
 }
 
-void MinimizerSettingsWidget::createGSLLevMarEdits()
+void MinimizerEditor::createGSLLevMarEdits()
 {
     GSLLMAMinimizerItem* minItem = m_container_item->minimizerItemGSLLMA();
 
@@ -390,7 +390,7 @@ void MinimizerSettingsWidget::createGSLLevMarEdits()
                                                            &m_updaters, true /*easy scroll*/));
 }
 
-void MinimizerSettingsWidget::updateUIValues()
+void MinimizerEditor::updateUIValues()
 {
     for (const auto& updater : m_updaters)
         updater();
diff --git a/GUI/View/FitControl/MinimizerSettingsWidget.h b/GUI/View/FitControl/MinimizerEditor.h
similarity index 71%
rename from GUI/View/FitControl/MinimizerSettingsWidget.h
rename to GUI/View/FitControl/MinimizerEditor.h
index b69e78c8fb0..b9f528ea00a 100644
--- a/GUI/View/FitControl/MinimizerSettingsWidget.h
+++ b/GUI/View/FitControl/MinimizerEditor.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/FitControl/MinimizerSettingsWidget.h
-//! @brief     Defines class MinimizerSettingsWidget.
+//! @file      GUI/View/FitControl/MinimizerEditor.h
+//! @brief     Defines class MinimizerEditor.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_FITCONTROL_MINIMIZERSETTINGSWIDGET_H
-#define BORNAGAIN_GUI_VIEW_FITCONTROL_MINIMIZERSETTINGSWIDGET_H
+#ifndef BORNAGAIN_GUI_VIEW_FITCONTROL_MINIMIZEREDITOR_H
+#define BORNAGAIN_GUI_VIEW_FITCONTROL_MINIMIZEREDITOR_H
 
 #include "GUI/Model/Mini/MinimizerItems.h"
 #include <QFormLayout>
@@ -21,13 +21,13 @@
 
 class JobItem;
 
-//! The MinimizerSettingsWidget contains editor for all minimizer settings and related fit
+//! The MinimizerEditor contains editor for all minimizer settings and related fit
 //! options. Part of FitSuiteWidget.
 
-class MinimizerSettingsWidget : public QWidget {
+class MinimizerEditor : public QWidget {
     Q_OBJECT
 public:
-    MinimizerSettingsWidget(QWidget* parent = nullptr);
+    MinimizerEditor(QWidget* parent = nullptr);
 
 public slots:
     void setJobItem(JobItem* jobItem);
@@ -51,4 +51,4 @@ private:
     QList<std::function<void()>> m_updaters;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_FITCONTROL_MINIMIZERSETTINGSWIDGET_H
+#endif // BORNAGAIN_GUI_VIEW_FITCONTROL_MINIMIZEREDITOR_H
-- 
GitLab


From 0276358389ac5c668015c484a1138eec80c4a523 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:40:46 +0100
Subject: [PATCH 20/31] rename class and sources GUI/Model/Sample/SampleModel
 -> GUI/Model/Sample/SamplesSet

---
 GUI/Model/Project/ProjectDocument.cpp         |  8 +++----
 GUI/Model/Project/ProjectDocument.h           |  6 ++---
 .../{SampleModel.cpp => SamplesSet.cpp}       | 24 +++++++++----------
 .../Sample/{SampleModel.h => SamplesSet.h}    | 14 +++++------
 GUI/View/Sample/SampleListModel.cpp           |  2 +-
 GUI/View/Sample/SampleListModel.h             |  4 ++--
 6 files changed, 29 insertions(+), 29 deletions(-)
 rename GUI/Model/Sample/{SampleModel.cpp => SamplesSet.cpp} (80%)
 rename GUI/Model/Sample/{SampleModel.h => SamplesSet.h} (81%)

diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp
index 47a1d8e05a1..6320400356f 100644
--- a/GUI/Model/Project/ProjectDocument.cpp
+++ b/GUI/Model/Project/ProjectDocument.cpp
@@ -40,7 +40,7 @@ const QString BornAgain("BornAgain");
 const QString DocumentInfo("DocumentInfo");
 const QString SimulationOptions("SimulationOptions");
 const QString InstrumentsSet("InstrumentsSet");
-const QString SampleModel("SampleModel");
+const QString SamplesSet("SamplesSet");
 const QString JobsSet("JobsSet");
 const QString RealModel("RealModel");
 const QString ActiveView("ActiveView");
@@ -106,7 +106,7 @@ InstrumentsSet* ProjectDocument::instrumentModel()
     return &m_instrument_model;
 }
 
-SampleModel* ProjectDocument::sampleModel()
+SamplesSet* ProjectDocument::sampleModel()
 {
     return &m_sample_model;
 }
@@ -243,7 +243,7 @@ void ProjectDocument::writeProject(QIODevice* device)
     w.writeEndElement();
 
     // samples
-    w.writeStartElement(Tag::SampleModel);
+    w.writeStartElement(Tag::SamplesSet);
     m_sample_model.writeTo(&w);
     w.writeEndElement();
 
@@ -305,7 +305,7 @@ ProjectDocument::ReadResult ProjectDocument::readProject(QIODevice* device,
                             XML::gotoEndElementOfTag(&r, tag);
 
                             // samples
-                        } else if (tag == Tag::SampleModel) {
+                        } else if (tag == Tag::SamplesSet) {
                             m_sample_model.readFrom(&r);
                             XML::gotoEndElementOfTag(&r, tag);
 
diff --git a/GUI/Model/Project/ProjectDocument.h b/GUI/Model/Project/ProjectDocument.h
index 2a44cf1868e..e0d38e2a342 100644
--- a/GUI/Model/Project/ProjectDocument.h
+++ b/GUI/Model/Project/ProjectDocument.h
@@ -18,7 +18,7 @@
 #include "GUI/Model/Device/MultiInstrumentNotifier.h"
 #include "GUI/Model/Files/DatafilesSet.h"
 #include "GUI/Model/Project/LinkInstrumentManager.h"
-#include "GUI/Model/Sample/SampleModel.h"
+#include "GUI/Model/Sample/SamplesSet.h"
 #include "GUI/Model/Tune/JobsSet.h"
 #include "GUI/Support/Data/SimulationOptionsItem.h"
 
@@ -56,7 +56,7 @@ public:
     void setProjectFullPath(const QString& fullPath);
 
     InstrumentsSet* instrumentModel();
-    SampleModel* sampleModel();
+    SamplesSet* sampleModel();
     DatafilesSet* realModel();
     JobsSet* jobModel();
     SimulationOptionsItem* simulationOptionsItem();
@@ -104,7 +104,7 @@ private:
     SimulationOptionsItem m_simulation_options_item;
     MultiInstrumentNotifier m_instrument_edit_controller;
     InstrumentsSet m_instrument_model;
-    SampleModel m_sample_model;
+    SamplesSet m_sample_model;
     DatafilesSet m_real_model;
     JobsSet m_job_model;
     int m_last_view_active;
diff --git a/GUI/Model/Sample/SampleModel.cpp b/GUI/Model/Sample/SamplesSet.cpp
similarity index 80%
rename from GUI/Model/Sample/SampleModel.cpp
rename to GUI/Model/Sample/SamplesSet.cpp
index a6ace944a37..bc9a17930c6 100644
--- a/GUI/Model/Sample/SampleModel.cpp
+++ b/GUI/Model/Sample/SamplesSet.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Sample/SampleModel.cpp
-//! @brief     Implements class SampleModel.
+//! @file      GUI/Model/Sample/SamplesSet.cpp
+//! @brief     Implements class SamplesSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Sample/SampleModel.h"
+#include "GUI/Model/Sample/SamplesSet.h"
 #include "GUI/Model/Sample/ItemWithMaterial.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/XML/Backup.h"
@@ -28,37 +28,37 @@ const QString SelectedIndex("SelectedIndex");
 } // namespace Tag
 } // namespace
 
-SampleModel::~SampleModel() = default;
+SamplesSet::~SamplesSet() = default;
 
-QVector<SampleItem*> SampleModel::sampleItems() const
+QVector<SampleItem*> SamplesSet::sampleItems() const
 {
     return QVector<SampleItem*>(m_samples.begin(), m_samples.end());
 }
 
-SampleItem* SampleModel::addSampleItem()
+SampleItem* SamplesSet::addSampleItem()
 {
     addSampleItem(new SampleItem());
     return m_samples.back();
 }
 
-void SampleModel::addSampleItem(SampleItem* sample)
+void SamplesSet::addSampleItem(SampleItem* sample)
 {
     m_samples.emplace_back(sample);
 }
 
-SampleItem* SampleModel::copySample(SampleItem* source)
+SampleItem* SamplesSet::copySample(SampleItem* source)
 {
     auto* copy = addSampleItem();
     GUI::Util::copyContents(source, copy);
     return copy;
 }
 
-void SampleModel::removeSample(SampleItem* sample)
+void SamplesSet::removeSample(SampleItem* sample)
 {
     m_samples.delete_element(sample);
 }
 
-QStringList SampleModel::sampleNames() const
+QStringList SamplesSet::sampleNames() const
 {
     QStringList existingNames;
     for (const auto* item : m_samples)
@@ -66,7 +66,7 @@ QStringList SampleModel::sampleNames() const
     return existingNames;
 }
 
-void SampleModel::writeTo(QXmlStreamWriter* w) const
+void SamplesSet::writeTo(QXmlStreamWriter* w) const
 {
     XML::writeAttribute(w, XML::Attrib::version, uint(1));
 
@@ -83,7 +83,7 @@ void SampleModel::writeTo(QXmlStreamWriter* w) const
     w->writeEndElement();
 }
 
-void SampleModel::readFrom(QXmlStreamReader* r)
+void SamplesSet::readFrom(QXmlStreamReader* r)
 {
     m_samples.clear();
 
diff --git a/GUI/Model/Sample/SampleModel.h b/GUI/Model/Sample/SamplesSet.h
similarity index 81%
rename from GUI/Model/Sample/SampleModel.h
rename to GUI/Model/Sample/SamplesSet.h
index 13eacbf7fc4..e1b7fdc42ac 100644
--- a/GUI/Model/Sample/SampleModel.h
+++ b/GUI/Model/Sample/SamplesSet.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Sample/SampleModel.h
-//! @brief     Defines class SampleModel.
+//! @file      GUI/Model/Sample/SamplesSet.h
+//! @brief     Defines class SamplesSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLEMODEL_H
-#define BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLEMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLESSET_H
+#define BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLESSET_H
 
 #include "Base/Types/OwningVector.h"
 #include <QVector>
@@ -23,9 +23,9 @@ class SampleItem;
 
 //! Main model to hold sample items.
 
-class SampleModel {
+class SamplesSet {
 public:
-    ~SampleModel();
+    ~SamplesSet();
     QVector<SampleItem*> sampleItems() const;
 
     SampleItem* addSampleItem();
@@ -47,4 +47,4 @@ private:
     int m_selected_index = 0;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLEMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_SAMPLE_SAMPLESSET_H
diff --git a/GUI/View/Sample/SampleListModel.cpp b/GUI/View/Sample/SampleListModel.cpp
index 2835cb797ae..00da1b5cc73 100644
--- a/GUI/View/Sample/SampleListModel.cpp
+++ b/GUI/View/Sample/SampleListModel.cpp
@@ -18,7 +18,7 @@
 #include "GUI/Model/FromCore/ItemizeSample.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Model/Sample/SampleItem.h"
-#include "GUI/Model/Sample/SampleModel.h"
+#include "GUI/Model/Sample/SamplesSet.h"
 #include "GUI/Support/Util/String.h"
 #include "GUI/View/Manager/PyImportAssistant.h"
 #include "Sample/Multilayer/MultiLayer.h"
diff --git a/GUI/View/Sample/SampleListModel.h b/GUI/View/Sample/SampleListModel.h
index e7869ff89cb..a8468b4f382 100644
--- a/GUI/View/Sample/SampleListModel.h
+++ b/GUI/View/Sample/SampleListModel.h
@@ -18,7 +18,7 @@
 #include <QAbstractItemModel>
 
 class SampleItem;
-class SampleModel;
+class SamplesSet;
 
 //! List model for sample selection (used in the left pane of the layer oriented sample editor)
 class SampleListModel : public QAbstractListModel {
@@ -57,7 +57,7 @@ public:
 #endif
 
 private:
-    SampleModel* m_sample_items = nullptr;
+    SamplesSet* m_sample_items = nullptr;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLELISTMODEL_H
-- 
GitLab


From 1a1a2cf7614ebf369718bb4df7747ea3a5f0c2f0 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:42:01 +0100
Subject: [PATCH 21/31] rename class and sources GUI/Model/Files/DatafilesTree
 -> GUI/Model/Files/DatafilesQModel

---
 ...{DatafilesTree.cpp => DatafilesQModel.cpp} | 38 +++++++++----------
 .../{DatafilesTree.h => DatafilesQModel.h}    | 14 +++----
 GUI/View/Data/DatafilesSelector.cpp           |  4 +-
 GUI/View/Data/DatafilesSelector.h             |  4 +-
 4 files changed, 30 insertions(+), 30 deletions(-)
 rename GUI/Model/Files/{DatafilesTree.cpp => DatafilesQModel.cpp} (80%)
 rename GUI/Model/Files/{DatafilesTree.h => DatafilesQModel.h} (83%)

diff --git a/GUI/Model/Files/DatafilesTree.cpp b/GUI/Model/Files/DatafilesQModel.cpp
similarity index 80%
rename from GUI/Model/Files/DatafilesTree.cpp
rename to GUI/Model/Files/DatafilesQModel.cpp
index 60138835db8..3216a72c4a8 100644
--- a/GUI/Model/Files/DatafilesTree.cpp
+++ b/GUI/Model/Files/DatafilesQModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Files/DatafilesTree.cpp
-//! @brief     Implements class DatafilesTree.
+//! @file      GUI/Model/Files/DatafilesQModel.cpp
+//! @brief     Implements class DatafilesQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Files/DatafilesTree.h"
+#include "GUI/Model/Files/DatafilesQModel.h"
 #include "Device/Data/Datafield.h"
 #include "GUI/Model/Device/DatafileItem.h"
 #include "GUI/Model/Files/DatafilesSet.h"
@@ -20,7 +20,7 @@
 #include <QFontMetrics>
 #include <QPalette>
 
-DatafilesTree::DatafilesTree(QObject* parent, DatafilesSet* model)
+DatafilesQModel::DatafilesQModel(QObject* parent, DatafilesSet* model)
     : QAbstractItemModel(parent)
     , m_model(model)
 {
@@ -28,7 +28,7 @@ DatafilesTree::DatafilesTree(QObject* parent, DatafilesSet* model)
         m_items[rank - 1] = model->realItems(rank);
 }
 
-void DatafilesTree::refreshAfterModelChange()
+void DatafilesQModel::refreshAfterModelChange()
 {
     for (int rank : {1, 2}) {
         if (!m_items[rank - 1].isEmpty()) {
@@ -39,7 +39,7 @@ void DatafilesTree::refreshAfterModelChange()
     }
 }
 
-void DatafilesTree::removeDataItem(DatafileItem* item)
+void DatafilesQModel::removeDataItem(DatafileItem* item)
 {
     QModelIndex index = indexForItem(item);
     if (!index.isValid())
@@ -53,7 +53,7 @@ void DatafilesTree::removeDataItem(DatafileItem* item)
     endRemoveRows();
 }
 
-DatafileItem* DatafilesTree::injectDataItem(const QString& fname, const Datafield& df)
+DatafileItem* DatafilesQModel::injectDataItem(const QString& fname, const Datafield& df)
 {
     const int rank = df.rank();
     DatafileItem* newItem = m_model->insertDataItem(fname, df);
@@ -64,7 +64,7 @@ DatafileItem* DatafilesTree::injectDataItem(const QString& fname, const Datafiel
     return newItem;
 }
 
-DatafileItem* DatafilesTree::topMostItem() const
+DatafileItem* DatafilesQModel::topMostItem() const
 {
     if (!m_items[0].isEmpty())
         return m_items[0].first();
@@ -73,12 +73,12 @@ DatafileItem* DatafilesTree::topMostItem() const
     return nullptr;
 }
 
-QModelIndex DatafilesTree::indexOfHeadline(int rank) const
+QModelIndex DatafilesQModel::indexOfHeadline(int rank) const
 {
     return createIndex(rank - 1, 0, nullptr);
 }
 
-QModelIndex DatafilesTree::index(int row, int column, const QModelIndex& parent) const
+QModelIndex DatafilesQModel::index(int row, int column, const QModelIndex& parent) const
 {
     if (!hasIndex(row, column, parent))
         return {};
@@ -93,7 +93,7 @@ QModelIndex DatafilesTree::index(int row, int column, const QModelIndex& parent)
     return {};
 }
 
-QModelIndex DatafilesTree::parent(const QModelIndex& index) const
+QModelIndex DatafilesQModel::parent(const QModelIndex& index) const
 {
     if (!index.isValid())
         return {};
@@ -104,12 +104,12 @@ QModelIndex DatafilesTree::parent(const QModelIndex& index) const
     return indexOfHeadline(itemForIndex(index)->rank());
 }
 
-int DatafilesTree::columnCount(const QModelIndex& /*parent*/) const
+int DatafilesQModel::columnCount(const QModelIndex& /*parent*/) const
 {
     return 1;
 }
 
-int DatafilesTree::rowCount(const QModelIndex& parent) const
+int DatafilesQModel::rowCount(const QModelIndex& parent) const
 {
     if (!parent.isValid())
         return 2;
@@ -122,7 +122,7 @@ int DatafilesTree::rowCount(const QModelIndex& parent) const
     return 0;
 }
 
-QVariant DatafilesTree::data(const QModelIndex& index, int role) const
+QVariant DatafilesQModel::data(const QModelIndex& index, int role) const
 {
     if (isHeadline(index)) {
         QString title = (index == indexOfHeadline(1)) ? "1D Data" : "2D Data";
@@ -174,7 +174,7 @@ QVariant DatafilesTree::data(const QModelIndex& index, int role) const
     return {};
 }
 
-Qt::ItemFlags DatafilesTree::flags(const QModelIndex& index) const
+Qt::ItemFlags DatafilesQModel::flags(const QModelIndex& index) const
 {
     if (isHeadline(index) || !index.isValid())
         return Qt::NoItemFlags;
@@ -188,7 +188,7 @@ Qt::ItemFlags DatafilesTree::flags(const QModelIndex& index) const
     return f;
 }
 
-bool DatafilesTree::setData(const QModelIndex& index, const QVariant& value, int role)
+bool DatafilesQModel::setData(const QModelIndex& index, const QVariant& value, int role)
 {
     if (!index.isValid())
         return false;
@@ -202,7 +202,7 @@ bool DatafilesTree::setData(const QModelIndex& index, const QVariant& value, int
     return false;
 }
 
-DatafileItem* DatafilesTree::itemForIndex(const QModelIndex& index) const
+DatafileItem* DatafilesQModel::itemForIndex(const QModelIndex& index) const
 {
     if (!index.isValid())
         return nullptr;
@@ -210,7 +210,7 @@ DatafileItem* DatafilesTree::itemForIndex(const QModelIndex& index) const
     return reinterpret_cast<DatafileItem*>(index.internalPointer());
 }
 
-QModelIndex DatafilesTree::indexForItem(DatafileItem* item) const
+QModelIndex DatafilesQModel::indexForItem(DatafileItem* item) const
 {
     if (item == nullptr)
         return {};
@@ -222,7 +222,7 @@ QModelIndex DatafilesTree::indexForItem(DatafileItem* item) const
     return {};
 }
 
-bool DatafilesTree::isHeadline(const QModelIndex& index) const
+bool DatafilesQModel::isHeadline(const QModelIndex& index) const
 {
     if (!index.isValid())
         return false;
diff --git a/GUI/Model/Files/DatafilesTree.h b/GUI/Model/Files/DatafilesQModel.h
similarity index 83%
rename from GUI/Model/Files/DatafilesTree.h
rename to GUI/Model/Files/DatafilesQModel.h
index d34816d9338..aac2967cd35 100644
--- a/GUI/Model/Files/DatafilesTree.h
+++ b/GUI/Model/Files/DatafilesQModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Files/DatafilesTree.h
-//! @brief     Defines class DatafilesTree.
+//! @file      GUI/Model/Files/DatafilesQModel.h
+//! @brief     Defines class DatafilesQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_FILES_DATAFILESTREE_H
-#define BORNAGAIN_GUI_MODEL_FILES_DATAFILESTREE_H
+#ifndef BORNAGAIN_GUI_MODEL_FILES_DATAFILESQMODEL_H
+#define BORNAGAIN_GUI_MODEL_FILES_DATAFILESQMODEL_H
 
 #include <QAbstractItemModel>
 
@@ -23,10 +23,10 @@ class DatafilesSet;
 
 //! Tree representation of DatafilesSet, for use in DatafilesSelector.
 
-class DatafilesTree : public QAbstractItemModel {
+class DatafilesQModel : public QAbstractItemModel {
     Q_OBJECT
 public:
-    explicit DatafilesTree(QObject* parent, DatafilesSet* model);
+    explicit DatafilesQModel(QObject* parent, DatafilesSet* model);
 
     QModelIndex index(int row, int column,
                       const QModelIndex& parent = QModelIndex()) const override;
@@ -56,4 +56,4 @@ private:
     QVector<DatafileItem*> m_items[2]; //< Items borrowed from model. Never delete the ptrs!
 };
 
-#endif // BORNAGAIN_GUI_MODEL_FILES_DATAFILESTREE_H
+#endif // BORNAGAIN_GUI_MODEL_FILES_DATAFILESQMODEL_H
diff --git a/GUI/View/Data/DatafilesSelector.cpp b/GUI/View/Data/DatafilesSelector.cpp
index 4a4969853f6..cde462b4ea0 100644
--- a/GUI/View/Data/DatafilesSelector.cpp
+++ b/GUI/View/Data/DatafilesSelector.cpp
@@ -18,7 +18,7 @@
 #include "Device/IO/IOFactory.h"
 #include "GUI/Model/Data/DataItem.h"
 #include "GUI/Model/Device/DatafileItem.h"
-#include "GUI/Model/Files/DatafilesTree.h"
+#include "GUI/Model/Files/DatafilesQModel.h"
 #include "GUI/View/Data/DatafileEditor.h"
 #include "GUI/View/Data/StackedFrames.h"
 #include "GUI/View/Info/MessageBox.h"
@@ -65,7 +65,7 @@ DatafilesSelector::DatafilesSelector(StackedDataFrames* data_frames)
     , m_rename_data_action(new QAction(this))
     , m_remove_data_action(new QAction(this))
     , m_tree_view(new QTreeView(this))
-    , m_tree_model(new DatafilesTree(this, gDoc->realModel()))
+    , m_tree_model(new DatafilesQModel(this, gDoc->realModel()))
     , m_editor(new DatafileEditor)
     , m_data_frames(data_frames)
 {
diff --git a/GUI/View/Data/DatafilesSelector.h b/GUI/View/Data/DatafilesSelector.h
index 7608f28282a..347ae9c1648 100644
--- a/GUI/View/Data/DatafilesSelector.h
+++ b/GUI/View/Data/DatafilesSelector.h
@@ -21,7 +21,7 @@
 
 class DatafileEditor;
 class DatafileItem;
-class DatafilesTree;
+class DatafilesQModel;
 class StackedDataFrames;
 
 //! For viewing and selecting loaded datafiles.
@@ -64,7 +64,7 @@ private:
     QList<QAction*> getOverlayActions(const QModelIndex& index, bool asHover);
 
     QTreeView* m_tree_view;
-    DatafilesTree* m_tree_model;
+    DatafilesQModel* m_tree_model;
     DatafileEditor* m_editor;
     StackedDataFrames* m_data_frames;
 };
-- 
GitLab


From 75eedb113da9cc4577e3d3219cb484939158c3e1 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:42:21 +0100
Subject: [PATCH 22/31] rename class and sources
 GUI/Model/Tune/FitParameterModel -> GUI/Model/Tune/FitparQModel

---
 ...FitParameterModel.cpp => FitparQModel.cpp} | 53 +++++++++----------
 .../{FitParameterModel.h => FitparQModel.h}   | 18 +++----
 GUI/View/Tuning/FitParameterWidget.cpp        | 18 +++----
 GUI/View/Tuning/FitParameterWidget.h          |  6 +--
 Tests/Unit/GUI/TestFitParameterModel.cpp      | 42 +++++++--------
 5 files changed, 68 insertions(+), 69 deletions(-)
 rename GUI/Model/Tune/{FitParameterModel.cpp => FitparQModel.cpp} (86%)
 rename GUI/Model/Tune/{FitParameterModel.h => FitparQModel.h} (82%)

diff --git a/GUI/Model/Tune/FitParameterModel.cpp b/GUI/Model/Tune/FitparQModel.cpp
similarity index 86%
rename from GUI/Model/Tune/FitParameterModel.cpp
rename to GUI/Model/Tune/FitparQModel.cpp
index 38b95f8c8a0..bf7e54b85ea 100644
--- a/GUI/Model/Tune/FitParameterModel.cpp
+++ b/GUI/Model/Tune/FitparQModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Tune/FitParameterModel.cpp
-//! @brief     Implements class FitParameterModel.
+//! @file      GUI/Model/Tune/FitparQModel.cpp
+//! @brief     Implements class FitparQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Tune/FitParameterModel.h"
+#include "GUI/Model/Tune/FitparQModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Job/FitParameterContainerItem.h"
 #include "GUI/Model/Job/JobItem.h"
@@ -20,7 +20,7 @@
 #include <QColor>
 #include <QMimeData>
 
-FitParameterModel::FitParameterModel(FitParameterContainerItem* fitParContainer, JobItem* jobItem)
+FitparQModel::FitparQModel(FitParameterContainerItem* fitParContainer, JobItem* jobItem)
     : m_fit_parameter_container(fitParContainer)
     , m_job_item(jobItem)
 {
@@ -35,7 +35,7 @@ FitParameterModel::FitParameterModel(FitParameterContainerItem* fitParContainer,
     connect(jobItem, &QObject::destroyed, [this] { m_job_item = nullptr; });
 }
 
-Qt::ItemFlags FitParameterModel::flags(const QModelIndex& index) const
+Qt::ItemFlags FitparQModel::flags(const QModelIndex& index) const
 {
     if (!m_fit_parameter_container)
         return Qt::NoItemFlags;
@@ -70,7 +70,7 @@ Qt::ItemFlags FitParameterModel::flags(const QModelIndex& index) const
     return result;
 }
 
-QModelIndex FitParameterModel::index(int row, int column, const QModelIndex& parent) const
+QModelIndex FitparQModel::index(int row, int column, const QModelIndex& parent) const
 {
     if (!m_fit_parameter_container || row < 0 || column < 0 || column >= columnCount(QModelIndex())
         || (parent.isValid() && parent.column() != COL_NAME))
@@ -115,7 +115,7 @@ QModelIndex FitParameterModel::index(int row, int column, const QModelIndex& par
     return {};
 }
 
-QModelIndex FitParameterModel::parent(const QModelIndex& child) const
+QModelIndex FitparQModel::parent(const QModelIndex& child) const
 {
     if (!m_fit_parameter_container)
         return {};
@@ -136,7 +136,7 @@ QModelIndex FitParameterModel::parent(const QModelIndex& child) const
     return {};
 }
 
-int FitParameterModel::rowCount(const QModelIndex& parent) const
+int FitparQModel::rowCount(const QModelIndex& parent) const
 {
     if (!m_fit_parameter_container)
         return 0;
@@ -154,7 +154,7 @@ int FitParameterModel::rowCount(const QModelIndex& parent) const
     return 0;
 }
 
-int FitParameterModel::columnCount(const QModelIndex& parent) const
+int FitparQModel::columnCount(const QModelIndex& parent) const
 {
     if (!m_fit_parameter_container)
         return 0;
@@ -172,7 +172,7 @@ int FitParameterModel::columnCount(const QModelIndex& parent) const
     return 0;
 }
 
-QVariant FitParameterModel::data(const QModelIndex& index, int role) const
+QVariant FitparQModel::data(const QModelIndex& index, int role) const
 {
     if (!m_fit_parameter_container)
         return {};
@@ -200,7 +200,7 @@ QVariant FitParameterModel::data(const QModelIndex& index, int role) const
     return {};
 }
 
-bool FitParameterModel::setData(const QModelIndex& index, const QVariant& value, int role)
+bool FitparQModel::setData(const QModelIndex& index, const QVariant& value, int role)
 {
     if (!m_fit_parameter_container)
         return false;
@@ -227,14 +227,14 @@ bool FitParameterModel::setData(const QModelIndex& index, const QVariant& value,
     return false;
 }
 
-QStringList FitParameterModel::mimeTypes() const
+QStringList FitparQModel::mimeTypes() const
 {
     QStringList types;
     types << XML::LinkMimeType;
     return types;
 }
 
-QMimeData* FitParameterModel::mimeData(const QModelIndexList& indexes) const
+QMimeData* FitparQModel::mimeData(const QModelIndexList& indexes) const
 {
     auto* mimeData = new QMimeData();
     QModelIndex index = indexes.first();
@@ -253,8 +253,8 @@ QMimeData* FitParameterModel::mimeData(const QModelIndexList& indexes) const
     return mimeData;
 }
 
-bool FitParameterModel::canDropMimeData(const QMimeData* data, Qt::DropAction action, int row,
-                                        int column, const QModelIndex& parent) const
+bool FitparQModel::canDropMimeData(const QMimeData* data, Qt::DropAction action, int row,
+                                   int column, const QModelIndex& parent) const
 {
     Q_UNUSED(data);
     Q_UNUSED(action);
@@ -267,8 +267,8 @@ bool FitParameterModel::canDropMimeData(const QMimeData* data, Qt::DropAction ac
     return drop_is_possible;
 }
 
-bool FitParameterModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row,
-                                     int column, const QModelIndex& parent)
+bool FitparQModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column,
+                                const QModelIndex& parent)
 {
     Q_UNUSED(action);
     Q_UNUSED(row);
@@ -292,7 +292,7 @@ bool FitParameterModel::dropMimeData(const QMimeData* data, Qt::DropAction actio
     return true;
 }
 
-QVariant FitParameterModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant FitparQModel::headerData(int section, Qt::Orientation orientation, int role) const
 {
     if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
         return m_column_names.value(section);
@@ -301,7 +301,7 @@ QVariant FitParameterModel::headerData(int section, Qt::Orientation orientation,
     return {};
 }
 
-void FitParameterModel::onFitItemChanged()
+void FitparQModel::onFitItemChanged()
 {
     if (!m_fit_parameter_container)
         return;
@@ -309,23 +309,22 @@ void FitParameterModel::onFitItemChanged()
     endResetModel();
 }
 
-void FitParameterModel::connectContainer() const
+void FitparQModel::connectContainer() const
 {
     if (!m_fit_parameter_container)
         return;
 
     connect(m_fit_parameter_container, &FitParameterContainerItem::fitItemChanged, this,
-            &FitParameterModel::onFitItemChanged, Qt::UniqueConnection);
+            &FitparQModel::onFitItemChanged, Qt::UniqueConnection);
 }
 
-void FitParameterModel::addColumn(FitParameterModel::EColumn id, const QString& name,
-                                  const QString& tooltip)
+void FitparQModel::addColumn(FitparQModel::EColumn id, const QString& name, const QString& tooltip)
 {
     m_column_names[id] = name;
     m_column_tool_tips[id] = tooltip;
 }
 
-QModelIndex FitParameterModel::indexOfItem(QObject* item) const
+QModelIndex FitparQModel::indexOfItem(QObject* item) const
 {
     if (!m_fit_parameter_container)
         return {};
@@ -361,7 +360,7 @@ QModelIndex FitParameterModel::indexOfItem(QObject* item) const
     return {};
 }
 
-QObject* FitParameterModel::itemForIndex(const QModelIndex& index) const
+QObject* FitparQModel::itemForIndex(const QModelIndex& index) const
 {
     if (!m_fit_parameter_container)
         return nullptr;
@@ -372,7 +371,7 @@ QObject* FitParameterModel::itemForIndex(const QModelIndex& index) const
     return m_fit_parameter_container;
 }
 
-QVariant FitParameterModel::valueOfItem(QObject* item) const
+QVariant FitparQModel::valueOfItem(QObject* item) const
 {
     if (auto* type = dynamic_cast<FitTypeItem*>(item))
         return type->type().variant();
@@ -384,7 +383,7 @@ QVariant FitParameterModel::valueOfItem(QObject* item) const
     return {};
 }
 
-void FitParameterModel::setValueOfItem(QObject* item, const QVariant& value)
+void FitparQModel::setValueOfItem(QObject* item, const QVariant& value)
 {
     if (auto* type = dynamic_cast<FitTypeItem*>(item))
         type->setType(value.value<ComboProperty>());
diff --git a/GUI/Model/Tune/FitParameterModel.h b/GUI/Model/Tune/FitparQModel.h
similarity index 82%
rename from GUI/Model/Tune/FitParameterModel.h
rename to GUI/Model/Tune/FitparQModel.h
index 6be69800365..a21eb9a0dce 100644
--- a/GUI/Model/Tune/FitParameterModel.h
+++ b/GUI/Model/Tune/FitparQModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Tune/FitParameterModel.h
-//! @brief     Defines class FitParameterModel.
+//! @file      GUI/Model/Tune/FitparQModel.h
+//! @brief     Defines class FitparQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_TUNE_FITPARAMETERMODEL_H
-#define BORNAGAIN_GUI_MODEL_TUNE_FITPARAMETERMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_TUNE_FITPARQMODEL_H
+#define BORNAGAIN_GUI_MODEL_TUNE_FITPARQMODEL_H
 
 #include <QAbstractItemModel>
 #include <QStringList>
@@ -22,10 +22,10 @@ class FitParameterContainerItem;
 class JobItem;
 
 //! Model to show items from FitParameterContainer in 5 column tree view.
-class FitParameterModel : public QAbstractItemModel {
+class FitparQModel : public QAbstractItemModel {
     Q_OBJECT
 public:
-    explicit FitParameterModel(FitParameterContainerItem* fitParContainer, JobItem* jobItem);
+    explicit FitparQModel(FitParameterContainerItem* fitParContainer, JobItem* jobItem);
 
     enum EColumn { COL_NAME, COL_TYPE, COL_VALUE, COL_MIN, COL_MAX, NUM_COLUMNS };
 
@@ -67,14 +67,14 @@ private:
     QMap<int, QString> m_column_tool_tips;
 };
 
-inline Qt::DropActions FitParameterModel::supportedDragActions() const
+inline Qt::DropActions FitparQModel::supportedDragActions() const
 {
     return Qt::MoveAction | Qt::CopyAction;
 }
 
-inline Qt::DropActions FitParameterModel::supportedDropActions() const
+inline Qt::DropActions FitparQModel::supportedDropActions() const
 {
     return Qt::MoveAction | Qt::CopyAction;
 }
 
-#endif // BORNAGAIN_GUI_MODEL_TUNE_FITPARAMETERMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_TUNE_FITPARQMODEL_H
diff --git a/GUI/View/Tuning/FitParameterWidget.cpp b/GUI/View/Tuning/FitParameterWidget.cpp
index cbbf42b8e56..216e3f12439 100644
--- a/GUI/View/Tuning/FitParameterWidget.cpp
+++ b/GUI/View/Tuning/FitParameterWidget.cpp
@@ -20,7 +20,7 @@
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
 #include "GUI/Model/Project/ProjectDocument.h"
-#include "GUI/Model/Tune/FitParameterModel.h"
+#include "GUI/Model/Tune/FitparQModel.h"
 #include "GUI/Support/Data/JobStatus.h"
 #include "GUI/View/Info/OverlayLabelController.h"
 #include "GUI/View/Layout/CustomEventFilters.h"
@@ -224,7 +224,7 @@ void FitParameterWidget::onAddToFitParAction(int ipar)
         fitContainerItem()->addToFitParameter(item, fitParName);
 }
 
-void FitParameterWidget::onFitParameterModelChange()
+void FitParameterWidget::onFitparQModelChange()
 {
     spanParameters();
     updateInfoLabel();
@@ -248,24 +248,24 @@ void FitParameterWidget::init_actions()
             &FitParameterWidget::onRemoveFitParAction);
 }
 
-//! Initializes FitParameterModel and its tree.
+//! Initializes FitparQModel and its tree.
 
 void FitParameterWidget::init_fit_model()
 {
     m_tree_view->setModel(nullptr);
 
-    m_fit_parameter_model = std::make_unique<FitParameterModel>(fitContainerItem(), m_job_item);
+    m_fit_parameter_model = std::make_unique<FitparQModel>(fitContainerItem(), m_job_item);
     m_tree_view->setModel(m_fit_parameter_model.get());
 
-    connect(m_fit_parameter_model.get(), &FitParameterModel::dataChanged, this,
-            &FitParameterWidget::onFitParameterModelChange, Qt::UniqueConnection);
-    connect(m_fit_parameter_model.get(), &FitParameterModel::modelReset, this,
-            &FitParameterWidget::onFitParameterModelChange, Qt::UniqueConnection);
+    connect(m_fit_parameter_model.get(), &FitparQModel::dataChanged, this,
+            &FitParameterWidget::onFitparQModelChange, Qt::UniqueConnection);
+    connect(m_fit_parameter_model.get(), &FitparQModel::modelReset, this,
+            &FitParameterWidget::onFitparQModelChange, Qt::UniqueConnection);
 
     connect(fitContainerItem(), &FitParameterContainerItem::fitItemChanged, gDoc.get(),
             &ProjectDocument::setModified, Qt::UniqueConnection);
 
-    onFitParameterModelChange();
+    onFitparQModelChange();
     connectFitParametersSelection(true);
 }
 
diff --git a/GUI/View/Tuning/FitParameterWidget.h b/GUI/View/Tuning/FitParameterWidget.h
index 0a50f8068c3..fb4186daf8a 100644
--- a/GUI/View/Tuning/FitParameterWidget.h
+++ b/GUI/View/Tuning/FitParameterWidget.h
@@ -22,7 +22,7 @@
 class DeleteEventFilter;
 class FitParameterContainerItem;
 class FitParameterItem;
-class FitParameterModel;
+class FitparQModel;
 class JobItem;
 class OverlayLabelController;
 class ParameterTuningWidget;
@@ -50,7 +50,7 @@ private slots:
     void onRemoveFromFitParAction();
     void onRemoveFitParAction();
     void onAddToFitParAction(int ipar);
-    void onFitParameterModelChange();
+    void onFitparQModelChange();
 
 private:
     void init_actions();
@@ -75,7 +75,7 @@ private:
     QAction* m_create_fit_par_action;
     QAction* m_remove_from_fit_par_action;
     QAction* m_remove_fit_par_action;
-    std::unique_ptr<FitParameterModel> m_fit_parameter_model;
+    std::unique_ptr<FitparQModel> m_fit_parameter_model;
     DeleteEventFilter* m_keyboard_filter;
     OverlayLabelController* m_info_label;
     JobItem* m_job_item;
diff --git a/Tests/Unit/GUI/TestFitParameterModel.cpp b/Tests/Unit/GUI/TestFitParameterModel.cpp
index 196dc88495c..59bd9ad940a 100644
--- a/Tests/Unit/GUI/TestFitParameterModel.cpp
+++ b/Tests/Unit/GUI/TestFitParameterModel.cpp
@@ -4,15 +4,15 @@
 #include "GUI/Model/Job/FitParameterLinkItem.h"
 #include "GUI/Model/Job/FitSuiteItem.h"
 #include "GUI/Model/Mini/MinimizerItems.h"
-#include "GUI/Model/Tune/FitParameterModel.h"
+#include "GUI/Model/Tune/FitparQModel.h"
 #include "Tests/GTestWrapper/google_test.h"
 
-TEST(TestFitParameterModel, addFitParameter)
+TEST(TestFitparQModel, addFitParameter)
 {
     JobItem* jobItem = nullptr;
     FitSuiteItem fitSuiteItem;
     FitParameterContainerItem* container = fitSuiteItem.fitParameterContainerItem();
-    FitParameterModel proxy(container, jobItem);
+    FitparQModel proxy(container, jobItem);
 
     // adding fit parameter
     auto* fitPar0 = container->createBareFitParameterItem();
@@ -22,7 +22,7 @@ TEST(TestFitParameterModel, addFitParameter)
 
     // checking index of root
     EXPECT_EQ(1, proxy.rowCount(QModelIndex()));
-    EXPECT_EQ(FitParameterModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
+    EXPECT_EQ(FitparQModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
 
     // accessing item at col=0 (original FitParameterItem)
     QModelIndex index = proxy.index(0, 0, QModelIndex());
@@ -36,9 +36,9 @@ TEST(TestFitParameterModel, addFitParameter)
     EXPECT_EQ(index, proxy.indexOfItem(fitPar0));
 
     // accessing item at col=2
-    index = proxy.index(0, FitParameterModel::COL_MIN, QModelIndex());
+    index = proxy.index(0, FitparQModel::COL_MIN, QModelIndex());
     EXPECT_EQ(index.row(), 0);
-    EXPECT_EQ(index.column(), FitParameterModel::COL_MIN);
+    EXPECT_EQ(index.column(), FitparQModel::COL_MIN);
     EXPECT_EQ(proxy.rowCount(index), 0);
     EXPECT_EQ(proxy.columnCount(index), 0);
 
@@ -47,9 +47,9 @@ TEST(TestFitParameterModel, addFitParameter)
     EXPECT_EQ(index, proxy.indexOfItem(fitPar0->minimumItem()));
 
     // accessing item at col=3
-    index = proxy.index(0, FitParameterModel::COL_VALUE, QModelIndex());
+    index = proxy.index(0, FitparQModel::COL_VALUE, QModelIndex());
     EXPECT_EQ(index.row(), 0);
-    EXPECT_EQ(index.column(), FitParameterModel::COL_VALUE);
+    EXPECT_EQ(index.column(), FitparQModel::COL_VALUE);
     EXPECT_EQ(proxy.rowCount(index), 0);
     EXPECT_EQ(proxy.columnCount(index), 0);
 
@@ -58,9 +58,9 @@ TEST(TestFitParameterModel, addFitParameter)
     EXPECT_EQ(index, proxy.indexOfItem(fitPar0->startValueItem()));
 
     // accessing item at col=4
-    index = proxy.index(0, FitParameterModel::COL_MAX, QModelIndex());
+    index = proxy.index(0, FitparQModel::COL_MAX, QModelIndex());
     EXPECT_EQ(index.row(), 0);
-    EXPECT_EQ(index.column(), FitParameterModel::COL_MAX);
+    EXPECT_EQ(index.column(), FitparQModel::COL_MAX);
     EXPECT_EQ(proxy.rowCount(index), 0);
     EXPECT_EQ(proxy.columnCount(index), 0);
 
@@ -78,12 +78,12 @@ TEST(TestFitParameterModel, addFitParameter)
 
     // checking index of root
     EXPECT_EQ(2, proxy.rowCount(QModelIndex()));
-    EXPECT_EQ(FitParameterModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
+    EXPECT_EQ(FitparQModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
 
     // accessing item at col=3 for fitPar0
-    index = proxy.index(0, FitParameterModel::COL_VALUE, QModelIndex());
+    index = proxy.index(0, FitparQModel::COL_VALUE, QModelIndex());
     EXPECT_EQ(index.row(), 0);
-    EXPECT_EQ(index.column(), FitParameterModel::COL_VALUE);
+    EXPECT_EQ(index.column(), FitparQModel::COL_VALUE);
     EXPECT_EQ(proxy.rowCount(index), 0);
     EXPECT_EQ(proxy.columnCount(index), 0);
 
@@ -92,9 +92,9 @@ TEST(TestFitParameterModel, addFitParameter)
     EXPECT_EQ(index, proxy.indexOfItem(fitPar0->startValueItem()));
 
     // accessing item at col=3 for fitPar1
-    index = proxy.index(1, FitParameterModel::COL_VALUE, QModelIndex());
+    index = proxy.index(1, FitparQModel::COL_VALUE, QModelIndex());
     EXPECT_EQ(index.row(), 1);
-    EXPECT_EQ(index.column(), FitParameterModel::COL_VALUE);
+    EXPECT_EQ(index.column(), FitparQModel::COL_VALUE);
     EXPECT_EQ(proxy.rowCount(index), 0);
     EXPECT_EQ(proxy.columnCount(index), 0);
 
@@ -103,12 +103,12 @@ TEST(TestFitParameterModel, addFitParameter)
     EXPECT_EQ(index, proxy.indexOfItem(fitPar1->startValueItem()));
 }
 
-TEST(TestFitParameterModel, addFitParameterAndLink)
+TEST(TestFitparQModel, addFitParameterAndLink)
 {
     JobItem* jobItem = nullptr;
     FitSuiteItem fitSuiteItem;
     FitParameterContainerItem* container = fitSuiteItem.fitParameterContainerItem();
-    FitParameterModel proxy(container, jobItem);
+    FitparQModel proxy(container, jobItem);
 
     // adding fit parameter
     auto* fitPar0 = container->createBareFitParameterItem();
@@ -122,7 +122,7 @@ TEST(TestFitParameterModel, addFitParameterAndLink)
 
     // checking index of root
     EXPECT_EQ(1, proxy.rowCount(QModelIndex()));
-    EXPECT_EQ(FitParameterModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
+    EXPECT_EQ(FitparQModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
 
     // accessing item at col=0 (original FitParameterItem)
     QModelIndex index = proxy.index(0, 0, QModelIndex());
@@ -163,12 +163,12 @@ TEST(TestFitParameterModel, addFitParameterAndLink)
     EXPECT_EQ(proxy.itemForIndex(linkIndex), link1->linkItem());
 }
 
-TEST(TestFitParameterModel, addTwoFitParameterAndLinks)
+TEST(TestFitparQModel, addTwoFitParameterAndLinks)
 {
     JobItem* jobItem = nullptr;
     FitSuiteItem fitSuiteItem;
     FitParameterContainerItem* container = fitSuiteItem.fitParameterContainerItem();
-    FitParameterModel proxy(container, jobItem);
+    FitparQModel proxy(container, jobItem);
 
     // adding fit parameters
     auto* fitPar0 = container->createBareFitParameterItem();
@@ -179,7 +179,7 @@ TEST(TestFitParameterModel, addTwoFitParameterAndLinks)
 
     // checking index of root
     EXPECT_EQ(2, proxy.rowCount(QModelIndex()));
-    EXPECT_EQ(FitParameterModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
+    EXPECT_EQ(FitparQModel::NUM_COLUMNS, proxy.columnCount(QModelIndex()));
 
     // accessing fitPar1
     QModelIndex index1 = proxy.index(1, 0, QModelIndex());
-- 
GitLab


From 4b999de795ae6ce604764069eaa0eddbdddf7221 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:42:53 +0100
Subject: [PATCH 23/31] rename class and sources
 GUI/Model/Tune/ParameterTuningModel -> GUI/Model/Tune/PartunerQModel

---
 ...eterTuningModel.cpp => PartunerQModel.cpp} | 42 +++++++++----------
 ...arameterTuningModel.h => PartunerQModel.h} | 14 +++----
 GUI/View/ParEdit/ParameterTuningDelegate.cpp  |  4 +-
 GUI/View/Tuning/ParameterTuningWidget.cpp     |  8 ++--
 GUI/View/Tuning/ParameterTuningWidget.h       |  4 +-
 5 files changed, 36 insertions(+), 36 deletions(-)
 rename GUI/Model/Tune/{ParameterTuningModel.cpp => PartunerQModel.cpp} (72%)
 rename GUI/Model/Tune/{ParameterTuningModel.h => PartunerQModel.h} (84%)

diff --git a/GUI/Model/Tune/ParameterTuningModel.cpp b/GUI/Model/Tune/PartunerQModel.cpp
similarity index 72%
rename from GUI/Model/Tune/ParameterTuningModel.cpp
rename to GUI/Model/Tune/PartunerQModel.cpp
index bce74da9a83..5e4ded6198a 100644
--- a/GUI/Model/Tune/ParameterTuningModel.cpp
+++ b/GUI/Model/Tune/PartunerQModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Tune/ParameterTuningModel.cpp
-//! @brief     Implements class ParameterTuningModel.
+//! @file      GUI/Model/Tune/PartunerQModel.cpp
+//! @brief     Implements class PartunerQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,26 +12,26 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Tune/ParameterTuningModel.h"
+#include "GUI/Model/Tune/PartunerQModel.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
 #include "GUI/Support/XML/UtilXML.h"
 #include <QFont>
 #include <QMimeData>
 
-ParameterTuningModel::ParameterTuningModel(QObject* rootObject, QObject* parent)
+PartunerQModel::PartunerQModel(QObject* rootObject, QObject* parent)
     : QAbstractItemModel(parent)
     , m_root_object(rootObject)
 {
 }
 
-QVariant ParameterTuningModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant PartunerQModel::headerData(int section, Qt::Orientation orientation, int role) const
 {
     if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
         return {};
     return (section == 0) ? "Name" : "Value";
 }
 
-QVariant ParameterTuningModel::parentColor(const QModelIndex& index) const
+QVariant PartunerQModel::parentColor(const QModelIndex& index) const
 {
     if (!index.isValid())
         return {};
@@ -43,7 +43,7 @@ QVariant ParameterTuningModel::parentColor(const QModelIndex& index) const
     return parentColor(index.parent());
 }
 
-QVariant ParameterTuningModel::data(const QModelIndex& index, int role) const
+QVariant PartunerQModel::data(const QModelIndex& index, int role) const
 {
     if (!index.isValid())
         return {};
@@ -77,7 +77,7 @@ QVariant ParameterTuningModel::data(const QModelIndex& index, int role) const
     return {};
 }
 
-Qt::ItemFlags ParameterTuningModel::flags(const QModelIndex& index) const
+Qt::ItemFlags PartunerQModel::flags(const QModelIndex& index) const
 {
     Qt::ItemFlags result = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
     if (toParameterItem(index)) {
@@ -88,7 +88,7 @@ Qt::ItemFlags ParameterTuningModel::flags(const QModelIndex& index) const
     return result;
 }
 
-QModelIndex ParameterTuningModel::index(int row, int column, const QModelIndex& parent) const
+QModelIndex PartunerQModel::index(int row, int column, const QModelIndex& parent) const
 {
     if (!hasIndex(row, column, parent))
         return {};
@@ -102,7 +102,7 @@ QModelIndex ParameterTuningModel::index(int row, int column, const QModelIndex&
     return {};
 }
 
-QModelIndex ParameterTuningModel::parent(const QModelIndex& index) const
+QModelIndex PartunerQModel::parent(const QModelIndex& index) const
 {
     if (!index.isValid())
         return {};
@@ -115,7 +115,7 @@ QModelIndex ParameterTuningModel::parent(const QModelIndex& index) const
     return createIndex(row, 0, item->parent());
 }
 
-int ParameterTuningModel::rowCount(const QModelIndex& parent) const
+int PartunerQModel::rowCount(const QModelIndex& parent) const
 {
     if (parent.column() > 0)
         return 0;
@@ -127,12 +127,12 @@ int ParameterTuningModel::rowCount(const QModelIndex& parent) const
     return item->children().size();
 }
 
-int ParameterTuningModel::columnCount(const QModelIndex&) const
+int PartunerQModel::columnCount(const QModelIndex&) const
 {
     return 2;
 }
 
-QMimeData* ParameterTuningModel::mimeData(const QModelIndexList& indexes) const
+QMimeData* PartunerQModel::mimeData(const QModelIndexList& indexes) const
 {
     auto* mimeData = new QMimeData();
 
@@ -147,22 +147,22 @@ QMimeData* ParameterTuningModel::mimeData(const QModelIndexList& indexes) const
     return mimeData;
 }
 
-Qt::DropActions ParameterTuningModel::supportedDragActions() const
+Qt::DropActions PartunerQModel::supportedDragActions() const
 {
     return Qt::CopyAction;
 }
 
-Qt::DropActions ParameterTuningModel::supportedDropActions() const
+Qt::DropActions PartunerQModel::supportedDropActions() const
 {
     return Qt::IgnoreAction;
 }
 
-ParameterItem* ParameterTuningModel::getParameterItem(const QModelIndex& index) const
+ParameterItem* PartunerQModel::getParameterItem(const QModelIndex& index) const
 {
     return toParameterItem(index);
 }
 
-QModelIndex ParameterTuningModel::indexForItem(ParameterItem* item) const
+QModelIndex PartunerQModel::indexForItem(ParameterItem* item) const
 {
     if (item == nullptr)
         return {};
@@ -175,25 +175,25 @@ QModelIndex ParameterTuningModel::indexForItem(ParameterItem* item) const
     return {};
 }
 
-ParameterItem* ParameterTuningModel::toParameterItem(const QModelIndex& index)
+ParameterItem* PartunerQModel::toParameterItem(const QModelIndex& index)
 {
     auto* item = static_cast<QObject*>(index.internalPointer());
     return dynamic_cast<ParameterItem*>(item);
 }
 
-ParameterLabelItem* ParameterTuningModel::toParameterLabelItem(const QModelIndex& index)
+ParameterLabelItem* PartunerQModel::toParameterLabelItem(const QModelIndex& index)
 {
     auto* item = static_cast<QObject*>(index.internalPointer());
     return dynamic_cast<ParameterLabelItem*>(item);
 }
 
-void ParameterTuningModel::setExpanded(const QModelIndex& index) const
+void PartunerQModel::setExpanded(const QModelIndex& index) const
 {
     if (auto* label = toParameterLabelItem(index))
         label->setCollapsed(false);
 }
 
-void ParameterTuningModel::setCollapsed(const QModelIndex& index) const
+void PartunerQModel::setCollapsed(const QModelIndex& index) const
 {
     if (auto* label = toParameterLabelItem(index))
         label->setCollapsed(true);
diff --git a/GUI/Model/Tune/ParameterTuningModel.h b/GUI/Model/Tune/PartunerQModel.h
similarity index 84%
rename from GUI/Model/Tune/ParameterTuningModel.h
rename to GUI/Model/Tune/PartunerQModel.h
index 0bc5db30372..ac28bf8dde7 100644
--- a/GUI/Model/Tune/ParameterTuningModel.h
+++ b/GUI/Model/Tune/PartunerQModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Tune/ParameterTuningModel.h
-//! @brief     Defines class ParameterTuningModel.
+//! @file      GUI/Model/Tune/PartunerQModel.h
+//! @brief     Defines class PartunerQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_TUNE_PARAMETERTUNINGMODEL_H
-#define BORNAGAIN_GUI_MODEL_TUNE_PARAMETERTUNINGMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_TUNE_PARTUNERQMODEL_H
+#define BORNAGAIN_GUI_MODEL_TUNE_PARTUNERQMODEL_H
 
 class ParameterItem;
 class ParameterLabelItem;
@@ -23,10 +23,10 @@ class ParameterLabelItem;
 //! Represents parameters which can be tuned in real time in ParameterTuningWidget.
 //! In the fitting activity context handles dragging of ParameterItem's to the FitParametersWidget.
 
-class ParameterTuningModel : public QAbstractItemModel {
+class PartunerQModel : public QAbstractItemModel {
     Q_OBJECT
 public:
-    ParameterTuningModel(QObject* rootObject, QObject* parent = nullptr);
+    PartunerQModel(QObject* rootObject, QObject* parent = nullptr);
 
     QVariant headerData(int section, Qt::Orientation orientation,
                         int role /* = Qt::DisplayRole */) const override;
@@ -57,4 +57,4 @@ private:
     QObject* m_root_object;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_TUNE_PARAMETERTUNINGMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_TUNE_PARTUNERQMODEL_H
diff --git a/GUI/View/ParEdit/ParameterTuningDelegate.cpp b/GUI/View/ParEdit/ParameterTuningDelegate.cpp
index e1329b06a4d..c85eb98e6a8 100644
--- a/GUI/View/ParEdit/ParameterTuningDelegate.cpp
+++ b/GUI/View/ParEdit/ParameterTuningDelegate.cpp
@@ -15,7 +15,7 @@
 #include "GUI/View/ParEdit/ParameterTuningDelegate.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
 #include "GUI/Model/Project/ProjectDocument.h"
-#include "GUI/Model/Tune/ParameterTuningModel.h"
+#include "GUI/Model/Tune/PartunerQModel.h"
 #include "GUI/View/Numeric/ScientificSpinBox.h"
 #include <QHBoxLayout>
 
@@ -137,7 +137,7 @@ QWidget* ParameterTuningDelegate::createEditor(QWidget* parent, const QStyleOpti
     if (!data.isValid())
         return nullptr;
 
-    m_current_item = ParameterTuningModel::toParameterItem(index);
+    m_current_item = PartunerQModel::toParameterItem(index);
     if (!m_current_item)
         return nullptr;
 
diff --git a/GUI/View/Tuning/ParameterTuningWidget.cpp b/GUI/View/Tuning/ParameterTuningWidget.cpp
index 222a4c87ab1..20b3062af81 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.cpp
+++ b/GUI/View/Tuning/ParameterTuningWidget.cpp
@@ -19,7 +19,7 @@
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
 #include "GUI/Model/Project/ProjectDocument.h"
-#include "GUI/Model/Tune/ParameterTuningModel.h"
+#include "GUI/Model/Tune/PartunerQModel.h"
 #include "GUI/Support/Data/JobStatus.h"
 #include "GUI/View/Info/CautionSign.h"
 #include "GUI/View/Layout/mainwindow_constants.h"
@@ -190,16 +190,16 @@ void ParameterTuningWidget::updateParameterModel()
 
     delete m_parameter_tuning_model;
     m_parameter_tuning_model =
-        new ParameterTuningModel(m_job_item->parameterContainerItem()->parameterTreeRoot(), this);
+        new PartunerQModel(m_job_item->parameterContainerItem()->parameterTreeRoot(), this);
 
     m_tree_view->setModel(m_parameter_tuning_model);
     m_tree_view->setColumnWidth(0, ::currentColumnWidth);
     expandChildren(m_tree_view->rootIndex(), m_tree_view);
 
     connect(m_tree_view, &QTreeView::expanded, m_parameter_tuning_model,
-            &ParameterTuningModel::setExpanded);
+            &PartunerQModel::setExpanded);
     connect(m_tree_view, &QTreeView::collapsed, m_parameter_tuning_model,
-            &ParameterTuningModel::setCollapsed);
+            &PartunerQModel::setCollapsed);
 
     connect(m_tree_view->header(), &QHeaderView::sectionResized, [](int i, int, int n) {
         if (i == 0)
diff --git a/GUI/View/Tuning/ParameterTuningWidget.h b/GUI/View/Tuning/ParameterTuningWidget.h
index a9f39e6fbe1..d13e26ada78 100644
--- a/GUI/View/Tuning/ParameterTuningWidget.h
+++ b/GUI/View/Tuning/ParameterTuningWidget.h
@@ -25,7 +25,7 @@ class JobsSet;
 class ParameterBackupWidget;
 class ParameterItem;
 class ParameterTuningDelegate;
-class ParameterTuningModel;
+class PartunerQModel;
 class SliderEditor;
 
 //! Main widget for real time parameter tuning.
@@ -69,7 +69,7 @@ private:
 
     JobItem* m_job_item;
     JobsSet* m_job_model;
-    ParameterTuningModel* m_parameter_tuning_model;
+    PartunerQModel* m_parameter_tuning_model;
     ParameterBackupWidget* m_backup_widget;
     SliderEditor* m_slider_settings_widget;
     QTreeView* m_tree_view;
-- 
GitLab


From ad8bc4353a5ac028cfcbd529acd63f5e7d763696 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:43:59 +0100
Subject: [PATCH 24/31] rename class and sources
 GUI/Model/Mask/MaskeditorListmodel -> GUI/Model/Mask/MasksQModel

---
 Doc/graph/mask-classes.gv                     | 12 +++---
 Doc/graph/projn-classes.gv                    |  4 +-
 GUI/Model/Data/Data2DItem.cpp                 | 10 ++---
 GUI/Model/Data/Data2DItem.h                   | 10 ++---
 ...askeditorListmodel.cpp => MasksQModel.cpp} | 42 +++++++++----------
 .../{MaskeditorListmodel.h => MasksQModel.h}  | 16 +++----
 GUI/View/Canvas/MaskEditorCanvas.cpp          |  2 +-
 GUI/View/Frame/Plot2DFrame.cpp                |  6 +--
 GUI/View/Scene/MaskGraphicsScene.cpp          |  4 +-
 GUI/View/Scene/MaskGraphicsScene.h            |  6 +--
 GUI/View/Setup/MaskPanel.cpp                  |  4 +-
 GUI/View/Setup/MaskPanel.h                    |  6 +--
 Tests/Unit/GUI/TestJobModel.cpp               |  2 +-
 13 files changed, 62 insertions(+), 62 deletions(-)
 rename GUI/Model/Mask/{MaskeditorListmodel.cpp => MasksQModel.cpp} (75%)
 rename GUI/Model/Mask/{MaskeditorListmodel.h => MasksQModel.h} (83%)

diff --git a/Doc/graph/mask-classes.gv b/Doc/graph/mask-classes.gv
index 75e355077ba..a527a9dff6a 100644
--- a/Doc/graph/mask-classes.gv
+++ b/Doc/graph/mask-classes.gv
@@ -19,10 +19,10 @@ MaskEditingFrame->MaskToolbar[style=dashed color=blue]
 MaskToolbar[label="MaskToolbar\n< QToolBar\n< QWidget" style=filled fillcolor=orchid]
 
 FrameActions[label="FrameActions\n< QObject" style=filled fillcolor=beige];
-FrameActions->MaskeditorListmodel;
+FrameActions->MasksQModel;
 
-MaskeditorListmodel[label="MaskeditorListmodel\n < QAbstractListModel\n... < QObject" style=filled fillcolor=beige];
-MaskeditorListmodel->MaskList;
+MasksQModel[label="MasksQModel\n < QAbstractListModel\n... < QObject" style=filled fillcolor=beige];
+MasksQModel->MaskList;
 
 MaskItem[label="MaskItem\n< OverlayItem\n< QObject" style=filled fillcolor=beige];
 
@@ -31,7 +31,7 @@ EllipseItem->MaskItem[arrowhead=onormal color=chocolate4];
 EllipseItem->DoubleProperty;
 
 MaskPanel[label="MaskPanel\n< QWidget" style=filled fillcolor=orchid];
-MaskPanel->MaskeditorListmodel;
+MaskPanel->MasksQModel;
 MaskPanel->MaskItem;
 MaskPanel->DoubleSpinBox[style=dashed color=blue] MaskPanel
     ->EllipseItem[style=dotted color=magenta];
@@ -51,7 +51,7 @@ MaskGraphicsView->MaskGraphicsScene;
 MaskGraphicsScene[label="MaskGraphicsScene\n< QGraphicsScene\n< QObject" style=filled fillcolor=beige];
 
 MaskGraphicsScene->ColorMap;
-MaskGraphicsScene->MaskeditorListmodel;
+MaskGraphicsScene->MasksQModel;
 MaskGraphicsScene->IOverlay;
 MaskGraphicsScene->MaskGraphicsProxy;
 MaskGraphicsScene->Data2DItem;
@@ -69,7 +69,7 @@ MaskToolbar->FrameActions[style=dotted color=magenta];
 
 Data2DItem[label="Data2DItem\n< DataItem\n< QObject" style=filled fillcolor=beige];
 Data2DItem->MaskList;
-Data2DItem->MaskeditorListmodel[style=dotted color=magenta];
+Data2DItem->MasksQModel[style=dotted color=magenta];
 
 MaskList->MaskItem;
 
diff --git a/Doc/graph/projn-classes.gv b/Doc/graph/projn-classes.gv
index 8ec2bc06d3c..54761dc15f7 100644
--- a/Doc/graph/projn-classes.gv
+++ b/Doc/graph/projn-classes.gv
@@ -12,7 +12,7 @@ digraph maskClasses
     Plot2DFrame->ProjectedGraphsCanvas;
     Plot2DFrame->AxesPanel;
 
-    ProjectionActions->MaskeditorListmodel;
+    ProjectionActions->MasksQModel;
     ProjectionActions->Data2DItem;
 
     ProjectionToolbar->ProjectionActions;
@@ -34,7 +34,7 @@ digraph maskClasses
 
     MaskGraphicsScene->QGraphicsScene[arrowhead=onormal color=chocolate4];
     MaskGraphicsScene->ColorMap;
-    MaskGraphicsScene->MaskeditorListmodel;
+    MaskGraphicsScene->MasksQModel;
     MaskGraphicsScene->IOverlay;
     MaskGraphicsScene->MaskGraphicsProxy;
     MaskGraphicsScene->Data2DItem;
diff --git a/GUI/Model/Data/Data2DItem.cpp b/GUI/Model/Data/Data2DItem.cpp
index 675e7651add..93a9fec88af 100644
--- a/GUI/Model/Data/Data2DItem.cpp
+++ b/GUI/Model/Data/Data2DItem.cpp
@@ -22,7 +22,7 @@
 #include "GUI/Model/Axis/AmplitudeAxisItem.h"
 #include "GUI/Model/Axis/BasicAxisItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskeditorListmodel.h"
+#include "GUI/Model/Mask/MasksQModel.h"
 #include "GUI/Model/Mask/ProjectionList.h"
 #include "GUI/Support/Data/ComboProperty.h"
 #include "GUI/Support/Style/QCP_Util.h"
@@ -361,10 +361,10 @@ const MaskList* Data2DItem::maskContainerItem() const
     return m_mask_model ? m_mask_model->maskContItem() : nullptr;
 }
 
-MaskeditorListmodel* Data2DItem::getOrCreateMaskModel()
+MasksQModel* Data2DItem::getOrCreateMaskModel()
 {
     if (!m_mask_model)
-        m_mask_model = std::make_unique<MaskeditorListmodel>(new MaskList);
+        m_mask_model = std::make_unique<MasksQModel>(new MaskList);
 
     return m_mask_model.get();
 }
@@ -410,10 +410,10 @@ const ProjectionList* Data2DItem::projectionContainerItem() const
     return m_proj_model ? m_proj_model->projnItem() : nullptr;
 }
 
-MaskeditorListmodel* Data2DItem::getOrCreateProjectionModel()
+MasksQModel* Data2DItem::getOrCreateProjectionModel()
 {
     if (!m_proj_model)
-        m_proj_model = std::make_unique<MaskeditorListmodel>(new ProjectionList);
+        m_proj_model = std::make_unique<MasksQModel>(new ProjectionList);
 
     return m_proj_model.get();
 }
diff --git a/GUI/Model/Data/Data2DItem.h b/GUI/Model/Data/Data2DItem.h
index d6fb26c6203..9d243742017 100644
--- a/GUI/Model/Data/Data2DItem.h
+++ b/GUI/Model/Data/Data2DItem.h
@@ -21,7 +21,7 @@ class AmplitudeAxisItem;
 class ComboProperty;
 class LineItem;
 class MaskList;
-class MaskeditorListmodel;
+class MasksQModel;
 class ProjectionList;
 class QCPColorGradient;
 
@@ -78,12 +78,12 @@ public:
 
     MaskList* maskContainerItem();
     const MaskList* maskContainerItem() const;
-    MaskeditorListmodel* getOrCreateMaskModel();
+    MasksQModel* getOrCreateMaskModel();
     Datafield* createMaskedField() const;
 
     ProjectionList* projectionContainerItem();
     const ProjectionList* projectionContainerItem() const;
-    MaskeditorListmodel* getOrCreateProjectionModel();
+    MasksQModel* getOrCreateProjectionModel();
 
     void clearMasks();
 
@@ -119,8 +119,8 @@ private:
     bool m_is_interpolated;
     std::unique_ptr<ComboProperty> m_gradient;
     std::unique_ptr<AmplitudeAxisItem> m_z_axis;
-    std::unique_ptr<MaskeditorListmodel> m_mask_model;
-    std::unique_ptr<MaskeditorListmodel> m_proj_model;
+    std::unique_ptr<MasksQModel> m_mask_model;
+    std::unique_ptr<MasksQModel> m_proj_model;
 };
 
 #endif // BORNAGAIN_GUI_MODEL_DATA_DATA2DITEM_H
diff --git a/GUI/Model/Mask/MaskeditorListmodel.cpp b/GUI/Model/Mask/MasksQModel.cpp
similarity index 75%
rename from GUI/Model/Mask/MaskeditorListmodel.cpp
rename to GUI/Model/Mask/MasksQModel.cpp
index aaf744b49b3..c33f2e8f4d6 100644
--- a/GUI/Model/Mask/MaskeditorListmodel.cpp
+++ b/GUI/Model/Mask/MasksQModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Mask/MaskeditorListmodel.cpp
-//! @brief     Implements class MaskeditorListmodel.
+//! @file      GUI/Model/Mask/MasksQModel.cpp
+//! @brief     Implements class MasksQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,25 +12,25 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Mask/MaskeditorListmodel.h"
+#include "GUI/Model/Mask/MasksQModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Model/Mask/ProjectionList.h"
 
-// Implementation of MaskeditorListmodel is based on the Qt source code for QStringListModel
+// Implementation of MasksQModel is based on the Qt source code for QStringListModel
 
-MaskeditorListmodel::MaskeditorListmodel(MaskList* item)
+MasksQModel::MasksQModel(MaskList* item)
     : m_mask_container_item(item)
     , m_selection_model(std::make_unique<QItemSelectionModel>(this))
 {
 }
 
-MaskeditorListmodel::~MaskeditorListmodel() = default;
+MasksQModel::~MasksQModel() = default;
 
 // Begin overridden methods from QAbstractListModel
 
-int MaskeditorListmodel::rowCount(const QModelIndex& parent) const
+int MasksQModel::rowCount(const QModelIndex& parent) const
 {
     if (parent.isValid())
         return 0;
@@ -38,7 +38,7 @@ int MaskeditorListmodel::rowCount(const QModelIndex& parent) const
     return m_mask_container_item->size();
 }
 
-QVariant MaskeditorListmodel::data(const QModelIndex& index, int role) const
+QVariant MasksQModel::data(const QModelIndex& index, int role) const
 {
     const qsizetype row = index.row();
 
@@ -53,7 +53,7 @@ QVariant MaskeditorListmodel::data(const QModelIndex& index, int role) const
 
 // End overridden methods from QAbstractListModel
 
-void MaskeditorListmodel::insertMask(int row, MaskItem* item)
+void MasksQModel::insertMask(int row, MaskItem* item)
 {
     QAbstractListModel::beginInsertRows(m_mask_container_item->rootIndex, row, row);
     m_mask_container_item->insertMask(row, item);
@@ -61,7 +61,7 @@ void MaskeditorListmodel::insertMask(int row, MaskItem* item)
 }
 
 //! Move mask to a given row
-void MaskeditorListmodel::moveMask(int from_row, int to_row)
+void MasksQModel::moveMask(int from_row, int to_row)
 {
     emit QAbstractListModel::beginMoveRows(m_mask_container_item->rootIndex, from_row, from_row,
                                            m_mask_container_item->rootIndex, to_row);
@@ -69,20 +69,20 @@ void MaskeditorListmodel::moveMask(int from_row, int to_row)
     emit QAbstractListModel::endMoveRows();
 }
 
-void MaskeditorListmodel::removeMaskAt(int row)
+void MasksQModel::removeMaskAt(int row)
 {
     QAbstractListModel::beginRemoveRows(m_mask_container_item->rootIndex, row, row);
     m_mask_container_item->removeMaskAt(row);
     QAbstractListModel::endRemoveRows();
 }
 
-void MaskeditorListmodel::removeMask(MaskItem* item)
+void MasksQModel::removeMask(MaskItem* item)
 {
     const int row = m_mask_container_item->indexOfItem(item);
     removeMaskAt(row);
 }
 
-QModelIndex MaskeditorListmodel::indexOfItem(const OverlayItem* item) const
+QModelIndex MasksQModel::indexOfItem(const OverlayItem* item) const
 {
     if (const auto* ii = dynamic_cast<const MaskItem*>(item)) {
         const int row = m_mask_container_item->indexOfItem(ii);
@@ -91,31 +91,31 @@ QModelIndex MaskeditorListmodel::indexOfItem(const OverlayItem* item) const
     return {};
 }
 
-MaskItem* MaskeditorListmodel::itemForIndex(const QModelIndex& index) const
+MaskItem* MasksQModel::itemForIndex(const QModelIndex& index) const
 {
     if (index.isValid())
         return m_mask_container_item->at(index.row());
     return nullptr;
 }
 
-void MaskeditorListmodel::clear()
+void MasksQModel::clear()
 {
     QAbstractListModel::beginResetModel();
     m_mask_container_item->clear();
     QAbstractListModel::endResetModel();
 }
 
-ProjectionList* MaskeditorListmodel::projnItem()
+ProjectionList* MasksQModel::projnItem()
 {
     return dynamic_cast<ProjectionList*>(m_mask_container_item);
 }
 
-const ProjectionList* MaskeditorListmodel::projnItem() const
+const ProjectionList* MasksQModel::projnItem() const
 {
     return dynamic_cast<const ProjectionList*>(m_mask_container_item);
 }
 
-void MaskeditorListmodel::moveUp()
+void MasksQModel::moveUp()
 {
     for (const QModelIndex& itemIndex : m_selection_model->selectedIndexes()) {
         int row = itemIndex.row();
@@ -125,7 +125,7 @@ void MaskeditorListmodel::moveUp()
     }
 }
 
-void MaskeditorListmodel::moveDown()
+void MasksQModel::moveDown()
 {
     for (const QModelIndex& itemIndex : m_selection_model->selectedIndexes()) {
         int row = itemIndex.row();
@@ -137,7 +137,7 @@ void MaskeditorListmodel::moveDown()
     }
 }
 
-void MaskeditorListmodel::removeSelected()
+void MasksQModel::removeSelected()
 {
     while (true) {
         QModelIndexList indexes = m_selection_model->selectedIndexes();
@@ -147,7 +147,7 @@ void MaskeditorListmodel::removeSelected()
     }
 }
 
-void MaskeditorListmodel::toggleMaskValue()
+void MasksQModel::toggleMaskValue()
 {
     for (auto itemIndex : maskSelectionModel()->selectedIndexes())
         if (MaskItem* item = itemForIndex(itemIndex))
diff --git a/GUI/Model/Mask/MaskeditorListmodel.h b/GUI/Model/Mask/MasksQModel.h
similarity index 83%
rename from GUI/Model/Mask/MaskeditorListmodel.h
rename to GUI/Model/Mask/MasksQModel.h
index 5afc9a3c555..62816e81af8 100644
--- a/GUI/Model/Mask/MaskeditorListmodel.h
+++ b/GUI/Model/Mask/MasksQModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Mask/MaskeditorListmodel.h
-//! @brief     Defines class MaskeditorListmodel.
+//! @file      GUI/Model/Mask/MasksQModel.h
+//! @brief     Defines class MasksQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_MASK_MASKEDITORLISTMODEL_H
-#define BORNAGAIN_GUI_MODEL_MASK_MASKEDITORLISTMODEL_H
+#ifndef BORNAGAIN_GUI_MODEL_MASK_MASKSQMODEL_H
+#define BORNAGAIN_GUI_MODEL_MASK_MASKSQMODEL_H
 
 #include <QAbstractListModel>
 #include <QItemSelectionModel>
@@ -28,11 +28,11 @@ class ProjectionList;
 //! Provides interfaces to a MaskList, allowing its contents to be displayed and modified
 //! using the Qt mechanisms.
 
-class MaskeditorListmodel : public QAbstractListModel {
+class MasksQModel : public QAbstractListModel {
     Q_OBJECT
 public:
-    MaskeditorListmodel(MaskList* item);
-    ~MaskeditorListmodel();
+    MasksQModel(MaskList* item);
+    ~MasksQModel();
 
     //... Override functions from QAbstractListModel
 
@@ -68,4 +68,4 @@ private:
     std::unique_ptr<QItemSelectionModel> m_selection_model;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_MASK_MASKEDITORLISTMODEL_H
+#endif // BORNAGAIN_GUI_MODEL_MASK_MASKSQMODEL_H
diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp
index 9a58e5fa7e0..805f07fdd91 100644
--- a/GUI/View/Canvas/MaskEditorCanvas.cpp
+++ b/GUI/View/Canvas/MaskEditorCanvas.cpp
@@ -17,7 +17,7 @@
 #include "GUI/Model/Data/Data2DItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
-#include "GUI/Model/Mask/MaskeditorListmodel.h"
+#include "GUI/Model/Mask/MasksQModel.h"
 #include "GUI/Model/Mask/ProjectionList.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Canvas/SavePlotAssistant.h"
diff --git a/GUI/View/Frame/Plot2DFrame.cpp b/GUI/View/Frame/Plot2DFrame.cpp
index 9ffcc3d22cb..7b32c3453c5 100644
--- a/GUI/View/Frame/Plot2DFrame.cpp
+++ b/GUI/View/Frame/Plot2DFrame.cpp
@@ -15,7 +15,7 @@
 #include "GUI/View/Frame/Plot2DFrame.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Data/Data2DItem.h"
-#include "GUI/Model/Mask/MaskeditorListmodel.h"
+#include "GUI/Model/Mask/MasksQModel.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Canvas/MaskEditorCanvas.h"
 #include "GUI/View/Canvas/ProjectedGraphsCanvas.h"
@@ -113,7 +113,7 @@ void Plot2DFrame::updateFrame()
 {
     ASSERT(m_data_item);
 
-    class MaskeditorListmodel* mask_list_model = m_data_item->getOrCreateMaskModel();
+    class MasksQModel* mask_list_model = m_data_item->getOrCreateMaskModel();
     ASSERT(mask_list_model);
 
     m_mask_panel->updateMaskPanel(mask_list_model);
@@ -137,7 +137,7 @@ void Plot2DFrame::removeProjection()
     if (!m_data_item)
         return;
 
-    MaskeditorListmodel* mask_list_model = m_data_item->getOrCreateProjectionModel();
+    MasksQModel* mask_list_model = m_data_item->getOrCreateProjectionModel();
     ASSERT(mask_list_model);
     mask_list_model->removeSelected();
     gDoc->setModified();
diff --git a/GUI/View/Scene/MaskGraphicsScene.cpp b/GUI/View/Scene/MaskGraphicsScene.cpp
index b2e42a5c94d..79dc6c3e8fd 100644
--- a/GUI/View/Scene/MaskGraphicsScene.cpp
+++ b/GUI/View/Scene/MaskGraphicsScene.cpp
@@ -16,7 +16,7 @@
 #include "GUI/Model/Data/Data2DItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
-#include "GUI/Model/Mask/MaskeditorListmodel.h"
+#include "GUI/Model/Mask/MasksQModel.h"
 #include "GUI/Model/Mask/PointItem.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Overlay/LineOverlays.h"
@@ -66,7 +66,7 @@ MaskGraphicsScene::MaskGraphicsScene()
 
 MaskGraphicsScene::~MaskGraphicsScene() = default;
 
-void MaskGraphicsScene::associateItems(Data2DItem* data_item, MaskeditorListmodel* mask_list_model)
+void MaskGraphicsScene::associateItems(Data2DItem* data_item, MasksQModel* mask_list_model)
 {
     ASSERT(mask_list_model);
     m_selection_model = mask_list_model->maskSelectionModel();
diff --git a/GUI/View/Scene/MaskGraphicsScene.h b/GUI/View/Scene/MaskGraphicsScene.h
index bb804862b0f..df7d055ba29 100644
--- a/GUI/View/Scene/MaskGraphicsScene.h
+++ b/GUI/View/Scene/MaskGraphicsScene.h
@@ -28,7 +28,7 @@ class LineItem;
 class MaskEditorAction;
 class MaskGraphicsProxy;
 class MaskItem;
-class MaskeditorListmodel;
+class MasksQModel;
 class OverlayItem;
 class PolygonOverlay;
 
@@ -40,7 +40,7 @@ public:
     MaskGraphicsScene();
     ~MaskGraphicsScene() override;
 
-    void associateItems(Data2DItem* data_item, MaskeditorListmodel* mask_list_model);
+    void associateItems(Data2DItem* data_item, MasksQModel* mask_list_model);
     void updateSize(const QSize& newSize);
     void cancelCurrentDrawing();
 
@@ -95,7 +95,7 @@ private:
     PolygonOverlay* currentPolygon() const;
 
     ColorMap* m_plot;
-    MaskeditorListmodel* m_mask_list_model = nullptr;
+    MasksQModel* m_mask_list_model = nullptr;
     QItemSelectionModel* m_selection_model = nullptr;
     QMap<const OverlayItem*, IOverlay*> m_mask2overlay;
     MaskGraphicsProxy* m_proxy = nullptr;
diff --git a/GUI/View/Setup/MaskPanel.cpp b/GUI/View/Setup/MaskPanel.cpp
index b1af78a7db5..9009dfcfc70 100644
--- a/GUI/View/Setup/MaskPanel.cpp
+++ b/GUI/View/Setup/MaskPanel.cpp
@@ -16,7 +16,7 @@
 #include "Fit/Param/RealLimits.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
-#include "GUI/Model/Mask/MaskeditorListmodel.h"
+#include "GUI/Model/Mask/MasksQModel.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Numeric/DoubleSpinBox.h"
 #include "GUI/View/Tool/LayoutUtil.h"
@@ -85,7 +85,7 @@ QSize MaskPanel::minimumSizeHint() const
     return {128, 128};
 }
 
-void MaskPanel::updateMaskPanel(MaskeditorListmodel* mask_list_model)
+void MaskPanel::updateMaskPanel(MasksQModel* mask_list_model)
 {
     m_mask_list_model = mask_list_model;
 
diff --git a/GUI/View/Setup/MaskPanel.h b/GUI/View/Setup/MaskPanel.h
index 93af1be0351..b6b2f1bd458 100644
--- a/GUI/View/Setup/MaskPanel.h
+++ b/GUI/View/Setup/MaskPanel.h
@@ -25,7 +25,7 @@
 
 class Data2DItem;
 class MaskItem;
-class MaskeditorListmodel;
+class MasksQModel;
 
 //! Panel with list of masks and parameter editor for one selected mask.
 
@@ -37,7 +37,7 @@ public:
     QSize sizeHint() const override;
     QSize minimumSizeHint() const override;
 
-    void updateMaskPanel(MaskeditorListmodel* mask_list_model);
+    void updateMaskPanel(MasksQModel* mask_list_model);
 
     void resetMaskPanel();
     void setPanelHidden(bool hidden);
@@ -59,7 +59,7 @@ private:
                          std::function<void(bool)> setter);
 
     QListView* m_list_view;
-    MaskeditorListmodel* m_mask_list_model;
+    MasksQModel* m_mask_list_model;
     QFormLayout* m_editor_layout;
     MaskItem* m_current_mask_item; //!< the mask item whose properties shall be edited
     bool m_keep_selection = false;
diff --git a/Tests/Unit/GUI/TestJobModel.cpp b/Tests/Unit/GUI/TestJobModel.cpp
index 4dbcf059cc7..397c1a3907b 100644
--- a/Tests/Unit/GUI/TestJobModel.cpp
+++ b/Tests/Unit/GUI/TestJobModel.cpp
@@ -10,7 +10,7 @@
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include "GUI/Model/Mask/MaskList.h"
-#include "GUI/Model/Mask/MaskeditorListmodel.h"
+#include "GUI/Model/Mask/MasksQModel.h"
 #include "GUI/Model/Tune/JobsSet.h"
 #include "Tests/GTestWrapper/google_test.h"
 #include "Tests/Unit/GUI/Utils.h"
-- 
GitLab


From fa604551b64b0b2312b8dd2aac945cd5aa93e79f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:44:22 +0100
Subject: [PATCH 25/31] rename class and sources GUI/Model/Mask/MaskList ->
 GUI/Model/Mask/MasksSet

---
 Doc/graph/mask-classes.gv                     |  6 +--
 Doc/graph/projn-classes.gv                    |  4 +-
 GUI/Model/Data/Data2DItem.cpp                 |  6 +--
 GUI/Model/Data/Data2DItem.h                   |  6 +--
 GUI/Model/Detector/DetectorItem.cpp           |  8 ++--
 GUI/Model/Detector/DetectorItem.h             |  8 ++--
 GUI/Model/FromCore/ItemizeSimulation.cpp      | 10 ++---
 GUI/Model/Job/JobItem.cpp                     |  2 +-
 GUI/Model/Mask/MasksQModel.cpp                |  4 +-
 GUI/Model/Mask/MasksQModel.h                  | 12 +++---
 GUI/Model/Mask/{MaskList.cpp => MasksSet.cpp} | 40 +++++++++----------
 GUI/Model/Mask/{MaskList.h => MasksSet.h}     | 16 ++++----
 GUI/Model/Mask/ProjectionList.h               |  4 +-
 GUI/View/Canvas/MaskEditorCanvas.cpp          |  4 +-
 GUI/View/Scene/MaskGraphicsScene.cpp          |  4 +-
 GUI/View/Setup/MaskPanel.cpp                  |  2 +-
 Tests/Unit/GUI/TestJobModel.cpp               |  4 +-
 17 files changed, 70 insertions(+), 70 deletions(-)
 rename GUI/Model/Mask/{MaskList.cpp => MasksSet.cpp} (74%)
 rename GUI/Model/Mask/{MaskList.h => MasksSet.h} (87%)

diff --git a/Doc/graph/mask-classes.gv b/Doc/graph/mask-classes.gv
index a527a9dff6a..790494035dd 100644
--- a/Doc/graph/mask-classes.gv
+++ b/Doc/graph/mask-classes.gv
@@ -22,7 +22,7 @@ FrameActions[label="FrameActions\n< QObject" style=filled fillcolor=beige];
 FrameActions->MasksQModel;
 
 MasksQModel[label="MasksQModel\n < QAbstractListModel\n... < QObject" style=filled fillcolor=beige];
-MasksQModel->MaskList;
+MasksQModel->MasksSet;
 
 MaskItem[label="MaskItem\n< OverlayItem\n< QObject" style=filled fillcolor=beige];
 
@@ -68,10 +68,10 @@ ColorMap->Data2DItem;
 MaskToolbar->FrameActions[style=dotted color=magenta];
 
 Data2DItem[label="Data2DItem\n< DataItem\n< QObject" style=filled fillcolor=beige];
-Data2DItem->MaskList;
+Data2DItem->MasksSet;
 Data2DItem->MasksQModel[style=dotted color=magenta];
 
-MaskList->MaskItem;
+MasksSet->MaskItem;
 
 EllipseOverlay[style=filled fillcolor=gold];
 EllipseOverlay->EllipseItem;
diff --git a/Doc/graph/projn-classes.gv b/Doc/graph/projn-classes.gv
index 54761dc15f7..594440d8db5 100644
--- a/Doc/graph/projn-classes.gv
+++ b/Doc/graph/projn-classes.gv
@@ -68,6 +68,6 @@ digraph maskClasses
 
     MaskResultsPresenter->Data2DItem;
 
-    Data2DItem->MaskList;
-    MaskList->MaskItem;
+    Data2DItem->MasksSet;
+    MasksSet->MaskItem;
 }
\ No newline at end of file
diff --git a/GUI/Model/Data/Data2DItem.cpp b/GUI/Model/Data/Data2DItem.cpp
index 93a9fec88af..7f09ce9c39f 100644
--- a/GUI/Model/Data/Data2DItem.cpp
+++ b/GUI/Model/Data/Data2DItem.cpp
@@ -351,12 +351,12 @@ void Data2DItem::readFrom(QXmlStreamReader* r)
     }
 }
 
-MaskList* Data2DItem::maskContainerItem()
+MasksSet* Data2DItem::maskContainerItem()
 {
     return m_mask_model ? m_mask_model->maskContItem() : nullptr;
 }
 
-const MaskList* Data2DItem::maskContainerItem() const
+const MasksSet* Data2DItem::maskContainerItem() const
 {
     return m_mask_model ? m_mask_model->maskContItem() : nullptr;
 }
@@ -364,7 +364,7 @@ const MaskList* Data2DItem::maskContainerItem() const
 MasksQModel* Data2DItem::getOrCreateMaskModel()
 {
     if (!m_mask_model)
-        m_mask_model = std::make_unique<MasksQModel>(new MaskList);
+        m_mask_model = std::make_unique<MasksQModel>(new MasksSet);
 
     return m_mask_model.get();
 }
diff --git a/GUI/Model/Data/Data2DItem.h b/GUI/Model/Data/Data2DItem.h
index 9d243742017..f04bdecc2d6 100644
--- a/GUI/Model/Data/Data2DItem.h
+++ b/GUI/Model/Data/Data2DItem.h
@@ -20,7 +20,7 @@
 class AmplitudeAxisItem;
 class ComboProperty;
 class LineItem;
-class MaskList;
+class MasksSet;
 class MasksQModel;
 class ProjectionList;
 class QCPColorGradient;
@@ -76,8 +76,8 @@ public:
     const AmplitudeAxisItem* zAxisItem() const;
     AmplitudeAxisItem* zAxisItem();
 
-    MaskList* maskContainerItem();
-    const MaskList* maskContainerItem() const;
+    MasksSet* maskContainerItem();
+    const MasksSet* maskContainerItem() const;
     MasksQModel* getOrCreateMaskModel();
     Datafield* createMaskedField() const;
 
diff --git a/GUI/Model/Detector/DetectorItem.cpp b/GUI/Model/Detector/DetectorItem.cpp
index e6b041ac871..21a84b7c14d 100644
--- a/GUI/Model/Detector/DetectorItem.cpp
+++ b/GUI/Model/Detector/DetectorItem.cpp
@@ -21,7 +21,7 @@
 #include "Device/Resolution/ResolutionFunction2DGaussian.h"
 #include "GUI/Model/Detector/ResolutionFunctionItems.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskList.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Support/XML/Backup.h"
 
 namespace {
@@ -87,14 +87,14 @@ std::unique_ptr<IDetector> DetectorItem::createDetector() const
     return result;
 }
 
-void DetectorItem::importMasks(const MaskList* item)
+void DetectorItem::importMasks(const MasksSet* item)
 {
     ASSERT(item);
-    m_mask_container_item = std::make_unique<MaskList>();
+    m_mask_container_item = std::make_unique<MasksSet>();
     GUI::Util::copyContents(item, m_mask_container_item.get());
 }
 
-void DetectorItem::setMasks(MaskList* item)
+void DetectorItem::setMasks(MasksSet* item)
 {
     m_mask_container_item.reset(item);
 }
diff --git a/GUI/Model/Detector/DetectorItem.h b/GUI/Model/Detector/DetectorItem.h
index 2de677535ad..f603eb51afb 100644
--- a/GUI/Model/Detector/DetectorItem.h
+++ b/GUI/Model/Detector/DetectorItem.h
@@ -22,7 +22,7 @@
 class Beam;
 class IDetector;
 class IResolutionFunction2D;
-class MaskList;
+class MasksSet;
 class ResolutionFunctionItem;
 
 class DetectorItem {
@@ -32,8 +32,8 @@ public:
 
     std::unique_ptr<IDetector> createDetector() const;
 
-    void importMasks(const MaskList* item);
-    void setMasks(MaskList* item);
+    void importMasks(const MasksSet* item);
+    void setMasks(MasksSet* item);
 
     SelectionProperty<ResolutionFunctionItemCatalog>& resolutionFunctionSelection()
     {
@@ -57,7 +57,7 @@ private:
     std::unique_ptr<IResolutionFunction2D> createResolutionFunction() const;
 
     //! for creation of domain detector; only filled and relevant in jobs
-    std::unique_ptr<MaskList> m_mask_container_item; // without serializtion
+    std::unique_ptr<MasksSet> m_mask_container_item; // without serializtion
     SelectionProperty<ResolutionFunctionItemCatalog> m_resolution_function;
 
     SpanProperty m_phi_axis;
diff --git a/GUI/Model/FromCore/ItemizeSimulation.cpp b/GUI/Model/FromCore/ItemizeSimulation.cpp
index 69a44b8a373..9b13572bbf6 100644
--- a/GUI/Model/FromCore/ItemizeSimulation.cpp
+++ b/GUI/Model/FromCore/ItemizeSimulation.cpp
@@ -39,7 +39,7 @@
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Model/Device/InstrumentsSet.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskList.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Support/Data/SimulationOptionsItem.h"
 #include "Param/Distrib/Distributions.h"
 #include "Resample/Options/SimulationOptions.h"
@@ -51,10 +51,10 @@
 
 namespace {
 
-//! Sets masks in MaskList according to given IDetector core object.
-MaskList* getMaskList(const IDetector& detector)
+//! Sets masks in MasksSet according to given IDetector core object.
+MasksSet* getMasksSet(const IDetector& detector)
 {
-    auto* result = new MaskList;
+    auto* result = new MasksSet;
     const MaskStack* maskStack = detector.detectorMask();
     for (size_t i_mask = 0; i_mask < maskStack->numberOfMasks(); ++i_mask) {
         const auto [shape, mask_value] = maskStack->patternAt(i_mask);
@@ -142,7 +142,7 @@ void setMaskStacks(DetectorItem* detector_item, const IDetector& detector)
 {
     if ((detector.detectorMask() && detector.detectorMask()->hasMasks())
         || detector.hasExplicitRegionOfInterest())
-        detector_item->setMasks(getMaskList(detector));
+        detector_item->setMasks(getMasksSet(detector));
 }
 
 //! Sets BeamDistributionItem according to given IDistribution1D core object.
diff --git a/GUI/Model/Job/JobItem.cpp b/GUI/Model/Job/JobItem.cpp
index e4d52755a0e..655ae31d08f 100644
--- a/GUI/Model/Job/JobItem.cpp
+++ b/GUI/Model/Job/JobItem.cpp
@@ -29,8 +29,8 @@
 #include "GUI/Model/Job/FitSuiteItem.h"
 #include "GUI/Model/Job/ParameterTreeBuilder.h"
 #include "GUI/Model/Job/ParameterTreeItems.h"
-#include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Model/Mask/MaskUnitsConverter.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Model/Mini/MinimizerItems.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/Data/JobStatus.h"
diff --git a/GUI/Model/Mask/MasksQModel.cpp b/GUI/Model/Mask/MasksQModel.cpp
index c33f2e8f4d6..85cea887c75 100644
--- a/GUI/Model/Mask/MasksQModel.cpp
+++ b/GUI/Model/Mask/MasksQModel.cpp
@@ -15,12 +15,12 @@
 #include "GUI/Model/Mask/MasksQModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskList.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Model/Mask/ProjectionList.h"
 
 // Implementation of MasksQModel is based on the Qt source code for QStringListModel
 
-MasksQModel::MasksQModel(MaskList* item)
+MasksQModel::MasksQModel(MasksSet* item)
     : m_mask_container_item(item)
     , m_selection_model(std::make_unique<QItemSelectionModel>(this))
 {
diff --git a/GUI/Model/Mask/MasksQModel.h b/GUI/Model/Mask/MasksQModel.h
index 62816e81af8..2ee2b3306ce 100644
--- a/GUI/Model/Mask/MasksQModel.h
+++ b/GUI/Model/Mask/MasksQModel.h
@@ -21,17 +21,17 @@
 #include <QVariant>
 
 class MaskItem;
-class MaskList;
+class MasksSet;
 class OverlayItem;
 class ProjectionList;
 
-//! Provides interfaces to a MaskList, allowing its contents to be displayed and modified
+//! Provides interfaces to a MasksSet, allowing its contents to be displayed and modified
 //! using the Qt mechanisms.
 
 class MasksQModel : public QAbstractListModel {
     Q_OBJECT
 public:
-    MasksQModel(MaskList* item);
+    MasksQModel(MasksSet* item);
     ~MasksQModel();
 
     //... Override functions from QAbstractListModel
@@ -58,13 +58,13 @@ public:
 
     QItemSelectionModel* maskSelectionModel() { return m_selection_model.get(); }
 
-    MaskList* maskContItem() { return m_mask_container_item; }
-    const MaskList* maskContItem() const { return m_mask_container_item; }
+    MasksSet* maskContItem() { return m_mask_container_item; }
+    const MasksSet* maskContItem() const { return m_mask_container_item; }
     ProjectionList* projnItem();
     const ProjectionList* projnItem() const;
 
 private:
-    MaskList* m_mask_container_item;
+    MasksSet* m_mask_container_item;
     std::unique_ptr<QItemSelectionModel> m_selection_model;
 };
 
diff --git a/GUI/Model/Mask/MaskList.cpp b/GUI/Model/Mask/MasksSet.cpp
similarity index 74%
rename from GUI/Model/Mask/MaskList.cpp
rename to GUI/Model/Mask/MasksSet.cpp
index 59b94230970..f0b2ea0e9c5 100644
--- a/GUI/Model/Mask/MaskList.cpp
+++ b/GUI/Model/Mask/MasksSet.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Mask/MaskList.cpp
-//! @brief     Implements class MaskList.
+//! @file      GUI/Model/Mask/MasksSet.cpp
+//! @brief     Implements class MasksSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/Model/Mask/MaskList.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Model/Mask/MaskItems.h"
 #include <QRegularExpression>
 
@@ -24,43 +24,43 @@ const QString Mask("Mask");
 } // namespace Tag
 } // namespace
 
-MaskList::MaskList() = default;
+MasksSet::MasksSet() = default;
 
-MaskList::~MaskList() = default;
+MasksSet::~MasksSet() = default;
 
-QVector<MaskItem*> MaskList::modifiableMaskItems() const
+QVector<MaskItem*> MasksSet::modifiableMaskItems() const
 {
     return m_mask_items.toModifiableQVector();
 }
 
-QVector<const MaskItem*> MaskList::maskItems() const
+QVector<const MaskItem*> MasksSet::maskItems() const
 {
     return m_mask_items.toQVector();
 }
 
-void MaskList::insertMask(int row, MaskItem* maskItem)
+void MasksSet::insertMask(int row, MaskItem* maskItem)
 {
     // takes owning of maskItem!
     m_mask_items.insert_at(row, maskItem);
 }
 
-void MaskList::addMaskItem(MaskItem* maskItem)
+void MasksSet::addMaskItem(MaskItem* maskItem)
 {
     // takes owning of maskItem!
     m_mask_items.push_back(maskItem);
 }
 
-void MaskList::moveMask(int from_row, int to_row)
+void MasksSet::moveMask(int from_row, int to_row)
 {
     m_mask_items.move(from_row, to_row);
 }
 
-void MaskList::removeMaskAt(int row)
+void MasksSet::removeMaskAt(int row)
 {
     m_mask_items.delete_at(row);
 }
 
-RegionOfInterestItem* MaskList::regionOfInterestItem() const
+RegionOfInterestItem* MasksSet::regionOfInterestItem() const
 {
     for (const auto& maskSel : m_mask_items)
         if (auto* roi = dynamic_cast<RegionOfInterestItem*>(maskSel.currentItem()))
@@ -69,32 +69,32 @@ RegionOfInterestItem* MaskList::regionOfInterestItem() const
     return nullptr;
 }
 
-void MaskList::clear()
+void MasksSet::clear()
 {
     m_mask_items.clear();
 }
 
-bool MaskList::isEmpty() const
+bool MasksSet::isEmpty() const
 {
     return m_mask_items.empty();
 }
 
-int MaskList::size() const
+int MasksSet::size() const
 {
     return m_mask_items.size();
 }
 
-MaskItem* MaskList::at(const int idx)
+MaskItem* MasksSet::at(const int idx)
 {
     return m_mask_items.at(idx).currentItem();
 }
 
-int MaskList::indexOfItem(const MaskItem* maskItem) const
+int MasksSet::indexOfItem(const MaskItem* maskItem) const
 {
     return m_mask_items.index_of(maskItem);
 }
 
-void MaskList::updateMaskNames()
+void MasksSet::updateMaskNames()
 {
     const auto reg = QRegularExpression("[0-9]");
 
@@ -116,7 +116,7 @@ void MaskList::updateMaskNames()
     }
 }
 
-void MaskList::writeTo(QXmlStreamWriter* w) const
+void MasksSet::writeTo(QXmlStreamWriter* w) const
 {
     XML::writeAttribute(w, XML::Attrib::version, uint(1));
 
@@ -127,7 +127,7 @@ void MaskList::writeTo(QXmlStreamWriter* w) const
     }
 }
 
-void MaskList::readFrom(QXmlStreamReader* r, MessageService*)
+void MasksSet::readFrom(QXmlStreamReader* r, MessageService*)
 {
     clear();
 
diff --git a/GUI/Model/Mask/MaskList.h b/GUI/Model/Mask/MasksSet.h
similarity index 87%
rename from GUI/Model/Mask/MaskList.h
rename to GUI/Model/Mask/MasksSet.h
index a86e6bfe4fe..0b2709194e1 100644
--- a/GUI/Model/Mask/MaskList.h
+++ b/GUI/Model/Mask/MasksSet.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/Model/Mask/MaskList.h
-//! @brief     Defines class MaskList.
+//! @file      GUI/Model/Mask/MasksSet.h
+//! @brief     Defines class MasksSet.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_MODEL_MASK_MASKLIST_H
-#define BORNAGAIN_GUI_MODEL_MASK_MASKLIST_H
+#ifndef BORNAGAIN_GUI_MODEL_MASK_MASKSSET_H
+#define BORNAGAIN_GUI_MODEL_MASK_MASKSSET_H
 
 #include "GUI/Model/Descriptor/SelectionProperty.h"
 #include "GUI/Model/Mask/MaskItemCatalog.h"
@@ -27,10 +27,10 @@ class RegionOfInterestItem;
 
 //! Container holding various masks as children
 
-class MaskList {
+class MasksSet {
 public:
-    MaskList();
-    virtual ~MaskList();
+    MasksSet();
+    virtual ~MasksSet();
 
     QVector<MaskItem*> modifiableMaskItems() const;
     QVector<const MaskItem*> maskItems() const;
@@ -76,4 +76,4 @@ protected:
     SelectionVector<MaskItemCatalog> m_mask_items;
 };
 
-#endif // BORNAGAIN_GUI_MODEL_MASK_MASKLIST_H
+#endif // BORNAGAIN_GUI_MODEL_MASK_MASKSSET_H
diff --git a/GUI/Model/Mask/ProjectionList.h b/GUI/Model/Mask/ProjectionList.h
index be1f11fcdc8..b013dfb2c04 100644
--- a/GUI/Model/Mask/ProjectionList.h
+++ b/GUI/Model/Mask/ProjectionList.h
@@ -15,7 +15,7 @@
 #ifndef BORNAGAIN_GUI_MODEL_MASK_PROJECTIONLIST_H
 #define BORNAGAIN_GUI_MODEL_MASK_PROJECTIONLIST_H
 
-#include "GUI/Model/Mask/MaskList.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Support/Data/ID.h"
 
 class LineItem;
@@ -23,7 +23,7 @@ class LineItem;
 //! A container to hold ProjectionList, intended to store projections of color map on X, Y
 //! axes.
 
-class ProjectionList : public MaskList {
+class ProjectionList : public MasksSet {
 public:
     ProjectionList();
 
diff --git a/GUI/View/Canvas/MaskEditorCanvas.cpp b/GUI/View/Canvas/MaskEditorCanvas.cpp
index 805f07fdd91..72e001b47cf 100644
--- a/GUI/View/Canvas/MaskEditorCanvas.cpp
+++ b/GUI/View/Canvas/MaskEditorCanvas.cpp
@@ -16,8 +16,8 @@
 #include "Device/Data/Datafield.h"
 #include "GUI/Model/Data/Data2DItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Model/Mask/MasksQModel.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Model/Mask/ProjectionList.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Canvas/SavePlotAssistant.h"
@@ -155,7 +155,7 @@ void MaskEditorCanvas::onResetViewRequest()
 
 void MaskEditorCanvas::setZoomToROI()
 {
-    if (MaskList* item = m_data_item->maskContainerItem()) {
+    if (MasksSet* item = m_data_item->maskContainerItem()) {
         if (auto* roiItem = item->regionOfInterestItem()) {
             m_data_item->setXrange(roiItem->xLow(), roiItem->xUp());
             m_data_item->setYrange(roiItem->yLow(), roiItem->yUp());
diff --git a/GUI/View/Scene/MaskGraphicsScene.cpp b/GUI/View/Scene/MaskGraphicsScene.cpp
index 79dc6c3e8fd..80f0b491256 100644
--- a/GUI/View/Scene/MaskGraphicsScene.cpp
+++ b/GUI/View/Scene/MaskGraphicsScene.cpp
@@ -15,8 +15,8 @@
 #include "GUI/View/Scene/MaskGraphicsScene.h"
 #include "GUI/Model/Data/Data2DItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Model/Mask/MasksQModel.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Model/Mask/PointItem.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Overlay/LineOverlays.h"
@@ -380,7 +380,7 @@ void MaskGraphicsScene::updateProxyWidget()
 void MaskGraphicsScene::updateOverlays()
 {
     ASSERT(m_mask_list_model);
-    MaskList* holder_item = m_mask_list_model->maskContItem();
+    MasksSet* holder_item = m_mask_list_model->maskContItem();
     ASSERT(holder_item);
     for (MaskItem* mask_item : holder_item->modifiableMaskItems()) {
         IOverlay* item_overlay = registerOverlay(mask_item);
diff --git a/GUI/View/Setup/MaskPanel.cpp b/GUI/View/Setup/MaskPanel.cpp
index 9009dfcfc70..d5b4515230c 100644
--- a/GUI/View/Setup/MaskPanel.cpp
+++ b/GUI/View/Setup/MaskPanel.cpp
@@ -15,8 +15,8 @@
 #include "GUI/View/Setup/MaskPanel.h"
 #include "Fit/Param/RealLimits.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Model/Mask/MasksQModel.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Numeric/DoubleSpinBox.h"
 #include "GUI/View/Tool/LayoutUtil.h"
diff --git a/Tests/Unit/GUI/TestJobModel.cpp b/Tests/Unit/GUI/TestJobModel.cpp
index 397c1a3907b..7ed54aa6691 100644
--- a/Tests/Unit/GUI/TestJobModel.cpp
+++ b/Tests/Unit/GUI/TestJobModel.cpp
@@ -9,8 +9,8 @@
 #include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Model/Mask/MaskItems.h"
-#include "GUI/Model/Mask/MaskList.h"
 #include "GUI/Model/Mask/MasksQModel.h"
+#include "GUI/Model/Mask/MasksSet.h"
 #include "GUI/Model/Tune/JobsSet.h"
 #include "Tests/GTestWrapper/google_test.h"
 #include "Tests/Unit/GUI/Utils.h"
@@ -147,7 +147,7 @@ TEST(TestJobsSet, masksToDetector)
     mask.setYUp(4.0);
 
     // add mask to DatafileItem
-    MaskList* container = realItem.data2DItem()->getOrCreateMaskModel()->maskContItem();
+    MasksSet* container = realItem.data2DItem()->getOrCreateMaskModel()->maskContItem();
     container->addMaskItem(&mask);
 
     // add DatafileItem to job
-- 
GitLab


From 0755dd5307069527acc6c9abc1a9c6346ecb641e Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:44:59 +0100
Subject: [PATCH 26/31] rename class and sources
 GUI/View/Sample/SampleListModel -> GUI/View/Sample/SamplesQModel

---
 GUI/View/Sample/SampleListing.cpp             |  4 +--
 GUI/View/Sample/SampleListing.h               |  4 +--
 ...{SampleListModel.cpp => SamplesQModel.cpp} | 33 +++++++++----------
 .../{SampleListModel.h => SamplesQModel.h}    | 14 ++++----
 4 files changed, 27 insertions(+), 28 deletions(-)
 rename GUI/View/Sample/{SampleListModel.cpp => SamplesQModel.cpp} (81%)
 rename GUI/View/Sample/{SampleListModel.h => SamplesQModel.h} (85%)

diff --git a/GUI/View/Sample/SampleListing.cpp b/GUI/View/Sample/SampleListing.cpp
index 315b5daa077..7a42410a307 100644
--- a/GUI/View/Sample/SampleListing.cpp
+++ b/GUI/View/Sample/SampleListing.cpp
@@ -18,7 +18,7 @@
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/View/Layout/ApplicationSettings.h"
-#include "GUI/View/Sample/SampleListModel.h"
+#include "GUI/View/Sample/SamplesQModel.h"
 #include "GUI/View/Tool/ItemDelegateForHTML.h"
 #include "GUI/View/Widget/ItemViewOverlayButtons.h"
 #include <QAction>
@@ -63,7 +63,7 @@ protected:
 
 
 SampleListing::SampleListing()
-    : m_model(new SampleListModel)
+    : m_model(new SamplesQModel)
     , m_new_sample_action(new QAction(this))
     , m_import_sample_action(new QAction(this))
     , m_choose_from_library_action(new QAction(this))
diff --git a/GUI/View/Sample/SampleListing.h b/GUI/View/Sample/SampleListing.h
index fc3a6bacd42..1e4a4e80874 100644
--- a/GUI/View/Sample/SampleListing.h
+++ b/GUI/View/Sample/SampleListing.h
@@ -18,7 +18,7 @@
 #include <QListView>
 
 class SampleItem;
-class SampleListModel;
+class SamplesQModel;
 
 //! List view to select one sample (left side of layer-oriented sample editor)
 class SampleListing : public QListView {
@@ -58,7 +58,7 @@ private:
 
     void showContextMenu(const QPoint& pos);
 
-    SampleListModel* m_model;
+    SamplesQModel* m_model;
     QAction* m_new_sample_action;
     QAction* m_import_sample_action;
     QAction* m_choose_from_library_action;
diff --git a/GUI/View/Sample/SampleListModel.cpp b/GUI/View/Sample/SamplesQModel.cpp
similarity index 81%
rename from GUI/View/Sample/SampleListModel.cpp
rename to GUI/View/Sample/SamplesQModel.cpp
index 00da1b5cc73..5bea6d938e8 100644
--- a/GUI/View/Sample/SampleListModel.cpp
+++ b/GUI/View/Sample/SamplesQModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Sample/SampleListModel.cpp
-//! @brief     Implements class SampleListModel.
+//! @file      GUI/View/Sample/SamplesQModel.cpp
+//! @brief     Implements class SamplesQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/Sample/SampleListModel.h"
+#include "GUI/View/Sample/SamplesQModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/FromCore/GUIExamplesFactory.h"
 #include "GUI/Model/FromCore/ItemizeSample.h"
@@ -24,12 +24,12 @@
 #include "Sample/Multilayer/MultiLayer.h"
 #include <QIcon>
 
-SampleListModel::SampleListModel()
+SamplesQModel::SamplesQModel()
     : m_sample_items(gDoc->sampleModel())
 {
 }
 
-int SampleListModel::rowCount(const QModelIndex& parent) const
+int SamplesQModel::rowCount(const QModelIndex& parent) const
 {
     if (parent.isValid())
         return 0;
@@ -37,7 +37,7 @@ int SampleListModel::rowCount(const QModelIndex& parent) const
     return m_sample_items->sampleItems().size();
 }
 
-QVariant SampleListModel::data(const QModelIndex& index, int role) const
+QVariant SamplesQModel::data(const QModelIndex& index, int role) const
 {
     auto* const item = itemForIndex(index);
 
@@ -64,7 +64,7 @@ QVariant SampleListModel::data(const QModelIndex& index, int role) const
     return {};
 }
 
-Qt::ItemFlags SampleListModel::flags(const QModelIndex& index) const
+Qt::ItemFlags SamplesQModel::flags(const QModelIndex& index) const
 {
     auto f = QAbstractItemModel::flags(index);
     f |= Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled;
@@ -72,7 +72,7 @@ Qt::ItemFlags SampleListModel::flags(const QModelIndex& index) const
     return f;
 }
 
-bool SampleListModel::setData(const QModelIndex& index, const QVariant& value, int role)
+bool SamplesQModel::setData(const QModelIndex& index, const QVariant& value, int role)
 {
     if (!index.isValid())
         return false;
@@ -92,7 +92,7 @@ bool SampleListModel::setData(const QModelIndex& index, const QVariant& value, i
     return false;
 }
 
-SampleItem* SampleListModel::itemForIndex(const QModelIndex& index) const
+SampleItem* SamplesQModel::itemForIndex(const QModelIndex& index) const
 {
     if (!index.isValid())
         return nullptr;
@@ -100,7 +100,7 @@ SampleItem* SampleListModel::itemForIndex(const QModelIndex& index) const
     return m_sample_items->sampleItems()[index.row()];
 }
 
-QModelIndex SampleListModel::indexForItem(SampleItem* item) const
+QModelIndex SamplesQModel::indexForItem(SampleItem* item) const
 {
     if (auto row = m_sample_items->sampleItems().indexOf(item); row >= 0)
         return index(row, 0);
@@ -108,7 +108,7 @@ QModelIndex SampleListModel::indexForItem(SampleItem* item) const
     return {};
 }
 
-void SampleListModel::removeSample(SampleItem* item)
+void SamplesQModel::removeSample(SampleItem* item)
 {
     QModelIndex index = indexForItem(item);
     if (!index.isValid())
@@ -119,7 +119,7 @@ void SampleListModel::removeSample(SampleItem* item)
     endRemoveRows();
 }
 
-QModelIndex SampleListModel::copySample(SampleItem* item)
+QModelIndex SamplesQModel::copySample(SampleItem* item)
 {
     ASSERT(item);
     const QStringList existingNames = m_sample_items->sampleNames();
@@ -132,7 +132,7 @@ QModelIndex SampleListModel::copySample(SampleItem* item)
     return indexForItem(copy_item);
 }
 
-QModelIndex SampleListModel::createSample()
+QModelIndex SamplesQModel::createSample()
 {
     const QStringList existingNames = m_sample_items->sampleNames();
 
@@ -145,9 +145,8 @@ QModelIndex SampleListModel::createSample()
     return indexForItem(sample_item);
 }
 
-QModelIndex SampleListModel::createSampleFromExamples(const QString& className,
-                                                      const QString& title,
-                                                      const QString& description)
+QModelIndex SamplesQModel::createSampleFromExamples(const QString& className, const QString& title,
+                                                    const QString& description)
 {
     auto* sample = dynamic_cast<SampleItem*>(GUI::ExamplesFactory::itemizeSample(className));
     if (!sample)
@@ -163,7 +162,7 @@ QModelIndex SampleListModel::createSampleFromExamples(const QString& className,
 }
 
 #ifdef BORNAGAIN_PYTHON
-QModelIndex SampleListModel::createSampleFromPython()
+QModelIndex SamplesQModel::createSampleFromPython()
 {
     std::unique_ptr<MultiLayer> sample = PyImportAssistant::importMultiLayer();
     if (!sample)
diff --git a/GUI/View/Sample/SampleListModel.h b/GUI/View/Sample/SamplesQModel.h
similarity index 85%
rename from GUI/View/Sample/SampleListModel.h
rename to GUI/View/Sample/SamplesQModel.h
index a8468b4f382..1f54b1d1e92 100644
--- a/GUI/View/Sample/SampleListModel.h
+++ b/GUI/View/Sample/SamplesQModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Sample/SampleListModel.h
-//! @brief     Defines class SampleListModel.
+//! @file      GUI/View/Sample/SamplesQModel.h
+//! @brief     Defines class SamplesQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLELISTMODEL_H
-#define BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLELISTMODEL_H
+#ifndef BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLESQMODEL_H
+#define BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLESQMODEL_H
 
 #include <QAbstractItemModel>
 
@@ -21,10 +21,10 @@ class SampleItem;
 class SamplesSet;
 
 //! List model for sample selection (used in the left pane of the layer oriented sample editor)
-class SampleListModel : public QAbstractListModel {
+class SamplesQModel : public QAbstractListModel {
     Q_OBJECT
 public:
-    SampleListModel();
+    SamplesQModel();
 
     int rowCount(const QModelIndex& parent = QModelIndex()) const override;
     QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
@@ -60,4 +60,4 @@ private:
     SamplesSet* m_sample_items = nullptr;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLELISTMODEL_H
+#endif // BORNAGAIN_GUI_VIEW_SAMPLE_SAMPLESQMODEL_H
-- 
GitLab


From 3a83db0f80838fe8caec1863a5110b9ca1339855 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:45:29 +0100
Subject: [PATCH 27/31] rename class and sources
 GUI/View/JobControl/JobPropertiesTableModel ->
 GUI/View/JobControl/JobparQModel

---
 GUI/View/JobControl/JobPropertiesWidget.cpp   |  4 +--
 GUI/View/JobControl/JobPropertiesWidget.h     |  4 +--
 ...pertiesTableModel.cpp => JobparQModel.cpp} | 27 +++++++++----------
 ...bPropertiesTableModel.h => JobparQModel.h} | 14 +++++-----
 4 files changed, 24 insertions(+), 25 deletions(-)
 rename GUI/View/JobControl/{JobPropertiesTableModel.cpp => JobparQModel.cpp} (84%)
 rename GUI/View/JobControl/{JobPropertiesTableModel.h => JobparQModel.h} (77%)

diff --git a/GUI/View/JobControl/JobPropertiesWidget.cpp b/GUI/View/JobControl/JobPropertiesWidget.cpp
index 144f819b928..789d023ecce 100644
--- a/GUI/View/JobControl/JobPropertiesWidget.cpp
+++ b/GUI/View/JobControl/JobPropertiesWidget.cpp
@@ -16,7 +16,7 @@
 #include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Support/Data/JobStatus.h"
-#include "GUI/View/JobControl/JobPropertiesTableModel.h"
+#include "GUI/View/JobControl/JobparQModel.h"
 #include "GUI/View/Layout/mainwindow_constants.h"
 #include <QHeaderView>
 #include <QVBoxLayout>
@@ -38,7 +38,7 @@ JobPropertiesWidget::JobPropertiesWidget(QWidget* parent, Qt::WindowFlags f)
     : QWidget(parent, f)
     , m_tab_widget(new QTabWidget(this))
     , m_properties_view(new QTreeView(this))
-    , m_properties_model(new JobPropertiesTableModel(this))
+    , m_properties_model(new JobparQModel(this))
     , m_comments_editor(new QTextEdit(this))
     , m_job_item(nullptr)
 {
diff --git a/GUI/View/JobControl/JobPropertiesWidget.h b/GUI/View/JobControl/JobPropertiesWidget.h
index 25e8281651d..2a46fe23d60 100644
--- a/GUI/View/JobControl/JobPropertiesWidget.h
+++ b/GUI/View/JobControl/JobPropertiesWidget.h
@@ -22,7 +22,7 @@
 #include <QWidget>
 
 class JobItem;
-class JobPropertiesTableModel;
+class JobparQModel;
 
 //! The JobPropertiesWidget class holds component editor for JobItem. Part of JobSelector,
 //! resides at lower left corner of JobView.
@@ -45,7 +45,7 @@ private slots:
 private:
     QTabWidget* m_tab_widget;
     QTreeView* m_properties_view;
-    JobPropertiesTableModel* m_properties_model;
+    JobparQModel* m_properties_model;
     QTextEdit* m_comments_editor;
     JobItem* m_job_item;
 };
diff --git a/GUI/View/JobControl/JobPropertiesTableModel.cpp b/GUI/View/JobControl/JobparQModel.cpp
similarity index 84%
rename from GUI/View/JobControl/JobPropertiesTableModel.cpp
rename to GUI/View/JobControl/JobparQModel.cpp
index 9e2a829a910..6389e57e76f 100644
--- a/GUI/View/JobControl/JobPropertiesTableModel.cpp
+++ b/GUI/View/JobControl/JobparQModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/JobControl/JobPropertiesTableModel.cpp
-//! @brief     Implements class JobPropertiesTableModel.
+//! @file      GUI/View/JobControl/JobparQModel.cpp
+//! @brief     Implements class JobparQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/JobControl/JobPropertiesTableModel.h"
+#include "GUI/View/JobControl/JobparQModel.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Model/Job/BatchInfo.h"
 #include "GUI/Model/Job/JobItem.h"
@@ -37,33 +37,33 @@ const QString ModelDateShortFormat = "yyyy.MM.dd hh:mm:ss";
 
 } // namespace
 
-JobPropertiesTableModel::JobPropertiesTableModel(QObject* parent)
+JobparQModel::JobparQModel(QObject* parent)
     : QAbstractTableModel(parent)
     , m_job_item(nullptr)
 {
 }
 
-JobPropertiesTableModel::~JobPropertiesTableModel()
+JobparQModel::~JobparQModel()
 {
     if (m_job_item)
         disconnect(m_job_item, nullptr, this, nullptr);
 }
 
-int JobPropertiesTableModel::rowCount(const QModelIndex& parent) const
+int JobparQModel::rowCount(const QModelIndex& parent) const
 {
     if (!parent.isValid() && m_job_item)
         return NumRows;
     return 0;
 }
 
-int JobPropertiesTableModel::columnCount(const QModelIndex& parent) const
+int JobparQModel::columnCount(const QModelIndex& parent) const
 {
     if (!parent.isValid() && m_job_item)
         return NumColumns;
     return 0;
 }
 
-QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
+QVariant JobparQModel::data(const QModelIndex& index, int role) const
 {
     if ((role != Qt::DisplayRole && role != Qt::EditRole && role != Qt::ToolTipRole)
         || index.column() < 0 || index.column() >= NumColumns || index.row() < 0
@@ -107,8 +107,7 @@ QVariant JobPropertiesTableModel::data(const QModelIndex& index, int role) const
     }
 }
 
-QVariant JobPropertiesTableModel::headerData(int section, Qt::Orientation orientation,
-                                             int role) const
+QVariant JobparQModel::headerData(int section, Qt::Orientation orientation, int role) const
 {
     if (role == Qt::DisplayRole && orientation == Qt::Horizontal && section >= 0
         && section < NumColumns)
@@ -116,7 +115,7 @@ QVariant JobPropertiesTableModel::headerData(int section, Qt::Orientation orient
     return {};
 }
 
-Qt::ItemFlags JobPropertiesTableModel::flags(const QModelIndex& index) const
+Qt::ItemFlags JobparQModel::flags(const QModelIndex& index) const
 {
     Qt::ItemFlags f = QAbstractTableModel::flags(index);
     if (index.column() == Column::Value && index.row() == Row::Name && m_job_item)
@@ -124,7 +123,7 @@ Qt::ItemFlags JobPropertiesTableModel::flags(const QModelIndex& index) const
     return f;
 }
 
-bool JobPropertiesTableModel::setData(const QModelIndex& index, const QVariant& value, int role)
+bool JobparQModel::setData(const QModelIndex& index, const QVariant& value, int role)
 {
     if (role != Qt::EditRole || index.column() != Column::Value || index.row() != Row::Name
         || !m_job_item)
@@ -133,7 +132,7 @@ bool JobPropertiesTableModel::setData(const QModelIndex& index, const QVariant&
     return true;
 }
 
-void JobPropertiesTableModel::setJobItem(JobItem* jobItem)
+void JobparQModel::setJobItem(JobItem* jobItem)
 {
     beginResetModel();
     if (m_job_item)
@@ -144,7 +143,7 @@ void JobPropertiesTableModel::setJobItem(JobItem* jobItem)
     endResetModel();
 }
 
-void JobPropertiesTableModel::notifyJobPropertyChange()
+void JobparQModel::notifyJobPropertyChange()
 {
     // name
     connect(m_job_item->batchInfo(), &BatchInfo::jobNameChanged, [this](const QString&) {
diff --git a/GUI/View/JobControl/JobPropertiesTableModel.h b/GUI/View/JobControl/JobparQModel.h
similarity index 77%
rename from GUI/View/JobControl/JobPropertiesTableModel.h
rename to GUI/View/JobControl/JobparQModel.h
index 0e59a3c2239..f5432cd214d 100644
--- a/GUI/View/JobControl/JobPropertiesTableModel.h
+++ b/GUI/View/JobControl/JobparQModel.h
@@ -2,7 +2,7 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/JobControl/JobPropertiesTableModel.h
+//! @file      GUI/View/JobControl/JobparQModel.h
 //! @brief     Defines class JobPropertiesWidget.
 //!
 //! @homepage  http://www.bornagainproject.org
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBPROPERTIESTABLEMODEL_H
-#define BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBPROPERTIESTABLEMODEL_H
+#ifndef BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBPARQMODEL_H
+#define BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBPARQMODEL_H
 
 #include <QAbstractTableModel>
 
@@ -22,11 +22,11 @@ class JobItem;
 //! A table model for the properties of a job except for the comment.
 //! The name of the job is editable, all other fields are read only.
 
-class JobPropertiesTableModel : public QAbstractTableModel {
+class JobparQModel : public QAbstractTableModel {
     Q_OBJECT
 public:
-    explicit JobPropertiesTableModel(QObject* parent = nullptr);
-    ~JobPropertiesTableModel() override;
+    explicit JobparQModel(QObject* parent = nullptr);
+    ~JobparQModel() override;
     int rowCount(const QModelIndex& parent = QModelIndex()) const override;
     int columnCount(const QModelIndex& parent = QModelIndex()) const override;
     QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
@@ -42,4 +42,4 @@ private:
     JobItem* m_job_item;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBPROPERTIESTABLEMODEL_H
+#endif // BORNAGAIN_GUI_VIEW_JOBCONTROL_JOBPARQMODEL_H
-- 
GitLab


From b8e39d3c6e95900916da8163c84d8cb70f3af662 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:46:28 +0100
Subject: [PATCH 28/31] rename class and sources
 GUI/View/Material/MaterialTableModel -> GUI/View/Material/MaterialsQModel

---
 GUI/View/Material/MaterialEditorDialog.cpp    |  6 +--
 ...rialTableModel.cpp => MaterialsQModel.cpp} | 53 +++++++++----------
 ...MaterialTableModel.h => MaterialsQModel.h} | 14 ++---
 3 files changed, 36 insertions(+), 37 deletions(-)
 rename GUI/View/Material/{MaterialTableModel.cpp => MaterialsQModel.cpp} (72%)
 rename GUI/View/Material/{MaterialTableModel.h => MaterialsQModel.h} (86%)

diff --git a/GUI/View/Material/MaterialEditorDialog.cpp b/GUI/View/Material/MaterialEditorDialog.cpp
index e46ccfcde7f..7998702279c 100644
--- a/GUI/View/Material/MaterialEditorDialog.cpp
+++ b/GUI/View/Material/MaterialEditorDialog.cpp
@@ -19,7 +19,7 @@
 #include "GUI/Model/Sample/SampleItem.h"
 #include "GUI/Support/Style/Style.h"
 #include "GUI/View/Layout/ApplicationSettings.h"
-#include "GUI/View/Material/MaterialTableModel.h"
+#include "GUI/View/Material/MaterialsQModel.h"
 #include "GUI/View/Numeric/DoubleSpinBox.h"
 #include "GUI/View/Widget/StyledToolbar.h"
 #include <QAction>
@@ -70,7 +70,7 @@ private:
 
     QAction* m_remove_material_action;
 
-    MaterialTableModel* m_model;
+    MaterialsQModel* m_model;
     SampleItem* m_sample;
 
     QTreeView* m_tree_view;
@@ -95,7 +95,7 @@ MaterialEditorDialog::MaterialEditorDialog(SampleItem* sample, const QString& id
 {
     setObjectName("MaterialEditorDialog");
 
-    m_model = new MaterialTableModel(m_sample->materialModel());
+    m_model = new MaterialsQModel(m_sample->materialModel());
 
     setGeometry(0, 0, 1023, 469);
     setWindowTitle("Material Editor");
diff --git a/GUI/View/Material/MaterialTableModel.cpp b/GUI/View/Material/MaterialsQModel.cpp
similarity index 72%
rename from GUI/View/Material/MaterialTableModel.cpp
rename to GUI/View/Material/MaterialsQModel.cpp
index fc534e8e7f9..b54d94e81ea 100644
--- a/GUI/View/Material/MaterialTableModel.cpp
+++ b/GUI/View/Material/MaterialsQModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Material/MaterialTableModel.cpp
-//! @brief     Implements class MaterialTableModel.
+//! @file      GUI/View/Material/MaterialsQModel.cpp
+//! @brief     Implements class MaterialsQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,30 +12,30 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/Material/MaterialTableModel.h"
+#include "GUI/View/Material/MaterialsQModel.h"
 #include "GUI/Model/Material/MaterialItem.h"
 #include "GUI/Model/Material/MaterialsSet.h"
 #include <QApplication>
 #include <QFontMetrics>
 #include <QPixmap>
 
-MaterialTableModel::MaterialTableModel(MaterialsSet& model)
+MaterialsQModel::MaterialsQModel(MaterialsSet& model)
     : m_model(model)
 {
 }
 
-int MaterialTableModel::rowCount(const QModelIndex& /*parent = QModelIndex()*/) const
+int MaterialsQModel::rowCount(const QModelIndex& /*parent = QModelIndex()*/) const
 {
     return m_model.materialItems().size();
 }
 
-int MaterialTableModel::columnCount(const QModelIndex& /*parent = QModelIndex()*/) const
+int MaterialsQModel::columnCount(const QModelIndex& /*parent = QModelIndex()*/) const
 {
     return NUM_COLUMNS;
 }
 
-QVariant MaterialTableModel::headerData(int section, Qt::Orientation /*orientation*/,
-                                        int role /* = Qt::DisplayRole */) const
+QVariant MaterialsQModel::headerData(int section, Qt::Orientation /*orientation*/,
+                                     int role /* = Qt::DisplayRole */) const
 {
     if (role != Qt::DisplayRole)
         return {};
@@ -54,7 +54,7 @@ QVariant MaterialTableModel::headerData(int section, Qt::Orientation /*orientati
     }
 }
 
-QVariant MaterialTableModel::data(const QModelIndex& index, int role /*= Qt::DisplayRole*/) const
+QVariant MaterialsQModel::data(const QModelIndex& index, int role /*= Qt::DisplayRole*/) const
 {
     if (!index.isValid())
         return {};
@@ -95,19 +95,19 @@ QVariant MaterialTableModel::data(const QModelIndex& index, int role /*= Qt::Dis
     return {};
 }
 
-void MaterialTableModel::setMaterialItemName(const QModelIndex& index, const QString& name)
+void MaterialsQModel::setMaterialItemName(const QModelIndex& index, const QString& name)
 {
     materialItemFromIndex(index)->setMatItemName(name);
     emit dataChanged(index, index);
 }
 
-void MaterialTableModel::setColor(const QModelIndex& index, const QColor& color)
+void MaterialsQModel::setColor(const QModelIndex& index, const QColor& color)
 {
     materialItemFromIndex(index)->setColor(color);
     emit dataChanged(index, index);
 }
 
-void MaterialTableModel::setX(const QModelIndex& index, double value)
+void MaterialsQModel::setX(const QModelIndex& index, double value)
 {
     auto* material = materialItemFromIndex(index);
     R3 m = material->magnetization();
@@ -117,7 +117,7 @@ void MaterialTableModel::setX(const QModelIndex& index, double value)
     emit dataChanged(magIndex, magIndex);
 }
 
-void MaterialTableModel::setY(const QModelIndex& index, double value)
+void MaterialsQModel::setY(const QModelIndex& index, double value)
 {
     auto* material = materialItemFromIndex(index);
     R3 m = material->magnetization();
@@ -127,7 +127,7 @@ void MaterialTableModel::setY(const QModelIndex& index, double value)
     emit dataChanged(magIndex, magIndex);
 }
 
-void MaterialTableModel::setZ(const QModelIndex& index, double value)
+void MaterialsQModel::setZ(const QModelIndex& index, double value)
 {
     auto* material = materialItemFromIndex(index);
     R3 m = material->magnetization();
@@ -137,7 +137,7 @@ void MaterialTableModel::setZ(const QModelIndex& index, double value)
     emit dataChanged(magIndex, magIndex);
 }
 
-void MaterialTableModel::setDelta(const QModelIndex& index, double value)
+void MaterialsQModel::setDelta(const QModelIndex& index, double value)
 {
     auto* m = materialItemFromIndex(index);
     m->setRefractiveIndex(value, m->beta());
@@ -145,7 +145,7 @@ void MaterialTableModel::setDelta(const QModelIndex& index, double value)
     emit dataChanged(paramIndex, paramIndex);
 }
 
-void MaterialTableModel::setBeta(const QModelIndex& index, double value)
+void MaterialsQModel::setBeta(const QModelIndex& index, double value)
 {
     auto* m = materialItemFromIndex(index);
     m->setRefractiveIndex(m->delta(), value);
@@ -153,7 +153,7 @@ void MaterialTableModel::setBeta(const QModelIndex& index, double value)
     emit dataChanged(paramIndex, paramIndex);
 }
 
-void MaterialTableModel::setRe(const QModelIndex& index, double value)
+void MaterialsQModel::setRe(const QModelIndex& index, double value)
 {
     auto* m = materialItemFromIndex(index);
     m->setScatteringLengthDensity(complex_t(value, m->sldIm()));
@@ -161,7 +161,7 @@ void MaterialTableModel::setRe(const QModelIndex& index, double value)
     emit dataChanged(paramIndex, paramIndex);
 }
 
-void MaterialTableModel::setIm(const QModelIndex& index, double value)
+void MaterialsQModel::setIm(const QModelIndex& index, double value)
 {
     auto* m = materialItemFromIndex(index);
     m->setScatteringLengthDensity(complex_t(m->sldRe(), value));
@@ -169,12 +169,12 @@ void MaterialTableModel::setIm(const QModelIndex& index, double value)
     emit dataChanged(paramIndex, paramIndex);
 }
 
-MaterialItem* MaterialTableModel::materialItemFromIndex(const QModelIndex& index) const
+MaterialItem* MaterialsQModel::materialItemFromIndex(const QModelIndex& index) const
 {
     return index.isValid() ? m_model.materialItems()[index.row()] : nullptr;
 }
 
-QModelIndex MaterialTableModel::indexFromMaterial(const QString& identifier) const
+QModelIndex MaterialsQModel::indexFromMaterial(const QString& identifier) const
 {
     const auto materials = m_model.materialItems();
     for (int row = 0; row < materials.size(); row++)
@@ -183,7 +183,7 @@ QModelIndex MaterialTableModel::indexFromMaterial(const QString& identifier) con
     return {};
 }
 
-QModelIndex MaterialTableModel::indexFromMaterial(const MaterialItem* m) const
+QModelIndex MaterialsQModel::indexFromMaterial(const MaterialItem* m) const
 {
     const auto materials = m_model.materialItems();
     for (int row = 0; row < materials.size(); row++)
@@ -192,13 +192,13 @@ QModelIndex MaterialTableModel::indexFromMaterial(const MaterialItem* m) const
     return {};
 }
 
-QModelIndex MaterialTableModel::first() const
+QModelIndex MaterialsQModel::first() const
 {
     return index(0, 0);
 }
 
-MaterialItem* MaterialTableModel::addRefractiveMaterialItem(const QString& name, double delta,
-                                                            double beta)
+MaterialItem* MaterialsQModel::addRefractiveMaterialItem(const QString& name, double delta,
+                                                         double beta)
 {
     beginInsertRows(QModelIndex(), rowCount(), rowCount());
     auto* m = m_model.addRefractiveMaterialItem(name, delta, beta);
@@ -206,8 +206,7 @@ MaterialItem* MaterialTableModel::addRefractiveMaterialItem(const QString& name,
     return m;
 }
 
-MaterialItem* MaterialTableModel::addSLDMaterialItem(const QString& name, double sld,
-                                                     double abs_term)
+MaterialItem* MaterialsQModel::addSLDMaterialItem(const QString& name, double sld, double abs_term)
 {
     beginInsertRows(QModelIndex(), rowCount(), rowCount());
     auto* m = m_model.addSLDMaterialItem(name, sld, abs_term);
@@ -215,7 +214,7 @@ MaterialItem* MaterialTableModel::addSLDMaterialItem(const QString& name, double
     return m;
 }
 
-void MaterialTableModel::removeMaterial(const QModelIndex& index)
+void MaterialsQModel::removeMaterial(const QModelIndex& index)
 {
     beginRemoveRows(QModelIndex(), index.row(), index.row());
     m_model.removeMaterialItem(materialItemFromIndex(index));
diff --git a/GUI/View/Material/MaterialTableModel.h b/GUI/View/Material/MaterialsQModel.h
similarity index 86%
rename from GUI/View/Material/MaterialTableModel.h
rename to GUI/View/Material/MaterialsQModel.h
index 6a2e84ad52e..070bc48f5ba 100644
--- a/GUI/View/Material/MaterialTableModel.h
+++ b/GUI/View/Material/MaterialsQModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Material/MaterialTableModel.h
-//! @brief     Defines class MaterialTableModel.
+//! @file      GUI/View/Material/MaterialsQModel.h
+//! @brief     Defines class MaterialsQModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_MATERIAL_MATERIALTABLEMODEL_H
-#define BORNAGAIN_GUI_VIEW_MATERIAL_MATERIALTABLEMODEL_H
+#ifndef BORNAGAIN_GUI_VIEW_MATERIAL_MATERIALSQMODEL_H
+#define BORNAGAIN_GUI_VIEW_MATERIAL_MATERIALSQMODEL_H
 
 #include <QAbstractItemModel>
 
@@ -24,10 +24,10 @@ class MaterialsSet;
 //!
 //! This model is also used for changing values of a material, therefore the list can be
 //! updated accordingly.
-class MaterialTableModel : public QAbstractTableModel {
+class MaterialsQModel : public QAbstractTableModel {
     Q_OBJECT
 public:
-    MaterialTableModel(MaterialsSet& model);
+    MaterialsQModel(MaterialsSet& model);
 
     int rowCount(const QModelIndex& parent = QModelIndex()) const override;
     int columnCount(const QModelIndex& parent = QModelIndex()) const override;
@@ -63,4 +63,4 @@ private:
 };
 
 
-#endif // BORNAGAIN_GUI_VIEW_MATERIAL_MATERIALTABLEMODEL_H
+#endif // BORNAGAIN_GUI_VIEW_MATERIAL_MATERIALSQMODEL_H
-- 
GitLab


From c59879f18e693a70d92e02d7b38b65ce0656f1d6 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:48:58 +0100
Subject: [PATCH 29/31] rename class and sources
 GUI/View/Instrument/InstrumentListModel ->
 GUI/View/Instrument/InstrumentsQListModel

---
 GUI/View/Instrument/InstrumentListing.cpp     |  4 +--
 GUI/View/Instrument/InstrumentListing.h       |  4 +--
 ...istModel.cpp => InstrumentsQListModel.cpp} | 34 +++++++++----------
 ...entListModel.h => InstrumentsQListModel.h} | 14 ++++----
 4 files changed, 28 insertions(+), 28 deletions(-)
 rename GUI/View/Instrument/{InstrumentListModel.cpp => InstrumentsQListModel.cpp} (80%)
 rename GUI/View/Instrument/{InstrumentListModel.h => InstrumentsQListModel.h} (80%)

diff --git a/GUI/View/Instrument/InstrumentListing.cpp b/GUI/View/Instrument/InstrumentListing.cpp
index ef7d522653c..4c6f599dc6d 100644
--- a/GUI/View/Instrument/InstrumentListing.cpp
+++ b/GUI/View/Instrument/InstrumentListing.cpp
@@ -16,7 +16,7 @@
 #include "GUI/Model/Device/InstrumentLibrary.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/View/Instrument/InstrumentLibraryDialog.h"
-#include "GUI/View/Instrument/InstrumentListModel.h"
+#include "GUI/View/Instrument/InstrumentsQListModel.h"
 #include "GUI/View/Tool/Globals.h"
 #include <QAction>
 #include <QMessageBox>
@@ -24,7 +24,7 @@
 
 InstrumentListing::InstrumentListing()
     : m_instrument_library(std::make_unique<InstrumentLibrary>())
-    , m_model(new InstrumentListModel)
+    , m_model(new InstrumentsQListModel)
     , m_separator_action1(new QAction(this))
     , m_separator_action2(new QAction(this))
 {
diff --git a/GUI/View/Instrument/InstrumentListing.h b/GUI/View/Instrument/InstrumentListing.h
index b7e07660852..5e741ce0b59 100644
--- a/GUI/View/Instrument/InstrumentListing.h
+++ b/GUI/View/Instrument/InstrumentListing.h
@@ -19,7 +19,7 @@
 
 class InstrumentItem;
 class InstrumentLibrary;
-class InstrumentListModel;
+class InstrumentsQListModel;
 
 //! Instrument selector on the left side of InstrumentView.
 
@@ -59,7 +59,7 @@ private:
 
 private:
     std::unique_ptr<InstrumentLibrary> m_instrument_library;
-    InstrumentListModel* m_model;
+    InstrumentsQListModel* m_model;
     QAction* m_new_gisas_action;
     QAction* m_new_offspec_action;
     QAction* m_new_specular_action;
diff --git a/GUI/View/Instrument/InstrumentListModel.cpp b/GUI/View/Instrument/InstrumentsQListModel.cpp
similarity index 80%
rename from GUI/View/Instrument/InstrumentListModel.cpp
rename to GUI/View/Instrument/InstrumentsQListModel.cpp
index 1791940ce36..e46dcdf04d2 100644
--- a/GUI/View/Instrument/InstrumentListModel.cpp
+++ b/GUI/View/Instrument/InstrumentsQListModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Instrument/InstrumentListModel.cpp
-//! @brief     Implements class InstrumentListModel.
+//! @file      GUI/View/Instrument/InstrumentsQListModel.cpp
+//! @brief     Implements class InstrumentsQListModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/Instrument/InstrumentListModel.h"
+#include "GUI/View/Instrument/InstrumentsQListModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Model/Device/MultiInstrumentNotifier.h"
@@ -49,7 +49,7 @@ template <> QString defaultInstrumentName<OffspecInstrumentItem>()
 } // namespace
 
 
-InstrumentListModel::InstrumentListModel()
+InstrumentsQListModel::InstrumentsQListModel()
     : m_notifier(gDoc->multiNotifier())
 {
     m_gisas_icon.addPixmap(QPixmap(":/images/gisas_instrument.svg"), QIcon::Selected);
@@ -62,15 +62,15 @@ InstrumentListModel::InstrumentListModel()
     m_depth_probe_icon.addPixmap(QPixmap(":/images/depth_instrument_shaded.svg"), QIcon::Normal);
 
     connect(m_notifier, &MultiInstrumentNotifier::instrumentNameChanged, this,
-            &InstrumentListModel::onInstrumentNameChanged);
+            &InstrumentsQListModel::onInstrumentNameChanged);
 }
 
-int InstrumentListModel::rowCount(const QModelIndex&) const
+int InstrumentsQListModel::rowCount(const QModelIndex&) const
 {
     return m_notifier->instrumentModel()->instrumentItems().size();
 }
 
-QVariant InstrumentListModel::data(const QModelIndex& index, int role) const
+QVariant InstrumentsQListModel::data(const QModelIndex& index, int role) const
 {
     QVector<InstrumentItem*> instruments = m_notifier->instrumentModel()->instrumentItems();
     if (!index.isValid() || index.row() >= instruments.size() || index.row() < 0)
@@ -95,7 +95,7 @@ QVariant InstrumentListModel::data(const QModelIndex& index, int role) const
     return {};
 }
 
-InstrumentItem* InstrumentListModel::instrumentItemForIndex(const QModelIndex& index) const
+InstrumentItem* InstrumentsQListModel::instrumentItemForIndex(const QModelIndex& index) const
 {
     if (!index.isValid())
         return nullptr;
@@ -106,27 +106,27 @@ InstrumentItem* InstrumentListModel::instrumentItemForIndex(const QModelIndex& i
     return nullptr;
 }
 
-QModelIndex InstrumentListModel::addNewGISASInstrument()
+QModelIndex InstrumentsQListModel::addNewGISASInstrument()
 {
     return addNewInstrument<GISASInstrumentItem>();
 }
 
-QModelIndex InstrumentListModel::addNewOffspecInstrument()
+QModelIndex InstrumentsQListModel::addNewOffspecInstrument()
 {
     return addNewInstrument<OffspecInstrumentItem>();
 }
 
-QModelIndex InstrumentListModel::addNewSpecularInstrument()
+QModelIndex InstrumentsQListModel::addNewSpecularInstrument()
 {
     return addNewInstrument<SpecularInstrumentItem>();
 }
 
-QModelIndex InstrumentListModel::addNewDepthprobeInstrument()
+QModelIndex InstrumentsQListModel::addNewDepthprobeInstrument()
 {
     return addNewInstrument<DepthprobeInstrumentItem>();
 }
 
-void InstrumentListModel::removeInstrument(const QModelIndex& index)
+void InstrumentsQListModel::removeInstrument(const QModelIndex& index)
 {
     beginRemoveRows(QModelIndex(), index.row(), index.row());
     InstrumentItem* instrument = instrumentItemForIndex(index);
@@ -134,7 +134,7 @@ void InstrumentListModel::removeInstrument(const QModelIndex& index)
     endRemoveRows();
 }
 
-QModelIndex InstrumentListModel::copyInstrument(const QModelIndex& source)
+QModelIndex InstrumentsQListModel::copyInstrument(const QModelIndex& source)
 {
     const InstrumentItem* srcInstr = instrumentItemForIndex(source);
     ASSERT(srcInstr);
@@ -142,7 +142,7 @@ QModelIndex InstrumentListModel::copyInstrument(const QModelIndex& source)
     return copyInstrument(srcInstr);
 }
 
-QModelIndex InstrumentListModel::copyInstrument(const InstrumentItem* source)
+QModelIndex InstrumentsQListModel::copyInstrument(const InstrumentItem* source)
 {
     const QString copyName =
         m_notifier->instrumentModel()->suggestInstrumentName(source->instrumentName());
@@ -155,7 +155,7 @@ QModelIndex InstrumentListModel::copyInstrument(const InstrumentItem* source)
     return createIndex(row, 0);
 }
 
-template <class Instrument> QModelIndex InstrumentListModel::addNewInstrument()
+template <class Instrument> QModelIndex InstrumentsQListModel::addNewInstrument()
 {
     const QString name =
         m_notifier->instrumentModel()->suggestInstrumentName(defaultInstrumentName<Instrument>());
@@ -169,7 +169,7 @@ template <class Instrument> QModelIndex InstrumentListModel::addNewInstrument()
     return createIndex(row, 0);
 }
 
-void InstrumentListModel::onInstrumentNameChanged(const InstrumentItem* instrument)
+void InstrumentsQListModel::onInstrumentNameChanged(const InstrumentItem* instrument)
 {
     const auto instruments = m_notifier->instrumentModel()->instrumentItems();
     if (const auto row = instruments.indexOf(instrument); row != -1)
diff --git a/GUI/View/Instrument/InstrumentListModel.h b/GUI/View/Instrument/InstrumentsQListModel.h
similarity index 80%
rename from GUI/View/Instrument/InstrumentListModel.h
rename to GUI/View/Instrument/InstrumentsQListModel.h
index ff6e6e8ad5e..51228d0ae0b 100644
--- a/GUI/View/Instrument/InstrumentListModel.h
+++ b/GUI/View/Instrument/InstrumentsQListModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Instrument/InstrumentListModel.h
-//! @brief     Defines class InstrumentListModel.
+//! @file      GUI/View/Instrument/InstrumentsQListModel.h
+//! @brief     Defines class InstrumentsQListModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTMODEL_H
-#define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTMODEL_H
+#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSQLISTMODEL_H
+#define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSQLISTMODEL_H
 
 #include <QAbstractListModel>
 #include <QIcon>
@@ -24,10 +24,10 @@ class MultiInstrumentNotifier;
 //! List model for instruments.
 //!
 //! Used e.g. to present the instrument list in the instrument view.
-class InstrumentListModel : public QAbstractListModel {
+class InstrumentsQListModel : public QAbstractListModel {
     Q_OBJECT
 public:
-    InstrumentListModel();
+    InstrumentsQListModel();
 
     int rowCount(const QModelIndex& parent = QModelIndex()) const override;
 
@@ -56,4 +56,4 @@ private:
     QIcon m_depth_probe_icon;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTMODEL_H
+#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSQLISTMODEL_H
-- 
GitLab


From 53d01378df509ec02f3c5a6baf3b2a77b003145b Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:49:11 +0100
Subject: [PATCH 30/31] rename class and sources
 GUI/View/Instrument/InstrumentsTreeModel ->
 GUI/View/Instrument/InstrumentsQTreeModel

---
 .../Instrument/InstrumentLibraryDialog.cpp    |  2 +-
 GUI/View/Instrument/InstrumentLibraryDialog.h |  4 +-
 ...reeModel.cpp => InstrumentsQTreeModel.cpp} | 44 +++++++++----------
 ...ntsTreeModel.h => InstrumentsQTreeModel.h} | 14 +++---
 4 files changed, 32 insertions(+), 32 deletions(-)
 rename GUI/View/Instrument/{InstrumentsTreeModel.cpp => InstrumentsQTreeModel.cpp} (83%)
 rename GUI/View/Instrument/{InstrumentsTreeModel.h => InstrumentsQTreeModel.h} (84%)

diff --git a/GUI/View/Instrument/InstrumentLibraryDialog.cpp b/GUI/View/Instrument/InstrumentLibraryDialog.cpp
index c9c937bc4b4..b1cf9eee315 100644
--- a/GUI/View/Instrument/InstrumentLibraryDialog.cpp
+++ b/GUI/View/Instrument/InstrumentLibraryDialog.cpp
@@ -33,7 +33,7 @@ InstrumentLibraryDialog::InstrumentLibraryDialog(QWidget* parent,
                                                  InstrumentLibrary* instrumentLibrary)
     : QDialog(parent)
     , m_instrument_library(instrumentLibrary)
-    , m_tree_model(new InstrumentsTreeModel(this, instrumentLibrary->instrumentModel()))
+    , m_tree_model(new InstrumentsQTreeModel(this, instrumentLibrary->instrumentModel()))
     , m_chosen_item(nullptr)
 {
     // object name is needed to reload application settings
diff --git a/GUI/View/Instrument/InstrumentLibraryDialog.h b/GUI/View/Instrument/InstrumentLibraryDialog.h
index f73275bceab..7db44401630 100644
--- a/GUI/View/Instrument/InstrumentLibraryDialog.h
+++ b/GUI/View/Instrument/InstrumentLibraryDialog.h
@@ -15,7 +15,7 @@
 #ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLIBRARYDIALOG_H
 #define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLIBRARYDIALOG_H
 
-#include "GUI/View/Instrument/InstrumentsTreeModel.h"
+#include "GUI/View/Instrument/InstrumentsQTreeModel.h"
 #include "GUI/View/Widget/GroupBoxes.h"
 #include <QDialog>
 #include <QDialogButtonBox>
@@ -47,7 +47,7 @@ private:
     void onInstrumentDescriptionEdited(const QString& t);
 
     InstrumentLibrary* m_instrument_library;
-    InstrumentsTreeModel* m_tree_model;
+    InstrumentsQTreeModel* m_tree_model;
     InstrumentItem* m_chosen_item;
 
     QTreeView* m_tree_view;
diff --git a/GUI/View/Instrument/InstrumentsTreeModel.cpp b/GUI/View/Instrument/InstrumentsQTreeModel.cpp
similarity index 83%
rename from GUI/View/Instrument/InstrumentsTreeModel.cpp
rename to GUI/View/Instrument/InstrumentsQTreeModel.cpp
index b78c5e536ee..ebdaf98f2f0 100644
--- a/GUI/View/Instrument/InstrumentsTreeModel.cpp
+++ b/GUI/View/Instrument/InstrumentsQTreeModel.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Instrument/InstrumentsTreeModel.cpp
-//! @brief     Implements class InstrumentsTreeModel.
+//! @file      GUI/View/Instrument/InstrumentsQTreeModel.cpp
+//! @brief     Implements class InstrumentsQTreeModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/Instrument/InstrumentsTreeModel.h"
+#include "GUI/View/Instrument/InstrumentsQTreeModel.h"
 #include "Base/Util/Assert.h"
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/Model/Device/InstrumentsSet.h"
@@ -21,14 +21,14 @@
 
 namespace {
 
-using IType = InstrumentsTreeModel::InstrumentType;
+using IType = InstrumentsQTreeModel::InstrumentType;
 
 const auto types = {IType::Gisas, IType::Offspec, IType::Specular, IType::Depthprobe};
 
 } // namespace
 
 
-InstrumentsTreeModel::InstrumentsTreeModel(QObject* parent, InstrumentsSet* model)
+InstrumentsQTreeModel::InstrumentsQTreeModel(QObject* parent, InstrumentsSet* model)
     : QAbstractItemModel(parent)
     , m_model(model)
     , m_names_are_editable(false)
@@ -36,12 +36,12 @@ InstrumentsTreeModel::InstrumentsTreeModel(QObject* parent, InstrumentsSet* mode
 {
 }
 
-void InstrumentsTreeModel::setNewInstrument(InstrumentItem* addedInstrument)
+void InstrumentsQTreeModel::setNewInstrument(InstrumentItem* addedInstrument)
 {
     m_new_instrument = addedInstrument;
 }
 
-void InstrumentsTreeModel::enableEmptyHeadlines(bool b)
+void InstrumentsQTreeModel::enableEmptyHeadlines(bool b)
 {
     if (b == m_enable_empty_headlines)
         return;
@@ -50,13 +50,13 @@ void InstrumentsTreeModel::enableEmptyHeadlines(bool b)
     endResetModel();
 }
 
-void InstrumentsTreeModel::clear()
+void InstrumentsQTreeModel::clear()
 {
     beginResetModel();
     endResetModel();
 }
 
-QVector<InstrumentItem*> InstrumentsTreeModel::instrumentItemsOfType(InstrumentType type) const
+QVector<InstrumentItem*> InstrumentsQTreeModel::instrumentItemsOfType(InstrumentType type) const
 {
     switch (type) {
     case Gisas:
@@ -80,7 +80,7 @@ QVector<InstrumentItem*> InstrumentsTreeModel::instrumentItemsOfType(InstrumentT
     }
 }
 
-QModelIndex InstrumentsTreeModel::indexOfHeadline(InstrumentType type) const
+QModelIndex InstrumentsQTreeModel::indexOfHeadline(InstrumentType type) const
 {
     int row = 0;
     for (auto t : ::types) {
@@ -92,7 +92,7 @@ QModelIndex InstrumentsTreeModel::indexOfHeadline(InstrumentType type) const
     return {};
 }
 
-QModelIndex InstrumentsTreeModel::index(int row, int column, const QModelIndex& parent) const
+QModelIndex InstrumentsQTreeModel::index(int row, int column, const QModelIndex& parent) const
 {
     if (!hasIndex(row, column, parent))
         return {};
@@ -107,7 +107,7 @@ QModelIndex InstrumentsTreeModel::index(int row, int column, const QModelIndex&
     return {};
 }
 
-QModelIndex InstrumentsTreeModel::parent(const QModelIndex& index) const
+QModelIndex InstrumentsQTreeModel::parent(const QModelIndex& index) const
 {
     if (!index.isValid())
         return {};
@@ -123,12 +123,12 @@ QModelIndex InstrumentsTreeModel::parent(const QModelIndex& index) const
     return {};
 }
 
-int InstrumentsTreeModel::columnCount(const QModelIndex& /*parent*/) const
+int InstrumentsQTreeModel::columnCount(const QModelIndex& /*parent*/) const
 {
     return 1;
 }
 
-int InstrumentsTreeModel::rowCount(const QModelIndex& parent) const
+int InstrumentsQTreeModel::rowCount(const QModelIndex& parent) const
 {
     if (!parent.isValid())
         return ::types.size();
@@ -141,7 +141,7 @@ int InstrumentsTreeModel::rowCount(const QModelIndex& parent) const
     return 0;
 }
 
-Qt::ItemFlags InstrumentsTreeModel::flags(const QModelIndex& index) const
+Qt::ItemFlags InstrumentsQTreeModel::flags(const QModelIndex& index) const
 {
     if (isHeadline(index) || !index.isValid())
         return Qt::NoItemFlags;
@@ -155,7 +155,7 @@ Qt::ItemFlags InstrumentsTreeModel::flags(const QModelIndex& index) const
     return f;
 }
 
-bool InstrumentsTreeModel::setData(const QModelIndex& index, const QVariant& value, int role)
+bool InstrumentsQTreeModel::setData(const QModelIndex& index, const QVariant& value, int role)
 {
     if (!index.isValid())
         return false;
@@ -175,7 +175,7 @@ bool InstrumentsTreeModel::setData(const QModelIndex& index, const QVariant& val
     return false;
 }
 
-InstrumentItem* InstrumentsTreeModel::itemForIndex(const QModelIndex& index) const
+InstrumentItem* InstrumentsQTreeModel::itemForIndex(const QModelIndex& index) const
 {
     if (!index.isValid())
         return nullptr;
@@ -183,7 +183,7 @@ InstrumentItem* InstrumentsTreeModel::itemForIndex(const QModelIndex& index) con
     return reinterpret_cast<InstrumentItem*>(index.internalPointer());
 }
 
-QModelIndex InstrumentsTreeModel::indexForItem(InstrumentItem* item) const
+QModelIndex InstrumentsQTreeModel::indexForItem(InstrumentItem* item) const
 {
     if (item == nullptr)
         return {};
@@ -195,7 +195,7 @@ QModelIndex InstrumentsTreeModel::indexForItem(InstrumentItem* item) const
     return {};
 }
 
-void InstrumentsTreeModel::removeItem(InstrumentItem* item)
+void InstrumentsQTreeModel::removeItem(InstrumentItem* item)
 {
     QModelIndex index = indexForItem(item);
     if (!index.isValid())
@@ -206,7 +206,7 @@ void InstrumentsTreeModel::removeItem(InstrumentItem* item)
     endRemoveRows();
 }
 
-bool InstrumentsTreeModel::isHeadline(const QModelIndex& index) const
+bool InstrumentsQTreeModel::isHeadline(const QModelIndex& index) const
 {
     if (!index.isValid())
         return false;
@@ -214,7 +214,7 @@ bool InstrumentsTreeModel::isHeadline(const QModelIndex& index) const
     return index.internalPointer() == nullptr;
 }
 
-InstrumentsTreeModel::InstrumentType InstrumentsTreeModel::instrumentType(InstrumentItem* item)
+InstrumentsQTreeModel::InstrumentType InstrumentsQTreeModel::instrumentType(InstrumentItem* item)
 {
     if (item->is<GISASInstrumentItem>())
         return Gisas;
@@ -231,7 +231,7 @@ InstrumentsTreeModel::InstrumentType InstrumentsTreeModel::instrumentType(Instru
     ASSERT_NEVER;
 }
 
-QVariant InstrumentsTreeModel::data(const QModelIndex& index, int role) const
+QVariant InstrumentsQTreeModel::data(const QModelIndex& index, int role) const
 {
     if (isHeadline(index)) {
         QString title;
diff --git a/GUI/View/Instrument/InstrumentsTreeModel.h b/GUI/View/Instrument/InstrumentsQTreeModel.h
similarity index 84%
rename from GUI/View/Instrument/InstrumentsTreeModel.h
rename to GUI/View/Instrument/InstrumentsQTreeModel.h
index 3c8c5429f5a..463bd405f23 100644
--- a/GUI/View/Instrument/InstrumentsTreeModel.h
+++ b/GUI/View/Instrument/InstrumentsQTreeModel.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Instrument/InstrumentsTreeModel.h
-//! @brief     Defines class InstrumentsTreeModel.
+//! @file      GUI/View/Instrument/InstrumentsQTreeModel.h
+//! @brief     Defines class InstrumentsQTreeModel.
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSTREEMODEL_H
-#define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSTREEMODEL_H
+#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSQTREEMODEL_H
+#define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSQTREEMODEL_H
 
 #include <QAbstractItemModel>
 
@@ -21,10 +21,10 @@ class InstrumentItem;
 class InstrumentsSet;
 
 //! Tree model for instrument item selection. Used e.g. for the instrument library.
-class InstrumentsTreeModel : public QAbstractItemModel {
+class InstrumentsQTreeModel : public QAbstractItemModel {
     Q_OBJECT
 public:
-    InstrumentsTreeModel(QObject* parent, InstrumentsSet* model);
+    InstrumentsQTreeModel(QObject* parent, InstrumentsSet* model);
 
     enum InstrumentType {
         None = 0x0,
@@ -70,4 +70,4 @@ private:
     InstrumentItem* m_new_instrument = nullptr;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSTREEMODEL_H
+#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTSQTREEMODEL_H
-- 
GitLab


From 7da810392d11d36dc360f1ab1c32d39d7c6e4380 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 18:55:20 +0100
Subject: [PATCH 31/31] sort forward decls

---
 GUI/Model/Data/Data2DItem.h     | 2 +-
 GUI/View/Fit/FitSessionWidget.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/GUI/Model/Data/Data2DItem.h b/GUI/Model/Data/Data2DItem.h
index f04bdecc2d6..d50fe9a3ba8 100644
--- a/GUI/Model/Data/Data2DItem.h
+++ b/GUI/Model/Data/Data2DItem.h
@@ -20,8 +20,8 @@
 class AmplitudeAxisItem;
 class ComboProperty;
 class LineItem;
-class MasksSet;
 class MasksQModel;
+class MasksSet;
 class ProjectionList;
 class QCPColorGradient;
 
diff --git a/GUI/View/Fit/FitSessionWidget.h b/GUI/View/Fit/FitSessionWidget.h
index 56e317f49fb..65aeee95e3e 100644
--- a/GUI/View/Fit/FitSessionWidget.h
+++ b/GUI/View/Fit/FitSessionWidget.h
@@ -18,12 +18,12 @@
 #include <QTabWidget>
 #include <QWidget>
 
+class FitEditor;
 class FitParameterWidget;
 class FitSessionController;
 class JobItem;
 class MinimizerEditor;
 class ParameterTuningWidget;
-class FitEditor;
 
 //! Contains all fit settings for given JobItem (fit parameters,
 //! minimizer settings). Controlled by FitActivityPanel.
-- 
GitLab