Skip to content

Commit

Permalink
Entity data is available on first start again
Browse files Browse the repository at this point in the history
  • Loading branch information
ea4k committed Jan 9, 2025
1 parent b581242 commit 5d6cfc5
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 112 deletions.
9 changes: 4 additions & 5 deletions src/Changelog
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
On first start, Locator is not identified
BUG: When adding EA KLog finds Spain, if EA4 is added, it fails to find the DXCC.
Find ONE single master place to do that calculation. Maybe World()??
TODO: When adding a QSO the DXCC list is not updated


TODO-Bug: Add QSOs from wsjtx does not work. Failure close to int QSO::toDB(int _qsoId) Maybe related to QSO dupe (it was already fixed)
Complete: void MainWindow::slotQSOReceived(const QSO &_qso) to add the QSO

TODO: Remove, if possible the QSO instance from the DataProxy_SQLite constructor

TODO-Test: Add tests to test the subsivisions
TODO-Test: the copy constructor of QSO


TODO: Reuse the bool World::insertPrefixes to read QSOs from a file so we can insert the whole log at once of in 500 or 1000 QSO blocks
BUG: When entering/modifying a QSO there is an error related to awarddxcc table not existing
TODO: After update, it is needed to restart KLog to be able to use the primary subdivisions
TODO-Bug: Review void tst_MainWindowInputQSO::test_GridLineEdit()
Expand Down
8 changes: 4 additions & 4 deletions src/dataproxy_sqlite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7365,7 +7365,7 @@ QHash<QString, int> DataProxy_SQLite::getWorldData()
{
emit queryError(Q_FUNC_INFO, query.lastError().databaseText(), query.lastError().text(), query.lastQuery());
query.finish();
//qDebug() << Q_FUNC_INFO << "END-FAIL1";
//qDebug() << Q_FUNC_INFO << "END-FAIL-1 - !sqlOK";
return world;
}
else
Expand All @@ -7374,7 +7374,7 @@ QHash<QString, int> DataProxy_SQLite::getWorldData()
{
if (query.isValid())
{
//qDebug() << Q_FUNC_INFO << QString("Pref/Ent = %1/%2").arg((query.value(0)).toString()).arg((query.value(1)).toInt());
//qDebug() << Q_FUNC_INFO << QString("Pref/Ent = %1/%2").arg((query.value(0)).toString()).arg((query.value(1)).toInt());
pref = (query.value(0)).toString();
if (pref.startsWith('='))
{
Expand All @@ -7386,14 +7386,14 @@ QHash<QString, int> DataProxy_SQLite::getWorldData()
{
query.finish();
world.clear();
//qDebug() << Q_FUNC_INFO << "END-FAIL";
//qDebug() << Q_FUNC_INFO << "END-FAIL - Query not valid";
return world;
}
}
}
query.finish();
//qDebug() << Q_FUNC_INFO << "END";
//qDebug() << Q_FUNC_INFO << ": count: " << QString::number(world.count());
//qDebug() << Q_FUNC_INFO << ": count: " << QString::number(world.count());
return world;
}

Expand Down
4 changes: 2 additions & 2 deletions src/dxcluster/dxcluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ void DXClusterWidget::addData()

void DXClusterWidget::slotClusterDXClusterWidgetItemDoubleClicked( QListWidgetItem * item )
{
qDebug() << Q_FUNC_INFO << item->text();
//qDebug() << Q_FUNC_INFO << item->text();

QStringList ql;
ql.clear();
Expand Down Expand Up @@ -380,7 +380,7 @@ void DXClusterWidget::slotClusterDataArrived()


dxSpotColor = awards->getQRZDXStatusColor(_entityStatus);
qDebug() << Q_FUNC_INFO << " - Color Status-1 " << dxSpotColor.name();
//qDebug() << Q_FUNC_INFO << " - Color Status-1 " << dxSpotColor.name();
if (showDxMarathon)
{
if (awards->isDXMarathonNeed(_entityStatus.entityId, world->getQRZCqz(spot.getDxCall()), QDateTime::currentDateTime().date().year(), currentLog))
Expand Down
2 changes: 1 addition & 1 deletion src/dxcluster/dxspot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void DXSpot::setFrequency(Frequency f)
{
if (f.isValid())
freq = f;
qDebug() << Q_FUNC_INFO << ": " << freq.toQString(MHz);
//qDebug() << Q_FUNC_INFO << ": " << freq.toQString(MHz);
}

Frequency DXSpot::getFrequency()
Expand Down
24 changes: 13 additions & 11 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,27 +341,29 @@ int main(int argc, char *argv[])
db->~DataBase();
//qDebug() << Q_FUNC_INFO << " - 99" << (QTime::currentTime()).toString("HH:mm:ss");
}
//qDebug() << Q_FUNC_INFO << " - 100 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 100 - Show" << (QTime::currentTime()).toString("HH:mm:ss");
splash.show();
//qDebug() << Q_FUNC_INFO << " - 101 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 101 " << (QTime::currentTime()).toString("HH:mm:ss");
splash.showMessage ("Creating window...");
//qDebug() << Q_FUNC_INFO << " - 102 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 102 " << (QTime::currentTime()).toString("HH:mm:ss");

MainWindow mw(version);
//qDebug() << Q_FUNC_INFO << " - 103 " << (QTime::currentTime()).toString("HH:mm:ss");
splash.showMessage ("Initializing window...");
//qDebug() << Q_FUNC_INFO << " - 104 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 103 " << (QTime::currentTime()).toString("HH:mm:ss");

//qDebug() << Q_FUNC_INFO << " - 104 " << (QTime::currentTime()).toString("HH:mm:ss");
mw.init();
//qDebug() << Q_FUNC_INFO << " - 105 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 105 " << (QTime::currentTime()).toString("HH:mm:ss");
splash.showMessage ("Checking for new versions...");
//qDebug() << Q_FUNC_INFO << " - 106 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 106 " << (QTime::currentTime()).toString("HH:mm:ss");
mw.checkIfNewVersion();
//qDebug() << Q_FUNC_INFO << " - 107 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 107 " << (QTime::currentTime()).toString("HH:mm:ss");
splash.showMessage ("Checking if backup is needed...");
//qDebug() << Q_FUNC_INFO << " - 108 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 108 " << (QTime::currentTime()).toString("HH:mm:ss");
mw.recommendBackupIfNeeded();
//qDebug() << Q_FUNC_INFO << " - 109 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 109 " << (QTime::currentTime()).toString("HH:mm:ss");
splash.showMessage ("Showing window...");
//qDebug() << Q_FUNC_INFO << " - 110 " << (QTime::currentTime()).toString("HH:mm:ss");
//qDebug() << Q_FUNC_INFO << " - 110 " << (QTime::currentTime()).toString("HH:mm:ss");
mw.show();
//qDebug() << Q_FUNC_INFO << " - 111 " << (QTime::currentTime()).toString("HH:mm:ss");
splash.finish(&mw);
Expand Down
66 changes: 34 additions & 32 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void MainWindow::showNotWar()

MainWindow::MainWindow(const QString &tversion)
{
//qDebug() << Q_FUNC_INFO << ": " << " Ver: " << tversion << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": " << " Ver: " << tversion << QTime::currentTime().toString("hh:mm:ss") ;
//logEvent(Q_FUNC_INFO, "Start: " + _klogDir + "/" + tversion, Debug);
showKLogLogWidget = new ShowKLogLogWidget;
showErrorDialog = new ShowErrorDialog();
Expand All @@ -112,13 +112,14 @@ MainWindow::MainWindow(const QString &tversion)
QRZCOMAutoCheckAct = new QAction(tr("Always check the current callsign in QRZ.com"), this);

//qDebug() << "MainWindow::MainWindow: Debug File: "<< util->getDebugLogFile() ;


dataProxy = new DataProxy_SQLite(Q_FUNC_INFO, softwareVersion);
world = new World(dataProxy, Q_FUNC_INFO);
world->create(util->getCTYFile());
//qDebug() << Q_FUNC_INFO << ": BEFORE HAMLIB " << QTime::currentTime().toString("hh:mm:ss") ;
hamlib = new HamLibClass();
//qDebug() << Q_FUNC_INFO << ": AFTER HAMLIB " << QTime::currentTime().toString("hh:mm:ss") ;

dataProxy = new DataProxy_SQLite(Q_FUNC_INFO, softwareVersion);

//qDebug() << Q_FUNC_INFO << ": AFTER dataproxy ";
lotwUtilities = new LoTWUtilities(util->getHomeDir (), softwareVersion, Q_FUNC_INFO, dataProxy);
//qDebug() << Q_FUNC_INFO << ": AFTER lotwUtilities";
Expand All @@ -134,25 +135,25 @@ MainWindow::MainWindow(const QString &tversion)

elogQRZcom = new eLogQrzLog(dataProxy, Q_FUNC_INFO, softwareVersion);

//qDebug() << Q_FUNC_INFO << ": 00083: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00083: " << QTime::currentTime().toString("hh:mm:ss") ;
updateSatsData = new UpdateSatsData(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 00084: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00084: " << QTime::currentTime().toString("hh:mm:ss") ;
statsWidget = new StatisticsWidget(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 00085: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00085: " << QTime::currentTime().toString("hh:mm:ss") ;
infoLabel1 = new QLabel(tr("Status bar ..."));
infoLabel2 = new QLabel(tr("DX Entity"));

//qDebug() << "MainWindow::MainWindow: 00086" << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << "MainWindow::MainWindow: 00086" << QTime::currentTime().toString("hh:mm:ss") ;
logWindow = new LogWindow(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 00087: " << QTime::currentTime().toString("hh:mm:ss") ;

searchWidget = new SearchWidget(dataProxy, this);
//qDebug() << Q_FUNC_INFO << ": 00087.1: " << QTime::currentTime().toString("hh:mm:ss") ;
//advancedSearchWidget = new AdvancedSearchWidget(dataProxy, this);
//qDebug() << "MainWindow::MainWindow: 00087.2" << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << "MainWindow::MainWindow: 00087.2" << QTime::currentTime().toString("hh:mm:ss") ;
infoWidget = new InfoWidget(dataProxy, this);

//qDebug() << Q_FUNC_INFO << ": 00088: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 00088: " << QTime::currentTime().toString("hh:mm:ss") ;
awardsWidget = new AwardsWidget(dataProxy, this);

//qDebug() << Q_FUNC_INFO << ": 0009: " << QTime::currentTime().toString("hh:mm:ss") ;
Expand All @@ -164,19 +165,19 @@ MainWindow::MainWindow(const QString &tversion)

statusBarMessage = tr("Starting KLog");

//qDebug() << Q_FUNC_INFO << ": 40: " << QTime::currentTime().toString("hh:mm:ss") ;
world = new World(dataProxy, Q_FUNC_INFO);
//qDebug() << Q_FUNC_INFO << ": 40: " << QTime::currentTime().toString("hh:mm:ss") ;


//qDebug() << Q_FUNC_INFO << ": 50: " << QTime::currentTime().toString("hh:mm:ss") ;

//qDebug() << Q_FUNC_INFO << ": 51: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 51: " << QTime::currentTime().toString("hh:mm:ss") ;
setupDialog = new SetupDialog(dataProxy, this);

//qDebug() << Q_FUNC_INFO << ": satTabWidget to be created " ;
satTabWidget = new MainWindowSatTab(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 52: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 52: " << QTime::currentTime().toString("hh:mm:ss") ;
QSOTabWidget = new MainWindowInputQSO(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 53: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 53: " << QTime::currentTime().toString("hh:mm:ss") ;
myDataTabWidget = new MainWindowMyDataTab(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 54: " << QTime::currentTime().toString("hh:mm:ss") ;
commentTabWidget = new MainWindowInputComment();
Expand All @@ -186,14 +187,14 @@ MainWindow::MainWindow(const QString &tversion)
eQSLTabWidget = new MainWindowInputEQSL(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 57: " << QTime::currentTime().toString("hh:mm:ss") ;
QSLTabWidget = new MainWindowInputQSL(dataProxy);
//qDebug() << Q_FUNC_INFO << ": 58: " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 58: " << QTime::currentTime().toString("hh:mm:ss") ;
mainQSOEntryWidget = new MainQSOEntryWidget(dataProxy);

//qDebug() << Q_FUNC_INFO << ": locator to be created 59" << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": locator to be created 59" << QTime::currentTime().toString("hh:mm:ss") ;
locator = new Locator();

mainWidget = new QWidget(this);
//qDebug() << Q_FUNC_INFO << ": 60 " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": 60 " << QTime::currentTime().toString("hh:mm:ss") ;

dateTime = std::make_unique<QDateTime>();
// UI DX
Expand All @@ -205,7 +206,7 @@ MainWindow::MainWindow(const QString &tversion)
dxClusterWidget = new DXClusterWidget(dataProxy, this);
dxClusterAssistant = new DXClusterAssistant(Q_FUNC_INFO);

//qDebug() << Q_FUNC_INFO << ": Awards to be created " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": Awards to be created " << QTime::currentTime().toString("hh:mm:ss") ;
awards = new Awards(dataProxy, Q_FUNC_INFO);
//qDebug() << Q_FUNC_INFO << ": Awards created " << QTime::currentTime().toString("hh:mm:ss") ;
// </UI>
Expand All @@ -215,7 +216,7 @@ MainWindow::MainWindow(const QString &tversion)
exit(0);
}

//qDebug() << Q_FUNC_INFO << ": Software update to be created " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": Software update to be created " << QTime::currentTime().toString("hh:mm:ss") ;
softUpdate = new SoftwareUpdate(softwareVersion);
//qDebug() << Q_FUNC_INFO << ": FileManager to be created " << QTime::currentTime().toString("hh:mm:ss") ;

Expand All @@ -231,7 +232,7 @@ MainWindow::MainWindow(const QString &tversion)
showAdifImportWidget = new ShowAdifImportWidget(dataProxy, Q_FUNC_INFO);

logEvent(Q_FUNC_INFO, "END", Debug);
//qDebug() << Q_FUNC_INFO << ": END " << QTime::currentTime().toString("hh:mm:ss") ;
//qDebug() << Q_FUNC_INFO << ": END " << QTime::currentTime().toString("hh:mm:ss") ;
}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -453,14 +454,15 @@ void MainWindow::checkHomeDir()

void MainWindow::init()
{
//qDebug() << Q_FUNC_INFO << " - Start - " << (QTime::currentTime()).toString("HH:mm:ss") ;
//qDebug() << Q_FUNC_INFO << " - Start - " << (QTime::currentTime()).toString("HH:mm:ss") ;
logLevel = Debug;
logEvent(Q_FUNC_INFO, "Start", Debug);
checkHomeDir();
checkDebugFile();

//qDebug() << Q_FUNC_INFO << " - 00" ;
world->readWorld();
//world->readWorld();
//world->create(util->getCTYFile());
//util->setLongPrefixes(dataProxy->getLongPrefixes());
//util->setSpecialCalls(dataProxy->getSpecialCallsigns());

Expand Down Expand Up @@ -538,7 +540,7 @@ void MainWindow::init()
//qDebug() << Q_FUNC_INFO << " - 130";

applySettings ();
//qDebug() << Q_FUNC_INFO << " - END" << (QTime::currentTime()).toString("HH:mm:ss") ;
//qDebug() << Q_FUNC_INFO << " - END" << (QTime::currentTime()).toString("HH:mm:ss") ;
logEvent(Q_FUNC_INFO, "END", Debug);
}

Expand Down Expand Up @@ -5147,14 +5149,14 @@ void MainWindow::slotAnalyzeDxClusterSignal(const DXSpot &_spot)
logEvent(Q_FUNC_INFO, "Start", Debug);

DXSpot spot = _spot;
if (spot.isValid())
qDebug() << Q_FUNC_INFO << " - Spot is Valid";
else
qDebug() << Q_FUNC_INFO << " - Spot is NOT Valid";
qDebug() << Q_FUNC_INFO << ": spot-dxCall : " << spot.getDxCall();
qDebug() << Q_FUNC_INFO << ": spot-Spotter : " << spot.getSpotter();
qDebug() << Q_FUNC_INFO << ": spot-Freq : " << spot.getFrequency().toQString();
qDebug() << Q_FUNC_INFO << ": spot-Comment : " << spot.getComment();
//if (spot.isValid())
//qDebug() << Q_FUNC_INFO << " - Spot is Valid";
//else
//qDebug() << Q_FUNC_INFO << " - Spot is NOT Valid";
//qDebug() << Q_FUNC_INFO << ": spot-dxCall : " << spot.getDxCall();
//qDebug() << Q_FUNC_INFO << ": spot-Spotter : " << spot.getSpotter();
//qDebug() << Q_FUNC_INFO << ": spot-Freq : " << spot.getFrequency().toQString();
//qDebug() << Q_FUNC_INFO << ": spot-Comment : " << spot.getComment();

EntityStatus _entityStatus;
_entityStatus.entityId = world->getQRZARRLId(spot.getDxCall());
Expand Down
13 changes: 7 additions & 6 deletions src/setuppages/setuppageuserdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
#include "setuppageuserdata.h"
#include "../callsign.h"


SetupPageUserDataPage::SetupPageUserDataPage(DataProxy_SQLite *dp, QWidget *parent) : QWidget(parent){
qDebug() << Q_FUNC_INFO << " - Start";
//qDebug() << Q_FUNC_INFO << " - Start";
slotQRZRunning = false;
locator = new Locator();
util = new Utilities(Q_FUNC_INFO);
Expand Down Expand Up @@ -244,7 +245,7 @@ SetupPageUserDataPage::~SetupPageUserDataPage()
//qDebug() << Q_FUNC_INFO << " - Start";
delete(locator);
delete(util);
delete(world);
//delete(world);
delete(defaultPalette);
delete(wrongPalette);
delete(dataProxy);
Expand Down Expand Up @@ -277,14 +278,14 @@ void SetupPageUserDataPage::slotEnterKeyPressed()

void SetupPageUserDataPage::slotQRZTextChanged()
{
qDebug() << Q_FUNC_INFO << " - Start";
//qDebug() << Q_FUNC_INFO << " - Start";
if (slotQRZRunning)
{
qDebug() << Q_FUNC_INFO << " - END-1";
//qDebug() << Q_FUNC_INFO << " - END-1";
return;
}
slotQRZRunning = true;
qDebug() << Q_FUNC_INFO << " - " << maincallsignLineEdit->text() << " / Length: " << QString::number((maincallsignLineEdit->text()).size());
//qDebug() << Q_FUNC_INFO << " - " << maincallsignLineEdit->text() << " / Length: " << QString::number((maincallsignLineEdit->text()).size());

int i = maincallsignLineEdit->cursorPosition();

Expand Down Expand Up @@ -335,7 +336,7 @@ int SetupPageUserDataPage::getITUz()

bool SetupPageUserDataPage::setMainCallsign(const QString &_qrz)
{
qDebug() << Q_FUNC_INFO << ": " << _qrz;
//qDebug() << Q_FUNC_INFO << ": " << _qrz;
Callsign callsign(_qrz);
if (!callsign.isValid())
return false;
Expand Down
Loading

0 comments on commit 5d6cfc5

Please sign in to comment.