Newer
Older
if (!plotType)
return;
m_currentRunMode = plotType->currentIndex();
}
void EnggDiffractionViewQtGUI::plotRepChanged(int /*idx*/) {
QComboBox *plotType = m_uiTabFocus.comboBox_PlotData;
if (!plotType)
return;
m_currentType = plotType->currentIndex();
}
// Fitting interface
void EnggDiffractionViewQtGUI::fittingBankIdChanged(int /*idx*/) {
QComboBox *BankName = m_uiTabFitting.comboBox_bank;
if (!BankName)
return;
m_currentCropCalibBankName = BankName->currentIndex();
}
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
void EnggDiffractionViewQtGUI::browsePeaksToFit() {
QString prevPath = QString::fromStdString(m_calibSettings.m_inputDirRaw);
if (prevPath.isEmpty()) {
prevPath =
MantidQt::API::AlgorithmInputHistory::Instance().getPreviousDirectory();
}
QString path(QFileDialog::getOpenFileName(
this, tr("Open Peaks To Fit"), prevPath,
QString::fromStdString(g_DetGrpExtStr)));
if (path.isEmpty()) {
return;
}
MantidQt::API::AlgorithmInputHistory::Instance().setPreviousDirectory(path);
m_uiTabFitting.lineEdit_fitting_peaks->setText(path);
}
std::string EnggDiffractionViewQtGUI::fittingPeaksFile() const {
return m_uiTabFitting.lineEdit_fitting_peaks->text().toStdString();
}
void EnggDiffractionViewQtGUI::instrumentChanged(int /*idx*/) {
QComboBox *inst = m_ui.comboBox_instrument;
if (!inst)
return;
m_currentInst = inst->currentText().toStdString();
m_presenter->notify(IEnggDiffractionPresenter::InstrumentChange);
}
void EnggDiffractionViewQtGUI::RBNumberChanged() {
m_presenter->notify(IEnggDiffractionPresenter::RBNumberChange);
}
void EnggDiffractionViewQtGUI::userSelectInstrument(const QString &prefix) {
// Set file browsing to current instrument
setPrefix(prefix.toStdString());
}
void EnggDiffractionViewQtGUI::setPrefix(std::string prefix) {
QString prefixInput = QString::fromStdString(prefix);
// focus tab
m_uiTabFocus.lineEdit_run_num->setInstrumentOverride(prefixInput);
m_uiTabFocus.lineEdit_texture_run_num->setInstrumentOverride(prefixInput);
m_uiTabFocus.lineEdit_cropped_run_num->setInstrumentOverride(prefixInput);
// calibration tab
m_uiTabCalib.lineEdit_new_ceria_num->setInstrumentOverride(prefixInput);
m_uiTabCalib.lineEdit_new_vanadium_num->setInstrumentOverride(prefixInput);
// rebin tab
m_uiTabPreproc.MWRunFiles_preproc_run_num->setInstrumentOverride(prefixInput);
m_uiTabCalib.lineEdit_cropped_run_num->setInstrumentOverride(prefixInput);
void EnggDiffractionViewQtGUI::closeEvent(QCloseEvent *event) {
int answer = QMessageBox::AcceptRole;
QMessageBox msgBox;
Federico Montesino Pouzols
committed
if (false /* TODO: get this from user settings if eventually used */) {
msgBox.setWindowTitle("Close the engineering diffraction interface");
// with something like this, we'd have layout issues:
// msgBox.setStandardButtons(QMessageBox::No | QMessageBox::Yes);
// msgBox.setDefaultButton(QMessageBox::Yes);
msgBox.setIconPixmap(QPixmap(":/win/unknown.png"));
QCheckBox confirmCheckBox("Always ask for confirmation", &msgBox);
confirmCheckBox.setCheckState(Qt::Checked);
msgBox.layout()->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
msgBox.layout()->addWidget(&confirmCheckBox);
QPushButton *bYes = msgBox.addButton("Yes", QMessageBox::YesRole);
bYes->setIcon(style()->standardIcon(QStyle::SP_DialogYesButton));
QPushButton *bNo = msgBox.addButton("No", QMessageBox::NoRole);
bNo->setIcon(style()->standardIcon(QStyle::SP_DialogNoButton));
msgBox.setDefaultButton(bNo);
msgBox.setText("You are about to close this interface");
msgBox.setInformativeText("Are you sure?");
answer = msgBox.exec();
}
Federico Montesino Pouzols
committed
if (answer == QMessageBox::AcceptRole && m_ui.pushButton_close->isEnabled()) {
m_presenter->notify(IEnggDiffractionPresenter::ShutDown);
event->accept();
} else {
event->ignore();
}
}
void EnggDiffractionViewQtGUI::openHelpWin() {
MantidQt::API::HelpWindow::showCustomInterface(
NULL, QString("Engineering_Diffraction"));
}
} // namespace CustomInterfaces
} // namespace MantidQt