diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h index a6b72f65f76b91c92af1c62d53bac166a5cff6ff..fe46ceea2256ad849e8c50756ee189d2a0894087 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCBaselineModellingView.h @@ -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(); diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h index 547a57a971839b7bc5c39b0e742665ed0f7ee1c2..11ea73759178593c49edddf88f4d7e72c64ba15d 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCDataLoadingPresenter.h @@ -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; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h index 9666c82a6418790fd9a1f62af32a50421f9350a0..e94e34c62671e591730f75c29bec72778a0a5cc4 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/ALCInterface.h @@ -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; diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h index c5772cdbea8abb1c925a670eb17131d0e9741511..3c0ac04337d569a3eb59e1d323853755edc1721a 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Muon/IALCDataLoadingView.h @@ -135,6 +135,9 @@ namespace CustomInterfaces /// User has selected the first run void firstRunSelected(); + /// New data have been loaded + void dataChanged(); + }; } // namespace CustomInterfaces diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp index 03be4452b122836f19f757ae37bcf69382d3a89b..b1ec6576a13fb0f4df52ec856443a8bac8cbfec8 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCBaselineModellingView.cpp @@ -272,5 +272,9 @@ namespace CustomInterfaces MantidQt::API::HelpWindow::showCustomInterface(NULL, QString("Muon_ALC")); } + void ALCBaselineModellingView::emitFitRequested() { + emit fitRequested(); + } + } // namespace CustomInterfaces } // namespace MantidQt diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp index 4492c6f91876c40633eb1ee49b7bd44d6d9eba94..8f56ec1b0f6dda9ee3a374c3f34150efedfbb044 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCDataLoadingPresenter.cpp @@ -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) { diff --git a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp index 5e0703eea02248d71696be2ee0b2dfb78329222b..9a293ee0a37390af4c4e924a1de6ac4fd73febd9 100644 --- a/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp +++ b/MantidQt/CustomInterfaces/src/Muon/ALCInterface.cpp @@ -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;