Skip to content
Snippets Groups Projects
Commit e7698c29 authored by Raquel Alvarez Banos's avatar Raquel Alvarez Banos
Browse files

Re #13862 Make BaselineModelling aware of data loaded by DataLoading

parent 29021202
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,7 @@ namespace CustomInterfaces
SectionRow sectionRow(int row) const;
SectionSelector sectionSelector(int index) const;
int noOfSectionRows() const;
void emitFitRequested();
public slots:
void initialize();
......
......@@ -60,6 +60,10 @@ namespace CustomInterfaces
/// Updates the list of logs and number of periods
void updateAvailableInfo();
signals:
/// Signal emitted when data get changed
void dataChanged();
private:
/// View which the object works with
IALCDataLoadingView* const m_view;
......
......@@ -18,9 +18,11 @@ namespace CustomInterfaces
class ALCDataLoadingPresenter;
class ALCBaselineModellingView;
class ALCBaselineModellingPresenter;
class ALCBaselineModellingModel;
class ALCPeakFittingView;
class ALCPeakFittingPresenter;
class ALCPeakFittingModel;
......@@ -68,11 +70,17 @@ namespace CustomInterfaces
void exportResults();
void importResults();
void updateBaselineData();
private:
/// UI form
Ui::ALCInterface m_ui;
// Step views
ALCBaselineModellingView* m_baselineModellingView;
ALCPeakFittingView* m_peakFittingView;
// Step presenters
ALCDataLoadingPresenter* m_dataLoading;
ALCBaselineModellingPresenter* m_baselineModelling;
......
......@@ -135,6 +135,9 @@ namespace CustomInterfaces
/// User has selected the first run
void firstRunSelected();
/// New data have been loaded
void dataChanged();
};
} // namespace CustomInterfaces
......
......@@ -272,5 +272,9 @@ namespace CustomInterfaces
MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC"));
}
void ALCBaselineModellingView::emitFitRequested() {
emit fitRequested();
}
} // namespace CustomInterfaces
} // namespace MantidQt
......@@ -108,6 +108,8 @@ namespace CustomInterfaces
m_view->setDataCurve(*(ALCHelper::curveDataFromWs(m_loadedData, 0)),
ALCHelper::curveErrorsFromWs(m_loadedData, 0));
emit dataChanged();
}
catch(std::exception& e)
{
......
......@@ -49,19 +49,36 @@ namespace CustomInterfaces
m_dataLoading = new ALCDataLoadingPresenter(dataLoadingView);
m_dataLoading->initialize();
auto baselineModellingView = new ALCBaselineModellingView(m_ui.baselineModellingView);
m_baselineModelling = new ALCBaselineModellingPresenter(baselineModellingView, m_baselineModellingModel);
m_baselineModellingView = new ALCBaselineModellingView(m_ui.baselineModellingView);
m_baselineModelling = new ALCBaselineModellingPresenter(m_baselineModellingView, m_baselineModellingModel);
m_baselineModelling->initialize();
auto peakFittingView = new ALCPeakFittingView(m_ui.peakFittingView);
m_peakFitting = new ALCPeakFittingPresenter(peakFittingView, m_peakFittingModel);
m_peakFittingView = new ALCPeakFittingView(m_ui.peakFittingView);
m_peakFitting = new ALCPeakFittingPresenter(m_peakFittingView, m_peakFittingModel);
m_peakFitting->initialize();
connect(m_dataLoading, SIGNAL(dataChanged()), SLOT(updateBaselineData()));
assert(m_ui.stepView->count() == STEP_NAMES.count()); // Should have names for all steps
switchStep(0); // We always start from the first step
}
void ALCInterface::updateBaselineData() {
if (m_dataLoading->loadedData()) {
m_baselineModellingModel->setData(m_dataLoading->loadedData());
if ((!m_baselineModellingView->function().isEmpty()) &&
(m_baselineModellingView->noOfSectionRows() > 0)) {
// Fit the data
m_baselineModellingView->emitFitRequested();
}
}
}
void ALCInterface::nextStep()
{
int next = m_ui.stepView->currentIndex() + 1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment