Only evaluate file if filename has changed

This commit is contained in:
Jan Käberich 2022-12-12 13:59:25 +01:00
parent 7f5228d934
commit fa8f49086c

View File

@ -4,6 +4,7 @@
#include "ui_newtracemathdialog.h" #include "ui_newtracemathdialog.h"
#include "Math/tdr.h" #include "Math/tdr.h"
#include "appwindow.h" #include "appwindow.h"
#include "CustomWidgets/informationbox.h"
#include <QColorDialog> #include <QColorDialog>
#include <QFileDialog> #include <QFileDialog>
@ -339,13 +340,26 @@ void TraceEditDialog::okClicked()
if(trace.getSource() != Trace::Source::Calibration) { if(trace.getSource() != Trace::Source::Calibration) {
// only apply changes if it is not a calibration trace // only apply changes if it is not a calibration trace
if (ui->bFile->isChecked()) { if (ui->bFile->isChecked()) {
if(ui->stack->currentIndex() == 1) { auto newName = ui->stack->currentIndex() == 1 ? ui->touchstoneImport->getFilename() : ui->csvImport->getFilename();
// touchstone page active if(newName != trace.getFilename()) {
auto t = ui->touchstoneImport->getTouchstone(); // only update if filename has changed
trace.fillFromTouchstone(t, ui->CParameter->currentIndex()); if(trace.deembeddingAvailable()) {
} else { InformationBox::ShowMessage("Removing de-embedding data", "You have selected a new file as the trace source. Any de-embedding data has been deleted before loading the new trace data.");
// CSV page active trace.clearDeembedding();
ui->csvImport->fillTrace(trace); }
if(ui->stack->currentIndex() == 1) {
// touchstone page active
if(ui->touchstoneImport->getFilename() != trace.getFilename()) {
auto t = ui->touchstoneImport->getTouchstone();
trace.fillFromTouchstone(t, ui->CParameter->currentIndex());
}
} else {
// CSV page active
if(ui->csvImport->getFilename() != trace.getFilename()) {
}
ui->csvImport->fillTrace(trace);
}
} }
} else if(ui->bLive->isChecked()) { } else if(ui->bLive->isChecked()) {
Trace::LivedataType type = Trace::LivedataType::Overwrite; Trace::LivedataType type = Trace::LivedataType::Overwrite;