Commit fa48e054 authored by Mikhail Svechnikov's avatar Mikhail Svechnikov
Browse files

diffItem moved to JobItem

parent f7f1a14b
...@@ -32,8 +32,9 @@ const double relative_diff_max_2d = 1.0; ...@@ -32,8 +32,9 @@ const double relative_diff_max_2d = 1.0;
class FitComparisonController2D::DiffItemController : public QObject { class FitComparisonController2D::DiffItemController : public QObject {
public: public:
DiffItemController(const QString& data_type, QObject* parent); DiffItemController(QObject* parent);
~DiffItemController() override; ~DiffItemController() override;
SessionModel* model();
void setItem(JobItem* job_item); void setItem(JobItem* job_item);
void updateDiffData(); void updateDiffData();
DataItem* diffItem(); DataItem* diffItem();
...@@ -42,7 +43,6 @@ public: ...@@ -42,7 +43,6 @@ public:
private: private:
JobItem* m_current_item; JobItem* m_current_item;
SessionModel* m_tempIntensityDataModel;
DataItem* m_diff_item; DataItem* m_diff_item;
}; };
...@@ -50,7 +50,7 @@ using DiffItemController = FitComparisonController2D::DiffItemController; ...@@ -50,7 +50,7 @@ using DiffItemController = FitComparisonController2D::DiffItemController;
FitComparisonController2D::FitComparisonController2D(QObject* parent) FitComparisonController2D::FitComparisonController2D(QObject* parent)
: QObject(parent) : QObject(parent)
, m_diff_item_controller(new DiffItemController(IntensityDataItem::M_TYPE, this)) , m_diff_item_controller(new DiffItemController(this))
, m_appearanceRepeater(new PropertyRepeater(this)) , m_appearanceRepeater(new PropertyRepeater(this))
, m_xAxisRepeater(new PropertyRepeater(this)) , m_xAxisRepeater(new PropertyRepeater(this))
, m_yAxisRepeater(new PropertyRepeater(this)) , m_yAxisRepeater(new PropertyRepeater(this))
...@@ -120,13 +120,11 @@ void FitComparisonController2D::clear() ...@@ -120,13 +120,11 @@ void FitComparisonController2D::clear()
m_zAxisRepeater->clear(); m_zAxisRepeater->clear();
} }
DiffItemController::DiffItemController(const QString& data_type, QObject* parent) DiffItemController::DiffItemController(QObject* parent)
: QObject(parent) : QObject(parent)
, m_current_item(nullptr) , m_current_item(nullptr)
// , m_tempIntensityDataModel(new SessionModel("TempIntensityDataModel", this))
// , m_diff_item(dynamic_cast<DataItem*>(m_tempIntensityDataModel->insertNewItem(data_type)))
{ {
// ASSERT(m_diff_item);
} }
DiffItemController::~DiffItemController() DiffItemController::~DiffItemController()
...@@ -148,6 +146,11 @@ void DiffItemController::setItem(JobItem* job_item) ...@@ -148,6 +146,11 @@ void DiffItemController::setItem(JobItem* job_item)
updateDiffData(); updateDiffData();
} }
SessionModel* DiffItemController::model()
{
return m_diff_item->model();
}
void DiffItemController::updateDiffData() void DiffItemController::updateDiffData()
{ {
ASSERT(m_current_item); ASSERT(m_current_item);
......
...@@ -33,7 +33,7 @@ const double relative_diff_max_1d = 4.0; ...@@ -33,7 +33,7 @@ const double relative_diff_max_1d = 4.0;
FitComparison1DViewController::FitComparison1DViewController(QObject* parent) FitComparison1DViewController::FitComparison1DViewController(QObject* parent)
: QObject(parent) : QObject(parent)
, m_diff_item_controller(new DiffItemController(SpecularDataItem::M_TYPE, this)) , m_diff_item_controller(new DiffItemController(this))
, m_diff_view_item(nullptr) , m_diff_view_item(nullptr)
, m_appearanceRepeater(new PropertyRepeater(this)) , m_appearanceRepeater(new PropertyRepeater(this))
, m_xAxisRepeater(new PropertyRepeater(this)) , m_xAxisRepeater(new PropertyRepeater(this))
...@@ -50,7 +50,7 @@ void FitComparison1DViewController::setItem(JobItem* job_item) ...@@ -50,7 +50,7 @@ void FitComparison1DViewController::setItem(JobItem* job_item)
ASSERT(job_item); ASSERT(job_item);
clear(); clear();
m_diff_item_controller->setJobItem(job_item); m_diff_item_controller->setItems(job_item);
createDiffViewItem(job_item); createDiffViewItem(job_item);
auto* job_data_view = job_item->dataItemView(); auto* job_data_view = job_item->dataItemView();
...@@ -111,13 +111,10 @@ void FitComparison1DViewController::deleteDiffViewItem() ...@@ -111,13 +111,10 @@ void FitComparison1DViewController::deleteDiffViewItem()
m_diff_view_item = nullptr; m_diff_view_item = nullptr;
} }
DiffItemController::DiffItemController(const QString& data_type, QObject* parent) DiffItemController::DiffItemController(QObject* parent)
: QObject(parent) : QObject(parent)
, m_current_item(nullptr) , m_current_item(nullptr)
// , m_private_model(new SessionModel("TempIntensityDataModel", this))
// , m_diff_item(dynamic_cast<DataItem*>(m_private_model->insertNewItem(data_type)))
{ {
// ASSERT(m_diff_item);
} }
DiffItemController::~DiffItemController() DiffItemController::~DiffItemController()
...@@ -125,7 +122,7 @@ DiffItemController::~DiffItemController() ...@@ -125,7 +122,7 @@ DiffItemController::~DiffItemController()
unsubscribe(); unsubscribe();
} }
void DiffItemController::setJobItem(JobItem* job_item) void DiffItemController::setItems(JobItem* job_item)
{ {
ASSERT(job_item); ASSERT(job_item);
ASSERT(job_item->diffDataItem()); ASSERT(job_item->diffDataItem());
...@@ -139,6 +136,11 @@ void DiffItemController::setJobItem(JobItem* job_item) ...@@ -139,6 +136,11 @@ void DiffItemController::setJobItem(JobItem* job_item)
updateDiffData(); updateDiffData();
} }
SessionModel* DiffItemController::model()
{
return m_diff_item->model();
}
void DiffItemController::updateDiffData() void DiffItemController::updateDiffData()
{ {
ASSERT(m_current_item); ASSERT(m_current_item);
......
...@@ -25,10 +25,10 @@ class SessionModel; ...@@ -25,10 +25,10 @@ class SessionModel;
class DiffItemController : public QObject { class DiffItemController : public QObject {
public: public:
DiffItemController(const QString& data_type, QObject* parent); DiffItemController(QObject* parent);
~DiffItemController() override; ~DiffItemController() override;
SessionModel* model() { return m_private_model; } SessionModel* model();
void setJobItem(JobItem* job_item); void setItems(JobItem* job_item);
JobItem* jobItem() { return m_current_item; } JobItem* jobItem() { return m_current_item; }
void updateDiffData(); void updateDiffData();
DataItem* diffItem() { return m_diff_item; } DataItem* diffItem() { return m_diff_item; }
...@@ -37,7 +37,6 @@ public: ...@@ -37,7 +37,6 @@ public:
private: private:
JobItem* m_current_item; JobItem* m_current_item;
SessionModel* m_private_model;
DataItem* m_diff_item; DataItem* m_diff_item;
}; };
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment