From 9c8f798ef09a78597767c184fa0424cee02f8035 Mon Sep 17 00:00:00 2001 From: Pavel Smokotnin Date: Sun, 12 Jan 2025 13:30:30 +0100 Subject: [PATCH] import cal files --- qml/main.qml | 2 +- src/sourcelist.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/qml/main.qml b/qml/main.qml index deabdc2..f4fa1d4 100644 --- a/qml/main.qml +++ b/qml/main.qml @@ -204,7 +204,7 @@ ApplicationWindow { folder: (typeof shortcuts !== 'undefined' ? shortcuts.home : Filesystem.StandardFolder.Home) defaultSuffix: "txt" nameFilters: [ - "txt transfer data file (*.txt)", + "txt transfer data file (*.txt *.cal)", "csv transfer data file (*.csv)", "txt impulse data file (*.txt)", "csv impulse data file (*.csv)", diff --git a/src/sourcelist.cpp b/src/sourcelist.cpp index a22eefd..51baaa9 100644 --- a/src/sourcelist.cpp +++ b/src/sourcelist.cpp @@ -457,12 +457,17 @@ bool SourceList::importFile(const QUrl &fileName, QString separator) frequency = list[0].replace(",", ".").toFloat(&fOk); magnitude = list[1].replace("*", "0").replace(",", ".").toFloat(&mOk); phase.polar(M_PI * (list.size() > 2 ? list[2].replace("*", "0").replace(",", ".").toFloat() : 0) / 180.f); - coherence = (list.size() > 3 ? list[3].replace("*", "0").replace(",", ".").toFloat() : 1); + + bool coherenceOk = false; + coherence = (list.size() > 3 ? list[3].replace("*", "0").replace(",", ".").toFloat(&coherenceOk) : 1); if (fOk && mOk && list.size() > 1) { if (magnitude > maxMagnitude) { maxMagnitude = magnitude; } + if (!coherenceOk) { + coherence = 1; + } d.push_back({ frequency,