Skip to content

Commit

Permalink
bugfix CTY filewas read everytime KLog was started
Browse files Browse the repository at this point in the history
  • Loading branch information
d authored and d committed Jun 21, 2024
1 parent 17ea650 commit de08057
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/dxccstatuswidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,26 +467,31 @@ void DXCCStatusWidget::addEntity2(const QStringList &_ent)
emit debugLog (Q_FUNC_INFO, "END", Debug);
}

void DXCCStatusWidget::setBands(const QString &_callingFunc, QStringList const &_ent, const bool _creating)
void DXCCStatusWidget::setBands(const QString &_callingFunc, QStringList const &_listOfBands, const bool _creating)
{// Receives the list of band names and defines the columns
qDebug() << Q_FUNC_INFO << "(" << _callingFunc << ")" << QTime::currentTime().toString("HH:mm:ss");
Q_UNUSED(_callingFunc);
//foreach(QString aux, _ent)
//foreach(QString aux, _listOfBands)
//{
// //qDebug << Q_FUNC_INFO << ": " << aux;
//}
emit debugLog (Q_FUNC_INFO, "Start", Debug);
QStringList qs;
qs.clear();
//qDebug() << Q_FUNC_INFO << " - 01" << QTime::currentTime().toString("HH:mm:ss");
qs << dataProxy->sortBandNamesBottonUp(_ent);
qs << dataProxy->sortBandNamesBottonUp(_listOfBands);
//qDebug() << Q_FUNC_INFO << " - 02: Lenght qs: " << QString::number(qs.size()) << QTime::currentTime().toString("HH:mm:ss");
if (qs.length()<0)
{
//qDebug() << Q_FUNC_INFO << " no bands received here " << QTime::currentTime().toString("HH:mm:ss") << QTime::currentTime().toString("HH:mm:ss");
return;
}

// Let's compare if we are changing something or not
Utilities util(Q_FUNC_INFO);
if (util.areThoseListsTheSame(_listOfBands, _listOfBands))
qDebug() << Q_FUNC_INFO << " - Bands are the same";

QString testBand;
testBand.clear();

Expand Down Expand Up @@ -542,6 +547,7 @@ void DXCCStatusWidget::setBands(const QString &_callingFunc, QStringList const &
qDebug() << Q_FUNC_INFO << " - 9 PRE-END" << QTime::currentTime().toString("HH:mm:ss");

if (_creating)
//Pasa por aqui en cada inicio y pide revisar todo el log... arggghh!
{
qDebug() << Q_FUNC_INFO << ": 9.1 !_creating so updating!" << QTime::currentTime().toString("HH:mm:ss");
update();
Expand Down
2 changes: 1 addition & 1 deletion src/dxccstatuswidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class DXCCStatusWidget : public QWidget

void update();
//void awardsUpdated();
void setBands(const QString &_callingFunc, const QStringList &_ent, const bool _creating = false); // Receives the list of bandIDs
void setBands(const QString &_callingFunc, const QStringList &_listOfBands, const bool _creating = false); // Receives the list of bandIDs
void setCurrentLog(const int _logN);
void setMyLocator(const QString &_loc);
void refresh();
Expand Down
28 changes: 28 additions & 0 deletions src/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,34 @@ QStringList Utilities::getValidADIFFieldAndData(const QString &_b)
return result;
}

bool Utilities::areThoseListsTheSame(const QStringList &_list1, const QStringList &_list2)
{
qDebug() << Q_FUNC_INFO << " - Start";

// If the lists don't have the same number of items are not the same.
if (_list1.size() != _list2.size())
return false;

// Let's order the lists and compare their elements
QStringList _first, _second;
_first.clear();
_first << _list1;
_first.sort(Qt::CaseInsensitive);

_second.clear();
_second << _list2;
_second.sort(Qt::CaseInsensitive);

for (int i=0;i<_first.count();i++)
{
qDebug() << Q_FUNC_INFO << ": " << _first.at(i) << "/" << _second.at(i);
if (_first.at(i) != _second.at(i))
return false;
}
qDebug() << Q_FUNC_INFO << " - END true";
return true;
}

QString Utilities::getAValidCall (const QString &_wrongCall)
{
//qDebug() << "Utilities::getAValidCall: " << _wrongCall ;
Expand Down
1 change: 1 addition & 0 deletions src/utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class Utilities : public QObject {
bool isValidPropMode(const QString &_s);
bool isValidEmail(const QString &_s);
QStringList getValidADIFFieldAndData(const QString &_b);
bool areThoseListsTheSame(const QStringList &_list1, const QStringList &_list2);
//QString getADIFField(const QString &_fieldName, const QString &_data);

QString getMainCallFromComplexCall(const QString &_complexCall); // F from F/EA4K/p, EA4K from EA4K/p or EA4K from EA4K
Expand Down

0 comments on commit de08057

Please sign in to comment.