Calibration - minor changes

This commit is contained in:
Zoran Kostic 2020-11-30 22:27:38 +01:00
parent 3fae95b33f
commit 18526407fb
3 changed files with 14 additions and 9 deletions

View File

@ -709,7 +709,7 @@ bool Calibration::openFromFile(QString filename)
qWarning() << "Calibration file parsing failed: " << e.what(); qWarning() << "Calibration file parsing failed: " << e.what();
return false; return false;
} }
this->currentCalFile = filename; // if all ok, remember this and show on widget this->currentCalFile = filename; // if all ok, remember this
return true; return true;
} }
@ -717,7 +717,7 @@ bool Calibration::openFromFile(QString filename)
bool Calibration::saveToFile(QString filename) bool Calibration::saveToFile(QString filename)
{ {
if(filename.isEmpty()) { if(filename.isEmpty()) {
// suggest descriptive name // Suggest descriptive name ie. "SOLT 40M-700M 1000pt"
QString fn = Calibration::TypeToString(this->getType()) QString fn = Calibration::TypeToString(this->getType())
+ " " + " "
+ hzToString(minFreq) + "-" + hzToString(maxFreq) + hzToString(minFreq) + "-" + hzToString(maxFreq)
@ -742,7 +742,7 @@ bool Calibration::saveToFile(QString filename)
auto calkit_file = filename + ".calkit"; auto calkit_file = filename + ".calkit";
qDebug() << "Saving associated calibration kit to file" << calkit_file; qDebug() << "Saving associated calibration kit to file" << calkit_file;
kit.toFile(calkit_file); kit.toFile(calkit_file);
this->currentCalFile = calibration_file; // if all ok, remember this and show on widget this->currentCalFile = calibration_file; // if all ok, remember this
return true; return true;
} }
@ -750,7 +750,7 @@ bool Calibration::saveToFile(QString filename)
/** /**
* @brief Calibration::hzToString * @brief Calibration::hzToString
* @param freqHz - input frequency in Hz * @param freqHz - input frequency in Hz
* @return frequency in human-readable form such as 145k 2M, 2.1M, 3.45G * @return frequency in human-friendly form such as 145k 2M, 2.1M, 3.45G
*/ */
QString Calibration::hzToString(double freqHz){ QString Calibration::hzToString(double freqHz){
int dgt = 3; // how many significant digits int dgt = 3; // how many significant digits

View File

@ -287,7 +287,7 @@ VNA::VNA(AppWindow *window)
// Calibration toolbar (and populate calibration menu) // Calibration toolbar (and populate calibration menu)
auto tb_cal = new QToolBar("Calibration"); auto tb_cal = new QToolBar("Calibration");
QLabel *cbEnableCal_label = new QLabel("Calibration:"); QLabel *cbEnableCal_label = new QLabel("Calibration:"); // correct object type
tb_cal->addWidget(cbEnableCal_label); tb_cal->addWidget(cbEnableCal_label);
auto cbEnableCal = new QCheckBox; auto cbEnableCal = new QCheckBox;
tb_cal->addWidget(cbEnableCal); tb_cal->addWidget(cbEnableCal);
@ -327,8 +327,8 @@ VNA::VNA(AppWindow *window)
cbEnableCal->blockSignals(true); cbEnableCal->blockSignals(true);
calDisable->setChecked(true); calDisable->setChecked(true);
cbEnableCal->setCheckState(Qt::CheckState::Unchecked); cbEnableCal->setCheckState(Qt::CheckState::Unchecked);
cbEnableCal_label->setStyleSheet("background-color: yellow"); cbEnableCal_label->setStyleSheet("background-color: yellow"); // visually indicate loss of calibration
cbEnableCal_label->setToolTip("none"); cbEnableCal_label->setToolTip("none"); // cal. file unknown at this moment
cbType->blockSignals(false); cbType->blockSignals(false);
cbEnableCal->blockSignals(false); cbEnableCal->blockSignals(false);
calImportTerms->setEnabled(false); calImportTerms->setEnabled(false);
@ -346,8 +346,8 @@ VNA::VNA(AppWindow *window)
} }
} }
cbEnableCal->setCheckState(Qt::CheckState::Checked); cbEnableCal->setCheckState(Qt::CheckState::Checked);
cbEnableCal_label->setStyleSheet(""); cbEnableCal_label->setStyleSheet(""); // restore default look of widget
cbEnableCal_label->setToolTip(cal.getCurrentCalibrationFile()); cbEnableCal_label->setToolTip(cal.getCurrentCalibrationFile()); // on hover, show name of active cal. file
cbType->blockSignals(false); cbType->blockSignals(false);
cbEnableCal->blockSignals(false); cbEnableCal->blockSignals(false);
calImportTerms->setEnabled(true); calImportTerms->setEnabled(true);

View File

@ -163,6 +163,11 @@ void PreferencesDialog::setInitialGUIState()
ui->GeneralGraphBackground->setColor(p->General.graphColors.background); ui->GeneralGraphBackground->setColor(p->General.graphColors.background);
ui->GeneralGraphAxis->setColor(p->General.graphColors.axis); ui->GeneralGraphAxis->setColor(p->General.graphColors.axis);
ui->GeneralGraphDivisions->setColor(p->General.graphColors.divisions); ui->GeneralGraphDivisions->setColor(p->General.graphColors.divisions);
QTreeWidgetItem *item = ui->treeWidget->topLevelItem(0);
if (item != nullptr) {
ui->treeWidget->setCurrentItem(item); // visually select first item
}
} }
void Preferences::load() void Preferences::load()