From adc99186c670fa3f7c2e2927b9b3c3f1d5654307 Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de>
Date: Mon, 20 Nov 2023 16:46:01 +0100
Subject: [PATCH] RunFitControlWidget no longer inherit from DataAccessWidget

---
 GUI/View/Fit/FitSessionWidget.cpp           |  2 +-
 GUI/View/FitControl/RunFitControlWidget.cpp | 19 +++++++++----------
 GUI/View/FitControl/RunFitControlWidget.h   | 10 ++++++----
 3 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/GUI/View/Fit/FitSessionWidget.cpp b/GUI/View/Fit/FitSessionWidget.cpp
index e727c9f8b33..383918681a5 100644
--- a/GUI/View/Fit/FitSessionWidget.cpp
+++ b/GUI/View/Fit/FitSessionWidget.cpp
@@ -57,7 +57,7 @@ void FitSessionWidget::setJobItem(JobItem* jobItem)
     ASSERT(jobItem);
     m_fitParametersWidget->setJobOrDatafileItem(jobItem);
     m_minimizerSettingsWidget->setJobItem(jobItem);
-    m_controlWidget->setJobOrDatafileItem(jobItem);
+    m_controlWidget->setJobItem(jobItem);
 }
 
 void FitSessionWidget::setModelTuningWidget(ParameterTuningWidget* tuningWidget)
diff --git a/GUI/View/FitControl/RunFitControlWidget.cpp b/GUI/View/FitControl/RunFitControlWidget.cpp
index ea5096aa795..aa761a09e33 100644
--- a/GUI/View/FitControl/RunFitControlWidget.cpp
+++ b/GUI/View/FitControl/RunFitControlWidget.cpp
@@ -33,9 +33,8 @@ const QString slider_tooltip = "Updates fit progress every Nth iteration";
 
 } // namespace
 
-RunFitControlWidget::RunFitControlWidget(QWidget* parent)
-    : DataAccessWidget(parent)
-    , m_startButton(new QPushButton)
+RunFitControlWidget::RunFitControlWidget()
+    : m_startButton(new QPushButton)
     , m_stopButton(new QPushButton)
     , m_updButton(new QPushButton)
     , m_intervalSlider(new QSlider)
@@ -97,12 +96,12 @@ RunFitControlWidget::RunFitControlWidget(QWidget* parent)
     setEnabled(false);
 }
 
-void RunFitControlWidget::setJobOrDatafileItem(QObject* job_item)
+void RunFitControlWidget::setJobItem(JobItem* job_item)
 {
-    setBaseItem(job_item);
-    ASSERT(jobItem());
+    ASSERT(job_item);
+    m_job_item = job_item;
 
-    updateControlElements(jobItem()->status());
+    updateControlElements(m_job_item->status());
     updateIterationsCountLabel(fitSuiteItem()->iterationCount());
 
     initializeSlider();
@@ -110,7 +109,7 @@ void RunFitControlWidget::setJobOrDatafileItem(QObject* job_item)
     connect(fitSuiteItem(), &FitSuiteItem::iterationCountChanged, this,
             &RunFitControlWidget::updateIterationsCountLabel, Qt::UniqueConnection);
 
-    connect(jobItem(), &JobItem::jobStatusChanged, this,
+    connect(m_job_item, &JobItem::jobStatusChanged, this,
             &RunFitControlWidget::updateControlElements, Qt::UniqueConnection);
 }
 
@@ -180,12 +179,12 @@ void RunFitControlWidget::updateControlElements(JobStatus status)
 
 FitSuiteItem* RunFitControlWidget::fitSuiteItem()
 {
-    return jobItem() ? jobItem()->fitSuiteItem() : nullptr;
+    return m_job_item ? m_job_item->fitSuiteItem() : nullptr;
 }
 
 bool RunFitControlWidget::isValidJobItem()
 {
-    return jobItem() ? jobItem()->isValidForFitting() : false;
+    return m_job_item ? m_job_item->isValidForFitting() : false;
 }
 
 void RunFitControlWidget::updateIterationsCountLabel(int iter)
diff --git a/GUI/View/FitControl/RunFitControlWidget.h b/GUI/View/FitControl/RunFitControlWidget.h
index 6303b9dc810..5ca6bd70174 100644
--- a/GUI/View/FitControl/RunFitControlWidget.h
+++ b/GUI/View/FitControl/RunFitControlWidget.h
@@ -15,11 +15,12 @@
 #ifndef BORNAGAIN_GUI_VIEW_FITCONTROL_RUNFITCONTROLWIDGET_H
 #define BORNAGAIN_GUI_VIEW_FITCONTROL_RUNFITCONTROLWIDGET_H
 
-#include "GUI/View/Access/DataAccessWidget.h"
+#include <QWidget>
 
 enum class JobStatus;
 class CautionSign;
 class FitSuiteItem;
+class JobItem;
 class QLabel;
 class QPushButton;
 class QSlider;
@@ -27,12 +28,12 @@ class QSlider;
 //! The RunFitControlWidget contains elements to start/stop fitting and to provide minimal
 //! diagnostic. Part of FitSuiteWidget.
 
-class RunFitControlWidget : public DataAccessWidget {
+class RunFitControlWidget : public QWidget {
     Q_OBJECT
 public:
-    RunFitControlWidget(QWidget* parent = nullptr);
+    RunFitControlWidget();
 
-    void setJobOrDatafileItem(QObject* job_item) override;
+    void setJobItem(JobItem* job_item);
 
 signals:
     void startFittingPushed();
@@ -63,6 +64,7 @@ private:
     QLabel* m_updateIntervalLabel;
     QLabel* m_iterationsCountLabel;
     CautionSign* m_cautionSign;
+    JobItem* m_job_item;
 };
 
 #endif // BORNAGAIN_GUI_VIEW_FITCONTROL_RUNFITCONTROLWIDGET_H
-- 
GitLab