From 8039d96a996dfd1cbc2f7ea75b6e31239bbe658d Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Tue, 31 Oct 2023 08:02:53 +0100
Subject: [PATCH] rename InstrumentListView -> InstrumentListing

---
 ...mentListView.cpp => InstrumentListing.cpp} | 65 +++++++++----------
 ...strumentListView.h => InstrumentListing.h} | 18 ++---
 GUI/View/Instrument/InstrumentView.cpp        |  6 +-
 GUI/View/Instrument/InstrumentView.h          |  4 +-
 4 files changed, 46 insertions(+), 47 deletions(-)
 rename GUI/View/Instrument/{InstrumentListView.cpp => InstrumentListing.cpp} (86%)
 rename GUI/View/Instrument/{InstrumentListView.h => InstrumentListing.h} (79%)

diff --git a/GUI/View/Instrument/InstrumentListView.cpp b/GUI/View/Instrument/InstrumentListing.cpp
similarity index 86%
rename from GUI/View/Instrument/InstrumentListView.cpp
rename to GUI/View/Instrument/InstrumentListing.cpp
index a32430e5813..7408c044a9b 100644
--- a/GUI/View/Instrument/InstrumentListView.cpp
+++ b/GUI/View/Instrument/InstrumentListing.cpp
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Instrument/InstrumentListView.cpp
-//! @brief     Implements class InstrumentListView
+//! @file      GUI/View/Instrument/InstrumentListing.cpp
+//! @brief     Implements class InstrumentListing
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,7 +12,7 @@
 //
 //  ************************************************************************************************
 
-#include "GUI/View/Instrument/InstrumentListView.h"
+#include "GUI/View/Instrument/InstrumentListing.h"
 #include "GUI/Model/Project/ProjectDocument.h"
 #include "GUI/Support/Tool/Globals.h"
 #include "GUI/View/Instrument/InstrumentLibraryEditor.h"
@@ -21,8 +21,7 @@
 #include <QMessageBox>
 #include <QVBoxLayout>
 
-InstrumentListView::InstrumentListView(ProjectDocument* document, QWidget* parent,
-                                       Qt::WindowFlags f)
+InstrumentListing::InstrumentListing(ProjectDocument* document, QWidget* parent, Qt::WindowFlags f)
     : QWidget(parent, f)
     , m_document(document)
 {
@@ -57,25 +56,25 @@ InstrumentListView::InstrumentListView(ProjectDocument* document, QWidget* paren
     m_newGisasAction = new QAction("New GISAS", this);
     m_newGisasAction->setIcon(QIcon(":/images/shape-square-plus.svg"));
     m_newGisasAction->setToolTip("Add new GISAS instrument with default settings");
-    connect(m_newGisasAction, &QAction::triggered, this, &InstrumentListView::onNewGisas);
+    connect(m_newGisasAction, &QAction::triggered, this, &InstrumentListing::onNewGisas);
     addAction(m_newGisasAction);
 
     m_newOffspecAction = new QAction("New off-specular", this);
     m_newOffspecAction->setIcon(QIcon(":/images/shape-square-plus.svg"));
     m_newOffspecAction->setToolTip("Add new off-specular instrument with default settings");
-    connect(m_newOffspecAction, &QAction::triggered, this, &InstrumentListView::onNewOffspec);
+    connect(m_newOffspecAction, &QAction::triggered, this, &InstrumentListing::onNewOffspec);
     addAction(m_newOffspecAction);
 
     m_newSpecularAction = new QAction("New specular", this);
     m_newSpecularAction->setIcon(QIcon(":/images/shape-square-plus.svg"));
     m_newSpecularAction->setToolTip("Add new specular instrument with default settings");
-    connect(m_newSpecularAction, &QAction::triggered, this, &InstrumentListView::onNewSpecular);
+    connect(m_newSpecularAction, &QAction::triggered, this, &InstrumentListing::onNewSpecular);
     addAction(m_newSpecularAction);
 
     m_newDepthprobeAction = new QAction("New depth probe", this);
     m_newDepthprobeAction->setIcon(QIcon(":/images/shape-square-plus.svg"));
     m_newDepthprobeAction->setToolTip("Add new depth probe instrument with default settings");
-    connect(m_newDepthprobeAction, &QAction::triggered, this, &InstrumentListView::onNewDepthprobe);
+    connect(m_newDepthprobeAction, &QAction::triggered, this, &InstrumentListing::onNewDepthprobe);
     addAction(m_newDepthprobeAction);
 
     m_separatorAction1 = new QAction(this);
@@ -85,13 +84,13 @@ InstrumentListView::InstrumentListView(ProjectDocument* document, QWidget* paren
     m_removeAction = new QAction("Remove", this);
     m_removeAction->setIcon(QIcon(":/images/delete.svg"));
     m_removeAction->setToolTip("Remove selected instrument");
-    connect(m_removeAction, &QAction::triggered, this, &InstrumentListView::onRemove);
+    connect(m_removeAction, &QAction::triggered, this, &InstrumentListing::onRemove);
     addAction(m_removeAction);
 
     m_copyAction = new QAction("Copy", this);
     m_copyAction->setIcon(QIcon(":/images/content-copy.svg"));
     m_copyAction->setToolTip("Make a copy of the selected instrument");
-    connect(m_copyAction, &QAction::triggered, this, &InstrumentListView::onCopy);
+    connect(m_copyAction, &QAction::triggered, this, &InstrumentListing::onCopy);
     addAction(m_copyAction);
 
     m_separatorAction2 = new QAction(this);
@@ -102,20 +101,20 @@ InstrumentListView::InstrumentListView(ProjectDocument* document, QWidget* paren
     m_storeInLibraryAction->setIcon(QIcon(":/images/library.svg"));
     m_storeInLibraryAction->setToolTip("Store instrument in library");
     connect(m_storeInLibraryAction, &QAction::triggered, this,
-            &InstrumentListView::onStoreInLibrary);
+            &InstrumentListing::onStoreInLibrary);
     addAction(m_storeInLibraryAction);
 
     m_loadFromLibraryAction = new QAction("Choose from library", this);
     m_loadFromLibraryAction->setIcon(QIcon(":/images/library.svg"));
     m_loadFromLibraryAction->setToolTip("Load an instrument from the instrument library");
     connect(m_loadFromLibraryAction, &QAction::triggered, this,
-            &InstrumentListView::onLoadFromLibrary);
+            &InstrumentListing::onLoadFromLibrary);
     addAction(m_loadFromLibraryAction);
 
     setContextMenuPolicy(Qt::ActionsContextMenu);
 
     connect(m_document, &ProjectDocument::functionalitiesChanged, this,
-            &InstrumentListView::updateFunctionalityNarrowing);
+            &InstrumentListing::updateFunctionalityNarrowing);
 
     updateFunctionalityNarrowing();
 
@@ -123,25 +122,25 @@ InstrumentListView::InstrumentListView(ProjectDocument* document, QWidget* paren
     restoreSelection();
 
     connect(m_listView->selectionModel(), &QItemSelectionModel::selectionChanged, this,
-            &InstrumentListView::onItemSelectionChanged);
+            &InstrumentListing::onItemSelectionChanged);
 }
 
-InstrumentListView::~InstrumentListView()
+InstrumentListing::~InstrumentListing()
 {
     m_instrumentLibrary.saveIfModified();
 }
 
-QSize InstrumentListView::sizeHint() const
+QSize InstrumentListing::sizeHint() const
 {
     return QSize(170, 400);
 }
 
-QSize InstrumentListView::minimumSizeHint() const
+QSize InstrumentListing::minimumSizeHint() const
 {
     return QSize(96, 200);
 }
 
-QList<QAction*> InstrumentListView::toolbarActions() const
+QList<QAction*> InstrumentListing::toolbarActions() const
 {
     return {m_newGisasAction,       m_newOffspecAction, m_newSpecularAction,
             m_newDepthprobeAction,  m_separatorAction1, m_removeAction,
@@ -149,7 +148,7 @@ QList<QAction*> InstrumentListView::toolbarActions() const
             m_loadFromLibraryAction};
 }
 
-InstrumentItem* InstrumentListView::currentInstrumentItem() const
+InstrumentItem* InstrumentListing::currentInstrumentItem() const
 {
     const QModelIndexList indexes = m_listView->selectionModel()->selectedIndexes();
     if (!indexes.empty())
@@ -157,7 +156,7 @@ InstrumentItem* InstrumentListView::currentInstrumentItem() const
     return nullptr;
 }
 
-void InstrumentListView::onItemSelectionChanged()
+void InstrumentListing::onItemSelectionChanged()
 {
     updateActions();
 
@@ -170,32 +169,32 @@ void InstrumentListView::onItemSelectionChanged()
         emit instrumentSelected(nullptr);
 }
 
-void InstrumentListView::onNewGisas()
+void InstrumentListing::onNewGisas()
 {
     QModelIndex idx = m_model->addNewGISASInstrument();
     m_listView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
 }
 
-void InstrumentListView::onNewOffspec()
+void InstrumentListing::onNewOffspec()
 {
     QModelIndex idx = m_model->addNewOffspecInstrument();
     m_listView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
 }
 
-void InstrumentListView::onNewSpecular()
+void InstrumentListing::onNewSpecular()
 {
     QModelIndex idx = m_model->addNewSpecularInstrument();
     m_listView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
 }
 
-void InstrumentListView::onNewDepthprobe()
+void InstrumentListing::onNewDepthprobe()
 {
     QModelIndex idx = m_model->addNewDepthprobeInstrument();
     m_listView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
 }
 
 //! Removes currently selected instrument.
-void InstrumentListView::onRemove()
+void InstrumentListing::onRemove()
 {
     QModelIndexList indexes = m_listView->selectionModel()->selectedIndexes();
     if (!indexes.empty()) {
@@ -206,7 +205,7 @@ void InstrumentListView::onRemove()
 }
 
 //! Makes a copy of the currently selected instrument.
-void InstrumentListView::onCopy()
+void InstrumentListing::onCopy()
 {
     QModelIndexList indexes = m_listView->selectionModel()->selectedIndexes();
     if (!indexes.empty()) {
@@ -215,7 +214,7 @@ void InstrumentListView::onCopy()
     }
 }
 
-void InstrumentListView::onStoreInLibrary()
+void InstrumentListing::onStoreInLibrary()
 {
     if (!m_listView->selectionModel()->hasSelection())
         return;
@@ -231,7 +230,7 @@ void InstrumentListView::onStoreInLibrary()
     dlg.execAdd(*instrument);
 }
 
-void InstrumentListView::onLoadFromLibrary()
+void InstrumentListing::onLoadFromLibrary()
 {
     if (m_instrumentLibrary.isEmpty()) {
         QMessageBox::information(GUI::Global::mainWindow, "Select from library",
@@ -253,7 +252,7 @@ void InstrumentListView::onLoadFromLibrary()
     m_listView->selectionModel()->select(idx, QItemSelectionModel::ClearAndSelect);
 }
 
-void InstrumentListView::updateFunctionalityNarrowing()
+void InstrumentListing::updateFunctionalityNarrowing()
 {
     const auto f = m_document->functionalities();
 
@@ -264,7 +263,7 @@ void InstrumentListView::updateFunctionalityNarrowing()
     m_copyAction->setVisible(!m_document->singleInstrumentMode());
 }
 
-void InstrumentListView::updateActions()
+void InstrumentListing::updateActions()
 {
     bool enabled = m_listView->selectionModel()->hasSelection();
     m_removeAction->setEnabled(enabled);
@@ -272,7 +271,7 @@ void InstrumentListView::updateActions()
     m_storeInLibraryAction->setEnabled(enabled);
 }
 
-void InstrumentListView::ensureItemSelected()
+void InstrumentListing::ensureItemSelected()
 {
     if (!m_listView->selectionModel()->hasSelection() && m_model->rowCount()) {
         QModelIndex last = m_model->index(m_model->rowCount() - 1, 0, QModelIndex());
@@ -280,7 +279,7 @@ void InstrumentListView::ensureItemSelected()
     }
 }
 
-void InstrumentListView::restoreSelection()
+void InstrumentListing::restoreSelection()
 {
     int lastUsed = m_document->instrumentModel()->selectedIndex();
     if (lastUsed >= 0 && lastUsed < m_model->rowCount()) {
diff --git a/GUI/View/Instrument/InstrumentListView.h b/GUI/View/Instrument/InstrumentListing.h
similarity index 79%
rename from GUI/View/Instrument/InstrumentListView.h
rename to GUI/View/Instrument/InstrumentListing.h
index e8d06253e9b..a17e7a5f405 100644
--- a/GUI/View/Instrument/InstrumentListView.h
+++ b/GUI/View/Instrument/InstrumentListing.h
@@ -2,8 +2,8 @@
 //
 //  BornAgain: simulate and fit reflection and scattering
 //
-//! @file      GUI/View/Instrument/InstrumentListView.h
-//! @brief     Defines class InstrumentListView
+//! @file      GUI/View/Instrument/InstrumentListing.h
+//! @brief     Defines class InstrumentListing
 //!
 //! @homepage  http://www.bornagainproject.org
 //! @license   GNU General Public License v3 or higher (see COPYING)
@@ -12,8 +12,8 @@
 //
 //  ************************************************************************************************
 
-#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTVIEW_H
-#define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTVIEW_H
+#ifndef BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTING_H
+#define BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTING_H
 
 #include "GUI/Model/Device/InstrumentLibrary.h"
 #include <QListView>
@@ -24,12 +24,12 @@ class ProjectDocument;
 
 //! Instrument selector on the left side of InstrumentView.
 
-class InstrumentListView : public QWidget {
+class InstrumentListing : public QWidget {
     Q_OBJECT
 public:
-    InstrumentListView(ProjectDocument* document, QWidget* parent = nullptr,
-                       Qt::WindowFlags f = Qt::WindowFlags());
-    ~InstrumentListView();
+    InstrumentListing(ProjectDocument* document, QWidget* parent = nullptr,
+                      Qt::WindowFlags f = Qt::WindowFlags());
+    ~InstrumentListing();
 
     QSize sizeHint() const override;
     QSize minimumSizeHint() const override;
@@ -79,4 +79,4 @@ private:
     QAction* m_loadFromLibraryAction;
 };
 
-#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTVIEW_H
+#endif // BORNAGAIN_GUI_VIEW_INSTRUMENT_INSTRUMENTLISTING_H
diff --git a/GUI/View/Instrument/InstrumentView.cpp b/GUI/View/Instrument/InstrumentView.cpp
index 2c012a69bf6..828a7ac1a67 100644
--- a/GUI/View/Instrument/InstrumentView.cpp
+++ b/GUI/View/Instrument/InstrumentView.cpp
@@ -16,7 +16,7 @@
 #include "GUI/Model/Device/InstrumentItems.h"
 #include "GUI/View/Instrument/DepthprobeInstrumentEditor.h"
 #include "GUI/View/Instrument/GISASInstrumentEditor.h"
-#include "GUI/View/Instrument/InstrumentListView.h"
+#include "GUI/View/Instrument/InstrumentListing.h"
 #include "GUI/View/Instrument/OffspecInstrumentEditor.h"
 #include "GUI/View/Instrument/SpecularInstrumentEditor.h"
 #include "GUI/View/Widget/ApplicationSettings.h"
@@ -36,11 +36,11 @@ InstrumentView::InstrumentView(QWidget* parent, ProjectDocument* document)
     , m_document(document)
 {
     // Left margin: instrument list
-    m_instrumentListView = new InstrumentListView(document, this);
+    m_instrumentListView = new InstrumentListing(document, this);
     m_instrumentListView->setVisible(!document->singleInstrumentMode());
     connect(m_document, &ProjectDocument::singleInstrumentModeChanged,
             [this]() { m_instrumentListView->setVisible(!m_document->singleInstrumentMode()); });
-    connect(m_instrumentListView, &InstrumentListView::instrumentSelected, this,
+    connect(m_instrumentListView, &InstrumentListing::instrumentSelected, this,
             &InstrumentView::createWidgetsForCurrentInstrument);
 
     // Large widget: current instrument
diff --git a/GUI/View/Instrument/InstrumentView.h b/GUI/View/Instrument/InstrumentView.h
index f2c539d229e..6aaaa24e673 100644
--- a/GUI/View/Instrument/InstrumentView.h
+++ b/GUI/View/Instrument/InstrumentView.h
@@ -19,7 +19,7 @@
 #include <QWidget>
 
 class InstrumentItem;
-class InstrumentListView;
+class InstrumentListing;
 class ProjectDocument;
 class QCheckBox;
 class QMenu;
@@ -44,7 +44,7 @@ private:
     void onSingleInstrumentModeChanged(bool newState);
     void onFunctionalityChanged();
 
-    InstrumentListView* m_instrumentListView;
+    InstrumentListing* m_instrumentListView;
     ProjectDocument* m_document;
     QScrollArea* m_scrollArea;
     QCheckBox* gisasCheck;
-- 
GitLab