Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ void BayesFitting::initLayout() {
// Connect each tab to the actions available in this GUI
std::map<unsigned int, BayesFittingTab *>::iterator iter;
for (iter = m_bayesTabs.begin(); iter != m_bayesTabs.end(); ++iter) {
connect(iter->second, SIGNAL(showMessageBox(const std::string &)), this, SLOT(showMessageBox(const std::string &)));
connect(iter->second, &BayesFittingTab::showMessageBox, this, &BayesFitting::showMessageBox);
}

loadSettings();

connect(m_uiForm.pbSettings, SIGNAL(clicked()), this, SLOT(settings()));
connect(m_uiForm.pbHelp, SIGNAL(clicked()), this, SLOT(help()));
connect(m_uiForm.pbManageDirs, SIGNAL(clicked()), this, SLOT(manageUserDirectories()));
connect(m_uiForm.pbSettings, &QPushButton::clicked, this, &BayesFitting::settings);
connect(m_uiForm.pbHelp, &QPushButton::clicked, this, &BayesFitting::help);
connect(m_uiForm.pbManageDirs, &QPushButton::clicked, this, &BayesFitting::manageUserDirectories);

InelasticInterface::initLayout();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace MantidQt::CustomInterfaces {
BayesFittingTab::BayesFittingTab(QWidget *parent) : InelasticTab(parent), m_propTree(new QtTreePropertyBrowser()) {
m_propTree->setFactoryForManager(m_dblManager, m_dblEdFac);

connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &BayesFittingTab::updateProperties);
}

BayesFittingTab::~BayesFittingTab() { m_propTree->unsetFactoryForManager(m_dblManager); }
Expand Down
51 changes: 22 additions & 29 deletions qt/scientific_interfaces/Inelastic/BayesFitting/Quasi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,36 +38,33 @@ Quasi::Quasi(QWidget *parent) : BayesFittingTab(parent), m_previewSpec(0) {

// Create range selector
auto eRangeSelector = m_uiForm.ppPlot->addRangeSelector("QuasiERange");
connect(eRangeSelector, SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double)));
connect(eRangeSelector, SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double)));
connect(eRangeSelector, &MantidWidgets::RangeSelector::minValueChanged, this, &Quasi::minValueChanged);
connect(eRangeSelector, &MantidWidgets::RangeSelector::maxValueChanged, this, &Quasi::maxValueChanged);

setupFitOptions();
setupPropertyBrowser();
setupPlotOptions();

// Connect optional form elements with enabling checkboxes
connect(m_uiForm.chkFixWidth, SIGNAL(toggled(bool)), m_uiForm.mwFixWidthDat, SLOT(setEnabled(bool)));
connect(m_uiForm.chkUseResNorm, SIGNAL(toggled(bool)), m_uiForm.dsResNorm, SLOT(setEnabled(bool)));

connect(m_uiForm.chkFixWidth, &QCheckBox::toggled, m_uiForm.mwFixWidthDat, &FileFinderWidget::setEnabled);
connect(m_uiForm.chkUseResNorm, &QCheckBox::toggled, m_uiForm.dsResNorm, &DataSelector::setEnabled);
// Connect the data selector for the sample to the mini plot
connect(m_uiForm.dsSample, SIGNAL(dataReady(const QString &)), this, SLOT(handleSampleInputReady(const QString &)));
connect(m_uiForm.dsSample, SIGNAL(filesAutoLoaded()), this, SLOT(enableView()));
connect(m_uiForm.dsSample, &DataSelector::dataReady, this, &Quasi::handleSampleInputReady);
connect(m_uiForm.dsSample, &DataSelector::filesAutoLoaded, [=] { this->enableView(); });

connect(m_uiForm.dsResolution, SIGNAL(dataReady(const QString &)), this,
SLOT(handleResolutionInputReady(const QString &)));
connect(m_uiForm.dsResolution, SIGNAL(filesAutoLoaded()), this, SLOT(enableView()));
connect(m_uiForm.dsResolution, &DataSelector::dataReady, this, &Quasi::handleResolutionInputReady);
connect(m_uiForm.dsResolution, &DataSelector::filesAutoLoaded, [=] { this->enableView(); });

// Connect the program selector to its handler
connect(m_uiForm.cbProgram, SIGNAL(currentIndexChanged(int)), this, SLOT(handleProgramChange(int)));

connect(m_uiForm.cbProgram, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
&Quasi::handleProgramChange);
// Connect preview spectrum spinner to handler
connect(m_uiForm.spPreviewSpectrum, SIGNAL(valueChanged(int)), this, SLOT(previewSpecChanged(int)));

connect(m_uiForm.spPreviewSpectrum, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
&Quasi::previewSpecChanged);
// Plot current preview
connect(m_uiForm.pbPlotPreview, SIGNAL(clicked()), this, SLOT(plotCurrentPreview()));

connect(m_uiForm.pbSave, SIGNAL(clicked()), this, SLOT(saveClicked()));
connect(m_uiForm.pbPlot, SIGNAL(clicked()), this, SLOT(plotClicked()));
connect(m_uiForm.pbPlotPreview, &QPushButton::clicked, this, &Quasi::plotCurrentPreview);
connect(m_uiForm.pbSave, &QPushButton::clicked, this, &Quasi::saveClicked);
connect(m_uiForm.pbPlot, &QPushButton::clicked, this, &Quasi::plotClicked);

// Allows empty workspace selector when initially selected
m_uiForm.dsSample->isOptional(true);
Expand Down Expand Up @@ -351,8 +348,7 @@ void Quasi::handleRun() {

m_QuasiAlg = runAlg;
m_batchAlgoRunner->addAlgorithm(runAlg);
connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool)));

connect(m_batchAlgoRunner, &API::BatchAlgorithmRunner::batchComplete, this, &Quasi::algorithmComplete);
m_batchAlgoRunner->executeBatchAsync();
}

Expand Down Expand Up @@ -496,10 +492,9 @@ void Quasi::handleResolutionInputReady(const QString &wsName) {
* @param min :: The new value of the lower guide
*/
void Quasi::minValueChanged(double min) {
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Quasi::updateProperties);
m_dblManager->setValue(m_properties["EMin"], min);
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Quasi::updateProperties);
}

/**
Expand All @@ -508,10 +503,9 @@ void Quasi::minValueChanged(double min) {
* @param max :: The new value of the upper guide
*/
void Quasi::maxValueChanged(double max) {
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Quasi::updateProperties);
m_dblManager->setValue(m_properties["EMax"], max);
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Quasi::updateProperties);
}

/**
Expand All @@ -523,16 +517,15 @@ void Quasi::maxValueChanged(double max) {
void Quasi::updateProperties(QtProperty *prop, double val) {
auto eRangeSelector = m_uiForm.ppPlot->getRangeSelector("QuasiERange");

disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Quasi::updateProperties);

if (prop == m_properties["EMin"]) {
setRangeSelectorMin(m_properties["EMin"], m_properties["EMax"], eRangeSelector, val);
} else if (prop == m_properties["EMax"]) {
setRangeSelectorMax(m_properties["EMin"], m_properties["EMax"], eRangeSelector, val);
}

connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Quasi::updateProperties);
}

/**
Expand Down
40 changes: 16 additions & 24 deletions qt/scientific_interfaces/Inelastic/BayesFitting/ResNorm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ ResNorm::ResNorm(QWidget *parent) : BayesFittingTab(parent), m_previewSpec(0) {

// Create range selector
auto eRangeSelector = m_uiForm.ppPlot->addRangeSelector("ResNormERange");
connect(eRangeSelector, SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double)));
connect(eRangeSelector, SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double)));

connect(eRangeSelector, &MantidWidgets::RangeSelector::minValueChanged, this, &ResNorm::minValueChanged);
connect(eRangeSelector, &MantidWidgets::RangeSelector::maxValueChanged, this, &ResNorm::maxValueChanged);
// Add the properties browser to the ui form
m_uiForm.treeSpace->addWidget(m_propTree);

Expand All @@ -49,20 +48,17 @@ ResNorm::ResNorm(QWidget *parent) : BayesFittingTab(parent), m_previewSpec(0) {
formatTreeWidget(m_propTree, m_properties);

// Connect data selector to handler method
connect(m_uiForm.dsVanadium, SIGNAL(dataReady(const QString &)), this,
SLOT(handleVanadiumInputReady(const QString &)));
connect(m_uiForm.dsResolution, SIGNAL(dataReady(const QString &)), this,
SLOT(handleResolutionInputReady(const QString &)));
connect(m_uiForm.dsVanadium, &DataSelector::dataReady, this, &ResNorm::handleVanadiumInputReady);
connect(m_uiForm.dsResolution, &DataSelector::dataReady, this, &ResNorm::handleResolutionInputReady);

// Connect the preview spectrum selector
connect(m_uiForm.spPreviewSpectrum, SIGNAL(valueChanged(int)), this, SLOT(previewSpecChanged(int)));

connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(handleAlgorithmComplete(bool)));

connect(m_uiForm.spPreviewSpectrum, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
&ResNorm::previewSpecChanged);
connect(m_batchAlgoRunner, &API::BatchAlgorithmRunner::batchComplete, this, &ResNorm::handleAlgorithmComplete);
// Post Plot and Save
connect(m_uiForm.pbSave, SIGNAL(clicked()), this, SLOT(saveClicked()));
connect(m_uiForm.pbPlot, SIGNAL(clicked()), this, SLOT(plotClicked()));
connect(m_uiForm.pbPlotCurrent, SIGNAL(clicked()), this, SLOT(plotCurrentPreview()));
connect(m_uiForm.pbSave, &QPushButton::clicked, this, &ResNorm::saveClicked);
connect(m_uiForm.pbPlot, &QPushButton::clicked, this, &ResNorm::plotClicked);
connect(m_uiForm.pbPlotCurrent, &QPushButton::clicked, this, &ResNorm::plotCurrentPreview);

// Allows empty workspace selector when initially selected
m_uiForm.dsVanadium->isOptional(true);
Expand Down Expand Up @@ -308,10 +304,9 @@ void ResNorm::handleResolutionInputReady(const QString &filename) {
* @param min :: The new value of the lower guide
*/
void ResNorm::minValueChanged(double min) {
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &ResNorm::updateProperties);
m_dblManager->setValue(m_properties["EMin"], min);
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &ResNorm::updateProperties);
}

/**
Expand All @@ -320,10 +315,9 @@ void ResNorm::minValueChanged(double min) {
* @param max :: The new value of the upper guide
*/
void ResNorm::maxValueChanged(double max) {
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &ResNorm::updateProperties);
m_dblManager->setValue(m_properties["EMax"], max);
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &ResNorm::updateProperties);
}

/**
Expand All @@ -335,16 +329,14 @@ void ResNorm::maxValueChanged(double max) {
void ResNorm::updateProperties(QtProperty *prop, double val) {
auto eRangeSelector = m_uiForm.ppPlot->getRangeSelector("ResNormERange");

disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &ResNorm::updateProperties);

if (prop == m_properties["EMin"]) {
setRangeSelectorMin(m_properties["EMin"], m_properties["EMax"], eRangeSelector, val);
} else if (prop == m_properties["EMax"]) {
setRangeSelectorMax(m_properties["EMin"], m_properties["EMax"], eRangeSelector, val);
}

connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &ResNorm::updateProperties);
}

/**
Expand Down
39 changes: 18 additions & 21 deletions qt/scientific_interfaces/Inelastic/BayesFitting/Stretch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,25 @@ Stretch::Stretch(QWidget *parent) : BayesFittingTab(parent), m_previewSpec(0), m

// Create range selector
auto eRangeSelector = m_uiForm.ppPlot->addRangeSelector("StretchERange");
connect(eRangeSelector, SIGNAL(minValueChanged(double)), this, SLOT(minValueChanged(double)));
connect(eRangeSelector, SIGNAL(maxValueChanged(double)), this, SLOT(maxValueChanged(double)));

connect(eRangeSelector, &MantidWidgets::RangeSelector::minValueChanged, this, &Stretch::minValueChanged);
connect(eRangeSelector, &MantidWidgets::RangeSelector::maxValueChanged, this, &Stretch::maxValueChanged);
setupFitOptions();
setupPropertyBrowser();
setupPlotOptions();

// Connect the data selector for the sample to the mini plot
connect(m_uiForm.dsSample, SIGNAL(dataReady(const QString &)), this, SLOT(handleSampleInputReady(const QString &)));
connect(m_uiForm.chkSequentialFit, SIGNAL(toggled(bool)), m_uiForm.cbPlot, SLOT(setEnabled(bool)));
connect(m_uiForm.dsSample, &DataSelector::dataReady, this, &Stretch::handleSampleInputReady);
connect(m_uiForm.chkSequentialFit, &QCheckBox::toggled, m_uiForm.cbPlot, &QComboBox::setEnabled);
// Connect preview spectrum spinner to handler
connect(m_uiForm.spPreviewSpectrum, SIGNAL(valueChanged(int)), this, SLOT(previewSpecChanged(int)));
connect(m_uiForm.spPreviewSpectrum, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this,
&Stretch::previewSpecChanged);
m_uiForm.spPreviewSpectrum->setMaximum(0);

// Connect the plot and save push buttons
connect(m_uiForm.pbPlot, SIGNAL(clicked()), this, SLOT(plotWorkspaces()));
connect(m_uiForm.pbPlotContour, SIGNAL(clicked()), this, SLOT(plotContourClicked()));
connect(m_uiForm.pbSave, SIGNAL(clicked()), this, SLOT(saveWorkspaces()));
connect(m_uiForm.pbPlotPreview, SIGNAL(clicked()), this, SLOT(plotCurrentPreview()));
connect(m_uiForm.pbPlot, &QPushButton::clicked, this, &Stretch::plotWorkspaces);
connect(m_uiForm.pbPlotContour, &QPushButton::clicked, this, &Stretch::plotContourClicked);
connect(m_uiForm.pbSave, &QPushButton::clicked, this, &Stretch::saveWorkspaces);
connect(m_uiForm.pbPlotPreview, &QPushButton::clicked, this, &Stretch::plotCurrentPreview);

// Allows empty workspace selector when initially selected
m_uiForm.dsSample->isOptional(true);
Expand Down Expand Up @@ -138,15 +138,15 @@ void Stretch::handleRun() {
}

m_batchAlgoRunner->addAlgorithm(stretch);
connect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool)));
connect(m_batchAlgoRunner, &API::BatchAlgorithmRunner::batchComplete, this, &Stretch::algorithmComplete);
m_batchAlgoRunner->executeBatchAsync();
}

/**
* Handles the saving and plotting of workspaces after execution
*/
void Stretch::algorithmComplete(const bool &error) {
disconnect(m_batchAlgoRunner, SIGNAL(batchComplete(bool)), this, SLOT(algorithmComplete(bool)));
disconnect(m_batchAlgoRunner, &API::BatchAlgorithmRunner::batchComplete, this, &Stretch::algorithmComplete);

m_runPresenter->setRunEnabled(true);
setPlotResultEnabled(!error);
Expand Down Expand Up @@ -413,10 +413,9 @@ void Stretch::plotCurrentPreview() {
* @param min :: The new value of the lower guide
*/
void Stretch::minValueChanged(double min) {
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Stretch::updateProperties);
m_dblManager->setValue(m_properties["EMin"], min);
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Stretch::updateProperties);
}

/**
Expand All @@ -425,10 +424,9 @@ void Stretch::minValueChanged(double min) {
* @param max :: The new value of the upper guide
*/
void Stretch::maxValueChanged(double max) {
disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Stretch::updateProperties);
m_dblManager->setValue(m_properties["EMax"], max);
connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Stretch::updateProperties);
}

/**
Expand All @@ -440,16 +438,15 @@ void Stretch::maxValueChanged(double max) {
void Stretch::updateProperties(QtProperty *prop, double val) {
auto eRangeSelector = m_uiForm.ppPlot->getRangeSelector("StretchERange");

disconnect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this,
SLOT(updateProperties(QtProperty *, double)));
disconnect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Stretch::updateProperties);

if (prop == m_properties["EMin"]) {
setRangeSelectorMin(m_properties["EMin"], m_properties["EMax"], eRangeSelector, val);
} else if (prop == m_properties["EMax"]) {
setRangeSelectorMax(m_properties["EMin"], m_properties["EMax"], eRangeSelector, val);
}

connect(m_dblManager, SIGNAL(valueChanged(QtProperty *, double)), this, SLOT(updateProperties(QtProperty *, double)));
connect(m_dblManager, &QtDoublePropertyManager::valueChanged, this, &Stretch::updateProperties);
}

void Stretch::setPlotResultEnabled(bool enabled) {
Expand Down
Loading
Loading