summaryrefslogtreecommitdiff
path: root/logbook/countrydat.cpp
diff options
context:
space:
mode:
authorEnrico Rossi <e.rossi@tecnobrain.com>2018-11-03 17:52:26 +0100
committerEnrico Rossi <e.rossi@tecnobrain.com>2018-11-03 17:52:26 +0100
commitb4aebf2d137b892f53503b13785ecae900062ff7 (patch)
tree3ba99b2baec2292f2e13bfe90a5e401a5f4c47a5 /logbook/countrydat.cpp
parent37f727ac0746fd85504aa46c1f023c09b3eff33a (diff)
New upstream version 1.9.1+repackupstream/1.9.1+repack
* Drop local hamlib copy (commit d1b545be). * Drop local boost copy (1.63.0).
Diffstat (limited to 'logbook/countrydat.cpp')
-rw-r--r--logbook/countrydat.cpp23
1 files changed, 15 insertions, 8 deletions
diff --git a/logbook/countrydat.cpp b/logbook/countrydat.cpp
index 7f3d613b..d1997a97 100644
--- a/logbook/countrydat.cpp
+++ b/logbook/countrydat.cpp
@@ -18,7 +18,8 @@
#include "countrydat.h"
#include <QFile>
#include <QTextStream>
-
+#include <QDebug>
+#include "Radio.hpp"
void CountryDat::init(const QString filename)
{
@@ -91,6 +92,11 @@ void CountryDat::load()
QString name = _extractName(line1);
if (name.length()>0)
{
+ QString continent=line1.mid(36,2);
+ QString principalPrefix=line1.mid(69,4);
+ int i1=principalPrefix.indexOf(":");
+ if(i1>0) principalPrefix=principalPrefix.mid(0,i1);
+ name += "; " + principalPrefix + "; " + continent;
_countryNames << name;
bool more = true;
QStringList prefixs;
@@ -126,14 +132,15 @@ QString CountryDat::find(QString call) const
return fixup (_data.value ("=" + call), call);
}
- auto prefix = call;
- while (prefix.size () >= 1)
+ auto prefix = Radio::effective_prefix (call);
+ auto match_candidate = prefix;
+ while (match_candidate.size () >= 1)
{
- if (_data.contains (prefix))
+ if (_data.contains (match_candidate))
{
- return fixup (_data.value (prefix), call);
+ return fixup (_data.value (match_candidate), prefix);
}
- prefix = prefix.left (prefix.size () - 1);
+ match_candidate = match_candidate.left (match_candidate.size () - 1);
}
return QString {};
}
@@ -145,9 +152,9 @@ QString CountryDat::fixup (QString country, QString const& call) const
//
// KG4 2x1 and 2x3 calls that map to Gitmo are mainland US not Gitmo
- if (call.startsWith ("KG4") && call.size () != 5)
+ if (call.startsWith ("KG4") && call.size () != 5 && call.size () != 3)
{
- country.replace ("Guantanamo Bay", "United States");
+ country.replace ("Guantanamo Bay; KG4; NA", "United States; K; NA");
}
return country;
}