From 1dce9443bdec1c78742f7600c36a581921766b8f Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Mon, 22 Jan 2024 13:16:03 +0100
Subject: [PATCH] disambiguate fcts

---
 GUI/View/Data/DataView.cpp          |  4 +--
 GUI/View/Data/DatafilesSelector.cpp | 38 ++++++++++++++---------------
 GUI/View/Data/DatafilesSelector.h   |  6 ++---
 GUI/View/Data/StackedFrames.cpp     |  8 +++---
 GUI/View/Frame/SpecularFrame.h      |  2 +-
 GUI/View/Job/JobView.cpp            |  8 +++---
 GUI/View/Setup/ProjectionsSaver.cpp |  3 ++-
 7 files changed, 35 insertions(+), 34 deletions(-)

diff --git a/GUI/View/Data/DataView.cpp b/GUI/View/Data/DataView.cpp
index f055d233c47..19b8a6a1e36 100644
--- a/GUI/View/Data/DataView.cpp
+++ b/GUI/View/Data/DataView.cpp
@@ -42,6 +42,6 @@ DataView::DataView()
     splitter->setSizes(QList<int>() << GUI::Style::ITEM_SELECTOR_WIDGET_WIDTH
                                     << GUI::Style::ITEM_SELECTOR_WIDGET_WIDTH * 7);
 
-    if (selector->currentItem())
-        stackedWidget->setStackedItem(selector->currentItem()->dataItem());
+    if (selector->currentDatafileItem())
+        stackedWidget->setStackedItem(selector->currentDatafileItem()->dataItem());
 }
diff --git a/GUI/View/Data/DatafilesSelector.cpp b/GUI/View/Data/DatafilesSelector.cpp
index 27e7eb31d45..b054a7bd960 100644
--- a/GUI/View/Data/DatafilesSelector.cpp
+++ b/GUI/View/Data/DatafilesSelector.cpp
@@ -118,7 +118,7 @@ DatafilesSelector::DatafilesSelector(StackedDataFrames* data_frames)
     setLayout(mainLayout);
 
     connect(m_editor, &DatafileEditor::instrumentUpdated,
-            [this] { m_data_frames->setStackedItem(currentItem()); }); // TODO rm ??
+            [this] { m_data_frames->setStackedItem(currentDatafileItem()); }); // TODO rm ??
 
     connect(m_tree_view, &QTreeView::customContextMenuRequested, this,
             &DatafilesSelector::onContextMenuRequest);
@@ -149,12 +149,12 @@ QSize DatafilesSelector::minimumSizeHint() const
     return {128, 200};
 }
 
-DatafileItem* DatafilesSelector::currentItem()
+DatafileItem* DatafilesSelector::currentDatafileItem()
 {
-    return m_tree_model->itemForIndex(currentIndex());
+    return m_tree_model->itemForIndex(currentDatafileIndex());
 }
 
-void DatafilesSelector::setCurrentItem(DatafileItem* item)
+void DatafilesSelector::setCurrentDatafileItem(DatafileItem* item)
 {
     m_tree_view->selectionModel()->clearSelection();
     QModelIndex index = m_tree_model->indexForItem(item);
@@ -173,13 +173,13 @@ void DatafilesSelector::restoreSelection()
         m_tree_view->selectionModel()->setCurrentIndex(lastUsedIndex,
                                                        QItemSelectionModel::SelectCurrent);
     else
-        setCurrentItem(m_tree_model->topMostItem());
+        setCurrentDatafileItem(m_tree_model->topMostItem());
 
-    if (currentItem())
-        m_data_frames->setStackedItem(currentItem());
+    if (currentDatafileItem())
+        m_data_frames->setStackedItem(currentDatafileItem());
 }
 
-QModelIndex DatafilesSelector::currentIndex() const
+QModelIndex DatafilesSelector::currentDatafileIndex() const
 {
     if (!m_tree_view->selectionModel()->isSelected(m_tree_view->selectionModel()->currentIndex()))
         return {};
@@ -221,11 +221,11 @@ void DatafilesSelector::onSelectionChanged()
 {
     updateActionEnabling();
 
-    gDoc->realModel()->setSelectedIndex(currentIndex().row());
-    gDoc->realModel()->setSelectedRank(currentIndex().parent().row() + 1);
+    gDoc->realModel()->setSelectedIndex(currentDatafileIndex().row());
+    gDoc->realModel()->setSelectedRank(currentDatafileIndex().parent().row() + 1);
 
-    m_editor->setDatafileItem(currentItem());
-    m_data_frames->setStackedItem(currentItem());
+    m_editor->setDatafileItem(currentDatafileItem());
+    m_data_frames->setStackedItem(currentDatafileItem());
 }
 
 void DatafilesSelector::onContextMenuRequest(const QPoint& point)
@@ -294,7 +294,7 @@ void DatafilesSelector::importData1D()
             if (df->rank() != 1)
                 throw std::runtime_error("File does not contain a 1d data set");
             realItem = m_tree_model->injectDataItem(fname, *df);
-            setCurrentItem(realItem);
+            setCurrentDatafileItem(realItem);
         } catch (std::exception& ex) {
             m_tree_model->removeDataItem(realItem);
 
@@ -348,7 +348,7 @@ void DatafilesSelector::importData2D()
             if (df->rank() != 2)
                 throw std::runtime_error("File does not contain a 2d data set");
             realItem = m_tree_model->injectDataItem(fname, *df);
-            setCurrentItem(realItem);
+            setCurrentDatafileItem(realItem);
         } catch (std::exception& ex) {
             m_tree_model->removeDataItem(realItem);
 
@@ -364,25 +364,25 @@ void DatafilesSelector::importData2D()
 
 void DatafilesSelector::renameCurrentItem()
 {
-    if (currentIndex().isValid()) {
+    if (currentDatafileIndex().isValid()) {
         // First delete any existing index widget. This is necessary if overlay buttons are used,
         // because these buttons use the indexWidget() functionality, which itself uses the same
         // internals as an item editor
-        m_tree_view->setIndexWidget(currentIndex(), nullptr);
-        m_tree_view->edit(currentIndex());
+        m_tree_view->setIndexWidget(currentDatafileIndex(), nullptr);
+        m_tree_view->edit(currentDatafileIndex());
         gDoc->setModified();
     }
 }
 
 void DatafilesSelector::removeCurrentItem()
 {
-    m_tree_model->removeDataItem(currentItem());
+    m_tree_model->removeDataItem(currentDatafileItem());
     gDoc->setModified();
 }
 
 void DatafilesSelector::updateActionEnabling()
 {
-    updateActionEnabling(currentItem());
+    updateActionEnabling(currentDatafileItem());
 }
 
 void DatafilesSelector::updateActionEnabling(const DatafileItem* item) const
diff --git a/GUI/View/Data/DatafilesSelector.h b/GUI/View/Data/DatafilesSelector.h
index 7f6f7057b01..7608f28282a 100644
--- a/GUI/View/Data/DatafilesSelector.h
+++ b/GUI/View/Data/DatafilesSelector.h
@@ -39,8 +39,8 @@ public:
     QSize sizeHint() const override;
     QSize minimumSizeHint() const override;
 
-    DatafileItem* currentItem();
-    void setCurrentItem(DatafileItem* item);
+    DatafileItem* currentDatafileItem();
+    void setCurrentDatafileItem(DatafileItem* item);
 
     void restoreSelection();
 
@@ -59,7 +59,7 @@ private:
     void onContextMenuRequest(const QPoint& point);
     void importData1D();
     void importData2D();
-    QModelIndex currentIndex() const;
+    QModelIndex currentDatafileIndex() const;
 
     QList<QAction*> getOverlayActions(const QModelIndex& index, bool asHover);
 
diff --git a/GUI/View/Data/StackedFrames.cpp b/GUI/View/Data/StackedFrames.cpp
index e097bec2002..3d73085303f 100644
--- a/GUI/View/Data/StackedFrames.cpp
+++ b/GUI/View/Data/StackedFrames.cpp
@@ -67,10 +67,10 @@ QWidget* StackedJobFrames::newWidget(QObject* obj) const
     else if (auto* item = dynamic_cast<Data2DItem*>(obj))
         return new Plot2DFrame(item);
     else if (auto* item = dynamic_cast<JobItem*>(obj)) {
-	if (item->rank() == 1)
-	    return new Fit1DFrame(item);
-	else if (item->rank() == 2)
-	    return new Fit2DFrame(item);
+        if (item->rank() == 1)
+            return new Fit1DFrame(item);
+        else if (item->rank() == 2)
+            return new Fit2DFrame(item);
     }
     ASSERT_NEVER;
 }
diff --git a/GUI/View/Frame/SpecularFrame.h b/GUI/View/Frame/SpecularFrame.h
index a50030315ed..fdb90bff39e 100644
--- a/GUI/View/Frame/SpecularFrame.h
+++ b/GUI/View/Frame/SpecularFrame.h
@@ -33,7 +33,7 @@ private:
     SpecularDataCanvas* m_specular_canvas;
     AxisPanel* m_scale_editor;
 
-//    const Data1DItem* m_data_item;
+    //    const Data1DItem* m_data_item;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_FRAME_SPECULARFRAME_H
diff --git a/GUI/View/Job/JobView.cpp b/GUI/View/Job/JobView.cpp
index 3c08e7bddeb..c6fed58dc99 100644
--- a/GUI/View/Job/JobView.cpp
+++ b/GUI/View/Job/JobView.cpp
@@ -16,10 +16,10 @@
 #include "GUI/Model/Data/DataItem.h"
 #include "GUI/Model/Job/JobItem.h"
 #include "GUI/Support/Data/ID.h"
+#include "GUI/View/Data/StackedFrames.h"
 #include "GUI/View/Dock/DocksController.h"
 #include "GUI/View/Fit/FitActivityPanel.h"
 #include "GUI/View/FitMessage/JobMessagePanel.h"
-#include "GUI/View/Data/StackedFrames.h"
 #include "GUI/View/Job/JobViewActivities.h"
 #include "GUI/View/JobControl/JobSelector.h"
 #include "GUI/View/Manager/ProjectManager.h"
@@ -149,11 +149,11 @@ void JobView::onJobSelected(JobItem* job_item)
 void JobView::setJob(JobItem* job_item)
 {
     if (!job_item)
-	return;
+        return;
     if (job_item->isValidForFitting())
-	m_data_frames->setStackedItem(job_item);
+        m_data_frames->setStackedItem(job_item);
     else
-	m_data_frames->setStackedItem(job_item->simulatedDataItem());
+        m_data_frames->setStackedItem(job_item->simulatedDataItem());
 }
 
 //! Sets docks visibility in accordance with required activity.
diff --git a/GUI/View/Setup/ProjectionsSaver.cpp b/GUI/View/Setup/ProjectionsSaver.cpp
index f7f0c6310e2..26c93a8837d 100644
--- a/GUI/View/Setup/ProjectionsSaver.cpp
+++ b/GUI/View/Setup/ProjectionsSaver.cpp
@@ -61,7 +61,8 @@ bool horiz_less_posy(const OverlayItem* item1, const OverlayItem* item2)
 }
 
 //! Returns vector of ProjectionList sorted according to axis value.
-QVector<const LineItem*> projectionItems(Qt::Orientation projectionsType, const Data2DItem* data_item)
+QVector<const LineItem*> projectionItems(Qt::Orientation projectionsType,
+                                         const Data2DItem* data_item)
 {
     auto result = data_item->projectionContainerItem()->projectionsOfType(projectionsType);
     std::sort(result.begin(), result.end(),
-- 
GitLab