From c36e2e06147711b1d8af8d56adfbe6865898e674 Mon Sep 17 00:00:00 2001 From: Dan Nixon Date: Tue, 21 Oct 2014 16:15:32 +0100 Subject: [PATCH] Add instrument changed signal to IDR & tab Refs #10266 --- .../IndirectDataReduction.h | 5 +++++ .../IndirectDataReductionTab.h | 2 ++ .../src/IndirectDataReduction.cpp | 21 +++++++++++++++++++ 3 files changed, 28 insertions(+) diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h index d772b475a258..4c1b658160f4 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReduction.h @@ -76,11 +76,16 @@ namespace MantidQt void handleDirectoryChange(Mantid::Kernel::ConfigValChangeNotification_ptr pNf); ///< handle POCO event + signals: + /// Emitted when the instrument setup is changed + void newInstrumentConfiguration(QString instrumentName, QString analyser, QString reflection); + private slots: void helpClicked(); void runClicked(); void instrumentLoadingDone(bool error); + void instrumentChanged(); void userSelectInstrument(const QString& name); void openDirectoryDialog(); void showMessageBox(const QString& message); /// Slot showing a message box to the user diff --git a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h index 9050abccba6b..2e04f8af5142 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h +++ b/Code/Mantid/MantidQt/CustomInterfaces/inc/MantidQtCustomInterfaces/IndirectDataReductionTab.h @@ -82,6 +82,8 @@ namespace CustomInterfaces protected slots: /// Slot to handle when an algorithm finishes running virtual void algorithmFinished(bool error); + /// Emitted when the instrument setup is changed + void newInstrumentConfiguration(QString instrumentName, QString analyser, QString reflection); protected: /// Run the load algorithm with the given file name, output name and spectrum range diff --git a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp index ed47aa0f798b..5ca5c6e30e43 100644 --- a/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp +++ b/Code/Mantid/MantidQt/CustomInterfaces/src/IndirectDataReduction.cpp @@ -156,6 +156,13 @@ void IndirectDataReduction::initLayout() connect(m_tab_trans, SIGNAL(showMessageBox(const QString&)), this, SLOT(showMessageBox(const QString&))); connect(m_tab_moments, SIGNAL(showMessageBox(const QString&)), this, SLOT(showMessageBox(const QString&))); + connect(this, SIGNAL(instrumentSelectionChanged(QString, QString, QString)), m_tab_convert_to_energy, SIGNAL(instrumentSelectionChanged(QString, QString, QString))), + connect(this, SIGNAL(instrumentSelectionChanged(QString, QString, QString)), m_tab_sqw, SIGNAL(instrumentSelectionChanged(QString, QString, QString))), + connect(this, SIGNAL(instrumentSelectionChanged(QString, QString, QString)), m_tab_calibration, SIGNAL(instrumentSelectionChanged(QString, QString, QString))), + connect(this, SIGNAL(instrumentSelectionChanged(QString, QString, QString)), m_tab_diagnostics, SIGNAL(instrumentSelectionChanged(QString, QString, QString))), + connect(this, SIGNAL(instrumentSelectionChanged(QString, QString, QString)), m_tab_trans, SIGNAL(instrumentSelectionChanged(QString, QString, QString))), + connect(this, SIGNAL(instrumentSelectionChanged(QString, QString, QString)), m_tab_moments, SIGNAL(instrumentSelectionChanged(QString, QString, QString))), + // Run any tab setup code m_tab_convert_to_energy->setupTab(); m_tab_sqw->setupTab(); @@ -209,6 +216,20 @@ void IndirectDataReduction::saveSettings() settings.endGroup(); } +/** + * Called when any of the instrument configuration options are changed. + * + * Used to notify tabs that rely on the instrument config when the config changes. + */ +void IndirectDataReduction::instrumentChanged() +{ + QString instrumentName = m_uiForm.cbInst->currentText(); + QString analyser = m_uiForm.cbAnalyser->currentText(); + QString reflection = m_uiForm.cbReflection->currentText(); + + emit newInstrumentConfiguration(instrumentName, analyser, reflection); +} + /** * Sets up the initial instrument for the interface. This value is taken from the users' * settings in the menu View -> Preferences -> Mantid -> Instrument