Skip to content

Commit

Permalink
Add instrument changed signal to IDR & tab
Browse files Browse the repository at this point in the history
Refs #10266
  • Loading branch information
DanNixon committed Oct 21, 2014
1 parent 92f6cf7 commit c36e2e0
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Expand Up @@ -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
Expand Down
Expand Up @@ -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
Expand Down
Expand Up @@ -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();
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c36e2e0

Please sign in to comment.