From 71aa30c30153ed033a30692252475e21e7eb0b69 Mon Sep 17 00:00:00 2001
From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de>
Date: Thu, 23 Jun 2022 16:19:32 +0200
Subject: [PATCH] rm unused functions

---
 GUI/Model/Data/DataItem.cpp            | 32 ++++----------
 GUI/Model/Data/DataItem.h              |  8 ++--
 GUI/Model/Data/SpecularDataItem.cpp    | 10 -----
 GUI/Model/Data/SpecularDataItem.h      |  3 --
 GUI/View/PlotComparison/Plot1D.cpp     | 43 -------------------
 GUI/View/PlotComparison/Plot1D.h       |  5 ---
 GUI/View/PlotSpecular/SpecularPlot.cpp | 44 -------------------
 GUI/View/PlotSpecular/SpecularPlot.h   |  5 ---
 GUI/View/PlotUtil/ColorMap.cpp         | 59 --------------------------
 GUI/View/PlotUtil/ColorMap.h           |  2 -
 10 files changed, 12 insertions(+), 199 deletions(-)

diff --git a/GUI/Model/Data/DataItem.cpp b/GUI/Model/Data/DataItem.cpp
index 7d0d71c3226..e7d96c503de 100644
--- a/GUI/Model/Data/DataItem.cpp
+++ b/GUI/Model/Data/DataItem.cpp
@@ -17,6 +17,15 @@
 #include "GUI/Util/ComboProperty.h"
 #include "GUI/Util/Error.h"
 
+DataItem::DataItem(const QString& modelType)
+    : SessionItem(modelType)
+{
+    // name of the file used to serialize given IntensityDataItem
+    addProperty(P_FILE_NAME, "undefined");
+
+    addProperty(P_AXES_UNITS, ComboProperty::fromList({"nbins"}).variant());
+}
+
 void DataItem::setDatafield(Datafield* data)
 {
     std::unique_lock<std::mutex> lock(m_update_data_mutex);
@@ -109,26 +118,3 @@ SelectionDescriptor<QString> DataItem::axesUnits() const
     };
     return d;
 }
-
-bool DataItem::isAxesUnitsPropertyName(const QString& name)
-{
-    return name == P_AXES_UNITS;
-}
-
-void DataItem::updateAxesUnits(SessionItem* item, const QString& name,
-                               InstrumentItem* instrumentItem)
-{
-    DataItem* dataItem = dynamic_cast<DataItem*>(item);
-    if (dataItem && isAxesUnitsPropertyName(name)) {
-        dataItem->updateCoords(instrumentItem);
-    }
-}
-
-DataItem::DataItem(const QString& modelType)
-    : SessionItem(modelType)
-{
-    // name of the file used to serialize given IntensityDataItem
-    addProperty(P_FILE_NAME, "undefined");
-
-    addProperty(P_AXES_UNITS, ComboProperty::fromList({"nbins"}).variant());
-}
diff --git a/GUI/Model/Data/DataItem.h b/GUI/Model/Data/DataItem.h
index da84092828f..02b148ce772 100644
--- a/GUI/Model/Data/DataItem.h
+++ b/GUI/Model/Data/DataItem.h
@@ -37,6 +37,9 @@ private:
     static constexpr auto P_FILE_NAME{"FileName"};
     static constexpr auto P_AXES_UNITS{"Axes Units"};
 
+protected:
+    explicit DataItem(const QString& modelType);
+
 public:
     Datafield* getDatafield() { return m_data.get(); }
     const Datafield* getDatafield() const { return m_data.get(); }
@@ -62,9 +65,6 @@ public:
 
     void setAxesUnits(const ComboProperty& units);
     SelectionDescriptor<QString> axesUnits() const;
-    static bool isAxesUnitsPropertyName(const QString& name);
-    static void updateAxesUnits(SessionItem* item, const QString& name,
-                                InstrumentItem* instrumentItem);
 
     virtual void setXaxisTitle(const QString& title) = 0;
     virtual void setYaxisTitle(const QString& title) = 0;
@@ -85,8 +85,6 @@ signals:
     void updateOtherPlots();
 
 protected:
-    explicit DataItem(const QString& modelType);
-
     std::unique_ptr<Datafield> m_data; //!< simulation results
     QDateTime m_last_modified;
     std::mutex m_update_data_mutex;
diff --git a/GUI/Model/Data/SpecularDataItem.cpp b/GUI/Model/Data/SpecularDataItem.cpp
index d95ecf59779..616a559405a 100644
--- a/GUI/Model/Data/SpecularDataItem.cpp
+++ b/GUI/Model/Data/SpecularDataItem.cpp
@@ -157,16 +157,6 @@ void SpecularDataItem::reset(ImportDataInfo data)
     setAxesRangeToData();
 }
 
-bool SpecularDataItem::isXaxisPropertyName(const QString& name)
-{
-    return name == P_XAXIS;
-}
-
-bool SpecularDataItem::isYaxisPropertyName(const QString& name)
-{
-    return name == P_YAXIS;
-}
-
 void SpecularDataItem::copyRangeFromItem(SpecularDataItem* sourceItem)
 {
     setLowerX(sourceItem->getLowerX());
diff --git a/GUI/Model/Data/SpecularDataItem.h b/GUI/Model/Data/SpecularDataItem.h
index 77d6c08471c..ef28af30973 100644
--- a/GUI/Model/Data/SpecularDataItem.h
+++ b/GUI/Model/Data/SpecularDataItem.h
@@ -79,9 +79,6 @@ public:
     //! data.
     void reset(ImportDataInfo data) override;
 
-    static bool isXaxisPropertyName(const QString& name);
-    static bool isYaxisPropertyName(const QString& name);
-
 public slots:
     void copyRangeFromItem(SpecularDataItem* sourceItem);
     void setLowerX(double value);
diff --git a/GUI/View/PlotComparison/Plot1D.cpp b/GUI/View/PlotComparison/Plot1D.cpp
index bb179503f8e..ad08028c2c9 100644
--- a/GUI/View/PlotComparison/Plot1D.cpp
+++ b/GUI/View/PlotComparison/Plot1D.cpp
@@ -79,18 +79,6 @@ void Plot1D::resetView()
     viewItem()->resetView();
 }
 
-void Plot1D::onPropertyChanged(const QString& property_name)
-{
-    if (m_block_update)
-        return;
-
-    if (Data1DViewItem::isAxesUnitsPropertyName(property_name)) {
-        setAxesRangeFromItem(viewItem());
-        updateAllGraphs();
-        replot();
-    }
-}
-
 void Plot1D::onXaxisRangeChanged(QCPRange newRange)
 {
     m_block_update = true;
@@ -305,37 +293,6 @@ const Data1DViewItem* Plot1D::viewItem() const
     return result;
 }
 
-void Plot1D::modifyAxesProperties(const QString& axisName, const QString& propertyName)
-{
-    if (m_block_update)
-        return;
-
-    if (BasicAxisItem::isTitlePropertyName(propertyName)
-        || BasicAxisItem::isTitleVisiblePropertyName(propertyName)) {
-        setAxesLabelsFromItem(viewItem());
-        replot();
-    }
-
-    if (SpecularDataItem::isXaxisPropertyName(axisName)) {
-        if (BasicAxisItem::isBoundsPropertiesName(propertyName)) {
-            setAxesRangeConnected(false);
-            m_custom_plot->xAxis->setRange(viewItem()->getLowerX(), viewItem()->getUpperX());
-            setAxesRangeConnected(true);
-            replot();
-        }
-    } else if (SpecularDataItem::isYaxisPropertyName(axisName)) {
-        if (BasicAxisItem::isBoundsPropertiesName(propertyName)) {
-            setAxesRangeConnected(false);
-            m_custom_plot->yAxis->setRange(viewItem()->getLowerY(), viewItem()->getUpperY());
-            setAxesRangeConnected(true);
-            replot();
-        } else if (AmplitudeAxisItem::isLogScalePropertyName(propertyName)) {
-            setLog(viewItem()->isLog());
-            replot();
-        }
-    }
-}
-
 void Plot1D::replot()
 {
     m_update_timer->scheduleUpdate();
diff --git a/GUI/View/PlotComparison/Plot1D.h b/GUI/View/PlotComparison/Plot1D.h
index 87103d04156..03a6194326d 100644
--- a/GUI/View/PlotComparison/Plot1D.h
+++ b/GUI/View/PlotComparison/Plot1D.h
@@ -51,9 +51,6 @@ public:
     void resetView();
 
 private slots:
-    //! updates plot depending on  IntensityDataItem properties
-    void onPropertyChanged(const QString& property_name);
-
     //! Propagate xmin, xmax back to IntensityDataItem
     void onXaxisRangeChanged(QCPRange newRange);
 
@@ -100,8 +97,6 @@ private:
     Data1DViewItem* viewItem();
     const Data1DViewItem* viewItem() const;
 
-    void modifyAxesProperties(const QString& axisName, const QString& propertyName);
-
     //! Schedule replot for later execution by onTimeReplot() slot.
     void replot();
 
diff --git a/GUI/View/PlotSpecular/SpecularPlot.cpp b/GUI/View/PlotSpecular/SpecularPlot.cpp
index eaffd5e150b..07ad1a9f914 100644
--- a/GUI/View/PlotSpecular/SpecularPlot.cpp
+++ b/GUI/View/PlotSpecular/SpecularPlot.cpp
@@ -74,17 +74,6 @@ void SpecularPlot::resetView()
     specularItem()->resetView();
 }
 
-void SpecularPlot::onPropertyChanged(const QString& property_name)
-{
-    if (m_block_update)
-        return;
-
-    if (DataItem::isAxesUnitsPropertyName(property_name)) {
-        setAxesRangeFromItem(specularItem());
-        replot();
-    }
-}
-
 void SpecularPlot::onXaxisRangeChanged(QCPRange newRange)
 {
     m_block_update = true;
@@ -292,39 +281,6 @@ const SpecularDataItem* SpecularPlot::specularItem() const
     return result;
 }
 
-void SpecularPlot::modifyAxesProperties(const QString& axisName, const QString& propertyName)
-{
-    if (m_block_update)
-        return;
-
-    if (BasicAxisItem::isTitlePropertyName(propertyName)
-        || BasicAxisItem::isTitleVisiblePropertyName(propertyName)) {
-        setAxesLabelsFromItem(specularItem());
-        replot();
-    }
-
-    if (SpecularDataItem::isXaxisPropertyName(axisName)) {
-        if (BasicAxisItem::isBoundsPropertiesName(propertyName)) {
-            setAxesRangeConnected(false);
-            m_custom_plot->xAxis->setRange(specularItem()->getLowerX(),
-                                           specularItem()->getUpperX());
-            setAxesRangeConnected(true);
-            replot();
-        }
-    } else if (SpecularDataItem::isYaxisPropertyName(axisName)) {
-        if (BasicAxisItem::isBoundsPropertiesName(propertyName)) {
-            setAxesRangeConnected(false);
-            m_custom_plot->yAxis->setRange(specularItem()->getLowerY(),
-                                           specularItem()->getUpperY());
-            setAxesRangeConnected(true);
-            replot();
-        } else if (AmplitudeAxisItem::isLogScalePropertyName(propertyName)) {
-            setLog(specularItem()->isLog());
-            replot();
-        }
-    }
-}
-
 void SpecularPlot::replot()
 {
     m_update_timer->scheduleUpdate();
diff --git a/GUI/View/PlotSpecular/SpecularPlot.h b/GUI/View/PlotSpecular/SpecularPlot.h
index 0331ff22c94..1770e472ef8 100644
--- a/GUI/View/PlotSpecular/SpecularPlot.h
+++ b/GUI/View/PlotSpecular/SpecularPlot.h
@@ -51,9 +51,6 @@ public:
     void resetView();
 
 private slots:
-    //! updates plot depending on  IntensityDataItem properties
-    void onPropertyChanged(const QString& property_name);
-
     //! Propagate xmin, xmax back to IntensityDataItem
     void onXaxisRangeChanged(QCPRange newRange);
 
@@ -100,8 +97,6 @@ private:
     SpecularDataItem* specularItem();
     const SpecularDataItem* specularItem() const;
 
-    void modifyAxesProperties(const QString& axisName, const QString& propertyName);
-
     //! Schedule replot for later execution by onTimeReplot() slot.
     void replot();
 
diff --git a/GUI/View/PlotUtil/ColorMap.cpp b/GUI/View/PlotUtil/ColorMap.cpp
index c1f949b3597..2f64b4862d8 100644
--- a/GUI/View/PlotUtil/ColorMap.cpp
+++ b/GUI/View/PlotUtil/ColorMap.cpp
@@ -105,65 +105,6 @@ void ColorMap::onIntensityModified()
     replot();
 }
 
-//! updates color map depending on  IntensityDataItem properties
-void ColorMap::onPropertyChanged(const QString& property_name)
-{
-    if (m_block_update)
-        return;
-
-    if (IntensityDataItem::isGradientPropertyName(property_name)) {
-        m_colorMap->setGradient(GUI::View::RangeUtils::itemGradient(intensityItem()));
-        replot();
-    } else if (IntensityDataItem::isInterpolatedPropertyName(property_name)) {
-        m_colorMap->setInterpolate(intensityItem()->isInterpolated());
-        replot();
-    } else if (DataItem::isAxesUnitsPropertyName(property_name)) {
-        setAxesRangeFromItem(intensityItem());
-        replot();
-    }
-}
-
-void ColorMap::onAxisPropertyChanged(const QString& axisName, const QString& propertyName)
-{
-    if (m_block_update)
-        return;
-
-    if (BasicAxisItem::isTitlePropertyName(propertyName)
-        || BasicAxisItem::isTitleVisiblePropertyName(propertyName)) {
-        setAxesLabelsFromItem(intensityItem());
-        replot();
-    }
-
-    if (IntensityDataItem::isXaxisPropertyName(axisName)) {
-        if (BasicAxisItem::isBoundsPropertiesName(propertyName)) {
-            setAxesRangeConnected(false);
-            m_customPlot->xAxis->setRange(GUI::View::RangeUtils::itemZoomX(intensityItem()));
-            setAxesRangeConnected(true);
-            replot();
-        }
-    } else if (IntensityDataItem::isYaxisPropertyName(axisName)) {
-        if (BasicAxisItem::isBoundsPropertiesName(propertyName)) {
-            setAxesRangeConnected(false);
-            m_customPlot->yAxis->setRange(GUI::View::RangeUtils::itemZoomY(intensityItem()));
-            setAxesRangeConnected(true);
-            replot();
-        }
-    }
-
-    else if (IntensityDataItem::isZaxisPropertyName(axisName)) {
-        if (BasicAxisItem::isBoundsPropertiesName(propertyName)) {
-            setDataRangeFromItem(intensityItem());
-            replot();
-        } else if (AmplitudeAxisItem::isLogScalePropertyName(propertyName)) {
-            setLogz(intensityItem()->isLogz());
-            replot();
-        } else if (BasicAxisItem::isVisibilityPropertyName(propertyName)) {
-            setColorScaleVisible(intensityItem()->zAxisItem()->isVisible());
-            replot();
-        }
-    }
-}
-
 //! Propagate zmin, zmax back to IntensityDataItem
 void ColorMap::onDataRangeChanged(QCPRange newRange)
 {
diff --git a/GUI/View/PlotUtil/ColorMap.h b/GUI/View/PlotUtil/ColorMap.h
index b41ea0e3e78..1de7fc08b29 100644
--- a/GUI/View/PlotUtil/ColorMap.h
+++ b/GUI/View/PlotUtil/ColorMap.h
@@ -61,8 +61,6 @@ public slots:
 
 private slots:
     void onIntensityModified();
-    void onPropertyChanged(const QString& property_name);
-    void onAxisPropertyChanged(const QString& axisName, const QString& propertyName);
     void onDataRangeChanged(QCPRange newRange);
     void onXaxisRangeChanged(QCPRange newRange);
     void onYaxisRangeChanged(QCPRange newRange);
-- 
GitLab