diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowPresenter.h index 85094459e913d80163de11fbf613d7f637c86532..91d386c968bed147139b026775cc4c7389682dc8 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowPresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowPresenter.h @@ -38,6 +38,15 @@ class IReflMainWindowPresenter { public: /// Destructor virtual ~IReflMainWindowPresenter(){}; + + enum Flag { + PauseReductionFlag, + ResumeReductionFlag, + ConfirmReductionPausedFlag, + ConfirmReductionResumedFlag + }; + virtual void notify(IReflMainWindowPresenter::Flag flag) = 0; + /// Pre-processing virtual std::string getTransmissionRuns(int group) const = 0; virtual std::string getTransmissionOptions(int group) const = 0; @@ -63,6 +72,8 @@ public: const std::string &title) = 0; virtual std::string runPythonAlgorithm(const std::string &pythonCode) = 0; virtual void setInstrumentName(const std::string &instName) const = 0; + /// Data processing check + virtual bool checkIfProcessing() const = 0; }; } } diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowView.h index d53151432840aef7ddb9027be9d33c3bf632a587..55dac0b680e5b91c094aa545afb36a5531f665ee 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflMainWindowView.h @@ -52,6 +52,9 @@ public: virtual void giveUserInfo(const std::string &prompt, const std::string &title) = 0; virtual std::string runPythonAlgorithm(const std::string &pythonCode) = 0; + + /// Close window handler + virtual void confirmCloseWindow() = 0; }; } } diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflRunsTabPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflRunsTabPresenter.h index 50bbcf9ea26345d99015e8400f203dee611de2d1..44337f670fcea46b452770713863d920dd9fe432 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflRunsTabPresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/IReflRunsTabPresenter.h @@ -43,7 +43,10 @@ public: ICATSearchCompleteFlag, TransferFlag, InstrumentChangedFlag, - GroupChangedFlag + GroupChangedFlag, + PauseReductionFlag, + ResumeReductionFlag, + ConfirmReductionPausedFlag }; // Tell the presenter something happened diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/QtReflMainWindowView.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/QtReflMainWindowView.h index 36ed2371f30213464402ac6bd17af06114025d1a..dd661d7f6305827a1357420dc14195c982c94b9f 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/QtReflMainWindowView.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/QtReflMainWindowView.h @@ -5,6 +5,8 @@ #include "MantidQtCustomInterfaces/Reflectometry/IReflMainWindowView.h" #include "ui_ReflMainWindowWidget.h" +#include <QCloseEvent> + namespace MantidQt { namespace CustomInterfaces { @@ -65,6 +67,10 @@ public: const std::string &title) override; std::string runPythonAlgorithm(const std::string &pythonCode) override; + /// Close window handlers + void confirmCloseWindow() override; + void closeEvent(QCloseEvent *event) override; + private: /// Initializes the interface void initLayout() override; @@ -81,6 +87,8 @@ private: Ui::RelMainWindowWidget m_ui; /// The presenter handling this view std::unique_ptr<IReflMainWindowPresenter> m_presenter; + /// Temporary store for a close event + QCloseEvent *m_closeEvent; }; } } diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflMainWindowPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflMainWindowPresenter.h index 37be468e6b050d823044dff5285b67d7dc4c8bc3..d1cad87f95277ae2783a0bb2e76a558adb9e03b7 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflMainWindowPresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflMainWindowPresenter.h @@ -50,6 +50,10 @@ public: IReflSaveTabPresenter *savePresenter); /// Destructor ~ReflMainWindowPresenter() override; + + // Tell the presenter something has happened + void notify(IReflMainWindowPresenter::Flag flag) override; + /// Returns values passed for 'Transmission run(s)' std::string getTransmissionRuns(int group) const override; /// Returns global options for 'CreateTransmissionWorkspaceAuto' @@ -77,11 +81,22 @@ public: std::string runPythonAlgorithm(const std::string &pythonCode) override; void setInstrumentName(const std::string &instName) const override; + /// Returns whether the Runs Tab is currently processing any runs + bool checkIfProcessing() const override; + private: /// Check for Settings Tab null pointer void checkSettingsPtrValid(IReflSettingsTabPresenter *pointer) const; /// Check for Event Handling Tab null pointer void checkEventPtrValid(IReflEventTabPresenter *pointer) const; + /// Pauses reduction in the Runs Tab + void pauseReduction() const; + /// Resumes reduction in the Runs Tab + void resumeReduction() const; + /// Confirm reduction in the Runs Tab is paused + void confirmReductionPaused() const; + /// Confirm reduction in the Runs Tab is resumed + void confirmReductionResumed() const; /// The view we are handling IReflMainWindowView *m_view; /// The presenter of tab 'Runs' @@ -92,6 +107,8 @@ private: IReflSettingsTabPresenter *m_settingsPresenter; /// The presenter of tab 'Save ASCII' IReflSaveTabPresenter *m_savePresenter; + /// State boolean on whether runs are currently being processed or not + mutable bool m_isProcessing; }; } } diff --git a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflRunsTabPresenter.h b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflRunsTabPresenter.h index 77cb7502590039354541d2ae21ef3932369aa36c..1b08a8d24b01eedc3c6325deecef4fe5b4d9d0a0 100644 --- a/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflRunsTabPresenter.h +++ b/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/Reflectometry/ReflRunsTabPresenter.h @@ -82,6 +82,9 @@ public: std::string getPostprocessingOptions() const override; std::string getTimeSlicingValues() const override; std::string getTimeSlicingType() const override; + /// Reduction paused/resumed confirmation handler + void confirmReductionPaused() const override; + void confirmReductionResumed() const override; private: /// The search model @@ -112,6 +115,9 @@ private: std::unique_ptr<ReflTransferStrategy> getTransferStrategy(); /// change the instrument void changeInstrument(); + /// handle pausing/resuming reduction + void pauseReduction(); + void resumeReduction(); }; } } diff --git a/MantidQt/CustomInterfaces/src/Reflectometry/QtReflMainWindowView.cpp b/MantidQt/CustomInterfaces/src/Reflectometry/QtReflMainWindowView.cpp index af7ae5433a957d129d57f71f839ae2e59e8a6cc2..6b7637216d24ff0c07a144b0fd73b0beea61c2c5 100644 --- a/MantidQt/CustomInterfaces/src/Reflectometry/QtReflMainWindowView.cpp +++ b/MantidQt/CustomInterfaces/src/Reflectometry/QtReflMainWindowView.cpp @@ -169,5 +169,38 @@ QtReflMainWindowView::runPythonAlgorithm(const std::string &pythonCode) { QString output = runPythonCode(QString::fromStdString(pythonCode), false); return output.toStdString(); } + +/** +Ask the user to confirm if they want to close the main window +*/ +void QtReflMainWindowView::confirmCloseWindow() { + + if (m_closeEvent) { + if (askUserYesNo("Runs are still being processed, are you sure you want to " + "close and stop processing?", + "Confirm Close")) { + m_closeEvent->accept(); // close window + } else { + // Prevent window close and resume processing + m_presenter->notify(IReflMainWindowPresenter::ResumeReductionFlag); + m_closeEvent->ignore(); + } + } +} + +/** +Handles attempt to close main window +* @param event : [input] The close event +*/ +void QtReflMainWindowView::closeEvent(QCloseEvent *event) { + + // No runs are being processed, close window + if (!m_presenter->checkIfProcessing()) + event->accept(); + + // Otherwise send message to pause the reduction and store the close event + m_presenter->notify(IReflMainWindowPresenter::PauseReductionFlag); + m_closeEvent = event; +} } } diff --git a/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainWindowPresenter.cpp b/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainWindowPresenter.cpp index 3ea51abb117e233d7f90c195cf5dc1b742d5c9ec..ca22338d9c94c50af7700e6898c6031065b9e51b 100644 --- a/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainWindowPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/Reflectometry/ReflMainWindowPresenter.cpp @@ -23,7 +23,7 @@ ReflMainWindowPresenter::ReflMainWindowPresenter( IReflSaveTabPresenter *savePresenter) : m_view(view), m_runsPresenter(runsPresenter), m_eventPresenter(eventPresenter), m_settingsPresenter(settingsPresenter), - m_savePresenter(savePresenter) { + m_savePresenter(savePresenter), m_isProcessing(false) { // Tell the tab presenters that this is going to be the main presenter m_runsPresenter->acceptMainPresenter(this); @@ -38,6 +38,28 @@ ReflMainWindowPresenter::ReflMainWindowPresenter( */ ReflMainWindowPresenter::~ReflMainWindowPresenter() {} +/** +Used by the view to tell the presenter something has changed +*/ +void ReflMainWindowPresenter::notify(IReflMainWindowPresenter::Flag flag) { + + switch (flag) { + case IReflMainWindowPresenter::PauseReductionFlag: + pauseReduction(); + break; + case IReflMainWindowPresenter::ResumeReductionFlag: + resumeReduction(); + break; + case IReflMainWindowPresenter::ConfirmReductionPausedFlag: + confirmReductionPaused(); + break; + case IReflMainWindowPresenter::ConfirmReductionResumedFlag: + confirmReductionResumed(); + } + // Not having a 'default' case is deliberate. gcc issues a warning if there's + // a flag we aren't handling. +} + /** Returns values passed for 'Transmission run(s)' * * @param group :: Index of the group in 'Settings' tab from which to get the @@ -201,6 +223,15 @@ void ReflMainWindowPresenter::setInstrumentName( m_settingsPresenter->setInstrumentName(instName); } +/** +Checks whether or not data is currently being processed in the Runs Tab +* @return : Bool on whether data is being processed +*/ +bool ReflMainWindowPresenter::checkIfProcessing() const { + + return m_isProcessing; +} + /** Checks for Settings Tab null pointer * @param pointer :: The pointer */ @@ -218,5 +249,35 @@ void ReflMainWindowPresenter::checkEventPtrValid( if (pointer == nullptr) throw std::invalid_argument("Could not read event handling"); } + +/** Pauses reduction in the runs tab +*/ +void ReflMainWindowPresenter::pauseReduction() const { + + m_runsPresenter->notify(IReflRunsTabPresenter::PauseReductionFlag); +} + +/** Resumes reduction in the runs tab +*/ +void ReflMainWindowPresenter::resumeReduction() const { + + m_isProcessing = true; + m_runsPresenter->notify(IReflRunsTabPresenter::ResumeReductionFlag); +} + +/** Confirm that reduction in the runs tab has been paused +*/ +void ReflMainWindowPresenter::confirmReductionPaused() const { + + m_isProcessing = false; + m_view->confirmCloseWindow(); +} + +/** Confirm that reduction in the runs tab has been resumed +*/ +void ReflMainWindowPresenter::confirmReductionResumed() const { + + m_isProcessing = true; +} } } diff --git a/MantidQt/CustomInterfaces/src/Reflectometry/ReflRunsTabPresenter.cpp b/MantidQt/CustomInterfaces/src/Reflectometry/ReflRunsTabPresenter.cpp index 4b664e120f7bdb5e5681b74099e9ea279b83410f..9d9f6a45118488ec0b440d6faf1822f082c0624f 100644 --- a/MantidQt/CustomInterfaces/src/Reflectometry/ReflRunsTabPresenter.cpp +++ b/MantidQt/CustomInterfaces/src/Reflectometry/ReflRunsTabPresenter.cpp @@ -126,6 +126,12 @@ void ReflRunsTabPresenter::notify(IReflRunsTabPresenter::Flag flag) { case IReflRunsTabPresenter::GroupChangedFlag: pushCommands(); break; + case IReflRunsTabPresenter::PauseReductionFlag: + pauseReduction(); + break; + case IReflRunsTabPresenter::ResumeReductionFlag: + resumeReduction(); + break; } // Not having a 'default' case is deliberate. gcc issues a warning if there's // a flag we aren't handling. @@ -343,7 +349,7 @@ ReflRunsTabPresenter::getTransferStrategy() { } /** -Used to tell the presenter something has changed in the ADS +Used to tell the presenter something has changed */ void ReflRunsTabPresenter::notify(DataProcessorMainPresenter::Flag flag) { @@ -351,6 +357,9 @@ void ReflRunsTabPresenter::notify(DataProcessorMainPresenter::Flag flag) { case DataProcessorMainPresenter::ADSChangedFlag: pushCommands(); break; + case DataProcessorMainPresenter::ConfirmReductionPausedFlag: + confirmReductionPaused(); + break; } // Not having a 'default' case is deliberate. gcc issues a warning if there's // a flag we aren't handling. @@ -427,6 +436,21 @@ std::string ReflRunsTabPresenter::getTimeSlicingType() const { return m_mainPresenter->getTimeSlicingType(m_view->getSelectedGroup()); } +/** Notifies main presenter that data reduction is confirmed to be paused +*/ +void ReflRunsTabPresenter::confirmReductionPaused() const { + + m_mainPresenter->notify(IReflMainWindowPresenter::ConfirmReductionPausedFlag); +} + +/** Notifies main presenter that data reduction is confirmed to be resumed +*/ +void ReflRunsTabPresenter::confirmReductionResumed() const { + + m_mainPresenter->notify( + IReflMainWindowPresenter::ConfirmReductionResumedFlag); +} + /** Tells the view to show an critical error dialog @param prompt : The prompt to appear on the dialog @@ -497,6 +521,24 @@ void ReflRunsTabPresenter::changeInstrument() { g_log.information() << "Instrument changed to " << instrument; } +/** +Tells table presenter to pause reducing runs +*/ +void ReflRunsTabPresenter::pauseReduction() { + + m_tablePresenters[m_view->getSelectedGroup()]->notify( + DataProcessorPresenter::PauseFlag); +} + +/** +Tells table presenter to resume reducing runs +*/ +void ReflRunsTabPresenter::resumeReduction() { + + m_tablePresenters[m_view->getSelectedGroup()]->notify( + DataProcessorPresenter::ResumeFlag); +} + const std::string ReflRunsTabPresenter::MeasureTransferMethod = "Measurement"; const std::string ReflRunsTabPresenter::LegacyTransferMethod = "Description"; } diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorMainPresenter.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorMainPresenter.h index 1fbf31fa466acd9d9c5e1dff03504a8076d41b9c..e68f5f72abb54baedf49f546c0e3384a51412076 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorMainPresenter.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorMainPresenter.h @@ -39,9 +39,13 @@ class DataProcessorMainPresenter { public: virtual ~DataProcessorMainPresenter(){}; - enum Flag { ADSChangedFlag }; + enum Flag { + ADSChangedFlag, + ConfirmReductionPausedFlag, + ConfirmReductionResumedFlag + }; - /// Notify this receiver that something changed in the ADS + /// Notify this receiver that something has changed virtual void notify(DataProcessorMainPresenter::Flag flag) = 0; /// Dialog/Prompt methods @@ -69,6 +73,11 @@ public: virtual std::string getTimeSlicingValues() const = 0; /// Return time-slicing type virtual std::string getTimeSlicingType() const = 0; + + /// Handle data reduction pause confirmation + virtual void confirmReductionPaused() const = 0; + /// Handle data reduction resume confirmation + virtual void confirmReductionResumed() const = 0; }; } } diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPresenter.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPresenter.h index f58f76ee80e6d6487bbaf59a82f96e62adf9d886..bc211f01052528632816ae790eff2847940b0772 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPresenter.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/DataProcessorPresenter.h @@ -71,7 +71,9 @@ public: PlotRowFlag, PlotGroupFlag, ExpandAllGroupsFlag, - CollapseAllGroupsFlag + CollapseAllGroupsFlag, + PauseFlag, + ResumeFlag }; // Tell the presenter something happened diff --git a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/GenericDataProcessorPresenter.h b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/GenericDataProcessorPresenter.h index 231b476043b6e7947ceb3cbde48d68c352537d84..c2a49feefe2a3f215ec9f94bc3e4ef85247fb2a9 100644 --- a/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/GenericDataProcessorPresenter.h +++ b/MantidQt/MantidWidgets/inc/MantidQtMantidWidgets/DataProcessorUI/GenericDataProcessorPresenter.h @@ -195,6 +195,12 @@ private: std::map<std::string, QVariant> m_options; // Thread to run reducer worker in std::unique_ptr<GenericDataProcessorPresenterThread> m_workerThread; + // A boolean indicating whether or not data reduction has been paused + mutable bool m_reductionPaused; + // Enumeration of the reduction actions that can be taken + enum ReductionFlag { ReduceRowFlag, ReduceGroupFlag }; + // A flag of the next action due to be carried out + ReductionFlag m_nextActionFlag; // load a run into the ADS, or re-use one in the ADS if possible Mantid::API::Workspace_sptr getRun(const std::string &run, const std::string &instrument, @@ -247,6 +253,13 @@ private: // actions/commands void addCommands(); + // start reduction + void startReduction(); + + // pause/resume reduction + void pause(); + void resume(); + // List of workspaces the user can open std::set<std::string> m_workspaceList; diff --git a/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp b/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp index 7e9da6319392b56e1ca835f53a7f58ab23021db3..c6fff89cd7ead210db719bf7718f845c11195b73 100644 --- a/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp +++ b/MantidQt/MantidWidgets/src/DataProcessorUI/GenericDataProcessorPresenter.cpp @@ -56,10 +56,11 @@ GenericDataProcessorPresenter::GenericDataProcessorPresenter( const std::map<std::string, std::string> &postprocessMap, const std::string &loader) : WorkspaceObserver(), m_view(nullptr), m_progressView(nullptr), - m_mainPresenter(), m_progressReporter(nullptr), m_loader(loader), m_whitelist(whitelist), - m_preprocessMap(preprocessMap), m_processor(processor), - m_postprocessor(postprocessor), m_postprocessMap(postprocessMap), - m_postprocess(true), m_tableDirty(false) { + m_mainPresenter(), m_progressReporter(nullptr), m_loader(loader), + m_whitelist(whitelist), m_preprocessMap(preprocessMap), + m_processor(processor), m_postprocessor(postprocessor), + m_postprocessMap(postprocessMap), m_postprocess(true), + m_tableDirty(false), m_reductionPaused(false) { // Column Options must be added to the whitelist m_whitelist.addElement("Options", "Options", @@ -219,8 +220,7 @@ void GenericDataProcessorPresenter::process() { m_gqueue.push(std::make_pair(item.first, rowQueue)); } - // Start processing all groups - nextGroup(); + startReduction(); // If "Output Notebook" checkbox is checked then create an ipython notebook if (m_view->getEnableNotebook()) @@ -234,6 +234,14 @@ void GenericDataProcessorPresenter::nextRow() { m_workerThread.reset(); + if (m_reductionPaused) { + // Set action flag and notify presenter that reduction is paused + m_nextActionFlag = GenericDataProcessorPresenter::ReduceRowFlag; + m_mainPresenter->notify( + DataProcessorMainPresenter::ConfirmReductionPausedFlag); + return; + } + // Add processed row data to the group int groupIndex = m_rowItem.first; m_groupData[groupIndex] = m_rowItem.second; @@ -275,6 +283,14 @@ void GenericDataProcessorPresenter::nextGroup() { m_workerThread.reset(); + if (m_reductionPaused) { + // Set action flag and notify presenter that reduction is paused + m_nextActionFlag = GenericDataProcessorPresenter::ReduceGroupFlag; + m_mainPresenter->notify( + DataProcessorMainPresenter::ConfirmReductionPausedFlag); + return; + } + if (!m_gqueue.empty()) { // Reduce first row int groupIndex = m_gqueue.front().first; @@ -944,6 +960,12 @@ void GenericDataProcessorPresenter::notify(DataProcessorPresenter::Flag flag) { case DataProcessorPresenter::CollapseAllGroupsFlag: collapseAll(); break; + case DataProcessorPresenter::PauseFlag: + pause(); + break; + case DataProcessorPresenter::ResumeFlag: + resume(); + break; } // Not having a 'default' case is deliberate. gcc issues a warning if there's // a flag we aren't handling. @@ -1356,6 +1378,50 @@ void GenericDataProcessorPresenter::addCommands() { m_view->addActions(std::move(commandsToShow)); } +/** +Start the reduction process and notify main presenter appropriately +*/ +void GenericDataProcessorPresenter::startReduction() { + + m_mainPresenter->notify( + DataProcessorMainPresenter::ConfirmReductionResumedFlag); + // Start processing the first group + nextGroup(); + m_mainPresenter->notify( + DataProcessorMainPresenter::ConfirmReductionPausedFlag); +} + +/** +Pauses reduction. If currently reducing runs, this does not take effect until +the current thread for reducing a row or group has finished +*/ +void GenericDataProcessorPresenter::pause() { + + if (!m_reductionPaused) + m_mainPresenter->notify( + DataProcessorMainPresenter::ConfirmReductionPausedFlag); + + m_reductionPaused = true; +} + +/** Resumes reduction if currently paused +*/ +void GenericDataProcessorPresenter::resume() { + + m_reductionPaused = false; + m_mainPresenter->notify( + DataProcessorMainPresenter::ConfirmReductionResumedFlag); + + switch (m_nextActionFlag) { + case GenericDataProcessorPresenter::ReduceRowFlag: + nextRow(); + break; + case GenericDataProcessorPresenter::ReduceGroupFlag: + nextGroup(); + break; + } +} + /** * Tells the view to load a table workspace * @param name : [input] The workspace's name