Skip to content
Snippets Groups Projects
Commit 2f84067b authored by Gemma Guest's avatar Gemma Guest
Browse files

Minor refactoring to reduce duplication

Re #23051
parent 6593da72
No related merge requests found
...@@ -37,8 +37,7 @@ void ExperimentPresenter::notifySettingsChanged() { ...@@ -37,8 +37,7 @@ void ExperimentPresenter::notifySettingsChanged() {
} }
void ExperimentPresenter::notifyRestoreDefaultsRequested() { void ExperimentPresenter::notifyRestoreDefaultsRequested() {
m_model = experimentDefaults(m_mainPresenter->instrument()); restoreDefaults();
updateViewFromModel();
m_mainPresenter->notifySettingsChanged(); m_mainPresenter->notifySettingsChanged();
} }
...@@ -112,7 +111,12 @@ void ExperimentPresenter::instrumentChanged( ...@@ -112,7 +111,12 @@ void ExperimentPresenter::instrumentChanged(
std::string const &instrumentName, std::string const &instrumentName,
Mantid::Geometry::Instrument_const_sptr instrument) { Mantid::Geometry::Instrument_const_sptr instrument) {
UNUSED_ARG(instrumentName); UNUSED_ARG(instrumentName);
m_model = experimentDefaults(instrument); UNUSED_ARG(instrument);
restoreDefaults();
}
void ExperimentPresenter::restoreDefaults() {
m_model = experimentDefaults(m_mainPresenter->instrument());
updateViewFromModel(); updateViewFromModel();
} }
......
...@@ -68,6 +68,9 @@ public: ...@@ -68,6 +68,9 @@ public:
private: private:
IBatchPresenter *m_mainPresenter; IBatchPresenter *m_mainPresenter;
void restoreDefaults();
ExperimentValidationResult validateExperimentFromView(); ExperimentValidationResult validateExperimentFromView();
PolarizationCorrections polarizationCorrectionsFromView(); PolarizationCorrections polarizationCorrectionsFromView();
FloodCorrections floodCorrectionsFromView(); FloodCorrections floodCorrectionsFromView();
......
...@@ -39,8 +39,7 @@ void InstrumentPresenter::notifySettingsChanged() { ...@@ -39,8 +39,7 @@ void InstrumentPresenter::notifySettingsChanged() {
} }
void InstrumentPresenter::notifyRestoreDefaultsRequested() { void InstrumentPresenter::notifyRestoreDefaultsRequested() {
m_model = instrumentDefaults(m_mainPresenter->instrument()); restoreDefaults();
updateViewFromModel();
m_mainPresenter->notifySettingsChanged(); m_mainPresenter->notifySettingsChanged();
} }
...@@ -106,7 +105,12 @@ void InstrumentPresenter::instrumentChanged( ...@@ -106,7 +105,12 @@ void InstrumentPresenter::instrumentChanged(
std::string const &instrumentName, std::string const &instrumentName,
Mantid::Geometry::Instrument_const_sptr instrument) { Mantid::Geometry::Instrument_const_sptr instrument) {
UNUSED_ARG(instrumentName); UNUSED_ARG(instrumentName);
m_model = instrumentDefaults(instrument); UNUSED_ARG(instrument);
restoreDefaults();
}
void InstrumentPresenter::restoreDefaults() {
m_model = instrumentDefaults(m_mainPresenter->instrument());
updateViewFromModel(); updateViewFromModel();
} }
......
...@@ -48,6 +48,7 @@ private: ...@@ -48,6 +48,7 @@ private:
Instrument m_model; Instrument m_model;
IBatchPresenter *m_mainPresenter; IBatchPresenter *m_mainPresenter;
void restoreDefaults();
boost::optional<RangeInLambda> wavelengthRangeFromView(); boost::optional<RangeInLambda> wavelengthRangeFromView();
boost::optional<RangeInLambda> monitorBackgroundRangeFromView(); boost::optional<RangeInLambda> monitorBackgroundRangeFromView();
boost::optional<RangeInLambda> monitorIntegralRangeFromView(); boost::optional<RangeInLambda> monitorIntegralRangeFromView();
......
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