void BioXASXASScanConfigurationEditor::setConfiguration(BioXASXASScanConfiguration *newConfiguration) { if (configuration_ != newConfiguration) { if (configuration_) { disconnect( configuration_, 0, this, 0 ); disconnect( configuration_->dbObject(), 0, this, 0 ); } configuration_ = newConfiguration; if (configuration_) { connect( configuration_, SIGNAL(nameChanged(QString)), this, SLOT(updateNameLineEdit()) ); connect( configuration_->dbObject(), SIGNAL(energyChanged(double)), this, SLOT(updateEnergySpinBox()) ); connect( configuration_, SIGNAL(detectorsChanged()), this, SLOT(updateExportSpectraCheckBox()) ); connect( configuration_->dbObject(), SIGNAL(exportSpectraPreferenceChanged(bool)), this, SLOT(updateExportSpectraCheckBox()) ); connect( configuration_, SIGNAL(detectorsChanged()), this, SLOT(updateCollectICRsCheckBox()) ); connect( configuration_->dbObject(), SIGNAL(collectICRsPreferenceChanged(bool)), this, SLOT(updateCollectICRsCheckBox()) ); } refresh(); emit configurationChanged(configuration_); } }
void FormEfficiencyCalibration::update_detector_calibs() { std::string msg_text("Propagating calibration "); msg_text += "<nobr>" + new_calibration_.to_string() + "</nobr><br/>"; std::string question_text("Do you want to save this calibration to "); question_text += current_detector_ + " in detector database?"; QMessageBox msgBox; msgBox.setText(QString::fromStdString(msg_text)); msgBox.setInformativeText(QString::fromStdString(question_text)); msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No); msgBox.setDefaultButton(QMessageBox::No); msgBox.setIcon(QMessageBox::Question); int ret = msgBox.exec(); Qpx::Detector modified; if (ret == QMessageBox::Yes) { if (!detectors_.has_a(Qpx::Detector(current_detector_))) { bool ok; QString text = QInputDialog::getText(this, "New Detector", "Detector name:", QLineEdit::Normal, QString::fromStdString(current_detector_), &ok); if (!ok) return; if (!text.isEmpty()) { modified = Qpx::Detector(current_detector_); if (detectors_.has_a(modified)) { QMessageBox::warning(this, "Already exists", "Detector " + text + " already exists. Will not save to database.", QMessageBox::Ok); modified = Qpx::Detector(); } } } else modified = detectors_.get(Qpx::Detector(current_detector_)); if (modified != Qpx::Detector()) { PL_INFO << " applying new calibrations for " << modified.name_ << " in detector database"; modified.efficiency_calibration_ = new_calibration_; detectors_.replace(modified); emit detectorsChanged(); } } }