From 434258717d380bacfc8e8b466a2453f684b28a59 Mon Sep 17 00:00:00 2001
From: Joachim Wuttke <j.wuttke@fz-juelich.de>
Date: Tue, 23 Jan 2024 22:19:09 +0100
Subject: [PATCH] std fct name

---
 GUI/Model/Device/InstrumentLibrary.cpp          |  2 +-
 GUI/Model/Device/InstrumentLibrary.h            |  2 +-
 GUI/Model/Device/MultiInstrumentNotifier.h      |  2 +-
 GUI/Model/Project/LinkInstrumentManager.cpp     |  4 ++--
 GUI/Model/Project/ProjectDocument.cpp           |  2 +-
 GUI/Model/Project/ProjectDocument.h             |  2 +-
 GUI/View/Data/DatafileEditor.cpp                |  4 ++--
 GUI/View/Instrument/InstrumentLibraryDialog.cpp |  2 +-
 GUI/View/Instrument/InstrumentListing.cpp       |  4 ++--
 GUI/View/Instrument/InstrumentsQListModel.cpp   | 16 ++++++++--------
 GUI/View/Project/SimulationView.cpp             |  4 ++--
 Tests/Unit/GUI/TestAutosaveController.cpp       | 10 +++++-----
 Tests/Unit/GUI/TestLinkInstrument.cpp           |  4 ++--
 Tests/Unit/GUI/TestProjectDocument.cpp          | 10 +++++-----
 14 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/GUI/Model/Device/InstrumentLibrary.cpp b/GUI/Model/Device/InstrumentLibrary.cpp
index db9a8f783ee..a7eb898d0e9 100644
--- a/GUI/Model/Device/InstrumentLibrary.cpp
+++ b/GUI/Model/Device/InstrumentLibrary.cpp
@@ -142,7 +142,7 @@ bool InstrumentLibrary::load()
     }
 }
 
-InstrumentsSet* InstrumentLibrary::instrumentModel()
+InstrumentsSet* InstrumentLibrary::instrumentsSet()
 {
     return &m_instrument_model;
 }
diff --git a/GUI/Model/Device/InstrumentLibrary.h b/GUI/Model/Device/InstrumentLibrary.h
index 3e56ca8279e..b58b2cb109f 100644
--- a/GUI/Model/Device/InstrumentLibrary.h
+++ b/GUI/Model/Device/InstrumentLibrary.h
@@ -32,7 +32,7 @@ public:
     bool saveIfModified();
     bool load();
 
-    InstrumentsSet* instrumentModel();
+    InstrumentsSet* instrumentsSet();
 
     MultiInstrumentNotifier* editController();
 
diff --git a/GUI/Model/Device/MultiInstrumentNotifier.h b/GUI/Model/Device/MultiInstrumentNotifier.h
index 3cf69668441..90e726bbcd3 100644
--- a/GUI/Model/Device/MultiInstrumentNotifier.h
+++ b/GUI/Model/Device/MultiInstrumentNotifier.h
@@ -43,7 +43,7 @@ public:
     MultiInstrumentNotifier(InstrumentsSet* instruments);
 
     //! The list of existing instruments.
-    InstrumentsSet* instrumentModel() { return m_instruments; }
+    InstrumentsSet* instrumentsSet() { return m_instruments; }
 
     //! Add an instrument and emit the respective signal.
     template <typename T> T* addInstrumentItem();
diff --git a/GUI/Model/Project/LinkInstrumentManager.cpp b/GUI/Model/Project/LinkInstrumentManager.cpp
index 382a0b798c9..e6761204f57 100644
--- a/GUI/Model/Project/LinkInstrumentManager.cpp
+++ b/GUI/Model/Project/LinkInstrumentManager.cpp
@@ -89,7 +89,7 @@ LinkInstrumentManager::LinkInstrumentManager(ProjectDocument* document)
 bool LinkInstrumentManager::canLinkDataToInstrument(const DatafileItem* dfile_item,
                                                     const QString& identifier, QWidget* parent)
 {
-    auto* instrumentItem = m_document->instrumentModel()->findInstrumentItemById(identifier);
+    auto* instrumentItem = m_document->instrumentsSet()->findInstrumentItemById(identifier);
 
     // linking to null instrument is possible, it means unlinking from currently linked
     if (!instrumentItem)
@@ -133,6 +133,6 @@ void LinkInstrumentManager::onInstrumentAddedOrRemoved()
 {
     // remove links in realItems (in case of a linked instrument was removed)
     for (auto* dfile_item : m_document->realModel()->dfileItems())
-        if (!m_document->instrumentModel()->instrumentExists(dfile_item->instrumentId()))
+        if (!m_document->instrumentsSet()->instrumentExists(dfile_item->instrumentId()))
             dfile_item->unlinkFromInstrument();
 }
diff --git a/GUI/Model/Project/ProjectDocument.cpp b/GUI/Model/Project/ProjectDocument.cpp
index adfabacf3fb..baeb0de9765 100644
--- a/GUI/Model/Project/ProjectDocument.cpp
+++ b/GUI/Model/Project/ProjectDocument.cpp
@@ -118,7 +118,7 @@ void ProjectDocument::setProjectFullPath(const QString& fullPath)
     setProjectDir(GUI::Util::Project::projectDir(fullPath));
 }
 
-InstrumentsSet* ProjectDocument::instrumentModel()
+InstrumentsSet* ProjectDocument::instrumentsSet()
 {
     return m_instrument_model.get();
 }
diff --git a/GUI/Model/Project/ProjectDocument.h b/GUI/Model/Project/ProjectDocument.h
index 56b6ec97f03..6517668dc25 100644
--- a/GUI/Model/Project/ProjectDocument.h
+++ b/GUI/Model/Project/ProjectDocument.h
@@ -58,7 +58,7 @@ public:
     QString projectFullPath() const;
     void setProjectFullPath(const QString& fullPath);
 
-    InstrumentsSet* instrumentModel();
+    InstrumentsSet* instrumentsSet();
     SamplesSet* sampleModel();
     DatafilesSet* realModel();
     JobsSet* jobModel();
diff --git a/GUI/View/Data/DatafileEditor.cpp b/GUI/View/Data/DatafileEditor.cpp
index 3939e0918e1..7df9abacd81 100644
--- a/GUI/View/Data/DatafileEditor.cpp
+++ b/GUI/View/Data/DatafileEditor.cpp
@@ -77,7 +77,7 @@ void DatafileEditor::onInstrumentComboIndexChanged(int /*index*/)
     if (gDoc->linkInstrumentManager()->canLinkDataToInstrument(
             m_current_datafile_item, newSelectedInstrumentId, GUI::Global::mainWindow)) {
         const auto* newSelectedInstrument =
-            gDoc->instrumentModel()->findInstrumentItemById(newSelectedInstrumentId);
+            gDoc->instrumentsSet()->findInstrumentItemById(newSelectedInstrumentId);
         m_current_datafile_item->linkToInstrument(newSelectedInstrument);
         gDoc->setModified();
     }
@@ -100,7 +100,7 @@ void DatafileEditor::updateInstrumentComboEntries()
 
     // fill the combo. Userdata contains instrument's uid
     m_instrument_combo->addItem("Undefined", ""); // undefined instrument
-    for (auto* instrumentItem : gDoc->instrumentModel()->instrumentItems())
+    for (auto* instrumentItem : gDoc->instrumentsSet()->instrumentItems())
         m_instrument_combo->addItem(instrumentItem->instrumentName(), instrumentItem->id());
 
     updateInstrumentComboIndex();
diff --git a/GUI/View/Instrument/InstrumentLibraryDialog.cpp b/GUI/View/Instrument/InstrumentLibraryDialog.cpp
index b1cf9eee315..0fb20d0dd8a 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 InstrumentsQTreeModel(this, instrumentLibrary->instrumentModel()))
+    , m_tree_model(new InstrumentsQTreeModel(this, instrumentLibrary->instrumentsSet()))
     , m_chosen_item(nullptr)
 {
     // object name is needed to reload application settings
diff --git a/GUI/View/Instrument/InstrumentListing.cpp b/GUI/View/Instrument/InstrumentListing.cpp
index 4c6f599dc6d..959d7d931d8 100644
--- a/GUI/View/Instrument/InstrumentListing.cpp
+++ b/GUI/View/Instrument/InstrumentListing.cpp
@@ -149,7 +149,7 @@ void InstrumentListing::onItemSelectionChanged()
     QModelIndexList indexes = selectionModel()->selectedIndexes();
     if (!indexes.empty()) {
         QModelIndex current = indexes.front();
-        gDoc->instrumentModel()->setSelectedIndex(current.row());
+        gDoc->instrumentsSet()->setSelectedIndex(current.row());
         emit instrumentSelected(m_model->instrumentItemForIndex(current));
     } else
         emit instrumentSelected(nullptr);
@@ -248,7 +248,7 @@ void InstrumentListing::ensureItemSelected()
 
 void InstrumentListing::restoreSelection()
 {
-    int lastUsed = gDoc->instrumentModel()->selectedIndex();
+    int lastUsed = gDoc->instrumentsSet()->selectedIndex();
     if (lastUsed >= 0 && lastUsed < m_model->rowCount()) {
         QModelIndex lastUsedIndex = m_model->index(lastUsed, 0, QModelIndex());
         selectionModel()->select(lastUsedIndex, QItemSelectionModel::ClearAndSelect);
diff --git a/GUI/View/Instrument/InstrumentsQListModel.cpp b/GUI/View/Instrument/InstrumentsQListModel.cpp
index e46dcdf04d2..3bbb92589f7 100644
--- a/GUI/View/Instrument/InstrumentsQListModel.cpp
+++ b/GUI/View/Instrument/InstrumentsQListModel.cpp
@@ -67,12 +67,12 @@ InstrumentsQListModel::InstrumentsQListModel()
 
 int InstrumentsQListModel::rowCount(const QModelIndex&) const
 {
-    return m_notifier->instrumentModel()->instrumentItems().size();
+    return m_notifier->instrumentsSet()->instrumentItems().size();
 }
 
 QVariant InstrumentsQListModel::data(const QModelIndex& index, int role) const
 {
-    QVector<InstrumentItem*> instruments = m_notifier->instrumentModel()->instrumentItems();
+    QVector<InstrumentItem*> instruments = m_notifier->instrumentsSet()->instrumentItems();
     if (!index.isValid() || index.row() >= instruments.size() || index.row() < 0)
         return {};
 
@@ -100,7 +100,7 @@ InstrumentItem* InstrumentsQListModel::instrumentItemForIndex(const QModelIndex&
     if (!index.isValid())
         return nullptr;
 
-    QVector<InstrumentItem*> instruments = m_notifier->instrumentModel()->instrumentItems();
+    QVector<InstrumentItem*> instruments = m_notifier->instrumentsSet()->instrumentItems();
     if (index.row() >= 0 && index.row() < instruments.size())
         return instruments[index.row()];
     return nullptr;
@@ -145,8 +145,8 @@ QModelIndex InstrumentsQListModel::copyInstrument(const QModelIndex& source)
 QModelIndex InstrumentsQListModel::copyInstrument(const InstrumentItem* source)
 {
     const QString copyName =
-        m_notifier->instrumentModel()->suggestInstrumentName(source->instrumentName());
-    const int row = m_notifier->instrumentModel()->instrumentItems().size();
+        m_notifier->instrumentsSet()->suggestInstrumentName(source->instrumentName());
+    const int row = m_notifier->instrumentsSet()->instrumentItems().size();
 
     beginInsertRows(QModelIndex(), row, row);
     m_notifier->addInstrumentItemCopy(source, copyName);
@@ -158,8 +158,8 @@ QModelIndex InstrumentsQListModel::copyInstrument(const InstrumentItem* source)
 template <class Instrument> QModelIndex InstrumentsQListModel::addNewInstrument()
 {
     const QString name =
-        m_notifier->instrumentModel()->suggestInstrumentName(defaultInstrumentName<Instrument>());
-    const int row = m_notifier->instrumentModel()->instrumentItems().size();
+        m_notifier->instrumentsSet()->suggestInstrumentName(defaultInstrumentName<Instrument>());
+    const int row = m_notifier->instrumentsSet()->instrumentItems().size();
 
     beginInsertRows(QModelIndex(), row, row);
     auto* instrument = m_notifier->addInstrumentItem<Instrument>();
@@ -171,7 +171,7 @@ template <class Instrument> QModelIndex InstrumentsQListModel::addNewInstrument(
 
 void InstrumentsQListModel::onInstrumentNameChanged(const InstrumentItem* instrument)
 {
-    const auto instruments = m_notifier->instrumentModel()->instrumentItems();
+    const auto instruments = m_notifier->instrumentsSet()->instrumentItems();
     if (const auto row = instruments.indexOf(instrument); row != -1)
         emit dataChanged(index(row, 0), index(row, 0));
 }
diff --git a/GUI/View/Project/SimulationView.cpp b/GUI/View/Project/SimulationView.cpp
index f16deaaa7ff..5b02a0d38f9 100644
--- a/GUI/View/Project/SimulationView.cpp
+++ b/GUI/View/Project/SimulationView.cpp
@@ -219,7 +219,7 @@ void SimulationView::showEvent(QShowEvent*)
 void SimulationView::writeOptionsToUI()
 {
     // -- selection group
-    updateSelection(m_instrument_combo, gDoc->instrumentModel()->instrumentNames(),
+    updateSelection(m_instrument_combo, gDoc->instrumentsSet()->instrumentNames(),
                     optionsItem()->selectedInstrumentIndex());
     updateSelection(m_sample_combo, gDoc->sampleModel()->sampleNames(),
                     optionsItem()->selectedSampleIndex());
@@ -402,7 +402,7 @@ const SampleItem* SimulationView::selectedSampleItem() const
 
 const InstrumentItem* SimulationView::selectedInstrumentItem() const
 {
-    return gDoc->instrumentModel()->instrumentItems().value(m_instrument_combo->currentIndex(),
+    return gDoc->instrumentsSet()->instrumentItems().value(m_instrument_combo->currentIndex(),
                                                             nullptr);
 }
 
diff --git a/Tests/Unit/GUI/TestAutosaveController.cpp b/Tests/Unit/GUI/TestAutosaveController.cpp
index a76abb20c0f..67a053eb889 100644
--- a/Tests/Unit/GUI/TestAutosaveController.cpp
+++ b/Tests/Unit/GUI/TestAutosaveController.cpp
@@ -21,7 +21,7 @@ protected:
     // helper method to modify something in a model
     void modify_models(ProjectDocument& doc)
     {
-        auto* instrument = doc.instrumentModel()->instrumentItems().front();
+        auto* instrument = doc.instrumentsSet()->instrumentItems().front();
         doc.multiNotifier()->setInstrumentName(instrument, QUuid::createUuid().toString());
     }
     const int m_save_wait = 3000;
@@ -40,7 +40,7 @@ TEST_F(TestAutosaveController, autoSaveController)
     const int autosave_time(100);
 
     std::unique_ptr<ProjectDocument> document(new ProjectDocument);
-    auto* instrument = document->instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
+    auto* instrument = document->instrumentsSet()->addInstrumentItem<GISASInstrumentItem>();
     instrument->setInstrumentName("GISAS");
     document->saveProjectFileWithData(projectFileName);
 
@@ -84,7 +84,7 @@ TEST_F(TestAutosaveController, autoSaveController)
 TEST_F(TestAutosaveController, autoSaveControllerNewDocument)
 {
     std::unique_ptr<ProjectDocument> document(new ProjectDocument);
-    auto* instrument = document->instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
+    auto* instrument = document->instrumentsSet()->addInstrumentItem<GISASInstrumentItem>();
     instrument->setInstrumentName("GISAS");
 
     const int autosave_time(100);
@@ -115,12 +115,12 @@ TEST_F(TestAutosaveController, autosaveEnabled)
     EXPECT_TRUE(document != nullptr);
 
     document->setProjectFullPath(projectFileName);
-    auto* instrument = document->instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
+    auto* instrument = document->instrumentsSet()->addInstrumentItem<GISASInstrumentItem>();
     instrument->setInstrumentName("GISAS");
 
     DatafileItem* realData = UTest::GUI::createRealData2D("TestData", *document->realModel(), 0.);
     DataItem* data_item = realData->dataItem();
-    const Frame frame = document->instrumentModel()->instrument2DItems().front()->makeFrame();
+    const Frame frame = document->instrumentsSet()->instrument2DItems().front()->makeFrame();
     data_item->setDatafield({frame.clonedAxes()});
     document->clearModified();
     EXPECT_FALSE(document->isModified());
diff --git a/Tests/Unit/GUI/TestLinkInstrument.cpp b/Tests/Unit/GUI/TestLinkInstrument.cpp
index 4531e1492c5..42351ba2e30 100644
--- a/Tests/Unit/GUI/TestLinkInstrument.cpp
+++ b/Tests/Unit/GUI/TestLinkInstrument.cpp
@@ -39,7 +39,7 @@ TEST(TestLinkInstrument, canLinkToGisas)
     ProjectDocument document;
 
     // populating instrument model
-    auto* instrument = document.instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
+    auto* instrument = document.instrumentsSet()->addInstrumentItem<GISASInstrumentItem>();
     const QString identifier = instrument->id();
     ASSERT_TRUE(!identifier.isEmpty());
 
@@ -72,7 +72,7 @@ TEST(TestLinkInstrument, canLinkToSpecular)
 
     // populating instrument model
     auto* instrument = dynamic_cast<SpecularInstrumentItem*>(
-        document.instrumentModel()->addInstrumentItem<SpecularInstrumentItem>());
+        document.instrumentsSet()->addInstrumentItem<SpecularInstrumentItem>());
     const QString identifier = instrument->id();
     ASSERT_TRUE(!identifier.isEmpty());
 
diff --git a/Tests/Unit/GUI/TestProjectDocument.cpp b/Tests/Unit/GUI/TestProjectDocument.cpp
index 3d798484204..8b6cea0439f 100644
--- a/Tests/Unit/GUI/TestProjectDocument.cpp
+++ b/Tests/Unit/GUI/TestProjectDocument.cpp
@@ -21,7 +21,7 @@ protected:
     //! helper method to modify something in a model
     void modify_models(ProjectDocument& doc)
     {
-        auto* instrument = doc.instrumentModel()->instrumentItems().front();
+        auto* instrument = doc.instrumentsSet()->instrumentItems().front();
         doc.multiNotifier()->setInstrumentName(instrument, QUuid::createUuid().toString());
     }
 };
@@ -41,7 +41,7 @@ TEST_F(TestProjectDocument, projectDocument)
     EXPECT_EQ(document.projectName(), QString());
     EXPECT_EQ(document.projectFullPath(), QString());
 
-    auto* instrument = document.instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
+    auto* instrument = document.instrumentsSet()->addInstrumentItem<GISASInstrumentItem>();
     instrument->setInstrumentName("GISAS");
 
     // Checking document name and isModified status after project save
@@ -76,12 +76,12 @@ TEST_F(TestProjectDocument, projectDocumentWithData)
     const QString ext = QString(GUI::Util::Project::projectFileExtension);
 
     ProjectDocument document;
-    auto* instrument = document.instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
+    auto* instrument = document.instrumentsSet()->addInstrumentItem<GISASInstrumentItem>();
     instrument->setInstrumentName("GISAS");
     DatafileItem* realData = UTest::GUI::createRealData2D("TestData", *document.realModel(), 0.);
     ASSERT(realData);
     DataItem* data_item = realData->dataItem();
-    const Frame frame = document.instrumentModel()->instrument2DItems().front()->makeFrame();
+    const Frame frame = document.instrumentsSet()->instrument2DItems().front()->makeFrame();
     data_item->setDatafield({frame.clonedAxes()});
 
     document.setProjectDir(projectDir);
@@ -107,7 +107,7 @@ TEST_F(TestProjectDocument, failingProjectSave)
     const QString projectFileName(projectDir + "/document" + ext);
 
     std::unique_ptr<ProjectDocument> document(new ProjectDocument);
-    auto* instrument = document->instrumentModel()->addInstrumentItem<GISASInstrumentItem>();
+    auto* instrument = document->instrumentsSet()->addInstrumentItem<GISASInstrumentItem>();
     instrument->setInstrumentName("GISAS");
     modify_models(*document);
 
-- 
GitLab