Newer
Older
}
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