Skip to content

Commit

Permalink
work in progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ea4k committed Oct 7, 2024
1 parent b6c4937 commit d897cee
Show file tree
Hide file tree
Showing 10 changed files with 119 additions and 118 deletions.
2 changes: 1 addition & 1 deletion src/Changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

ODO: Working in void MainWindowInputOthers::setEntityAndPrefix
TODO-Bug: EA8, EA9 fails for subdivisions, it is detected as EA
TODO-Bug: CT9 is detected as Portugal but subdivision is properly detected

Expand Down
18 changes: 9 additions & 9 deletions src/callsign.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Callsign::Callsign(const QString &callsign, QObject *parent) : QObject{parent},
fullCallsign(callsign.toUpper()), areaNumber(0), valid(false), prefValid(false)
{
qDebug() << Q_FUNC_INFO << ": " << callsign;
//qDebug() << Q_FUNC_INFO << ": " << callsign;

QRegularExpression callsignRE = callsignRegEx();
QRegularExpressionMatch match = callsignRE.match(fullCallsign);
Expand All @@ -53,13 +53,13 @@ Callsign::Callsign(const QString &callsign, QObject *parent) : QObject{parent},
{
prefValid = true;

qDebug() << Q_FUNC_INFO << " - match1: " << matchPrefix.captured(1);
qDebug() << Q_FUNC_INFO << " - match2: " << matchPrefix.captured(2);
qDebug() << Q_FUNC_INFO << " - match3: " << matchPrefix.captured(3);
qDebug() << Q_FUNC_INFO << " - match4: " << matchPrefix.captured(4);
qDebug() << Q_FUNC_INFO << " - match5: " << matchPrefix.captured(5);
qDebug() << Q_FUNC_INFO << " - match6: " << matchPrefix.captured(6);
qDebug() << Q_FUNC_INFO << " - match7: " << matchPrefix.captured(7);
//qDebug() << Q_FUNC_INFO << " - match1: " << matchPrefix.captured(1);
//qDebug() << Q_FUNC_INFO << " - match2: " << matchPrefix.captured(2);
//qDebug() << Q_FUNC_INFO << " - match3: " << matchPrefix.captured(3);
//qDebug() << Q_FUNC_INFO << " - match4: " << matchPrefix.captured(4);
//qDebug() << Q_FUNC_INFO << " - match5: " << matchPrefix.captured(5);
//qDebug() << Q_FUNC_INFO << " - match6: " << matchPrefix.captured(6);
//qDebug() << Q_FUNC_INFO << " - match7: " << matchPrefix.captured(7);
hostPrefix = matchPrefix.captured(1); // Full prefix
hostPrefixWithoutAreaNumber = matchPrefix.captured(4); // The prefix without the area number
areaNumber = matchPrefix.captured(7).toInt(); // Just the area number (optional)
Expand Down Expand Up @@ -90,7 +90,7 @@ QRegularExpression Callsign::callsignRegEx()

;QString Callsign::prefixRegExString()
{
qDebug() << Q_FUNC_INFO;
//qDebug() << Q_FUNC_INFO;
// Matches prefix: "^([A-Z0-9]+[\/])?([A-Z][0-9]|[A-Z]{1,2}|[0-9][A-Z])([0-9]|[0-9]+)([A-Z]+)([\/][A-Z0-9]+)?"
// E73 prefix is not correctly matched, it is matched as EA400 so simple prefix is not OK

Expand Down
88 changes: 43 additions & 45 deletions src/inputwidgets/mainwindowinputothers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ void MainWindowInputOthers::clear(bool _full)
currentPref = QString();
currentInt = 0;


distance = 0.0;
age = 0;
vucc_grids = QString();
Expand Down Expand Up @@ -236,30 +237,7 @@ void MainWindowInputOthers::setEntitiesList(const QStringList _qs)
logEvent (Q_FUNC_INFO, "END", Debug);
}

void MainWindowInputOthers::setEntity(const int _ent)
{// Select the appropriate entity in the ComboBox
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_ent);
logEvent (Q_FUNC_INFO, "Start", Debug);
if (_ent<=0)
{
entityNameComboBox->setCurrentIndex(0);
logEvent (Q_FUNC_INFO, "END-1", Debug);
return;
}
QString aux = QString();
aux = QString::number(_ent);
if (_ent > 1000)
{
aux = (QString::number(_ent)).right(3);
}

int indexC = entityNameComboBox->findText("(" + aux + ")", Qt::MatchEndsWith);

entityNameComboBox->setCurrentIndex(indexC);
setIOTAContinentFromEntity(_ent);
//updatePrimarySubDivisions(_ent, QString());
logEvent (Q_FUNC_INFO, "END", Debug);
}

int MainWindowInputOthers::getEntity()
{
Expand Down Expand Up @@ -396,14 +374,6 @@ QString MainWindowInputOthers::getIOTA()
return (checkIfValidIOTA(iotaContinentComboBox->currentText() + "-" + iotaNumberLineEdit->text()));
}


void MainWindowInputOthers::setIOTAContinentFromEntity(const int _n)
{
//qDebug() << "MainWindow::setIOTAContinentFromEntity:" << QString::number(_n);
logEvent (Q_FUNC_INFO, "Start-END", Debug);
setIOTAContinent(dataProxy->getContinentShortNameFromEntity(_n)) ;
}

void MainWindowInputOthers::setIOTAContinent(const QString &_qs)
{
logEvent (Q_FUNC_INFO, "Start", Debug);
Expand Down Expand Up @@ -771,24 +741,57 @@ void MainWindowInputOthers::updatePrimarySubdivisionsComboBox(QList<PrimarySubdi
//qDebug() << Q_FUNC_INFO << " - END";
}

void MainWindowInputOthers::updatePrimarySubDivisions(const int _n, const QString &_qrz)
void MainWindowInputOthers::setEntity(const int _ent)
{// Select the appropriate entity in the ComboBox
//qDebug() << Q_FUNC_INFO << ": " << QString::number(_ent);
logEvent (Q_FUNC_INFO, "Start", Debug);
if (_ent<=0)
{
entityNameComboBox->setCurrentIndex(0);
logEvent (Q_FUNC_INFO, "END-1", Debug);
return;
}
currentInt = _ent;
QString aux = QString();
aux = QString::number(_ent);
if (_ent > 1000)
{
aux = (QString::number(_ent)).right(3);
}

int indexC = entityNameComboBox->findText("(" + aux + ")", Qt::MatchEndsWith);

entityNameComboBox->setCurrentIndex(indexC);
setIOTAContinent(dataProxy->getContinentShortNameFromEntity(_ent)) ;
logEvent (Q_FUNC_INFO, "END", Debug);
}

void MainWindowInputOthers::setEntityAndPrefix(const int _entity, const QString &_qrz)
{
//qDebug() << Q_FUNC_INFO << " - Start: " << QString::number(_n) << "/" << _qrz;
if (_n<1)
if (_entity<=0)
{
entityNameComboBox->setCurrentIndex(0);
logEvent (Q_FUNC_INFO, "END-1", Debug);
return;
}
setEntity(_entity);

Callsign callsign(_qrz);
currentInt = _n;

QString mainPref = dataProxy->getEntityMainPrefix(_n);
QString mainToUse = mainPref + QString::number(callsign.getAreaNumber()); // The default is that showAll is not checked
QString mainPref = dataProxy->getEntityMainPrefix(_entity); // The main prefix of the entity.
QString mainToUse = mainPref + QString::number(callsign.getAreaNumber()); // The default is that showAll is not checked. Main prefix+ the area
QString prefUsed = callsign.getHostPrefix(); // The default is that showAll is not checked

if (showAllCheckBox->isChecked())
{
{ // The prefix without the number should be used.
// be careful with prefixes like EA8/EA or E73 / E7
mainToUse = mainPref;
prefUsed = callsign.getHostPrefixWithoutNumber();
}

qDebug() << Q_FUNC_INFO << "mainPref: " << mainPref;
qDebug() << Q_FUNC_INFO << "prefUsed: " << prefUsed;

if ((mainToUse.isEmpty()) && (prefUsed.isEmpty()))
return;
Expand All @@ -798,11 +801,11 @@ void MainWindowInputOthers::updatePrimarySubDivisions(const int _n, const QStrin
subdivisions.append(dataProxy->getPrimarySubDivisions(currentInt, prefUsed));
if (subdivisions.length()<1)
{
//qDebug() << Q_FUNC_INFO << " - Subdivisions is empty, running for the main prefix";
qDebug() << Q_FUNC_INFO << " - Subdivisions is empty with prefUSed, running for the main prefix";
subdivisions.append(dataProxy->getPrimarySubDivisions(currentInt, mainToUse));
if (subdivisions.length()<1)
{
//qDebug() << Q_FUNC_INFO << " - Subdivisions is empty, running just with the entity";
qDebug() << Q_FUNC_INFO << " - Subdivisions is empty with mainpref, running just with the entity";
subdivisions.append(dataProxy->getPrimarySubDivisions(currentInt, QString()));
}
}
Expand Down Expand Up @@ -1024,12 +1027,7 @@ void MainWindowInputOthers::slotPrimarySubdivisionsComboBoxChanged()

void MainWindowInputOthers::slotShowAllChecBoxChanged()
{
updatePrimarySubDivisions(currentInt, currentPref);
//if (showAllCheckBox->isChecked())
// updatePrimarySubDivisions(currentInt, QString());
//else
// updatePrimarySubDivisions(currentInt, currentPref);
//emit showAll(showAllCheckBox->isChecked());
setEntityAndPrefix(currentInt, currentPref);
}


Expand Down
13 changes: 6 additions & 7 deletions src/inputwidgets/mainwindowinputothers.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,12 @@ class MainWindowInputOthers : public QWidget
~MainWindowInputOthers();

void setEntitiesList(const QStringList _qs);
void setEntity(const int _n);
void setEntity(const int _n); // Move the external call to setEntityAndPrefix
int getEntity();
QString getEntityPrefix();

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
void setEntityAndPrefix(const int _entity, const QString &_qrz); // Receives the entity & prefix of the call to check if
// It is possible to focus the primary
// subdivision. Updates also the IOTA continent

void setPropMode(const QString &_qs, bool _keep);
QString getPropModeFromComboBox();
Expand Down Expand Up @@ -80,7 +79,7 @@ class MainWindowInputOthers : public QWidget

void setIOTA(const QString &_qs);
QString getIOTA();
void setIOTAContinentFromEntity(const int _n);

void setIOTAContinent(const QString &_qs);
bool isIOTAModified();
void clearIOTA();
Expand Down Expand Up @@ -136,7 +135,7 @@ private slots:
QLineEdit *userDefinedADIFValueLineEdit;
QStringList adifValidTypes;

QString currentPref; // Just a cache to be able to rewrite the subdivisions combobox
KLOG_DEPRECATED 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;
Expand Down
12 changes: 7 additions & 5 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2082,9 +2082,9 @@ void MainWindow::slotQRZTextChanged(QString _qrz)
//qDebug()<< Q_FUNC_INFO << " - 50 - currentEntity: " << QString::number(currentEntity) ;

logEvent(Q_FUNC_INFO, QString("Entity: %1").arg(currentEntity), Devel);
othersTabWidget->updatePrimarySubDivisions(currentEntity, _qrz);
//othersTabWidget->updatePrimarySubDivisions(currentEntity, util->getPrefixFromCall(_qrz, !othersTabWidget->getShowAll()));
//othersTabWidget->updatePrimarySubDivisions(currentEntity, util->getPrefixFromCall(_qrz, true));

//othersTabWidget->setEntityAndPrefix(currentEntity, util->getPrefixFromCall(_qrz, !othersTabWidget->getShowAll()));
//othersTabWidget->setEntityAndPrefix(currentEntity, util->getPrefixFromCall(_qrz, true));
//othersTabWidget->setEntity(currentEntity);
dxE_CQz = world->getEntityCqz(currentEntity);
dx_CQz = world->getQRZCqz(_qrz);
Expand Down Expand Up @@ -2137,7 +2137,8 @@ void MainWindow::slotQRZTextChanged(QString _qrz)

showStatusOfDXCC(_entityStatus);
showDXMarathonNeeded(currentEntity, dx_CQz, mainQSOEntryWidget->getDate().year(), currentLog);
othersTabWidget->setIOTAContinentFromEntity(currentEntity);
//othersTabWidget->setEntity(currentEntity);
othersTabWidget->setEntityAndPrefix(currentEntity, _qrz);

// we need to update the list of Primary Subdivisions

Expand Down Expand Up @@ -4780,7 +4781,7 @@ void MainWindow::qsoToEdit (const int _qso)
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->setEntityAndPrefix(qsoE.getDXCC(), qsoE.getCall());
othersTabWidget->setState(qsoE.getState());

//qDebug() << Q_FUNC_INFO << " - in default - 100: " << QString::number(currentEntity) ;
Expand All @@ -4806,6 +4807,7 @@ void MainWindow::qsoToEdit (const int _qso)
infoWidget->showEntityInfo(currentEntity);
othersTabWidget->setEntity(currentEntity);


//qDebug() << Q_FUNC_INFO << " - in default - 101" ;
EntityStatus _entityStatus;
_entityStatus.entityId = currentEntity;
Expand Down
7 changes: 5 additions & 2 deletions src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ CONFIG += static
CONFIG -=depend_includepath
#CONFIG += release
TEMPLATE = app

PKGVERSION = 2.4.0
VERSION = 2.4.0

Expand Down Expand Up @@ -343,12 +342,16 @@ DISTFILES += Changelog COPYING \
unix:!mac {
message(unix:!mac)
DEFINES += APP_LINUX
CONFIG += c++11
#CONFIG += c++11
CONFIG += c++20

#QMAKE_CXXFLAGS += --coverage
#LIBS += -lgcov
# Translations should be copied in /usr/share/klog/translations
# https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
# QT += dbus
#CXXFLAGS += -Wall -Werror -Wno-error=template-id-cdtor
#CXXFLAGS += -Wtemplate-id-cdtor
isEmpty(PREFIX):PREFIX = /usr
BINDIR = $$PREFIX/bin
DATADIR = $$PREFIX/share
Expand Down
Loading

0 comments on commit d897cee

Please sign in to comment.