From c728ddc45b873ceaa6d59b19cae8b63a221f6633 Mon Sep 17 00:00:00 2001 From: "Charles J. Cliffe" Date: Mon, 6 Jul 2015 23:15:18 -0400 Subject: [PATCH] Assume Mhz if input <= 3000 with no suffix, require suffix of 'hz' below 3001hz --- src/FrequencyDialog.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/FrequencyDialog.cpp b/src/FrequencyDialog.cpp index d7fd9a8..712739e 100644 --- a/src/FrequencyDialog.cpp +++ b/src/FrequencyDialog.cpp @@ -65,7 +65,7 @@ std::string FrequencyDialog::frequencyToStr(long long freq) { } long long FrequencyDialog::strToFrequency(std::string freqStr) { - std::string filterStr = filterChars(freqStr, std::string("0123456789.MKGmkg")); + std::string filterStr = filterChars(freqStr, std::string("0123456789.MKGHmkgh")); int numLen = filterStr.find_first_not_of("0123456789."); @@ -90,8 +90,10 @@ long long FrequencyDialog::strToFrequency(std::string freqStr) { freqTemp *= 1.0e6; } else if (suffixStr.find_first_of("Kk") != std::string::npos) { freqTemp *= 1.0e3; + } else if (suffixStr.find_first_of("Hh") != std::string::npos) { + // ... } - } else if (numPartStr.find_first_of(".") != std::string::npos) { + } else if (numPartStr.find_first_of(".") != std::string::npos || freqTemp <= 3000) { freqTemp *= 1.0e6; }