From 3e3b51dfbdb6491cfea160e7feeec5206b30810f Mon Sep 17 00:00:00 2001 From: Edward Brown <edward.brown@stfc.ac.uk> Date: Thu, 1 Feb 2018 16:29:18 +0000 Subject: [PATCH] Re #21674: Disables settings tab when processing. - Additionally refreshes save tab when reduction paused/finished. --- .../ISISReflectometry/IReflSaveTabPresenter.h | 2 ++ .../ISISReflectometry/IReflSettingsPresenter.h | 3 +++ .../IReflSettingsTabPresenter.h | 2 ++ .../ISISReflectometry/IReflSettingsView.h | 2 ++ .../ISISReflectometry/QtReflSettingsView.cpp | 10 ++++++++++ .../ISISReflectometry/QtReflSettingsView.h | 2 ++ .../ReflMainWindowPresenter.cpp | 16 ++++++++++++++-- .../ISISReflectometry/ReflMainWindowPresenter.h | 3 +++ .../ISISReflectometry/ReflSaveTabPresenter.cpp | 6 +++++- .../ISISReflectometry/ReflSaveTabPresenter.h | 2 ++ .../ISISReflectometry/ReflSaveTabWidget.ui | 4 ++-- .../ISISReflectometry/ReflSettingsPresenter.cpp | 8 ++++++++ .../ISISReflectometry/ReflSettingsPresenter.h | 2 ++ .../ReflSettingsTabPresenter.cpp | 10 ++++++++++ .../ISISReflectometry/ReflSettingsTabPresenter.h | 2 ++ 15 files changed, 69 insertions(+), 5 deletions(-) diff --git a/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h b/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h index 81c38776915..c29a7976147 100644 --- a/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/IReflSaveTabPresenter.h @@ -48,6 +48,8 @@ public: /// Tell the presenter something happened virtual void notify(IReflSaveTabPresenter::Flag flag) = 0; + virtual void onReductionPaused() = 0; + virtual void onReductionResumed() = 0; }; } } diff --git a/qt/scientific_interfaces/ISISReflectometry/IReflSettingsPresenter.h b/qt/scientific_interfaces/ISISReflectometry/IReflSettingsPresenter.h index c809b910200..f59f2476064 100644 --- a/qt/scientific_interfaces/ISISReflectometry/IReflSettingsPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/IReflSettingsPresenter.h @@ -62,6 +62,9 @@ public: virtual void notify(IReflSettingsPresenter::Flag flag) = 0; /// Set current instrument name virtual void setInstrumentName(const std::string &instName) = 0; + + virtual void onReductionPaused() = 0; + virtual void onReductionResumed() = 0; }; } } diff --git a/qt/scientific_interfaces/ISISReflectometry/IReflSettingsTabPresenter.h b/qt/scientific_interfaces/ISISReflectometry/IReflSettingsTabPresenter.h index a0ba40b2364..f75595cef29 100644 --- a/qt/scientific_interfaces/ISISReflectometry/IReflSettingsTabPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/IReflSettingsTabPresenter.h @@ -52,6 +52,8 @@ public: virtual void setInstrumentName(const std::string &instName) = 0; virtual void acceptMainPresenter(IReflMainWindowPresenter *mainPresenter) = 0; virtual void settingsChanged(int group) = 0; + virtual void onReductionPaused() = 0; + virtual void onReductionResumed() = 0; }; } } diff --git a/qt/scientific_interfaces/ISISReflectometry/IReflSettingsView.h b/qt/scientific_interfaces/ISISReflectometry/IReflSettingsView.h index 8cd53321245..f141462666f 100644 --- a/qt/scientific_interfaces/ISISReflectometry/IReflSettingsView.h +++ b/qt/scientific_interfaces/ISISReflectometry/IReflSettingsView.h @@ -99,6 +99,8 @@ public: /// Set polarisation corrections and parameters enabled/disabled virtual void setPolarisationOptionsEnabled(bool enable) = 0; virtual void setDetectorCorrectionEnabled(bool enable) = 0; + virtual void disableAll() = 0; + virtual void enableAll() = 0; }; } } diff --git a/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.cpp b/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.cpp index 80f4cc04f8a..e527b393e9b 100644 --- a/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.cpp @@ -89,6 +89,16 @@ void QtReflSettingsView::connectInstrumentSettingsChangeListeners() { connectSettingsChange(m_ui.summationTypeComboBox); } +void QtReflSettingsView::disableAll() { + m_ui.instSettingsGroup->setEnabled(false); + m_ui.expSettingsGroup->setEnabled(false); +} + +void QtReflSettingsView::enableAll() { + m_ui.instSettingsGroup->setEnabled(true); + m_ui.expSettingsGroup->setEnabled(true); +} + void QtReflSettingsView::connectExperimentSettingsChangeListeners() { connectSettingsChange(m_ui.expSettingsGroup); connectSettingsChange(m_ui.analysisModeComboBox); diff --git a/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.h b/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.h index a75c1b76dbd..28348739c38 100644 --- a/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.h +++ b/qt/scientific_interfaces/ISISReflectometry/QtReflSettingsView.h @@ -108,6 +108,8 @@ public: /// Creates hints for 'Stitch1DMany' void createStitchHints(const std::map<std::string, std::string> &hints) override; + void disableAll() override; + void enableAll() override; void showOptionLoadErrors( std::vector<InstrumentParameterTypeMissmatch> const &errors, diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp index 95742d9cc15..e7cb0af74eb 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.cpp @@ -48,16 +48,28 @@ void ReflMainWindowPresenter::notify(IReflMainWindowPresenter::Flag flag) { switch (flag) { case Flag::ConfirmReductionPausedFlag: - m_isProcessing = false; + onReductionPaused(); break; case Flag::ConfirmReductionResumedFlag: - m_isProcessing = true; + onReductionResumed(); break; } // Not having a 'default' case is deliberate. gcc issues a warning if there's // a flag we aren't handling. } +void ReflMainWindowPresenter::onReductionPaused() { + m_isProcessing = false; + m_savePresenter->onReductionPaused(); + m_settingsPresenter->onReductionPaused(); +} + +void ReflMainWindowPresenter::onReductionResumed() { + m_isProcessing = true; + m_settingsPresenter->onReductionResumed(); + m_savePresenter->onReductionResumed(); +} + void ReflMainWindowPresenter::settingsChanged(int group) { m_runsPresenter->settingsChanged(group); } diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h index b6c75d20c6c..87de82157eb 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflMainWindowPresenter.h @@ -94,6 +94,9 @@ private: void pauseReduction() const; /// Resumes reduction in the Runs Tab void resumeReduction() const; + + void onReductionPaused(); + void onReductionResumed(); /// The view we are handling IReflMainWindowView *m_view; /// The presenter of tab 'Runs' diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp index 316fa0dd725..2488a88cf49 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.cpp @@ -41,6 +41,10 @@ void ReflSaveTabPresenter::acceptMainPresenter( m_mainPresenter = mainPresenter; } +void ReflSaveTabPresenter::onReductionPaused() { populateWorkspaceList(); } + +void ReflSaveTabPresenter::onReductionResumed() {} + void ReflSaveTabPresenter::notify(IReflSaveTabPresenter::Flag flag) { switch (flag) { case populateWorkspaceListFlag: @@ -212,4 +216,4 @@ std::vector<std::string> ReflSaveTabPresenter::getAvailableWorkspaceNames() { return validNames; } } -} \ No newline at end of file +} diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h index 640f616a13a..28ca6bd6c49 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabPresenter.h @@ -49,6 +49,8 @@ public: /// Accept a main presenter void acceptMainPresenter(IReflMainWindowPresenter *mainPresenter) override; void notify(IReflSaveTabPresenter::Flag flag) override; + void onReductionPaused() override; + void onReductionResumed() override; private: /// Adds all workspace names to the list of workspaces diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabWidget.ui b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabWidget.ui index 682e1649942..f90507e4f76 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabWidget.ui +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSaveTabWidget.ui @@ -266,7 +266,7 @@ </item> </layout> </widget> - </item> + </item> <item row ="5" column="0"> <widget class="QLabel" name="fileFormatLabel"> <property name="text"> @@ -335,7 +335,7 @@ </size> </property> </spacer> - </item> + </item> </layout> </widget> </item> diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp index 1b61f927670..c82cbb1be6a 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.cpp @@ -184,6 +184,14 @@ QString ReflSettingsPresenter::asAlgorithmPropertyBool(bool value) { return value ? "1" : "0"; } +void ReflSettingsPresenter::onReductionResumed() { + m_view->disableAll(); +} + +void ReflSettingsPresenter::onReductionPaused() { + m_view->enableAll(); +} + /** Returns global options for 'ReflectometryReductionOneAuto' * @return :: Global options for 'ReflectometryReductionOneAuto' */ diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.h index f222877be6a..3e7119285e0 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsPresenter.h @@ -63,6 +63,8 @@ public: std::string getTransmissionRuns() const override; void acceptTabPresenter(IReflSettingsTabPresenter *tabPresenter) override; + void onReductionPaused() override; + void onReductionResumed() override; private: void createStitchHints(); diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.cpp index e98bce91d02..71c417c7a0f 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.cpp @@ -51,6 +51,16 @@ void ReflSettingsTabPresenter::setInstrumentName(const std::string &instName) { presenter->setInstrumentName(instName); } +void ReflSettingsTabPresenter::onReductionResumed() { + for(auto presenter : m_settingsPresenters) + presenter->onReductionResumed(); +} + +void ReflSettingsTabPresenter::onReductionPaused() { + for(auto presenter : m_settingsPresenters) + presenter->onReductionPaused(); +} + /** Returns values passed for 'Transmission run(s)' * * @param group :: The group from which to get the values diff --git a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.h b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.h index 978aeb548b4..22ccf979f3e 100644 --- a/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/ReflSettingsTabPresenter.h @@ -49,6 +49,8 @@ public: void setInstrumentName(const std::string &instName) override; void acceptMainPresenter(IReflMainWindowPresenter *mainPresenter) override; void settingsChanged(int group) override; + void onReductionPaused() override; + void onReductionResumed() override; void passSelfToChildren(std::vector<IReflSettingsPresenter *> const &children); -- GitLab