1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 09:18:54 -05:00

Callsign: removed comma separated country data

This commit is contained in:
f4exb 2024-03-08 15:36:03 +01:00
parent 41eb0fea9b
commit 788190872b
5 changed files with 3 additions and 43 deletions

View File

@ -144,41 +144,6 @@ QString Callsign::striped_prefix (QString callsign)
return match.captured("prefix");
}
QString Callsign::getCountryData(QString const& callsign)
{
QString pf = callsign.toUpper();
while (!pf.isEmpty ())
{
QString country = "";
if (pf.length() == callsign.length())
{
country = m_countryDat.getData().value("="+pf, country);
if (!country.isEmpty ()) {
return country;
} else {
pf = effective_prefix(callsign);
}
}
if (pf == "KG4" && callsign.length() != 5) {
pf = "AA";
}
country = m_countryDat.getData().value(pf, country);
if (!country.isEmpty ()) {
return country;
}
pf = pf.left(pf.length()-1);
}
return " ,?,where?, , ";
}
CountryDat::CountryInfo Callsign::getCountryInfo(QString const& callsign)
{
QString pf = callsign.toUpper();

View File

@ -41,7 +41,6 @@ public:
static QString base_callsign(QString);
static QString effective_prefix(QString);
static QString striped_prefix(QString);
QString getCountryData(QString const& callsign);
CountryDat::CountryInfo getCountryInfo(QString const& callsign);
private:

View File

@ -44,7 +44,7 @@ const CountryDat::CountryInfo CountryDat::nullCountry = CountryDat::CountryInfo{
void CountryDat::init()
{
_data.clear();
_countries.clear();
_name.clear();
_name.insert("where?","where?");
_name.insert("Sov Mil Order of Malta","Sov Mil Order of Malta");
@ -544,7 +544,7 @@ QStringList CountryDat::_extractPrefix(QString &line, bool &more)
void CountryDat::load()
{
_data.clear();
_countries.clear();
QFile inputFile(":/data/cty.dat");
if (inputFile.open(QIODevice::ReadOnly))
@ -610,7 +610,6 @@ void CountryDat::load()
_continent = continent;
}
_data.insert(p, _continent + ',' + masterPrefix + ',' + country + ',' + _cqz + ',' + _ituz);
_countries.insert(p, CountryInfo{_continent, masterPrefix, country, _cqz, _ituz});
}
}

View File

@ -49,7 +49,6 @@ public:
void init();
void load();
const QHash<QString, QString>& getData() const { return _data; }
const QHash<QString, CountryInfo>& getCountries() const { return _countries; }
static const CountryInfo nullCountry;
@ -63,7 +62,6 @@ private:
QStringList _extractPrefix(QString &line, bool &more);
QString _filename;
QHash<QString, QString> _data;
QHash<QString, QString> _name;
QHash<QString, CountryInfo> _countries;
};

View File

@ -38,9 +38,8 @@ void MainBench::testCallsign(const QString& argsStr)
qInfo("%s is the base callsign of %s", qPrintable(Callsign::base_callsign(argsStr)), qPrintable(argsStr));
qInfo("%s is the effective prefix of %s", qPrintable(Callsign::effective_prefix(argsStr)), qPrintable(argsStr));
qInfo("%s is the striped prefix of %s", qPrintable(Callsign::striped_prefix(argsStr)), qPrintable(argsStr));
qInfo("%s is the country data for callsign %s", qPrintable(Callsign::instance()->getCountryData(argsStr)), qPrintable(argsStr));
CountryDat::CountryInfo countryInfo = Callsign::instance()->getCountryInfo(argsStr);
qInfo("%s is the continent", qPrintable(countryInfo.continent));
qInfo("%s DXCC country infoirmation", qPrintable(argsStr)); qInfo("%s is the continent", qPrintable(countryInfo.continent));
qInfo("%s is the country", qPrintable(countryInfo.country));
qInfo("%s is the master prefix", qPrintable(countryInfo.masterPrefix));
qInfo("%s is the cq zone", qPrintable(countryInfo.cqZone));