This commit is contained in:
ea4k 2022-08-20 18:03:29 +02:00
parent f1e846ad1d
commit 8e37038aa5
3 changed files with 31 additions and 59 deletions

View File

@ -374,12 +374,12 @@ int World::getPrefixId(const QString &_prefix)
QString World::getQRZEntityName(const QString &_qrz)
{
//qDebug() << "World::getQRZEntityName: " << _qrz;
//qDebug() << "World::getQRZEntityName: " << _qrz;
if (_qrz.length() < 1 )
{
return QString();
}
int prefixIDNumber = getPrefixId(_qrz);
}
int prefixIDNumber = getQRZARRLId(_qrz);
return getEntityName(prefixIDNumber);
}
@ -401,8 +401,7 @@ int World::getQRZCqz(const QString &_qrz)
return -1;
}
QString aux = _qrz;
aux = util->getPrefixFromCall(aux);
QString aux = util->getPrefixFromCall(_qrz);
return dataProxy->getCQzFromPrefix(aux);
}
@ -414,8 +413,7 @@ int World::getQRZItuz(const QString &_qrz)
return -1;
}
QString aux = _qrz;
aux = util->getPrefixFromCall(aux);
QString aux = util->getPrefixFromCall(_qrz);
return dataProxy->getITUzFromPrefix(aux);
}
@ -572,12 +570,6 @@ QString World::getLocator(const int _entityN)
return locator->getLocator(getLongitude(_entityN), getLatitude(_entityN));
}
QString World::getQRZEntityPrefixes(const QString &_qrz)
{
int i = getQRZARRLId(_qrz);
return dataProxy->getEntityMainPrefix(i);
}
bool World::readCTYCSV(const QString &_worldFile)
{
//qDebug() << "World::readCTYCSV(): " << _worldFile;
@ -790,47 +782,6 @@ bool World::readCTYCSV(const QString &_worldFile)
return true;
}
QString World::changeSlashAndFindPrefix(const QString &_qrz)
{
//qDebug() << "World::changeSlashAndFindPrefix: -" << _qrz <<"-";
QString aux = _qrz.toUpper();
if ((aux).count('\\')) // Replaces \ by / to ease operation.
{
aux.replace(QChar('\\'), QChar('/'));
}
else
{
return aux;
}
if (aux.count('/')) // / found! Checking different options
{
int iaux1, iaux2;
if (aux.endsWith("/") )
{ // We look for calls ending in slash "/" or "\"
aux.remove(aux.length()-1,1);
}
iaux1 = aux.indexOf('/');
//qDebug() << "World::changeSlashAndFindPrefix: Slash found at: " << QString::number(iaux1);
iaux2 = (aux.length())- iaux1; // iaux2 is the length of the second part
if (iaux2 < 0){
iaux2 = -iaux2;
}
if ( iaux1 < iaux2 ) { //Like in F/EA0XXX, we can simply take the first part as the prefix
aux = aux.left(iaux1);
}
else
{
aux = aux.right(iaux2-1);
}
}
return aux;
}
QStringList World::getEntitiesNames()
{
//qDebug() << "World::getEntitiesNames" ;

View File

@ -100,8 +100,6 @@ public:
bool isNewCQz(const int _cqz);
bool isNewEntity(const int _entityN);
//int getBandIdFromFreq(const QString fr);
QString getQRZEntityPrefixes(const QString &_qrz);
QString getEntityPrefixes(const int _enti);
QStringList getEntitiesNames();
@ -121,7 +119,6 @@ private:
QStringList processLineP(const QString &_line, const int _processingEntity);
//void createWorldModel();
QStringList readZones(const QString &pref, const int _cq, const int _itu);
QString changeSlashAndFindPrefix(const QString &_qrz); // Changes the \ into / and find the country prefix
int progressBarPosition;

View File

@ -47,6 +47,7 @@ private slots:
void test_WorldCreation();
void test_EntityIdentification();
void test_ZonesIdentification();
void test_SeveralIdentification();
private:
DataProxy_SQLite *dataProxy;
@ -158,13 +159,36 @@ void tst_World::test_ZonesIdentification()
QVERIFY2(world->getQRZItuz("EA4K") == 37, "ITUz for EA not properly identified");
QVERIFY2(world->getQRZItuz("PY") == 15, "ITUz for PY not properly identified");
QVERIFY2(world->getQRZItuz("AX9XA") ==54, "ITUz for AX9XA not properly identified");
}
QVERIFY2(world->getQRZContinentShortName("EA4K") == "EU", "Continent for AX9XA not properly identified");
QVERIFY2(world->getQRZContinentShortName("PY") == "SA", "Continent for AX9XA not properly identified");
void tst_World::test_SeveralIdentification()
{
QVERIFY2(world->getQRZEntityName("EA4K") == "Spain", "Entity name for EA4K not properly identified");
QVERIFY2(world->getQRZEntityName("PY") == "Brazil", "Entity name for EA4K not properly identified");
QVERIFY2(world->getEntityName(281) == "Spain", "Entity name for 281 not properly identified");
QVERIFY2(world->getEntityCqz(281) == 14, "CQz name for 281 not properly identified");
QVERIFY2(world->getEntityItuz(281) == 37, "ITUz name for 281 not properly identified");
QVERIFY2(world->getQRZEntityMainPrefix("AM4A") == "EA", "Main prefix for AM4A not properly identified");
QVERIFY2(world->getEntityMainPrefix(281) == "EA", "Entity main prefix for 281 not properly identified");
QVERIFY2(world->getQRZContinentShortName("EA4K") == "EU", "Continent for EA4K not properly identified");
QVERIFY2(world->getQRZContinentShortName("PY") == "SA", "Continent for PY not properly identified");
QVERIFY2(world->getQRZContinentShortName("AX9XA") == "OC", "Continent for AX9XA not properly identified");
QVERIFY2(world->getContinentShortName(281) == "EU", "Continent for 281 not properly identified");
QVERIFY2(world->getQRZLongitude("EA4K") == -3.43, "Longitude for EA4K not properly identified");
QVERIFY2(world->getLongitude(281) == -3.43, "Longitude for 281 not properly identified");
QVERIFY2(world->getQRZLatitude("EA4K") == 40.32, "Latitue for EA4K not properly identified");
QVERIFY2(world->getLatitude(281) == 40.32, "Latitude for 281 not properly identified");
QVERIFY2(world->getQRZLocator("EA4K") == "IN80GH", "Locator for EA4K not properly identified");
QVERIFY2(world->getLocator(281) == "IN80GH", "Locator for 281 not properly identified");
}
QTEST_APPLESS_MAIN(tst_World)
#include "tst_world.moc"