Primary subdivisions working

This commit is contained in:
ea4k 2024-08-09 19:57:04 +02:00
parent 1c1251a1d7
commit ae35b3761c
7 changed files with 155 additions and 45 deletions

View File

@ -1,4 +1,5 @@
BUG: When entering/modifying a QSO thre is an error related to awarddxcc table not existing
TODO: Include the primary subdivisions table in the update of the DB, not just in creation
TODO: Update the DB (modes table) updateToLatest() => updateTo026
WIP: Try to optimize bool DataProxy_SQLite::fillEmptyDXCCInTheLog()

View File

@ -5610,16 +5610,22 @@ QList<PrimarySubdivision> DataProxy_SQLite::getPrimarySubDivisions(const int _en
QSqlQuery query;
QString queryString;
if (!_pref.isEmpty())
if ((_pref.length()>0))
{
qDebug() << Q_FUNC_INFO << " - Running for no pref, delivering ALL for the entity";
queryString = QString("SELECT name, shortname, cqz, ituz FROM primary_subdivisions WHERE prefix = :prefix");
query.prepare(queryString);
query.bindValue(":prefix", _pref);
}
else
{
qDebug() << Q_FUNC_INFO << " - Running with a pref, delivering just for the prefix";
qDebug() << Q_FUNC_INFO << QString("If the entity is <=0 The list will be empty. Entity: %1").arg(_entity);
if (_entity<=0)
{
qDebug() << Q_FUNC_INFO << " - END: entity <= 0";
return list;
}
queryString = QString("SELECT name, shortname, cqz, ituz FROM primary_subdivisions WHERE dxcc = :dxcc");
query.prepare(queryString);
query.bindValue(":dxcc", _entity);
@ -5629,6 +5635,8 @@ QList<PrimarySubdivision> DataProxy_SQLite::getPrimarySubDivisions(const int _en
if (sqlOK)
{
qDebug() << Q_FUNC_INFO << ": sqlOK true";
while (query.next())
{
if (query.isValid())
@ -5641,10 +5649,16 @@ QList<PrimarySubdivision> DataProxy_SQLite::getPrimarySubDivisions(const int _en
list.append(ps);
qDebug() << Q_FUNC_INFO << " : " << ps.name ;
}
else
{
qDebug() << Q_FUNC_INFO << ": query not valid";
}
}
qDebug() << Q_FUNC_INFO << ": query not next";
}
else
{
qDebug() << Q_FUNC_INFO << ": sqlOK FALSE";
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().nativeErrorCode(), query.lastQuery());
list.clear();
}

View File

@ -35,6 +35,8 @@ MainWindowInputOthers::MainWindowInputOthers(DataProxy_SQLite *dp, QWidget *pare
dataProxy = dp;
util = new Utilities(Q_FUNC_INFO);
util->setLongPrefixes(dataProxy->getLongPrefixes());
util->setSpecialCalls(dataProxy->getSpecialCallsigns());
//QLabel *entityPrimLabel, *entitySecLabel, *iotaAwardLabel, *entityNameLabel, *propModeLabel;
iotaContinentComboBox = new QComboBox();
@ -44,6 +46,7 @@ MainWindowInputOthers::MainWindowInputOthers(DataProxy_SQLite *dp, QWidget *pare
propModeComboBox = new QComboBox();
iotaNumberLineEdit = new QLineEdit();
keepPropCheckBox = new QCheckBox();
showAllCheckBox = new QCheckBox();
userDefinedADIFComboBox = new QComboBox();
userDefinedADIFValueLineEdit = new QLineEdit();
@ -52,7 +55,9 @@ MainWindowInputOthers::MainWindowInputOthers(DataProxy_SQLite *dp, QWidget *pare
//connect(satTabWidget, SIGNAL(setPropModeSat(QString)), this, SLOT(slotSetPropMode(QString)) ) ;
connect(propModeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPropModeComboBoxChanged() ) ) ;
connect(userDefinedADIFComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUSerDefinedADIFComboBoxChanged() ) ) ;
connect(userDefinedADIFValueLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSetCurrentUSerData() ) );
connect(userDefinedADIFValueLineEdit, SIGNAL(textChanged(QString)), this, SLOT(slotSetCurrentUserData() ) );
connect(entityPrimDivComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotPrimarySubdivisionsComboBoxChanged()) ) ;
connect(showAllCheckBox, SIGNAL(stateChanged(int)), this, SLOT(slotShowAllChecBoxChanged() ) ) ;
createUI();
setInitialADIFValues ();
@ -78,6 +83,8 @@ void MainWindowInputOthers::createUI()
sota_ref = QString();
distance = 0;
age = 0;
currentInt = 0;
currentPref = QString();
pota_ref = QString();
sig = QString();
sig_info= QString();
@ -102,6 +109,7 @@ void MainWindowInputOthers::createUI()
userSelectLabel->setAlignment(Qt::AlignVCenter| Qt::AlignRight);
keepPropCheckBox->setText(tr("Keep propagation mode"));
showAllCheckBox->setText(tr("Show All"));
entityPrimDivComboBox->setToolTip(tr("Select the primary division for this QSO."));
entitySecDivComboBox->setToolTip(tr("Select the secondary division for this QSO."));
@ -110,6 +118,7 @@ void MainWindowInputOthers::createUI()
iotaContinentComboBox->setToolTip(tr("Select the IOTA continent for this QSO."));
iotaNumberLineEdit->setToolTip(tr("Select the IOTA reference number for this QSO."));
keepPropCheckBox->setToolTip(tr("Keeps the same propagation mode for next QSO."));
showAllCheckBox->setToolTip(tr("Show all subdivisions for the current DXCC Entity."));
userDefinedADIFComboBox->setToolTip(tr("Select the appropriate ADIF field for this QSO."));
userDefinedADIFValueLineEdit->setToolTip (tr("Value for the selected ADIF field."));
@ -119,17 +128,20 @@ void MainWindowInputOthers::createUI()
entityNameComboBox->setEnabled(true);
propModeComboBox->setEnabled(true);
keepPropCheckBox->setEnabled(true);
showAllCheckBox->setEnabled(true);
QHBoxLayout *keepLayout = new QHBoxLayout;
keepLayout->addWidget(propModeComboBox);
//keepLayout->addWidget(keepPropCheckBox);
keepLayout->setSizeConstraint(QLayout::SetFixedSize);
QGridLayout *tabLayout = new QGridLayout;
tabLayout->addWidget(entityNameLabel, 0, 0);
tabLayout->addWidget(entityNameComboBox, 0, 1, 1, 2);
tabLayout->addWidget(entityPrimLabel, 1, 0);
tabLayout->addWidget(entityPrimDivComboBox, 1, 1, 1, 2);
tabLayout->addWidget(showAllCheckBox, 1, 3);
tabLayout->addWidget(entitySecLabel, 2, 0);
tabLayout->addWidget(entitySecDivComboBox, 2, 1, 1, 2);
tabLayout->addWidget(iotaAwardLabel, 3, 0);
@ -172,8 +184,13 @@ void MainWindowInputOthers::clear(bool _full)
logEvent (Q_FUNC_INFO, "Start", Debug);
entityNameComboBox->setCurrentIndex(0);
userDefinedADIFComboBox->setCurrentIndex (0);
entityPrimDivComboBox->clear();
entityPrimDivComboBox->addItem("00-" + tr("None Identified") + " (000)");
userDefinedADIFValueLineEdit->clear ();
sota_ref = QString();
currentPref = QString();
currentInt = 0;
distance = 0.0;
age = 0;
@ -691,9 +708,37 @@ bool MainWindowInputOthers::setInitialADIFValues()
return true;
}
bool MainWindowInputOthers::setState(const QString &_op)
{ // Sets a subdivision/State
qDebug() << Q_FUNC_INFO << ": " << _op;
if (_op.length()<1)
return false;
int indexC = entityPrimDivComboBox->findText(QString("%1-").arg(_op), Qt::MatchStartsWith);
qDebug() << Q_FUNC_INFO << _op << "/" << QString::number(indexC) << " / (6): " << entityPrimDivComboBox->itemText(6);
if (indexC<0)
return false;
entityPrimDivComboBox->setCurrentIndex(indexC);
return true;
}
QString MainWindowInputOthers::getState()
{// Reads the subdivision. It return just the shortname/code for the subdivision/State
qDebug() << Q_FUNC_INFO << ": " << ((entityPrimDivComboBox->currentText()).split("-")).at(0);
QString aux = entityPrimDivComboBox->currentText();
if ((aux.startsWith("00-")) && (aux.endsWith("(000)")) )
return QString();
return ((entityPrimDivComboBox->currentText()).split("-")).at(0);
}
void MainWindowInputOthers::updatePrimarySubdivisionsComboBox(QList<PrimarySubdivision> _subdivisions)
{
//qDebug() << Q_FUNC_INFO << " - count: " << QString::number(_subdivisions.count());
entityPrimDivComboBox->clear();
if (_subdivisions.count()<1)
return;
@ -707,30 +752,40 @@ void MainWindowInputOthers::updatePrimarySubdivisionsComboBox(QList<PrimarySubdi
}
if (listOfSubdivisions.count()<1)
return;
entityPrimDivComboBox->clear();
listOfSubdivisions.prepend("00-" + tr("Not selected") + " (000)");
entityPrimDivComboBox->addItems(listOfSubdivisions);
//qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindowInputOthers::updatePrimarySubDivisions(const int _n, const QString &_pref)
void MainWindowInputOthers::updatePrimarySubDivisions(const int _n, const QString &_qrz)
{
qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_n) << "/" << _pref;
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_n) << "/" << _qrz;
currentPref = _qrz;
QString currentPrefTMP = util->getPrefixFromCall(_qrz, !showAllCheckBox->isChecked());
qDebug() << Q_FUNC_INFO << " - currentPref: " << QString::number(_n) << "/" << currentPrefTMP;
if (_n<1)
return;
currentInt = _n;
setEntity(_n);
if (_pref.isEmpty())
if (currentPrefTMP.isEmpty())
return;
QList<PrimarySubdivision> subdivisions;
subdivisions.clear();
subdivisions.append(dataProxy->getPrimarySubDivisions(_n, _pref));
subdivisions.append(dataProxy->getPrimarySubDivisions(currentInt, currentPrefTMP));
if (subdivisions.isEmpty())
subdivisions.append(dataProxy->getPrimarySubDivisions(_n, QString()));
{
qDebug() << Q_FUNC_INFO << " - Subdivisions is empty, running just with the entity";
subdivisions.append(dataProxy->getPrimarySubDivisions(currentInt, QString()));
}
qDebug() << Q_FUNC_INFO << " - count: " << QString::number(subdivisions.count());
//qDebug() << Q_FUNC_INFO << " - count: " << QString::number(subdivisions.count());
if (subdivisions.count()<1)
return;
updatePrimarySubdivisionsComboBox(subdivisions);
qDebug() << Q_FUNC_INFO << " - END";
//qDebug() << Q_FUNC_INFO << " - END";
}
void MainWindowInputOthers::slotUSerDefinedADIFComboBoxChanged()
@ -887,7 +942,7 @@ double MainWindowInputOthers::getDistance()
return distance;
}
void MainWindowInputOthers::slotSetCurrentUSerData()
void MainWindowInputOthers::slotSetCurrentUserData()
{
logEvent (Q_FUNC_INFO, "Start", Debug);
QString currentTag = getUserADIFTypeComboBox ();
@ -932,6 +987,27 @@ void MainWindowInputOthers::slotSetCurrentUSerData()
logEvent (Q_FUNC_INFO, "END", Debug);
}
void MainWindowInputOthers::slotPrimarySubdivisionsComboBoxChanged()
{
logEvent (Q_FUNC_INFO, "Start", Debug);
//qDebug() << Q_FUNC_INFO << entityPrimDivComboBox->currentText();
logEvent (Q_FUNC_INFO, "END", Debug);
}
void MainWindowInputOthers::slotShowAllChecBoxChanged()
{
updatePrimarySubDivisions(currentInt, currentPref);
//if (showAllCheckBox->isChecked())
// updatePrimarySubDivisions(currentInt, QString());
//else
// updatePrimarySubDivisions(currentInt, currentPref);
//emit showAll(showAllCheckBox->isChecked());
}
bool MainWindowInputOthers::getDarkMode()
{
logEvent (Q_FUNC_INFO, "Start-END", Debug);

View File

@ -49,7 +49,7 @@ public:
int getEntity();
QString getEntityPrefix();
void updatePrimarySubDivisions(const int _n, const QString &_pref); // Receives the entity & prefix of the call to check if
void updatePrimarySubDivisions(const int _n, const QString &_qrz); // Receives the entity & prefix of the call to check if
// It is possible to focus the primary
// subdivision
@ -88,6 +88,9 @@ public:
void setKeep(const bool _b);
bool getKeep();
bool setState(const QString &_op); // Sets a subdivision / State
QString getState(); // Reads the subdivision / State
void createUI();
void clear(bool _full = false); //full= false leaves the "keep this data"; full = true clears everything
void setLogLevel (const DebugLogLevel _l);
@ -95,23 +98,29 @@ public:
signals:
void setPropMode(const QString _p);
void debugLog (QString _func, QString _msg, DebugLogLevel _level);
//void showAll(bool _showAll);
private slots:
//void slotSetPropMode(const QString &_p); // To receive the signal from the SAT widget and set "SAT" propagation mode, of needed.
void slotPropModeComboBoxChanged();
void slotUSerDefinedADIFComboBoxChanged();
void slotSetCurrentUSerData();
void slotSetCurrentUserData();
void slotPrimarySubdivisionsComboBoxChanged();
void slotShowAllChecBoxChanged();
private:
QString checkIfValidIOTA(const QString &_tiota); //TODO: There is an equivalent function in the Awards class. I should use only one!
void setColorsForUserDefinedADIFValueLineEdit();
bool checkVUCC_GRIDS(const QString &_string);
bool setInitialADIFValues();
void updateShowAll();
void updatePrimarySubdivisionsComboBox(QList<PrimarySubdivision> _subdivisions);
bool getDarkMode();
void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level);
Utilities *util;
DataProxy_SQLite *dataProxy;
@ -119,7 +128,7 @@ private:
//QLabel *entityPrimLabel, *entitySecLabel, *iotaAwardLabel, *entityNameLabel, *propModeLabel;
QComboBox *iotaContinentComboBox, *entityPrimDivComboBox, *entitySecDivComboBox, *entityNameComboBox, *propModeComboBox;
QLineEdit *iotaNumberLineEdit;
QCheckBox *keepPropCheckBox;
QCheckBox *keepPropCheckBox, *showAllCheckBox;
QPalette palRed, palBlack, palWhite;
bool autoUpdating;
@ -128,6 +137,9 @@ private:
QLineEdit *userDefinedADIFValueLineEdit;
QStringList adifValidTypes;
QString currentPref; // Just a cache to be able to rewrite the subdivisions combobox
int currentInt; // if the showAllCheckBox is toggled
QString sota_ref, vucc_grids, pota_ref, sig, sig_info, wwff_ref;
double age, distance;
DebugLogLevel logLevel;

View File

@ -759,6 +759,7 @@ void MainWindow::createActionsCommon(){
connect(othersTabWidget, SIGNAL(debugLog(QString, QString, DebugLogLevel)), this, SLOT(slotCaptureDebugLogs(QString, QString, DebugLogLevel)) );
connect(othersTabWidget, SIGNAL(setPropMode(QString)), this, SLOT(slotSetPropModeFromOther(QString)) ) ;
connect(downloadcty, SIGNAL(done(bool)), this, SLOT(slotWorldReload(bool)) );
connect(timerInfoBars, SIGNAL(timeout()), this, SLOT(slotTimeOutInfoBars()) );
connect(hamlib, SIGNAL(freqChanged(double)), this, SLOT(slotHamlibTXFreqChanged(double)) );
@ -915,7 +916,7 @@ void MainWindow::slotShowDXClusterAssistant()
}
void MainWindow::setMainWindowTitle()
{
qDebug() << Q_FUNC_INFO << " - Start";
//qDebug() << Q_FUNC_INFO << " - Start";
QString aux = dataProxy->getCommentsFromLog(currentLog);
int numberOfQSOs = dataProxy->getHowManyQSOInLog (currentLog);
//qDebug() << Q_FUNC_INFO << " - (comment): " << aux ;
@ -1328,6 +1329,7 @@ bool MainWindow::readQSOFromUI()
qso->setSIG(othersTabWidget->getSIG());
qso->setSIG_INFO(othersTabWidget->getSIG_INFO());
qso->setWWFF_Ref(othersTabWidget->getWWFF_Ref());
qso->setState(othersTabWidget->getState());
qso->setSatName (satTabWidget->getSatName());
qso->setSatMode (satTabWidget->getSatMode());
@ -2090,8 +2092,9 @@ void MainWindow::slotQRZTextChanged(QString _qrz)
}
*/
logEvent(Q_FUNC_INFO, QString("Entity: %1").arg(currentEntity), Devel);
othersTabWidget->updatePrimarySubDivisions(currentEntity, util->getPrefixFromCall(_qrz, true));
othersTabWidget->updatePrimarySubDivisions(currentEntity, _qrz);
//othersTabWidget->updatePrimarySubDivisions(currentEntity, util->getPrefixFromCall(_qrz, !othersTabWidget->getShowAll()));
//othersTabWidget->updatePrimarySubDivisions(currentEntity, util->getPrefixFromCall(_qrz, true));
//othersTabWidget->setEntity(currentEntity);
dxE_CQz = world->getEntityCqz(currentEntity);
dx_CQz = world->getQRZCqz(_qrz);
@ -4785,6 +4788,10 @@ void MainWindow::qsoToEdit (const int _qso)
othersTabWidget->setSIG(qsoE.getSIG());
othersTabWidget->setSIG_INFO(qsoE.getSIG_INFO());
othersTabWidget->setWWFF_Ref(qsoE.getWWFF_Ref());
// Next two lines must be together. First we need to define the list of state for the call
// second step is to select the state.
othersTabWidget->updatePrimarySubDivisions(qsoE.getDXCC(), qsoE.getCall());
othersTabWidget->setState(qsoE.getState());
//qDebug() << Q_FUNC_INFO << " - in default - 100: " << QString::number(currentEntity) ;
//qDebug() << Q_FUNC_INFO << " - Checking DXCC: " << aux1 << " - " << world->getEntityName(aux1.toInt()) ;
@ -5114,7 +5121,7 @@ void MainWindow::slotFillEmptyDXCCInTheLog()
void MainWindow::slotUpdateCTYDAT()
{
qDebug() << "MainWindow::slotUpdateCTYDAT" ;
//qDebug() << "MainWindow::slotUpdateCTYDAT" ;
logEvent(Q_FUNC_INFO, "Start", Debug);
downloadcty->download();
logEvent(Q_FUNC_INFO, "END", Debug);
@ -5552,7 +5559,6 @@ void MainWindow::slotSetPropModeFromOther(const QString &_p)
}
}
void MainWindow::clearIfNotCompleted()
{
if (completedWithPreviousIOTA)

View File

@ -2620,6 +2620,7 @@ bool QSO::setState(const QString &_c)
QString QSO::getState()
{
qDebug() << Q_FUNC_INFO << ": " << state;
return state;
}
@ -3083,8 +3084,8 @@ QString QSO::getModifyQueryString()
"distance = :distance, email = :email, eq_call = :eq_call, eqsl_qslrdate = :eqsl_qslrdate, "
"eqsl_qslsdate = :eqsl_qslsdate, eqsl_qsl_rcvd = :eqsl_qsl_rcvd, eqsl_qsl_sent = :eqsl_qsl_sent, "
"fists = :fists, fists_cc = :fists_cc, force_init = :force_init, freq = :freq_tx, freq_rx = :freq_rx, "
"gridsquare = :gridsquare, gridsquare_ext = :gridsquare_ext, hrdlog_qso_upload_date = :hrdlog_qso_upload_date, "
"hrdlog_qso_upload_status = :hrdlog_qso_upload_status, "
"gridsquare = :gridsquare, gridsquare_ext = :gridsquare_ext, "
"hrdlog_qso_upload_date = :hrdlog_qso_upload_date, hrdlog_qso_upload_status = :hrdlog_qso_upload_status, "
"hamlogeu_qso_upload_date = :hamlogeu_qso_upload_date, hamlogeu_qso_upload_status = :hamlogeu_qso_upload_status, "
"hamqth_qso_upload_date = :hamqth_qso_upload_date, hamqth_qso_upload_status = :hamqth_qso_upload_status, "
"iota = :iota, iota_island_id = :iota_island_id, "
@ -3094,7 +3095,7 @@ QString QSO::getModifyQueryString()
"my_country = :my_country, my_cq_zone = :my_cq_zone, my_dxcc = :my_dxcc, my_fists = :my_fists, "
"my_gridsquare = :my_gridsquare, my_gridsquare_ext = :my_gridsquare_ext, my_iota = :my_iota, my_iota_island_id = :my_iota_island_id, "
"my_itu_zone = :my_itu_zone, my_lat = :my_lat, my_lon = :my_lon, my_name = :my_name, "
"mypota_ref = :my_pota_ref, my_postal_code = :my_postal_code, my_rig = :my_rig, my_sig = :my_sig, my_sig_info = :my_sig_info, "
"my_pota_ref = :my_pota_ref, my_postal_code = :my_postal_code, my_rig = :my_rig, my_sig = :my_sig, my_sig_info = :my_sig_info, "
"my_sota_ref = :my_sota_ref, my_state = :my_state, my_street = :my_street, "
"my_usaca_counties = :my_usaca_counties, my_wwff_ref = :my_wwff_ref, my_vucc_grids = :my_vucc_grids, name = :name, notes = :notes, "
"nr_bursts = :nr_bursts, nr_pings = :nr_pings, operator = :operator, owner_callsign = :owner_callsign, "
@ -3119,7 +3120,7 @@ int QSO::getBandIdFromBandName(bool _rxBand)
bool ok = query.prepare ("SELECT band.id FROM band WHERE band.name=:bandname");
if (!ok)
{
//qDebug() << Q_FUNC_INFO << " - Query NOT prepared";
//qDebug() << Q_FUNC_INFO << " - Query NOT prepared-3122";
}
if (_rxBand){
query.bindValue (":bandname", getBandRX());
@ -3164,7 +3165,7 @@ QString QSO::getBandNameFromBandId(int bandId)
if (!ok)
{
return QString();
//qDebug() << Q_FUNC_INFO << " - Query NOT prepared";
//qDebug() << Q_FUNC_INFO << " - Query NOT prepared-3167";
}
query.bindValue (":id", bandId);
@ -3252,7 +3253,7 @@ QString QSO::getModeNameFromModeId(int _modeId, bool _submode)
if (!ok)
{
qDebug() << Q_FUNC_INFO << " - Query NOT prepared";
qDebug() << Q_FUNC_INFO << " - Query NOT prepared-3255";
return QString();
}
query.bindValue (":id", _modeId);
@ -3282,7 +3283,7 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s)
query.clear ();
if (!query.prepare (_s))
{
qDebug() << Q_FUNC_INFO << " - Query not prepared";
qDebug() << Q_FUNC_INFO << " - Query not prepared-3285";
query.clear ();
return query;
}

View File

@ -826,7 +826,7 @@ bool Utilities::isAPrefix (const QString &_c)
void Utilities::setLongPrefixes (const QStringList &_p)
{
//qDebug() << Q_FUNC_INFO << ": Start count: " << QString::number(_p.count());
qDebug() << Q_FUNC_INFO << ": Start count: " << QString::number(_p.count());
longPrefixes.clear();
longPrefixes.append(_p);
//qDebug() << Q_FUNC_INFO << ": count: " << QString::number(longPrefixes.count());
@ -842,18 +842,18 @@ void Utilities::setSpecialCalls (const QStringList &_p)
bool Utilities::isAKnownPrefix(const QString &_c)
{// TODO: Complete with https://rsgb.org/main/operating/licensing-novs-visitors/international-prefixes/
//qDebug() << Q_FUNC_INFO << ": " << _c;
qDebug() << Q_FUNC_INFO << ": " << _c;
QString aux;
if (_c.isNull() )
{
//qDebug() << Q_FUNC_INFO << ": END - 1";
qDebug() << Q_FUNC_INFO << ": END - 1";
return false;
}
if (longPrefixes.count()<100)
{
//qDebug() << Q_FUNC_INFO << ": ********** END - FAIL";
qDebug() << Q_FUNC_INFO << ": ********** END - FAIL";
}
//qDebug() << Q_FUNC_INFO << QString(": END - 2 - %1 - %2").arg(_c).arg(boolToQString(longPrefixes.contains(_c)));
qDebug() << Q_FUNC_INFO << QString(": END - 2 - %1 - %2").arg(_c).arg(boolToQString(longPrefixes.contains(_c)));
return longPrefixes.contains(_c);
}
@ -1104,7 +1104,7 @@ bool Utilities::isValidCall(const QString &_c, bool _force)
QString Utilities::getPrefixFromCall(const QString &_c, bool withAreaNumber)
{
//qDebug() << Q_FUNC_INFO << ": " << _c << " - WithAreaNumber=" << boolToQString(withAreaNumber);
qDebug() << Q_FUNC_INFO << ": " << _c << " - WithAreaNumber=" << boolToQString(withAreaNumber);
if (_c.isNull())
{
return QString();
@ -1125,49 +1125,49 @@ QString Utilities::getPrefixFromCall(const QString &_c, bool withAreaNumber)
return QString();
}
}
//qDebug() << Q_FUNC_INFO << " - Going to calculate - length = " << QString::number(length);
qDebug() << Q_FUNC_INFO << " - Going to calculate - length = " << QString::number(length);
if (length>2)
{
//qDebug() << Q_FUNC_INFO << " - Going to Look for a known call" ;
qDebug() << Q_FUNC_INFO << " - Going to Look for a known call" ;
if (isAKnownCall(_c))
{
//qDebug() << Q_FUNC_INFO << " - Known CALL found!";
qDebug() << Q_FUNC_INFO << " - Known CALL found!";
return _c;
}
//qDebug() << Q_FUNC_INFO << " - Call not found!" ;
qDebug() << Q_FUNC_INFO << " - Call not found!" ;
}
//qDebug() << Q_FUNC_INFO << " - 010";
qDebug() << Q_FUNC_INFO << " - 010";
call = getMainCallFromComplexCall(call);
//qDebug() << Q_FUNC_INFO << " - 011: " << call;
qDebug() << Q_FUNC_INFO << " - 011: " << call;
QString call2 = call;
QString call3 = call;
int i = length;
while (i>0)
{
//qDebug() << Q_FUNC_INFO << QString(" While (i=%1) = ").arg(i) << call;
qDebug() << Q_FUNC_INFO << QString(" While (i=%1) = ").arg(i) << call;
if (isAKnownPrefix(call))
{// EA, EA6, VK9N, VP2E, K, K1, KN1, 4U1I
//qDebug() << Q_FUNC_INFO << QString("- Known prefix found: %1").arg(call);
qDebug() << Q_FUNC_INFO << QString("- Known prefix found: %1").arg(call);
if (withAreaNumber)
{
//qDebug() << Q_FUNC_INFO << QString("- With Area number");
qDebug() << Q_FUNC_INFO << QString("- With Area number");
if ( (call2.back()).isDigit() )
{
//qDebug() << Q_FUNC_INFO << QString("- With Area number -call2- & last is a digit");
qDebug() << Q_FUNC_INFO << QString("- With Area number -call2- & last is a digit");
return call2;
}
else if((call3.back()).isDigit())
{
//qDebug() << Q_FUNC_INFO << QString("- With Area number -call3- & last is a digit");
qDebug() << Q_FUNC_INFO << QString("- With Area number -call3- & last is a digit");
return call3;
}
}
//qDebug() << Q_FUNC_INFO << QString("- With NO Area number");
qDebug() << Q_FUNC_INFO << QString("- With NO Area number");
return call;
}
//qDebug() << Q_FUNC_INFO << QString("- Known prefix NOT found: %1").arg(call);
qDebug() << Q_FUNC_INFO << QString("- Known prefix NOT found: %1").arg(call);
call3 = call2;
call2 = call;
call.chop(1);