Skip to content

Commit

Permalink
qso and wstx work
Browse files Browse the repository at this point in the history
  • Loading branch information
ea4k committed Aug 11, 2024
1 parent d73cbf2 commit c873456
Show file tree
Hide file tree
Showing 7 changed files with 420 additions and 156 deletions.
20 changes: 13 additions & 7 deletions src/Changelog
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
Complete the copy constructor of QSO
Complete: void MainWindow::slotQSOReceived(const QSO &_qso) to add the QSO
Check the bug that makes WSJTX not logging automatically
TODO: After refactor, remove/comment out
void UDPServer::adifParse(QByteArray &msg)
udpserver signal logged_qso
void MainWindow::slotWSJTXloggedQSO

BUG: When entering/modifying a QSO thre 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: Update the DB (modes table) updateToLatest() => updateTo026
WIP: Try to optimize bool DataProxy_SQLite::fillEmptyDXCCInTheLog()
WIP: Working in the update of the table awarddxcc in DB class
WIP: - Bugfix: DB in alternative locations was not always found. (WIP #706)

TODO: IOTA number is on red on editing.
TODO: When completing with previous data the QSL is in red


TESTS to do during RC releases:
- ADIF log Import
- LoTW log Import
- Edit QSO. Check how data comes from DB to the UI.
- Attention to name
- CompleteWithPreviousQSO: Test that the following fields are reused:
- name
- QTH
- GridSquare
- IOTA
- QSLVia


- Receive QSOs from WSJTX:
- check if they are properly imported to the log.
Expand Down
68 changes: 68 additions & 0 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,7 @@ void MainWindow::createActionsCommon(){
connect(UDPLogServer, SIGNAL(status_update(int, QString, double, QString, QString, QString, QString, QString, QString)), this, SLOT(slotWSJXstatusFromUDPServer(int, QString, double, QString, QString, QString, QString, QString, QString) ) );
connect(UDPLogServer, SIGNAL( logged_qso(QString, QString, QString, double, QString, QString, QString, QString, QString, QString, QString, QString, QDateTime, QDateTime, QString, QString, QString)), this, SLOT(slotWSJTXloggedQSO (QString, QString, QString, double, QString, QString, QString, QString, QString, QString, QString, QString, QDateTime, QDateTime, QString, QString, QString) ) );
connect(UDPLogServer, SIGNAL(clearSignal(QString)), this, SLOT(slotClearButtonClicked(QString) ) );
connect(UDPLogServer, SIGNAL( logged(QSO)), this, SLOT(slotQSOReceived(QSO) ) );

connect(this, SIGNAL(queryError(QString, QString, QString, QString)), this, SLOT(slotQueryErrorManagement(QString, QString, QString, QString)) );
connect(setupDialog, SIGNAL(debugLog(QString, QString, DebugLogLevel)), this, SLOT(slotCaptureDebugLogs(QString, QString, DebugLogLevel)) );
Expand Down Expand Up @@ -5743,6 +5744,73 @@ void MainWindow::slotShowQSOsFromDXCCWidget(QList<int> _qsos)
logEvent(Q_FUNC_INFO, "END", Debug);
}


void MainWindow::slotQSOReceived(const QSO &_qso)
{
qDebug() << Q_FUNC_INFO << " - Start";
//logEvent(Q_FUNC_INFO, "Start", Debug);
if (!askToAddQSOReceived(_qso))
return;
QSO q(_qso);

int addedQSO = q.toDB();
if (addedQSO>0)
qDebug() << Q_FUNC_INFO << " - QSO added";
else
qDebug() << Q_FUNC_INFO << " - QSO NOT added";

qDebug() << Q_FUNC_INFO << " - END";
logEvent(Q_FUNC_INFO, "END", Debug);
}

bool MainWindow::askToAddQSOReceived(const QSO &_qso)
{
qDebug() << Q_FUNC_INFO << " - Start";
QMessageBox msgBox;
msgBox.setIcon(QMessageBox::Information);
msgBox.setWindowTitle(tr("KLog - QSO received - NEW"));
msgBox.setTextFormat(Qt::RichText);
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No );
msgBox.setDefaultButton(QMessageBox::Yes);

QString aux = QString(tr("ASK-The following QSO data has been received from to be logged:\n\n"
"<UL>"
"<LI><b>Callsign:</b>%1</LI>"
"<LI><b>Freq:</b>%2</LI>"
"<LI><b>Mode:</b>%3</LI>"
"<LI><b>Time On:</b>%4</LI>"
"<LI><b>Time Off:</b>%5</LI>"
"<LI><b>RST TX:</b>%6</LI>"
"<LI><b>RST RX:</b>%7</LI>"
"<LI><b>Comment:</b>%8</LI>"
"<LI><b>DX-Grid:</b>%9</LI>"
"<LI><b>Local-Grid:</b>%10</LI>"
"<LI><b>Station Callsign:</b>%11</LI>"
"<LI><b>Operator Callsign:</b>%12</LI>")).arg(qso->getCall(), QString::number(qso->getFreqTX()), qso->getMode(),
util->getADIFTimeFromQTime(qso->getTimeOn()), util->getADIFTimeFromQTime(qso->getTimeOff()), qso->getRSTTX(), qso->getRSTRX(),
qso->getComment(), qso->getGridSquare(), qso->getMyGridSquare(),
qso->getStationCallsign(), qso->getOperatorCallsign());



msgBox.setText(aux);
int ret = msgBox.exec();
switch (ret)
{
//case QMessageBox::Yes:
//break;
case QMessageBox::No:
//logTheQso = false;
return false;
break;
default:
// should never be reached
//logTheQso = false;
return true;
break;
}
}

void MainWindow::slotWSJTXloggedQSO (const QString &_dxcall, const QString &_mode, const QString &_band, const double _freq,
const QString &_mygrid, const QString &_dxgrid, const QString &_rstTX, const QString &_rstRX,
const QString &_comment, const QString &_stationcallsign, const QString &_name,
Expand Down
2 changes: 2 additions & 0 deletions src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ private slots:
const QString &_report, const QString &_de_call, const QString &_de_grid,
const QString &_dx_grid, const QString &_sub_mode);

void slotQSOReceived(const QSO &_qso);
void slotWSJTXloggedQSO (const QString &_dxcall, const QString &_mode, const QString &_band, const double _freq,
const QString &_mygrid, const QString &_dxgrid, const QString &_rstTX, const QString &_rstRX,
const QString &_comment, const QString &_stationcallsign, const QString &_name,
Expand Down Expand Up @@ -347,6 +348,7 @@ private slots:
void setCleaning(const bool _c);
bool setHamlib(const bool _b);
bool setUDPServer(const bool _b);
bool askToAddQSOReceived(const QSO &_qso); // Shows a message with the data of the QSO
void logEvent(const QString &_func, const QString &_msg, DebugLogLevel _level);
void setLogLevel(const DebugLogLevel _sev);
//void fileExportLoTW(const QString &_st, const QString &_grid, const QDate &_startDate, const QDate &_endDate);
Expand Down
171 changes: 171 additions & 0 deletions src/qso.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,177 @@ QSO::QSO()
//db = new DataBase(Q_FUNC_INFO, klogVersion, util->getKLogDBFile());
}

QSO::QSO(const QSO& other)
{
haveBand = other.haveBand;
haveMode = other.haveMode;
haveSubMode = other.haveSubMode;
haveDateTime = other.haveDateTime
haveCall = other.haveCall;

qsoId = other.qsoId;
logId = other.logId;
backup = other.backup;
stationCallsign = other.stationCallsign;
lotwUpdating = other.lotwUpdating;
realTime = other.realTime;
manualMode = other.manualMode;
keepComment = other.keepComment;
keepMyData = other.keepMyData;
keepOther = other.keepOther;
keepSat = other.keepSat;
modifying = other.modifying;

// VARIABLES for ADIF //////////
address = other.address;
age = 0;
altitude = 0.0;
a_index = 0;
ant_az = 0.0;
ant_el = 0.0;
ant_path = QString();
arrl_sect = QString();
award_submitted = QString();
award_granted = QString();
band = other.band;
band_rx = other.band_rx;
callsign = other.callsign;
check = QString();
clase = QString();
clublogQSOUpdateDate = QDate();
clublog_status = QString();
county = QString();
comment = other.comment;
continent = QString();
contacted_op = other.contacted_op;
contest_id = QString();
country = QString();
cqz = 0;
credit_granted = QString();
credit_submitted = QString();
darc_dok = QString();
distance = 0;
dxcc = other.dxcc;
email = QString();
ownerCall = QString();
contacted_owner = QString();
eQSLRDate = QDate();
eQSLSDate = QDate();
eqsl_qsl_rcvd = QString();
eqsl_qsl_sent = QString();
fists = 0;
fists_cc = 0;
forceInit = false;
freq_tx = other.freq_tx;
freq_rx = other.freq_rx;
gridsquare = other.gridsquare;
gridsquare_ext = other.gridsquare_ext
operatorCall = QString();
hrdlogUploadDate = QDate();
hrdlog_status = QString();
hamlogeu_status = QString();
hamlogeuUpdateDate = QDate();
hamqth_status = QString();
hamqthUpdateDate = QDate();
iota = QString();
iota_ID = 0;
itu_zone = 0;
k_index = 0;
latitude = QString();
longitude = QString();
QSLLoTWRDate = QDate();
QSLLoTWSDate = QDate();
lotw_qsl_rcvd = QString();
lotw_qsl_sent = QString();
max_bursts = 0;
mode = QString();
ms_shower = QString();
my_altitude = 0.0;
my_antenna = QString();
my_arrl_sect = QString();
my_city = QString();
my_county = QString();
my_country = QString();
my_cqz = 0;
my_dxcc = 0;
my_fists = 0;
my_gridsquare = other.my_gridsquare;
my_gridsquare_ext = other.my_gridsquare_ext;
my_iota = QString();
my_iota_ID = 0;
my_itu_zone = 0;
my_latitude = QString();
my_longitude = QString();
my_name = QString();
my_pota_ref = QString();
my_postal_code = QString();
my_rig = QString();
my_sig = QString();
my_sig_info = QString();
my_sota_ref = QString();
my_state = QString();
my_street = QString();
my_usaca_counties = QString();
my_vucc_grids= QString();
my_wwff_ref = QString();
name = other.name;
notes = QString();
nr_bursts = 0;
nr_pings = 0;
operatorCall = other.operatorCall;
ownerCall = QString();
contacted_owner = QString();
prefix = QString();
pota_ref = QString();
precedence = QString();
propMode = QString();
public_key = QString();
QRZComDate = QDate();
QRZCom_status = QString();
qslmsg = QString();
QSLRDate = QDate();
QSLSDate = QDate();
qsl_rcvd = QString();
qsl_sent = QString();
qslSenVia = QString();
qslRecVia = QString();
qslVia = other.qslVia;
qso_complete = other.qso_complete;
qso_dateTime = other.qso_dateTime;
qso_date_off = other.qso_date_off;
qso_random = true;
qth = QString();
region = QString();
rig = QString();
RST_rx = other.RST_rx;
RST_tx = other.RST_tx
pwr_rx = 0.0;
satMode = QString();
satName = QString();
sfi = 0;
sig = QString();
sig_info = QString();
silent_key = false;
skcc = QString();
sota_ref = QString();
srx = 0;
srx_string = other.srx_string;
state = QString();
stx = 0;
stx_string = other.stx_string;
submode = QString();
swl = false;
ten_ten = 0;
qso_time_off = other.qso_time_off
pwr_tx = other.pwr_tx;
uksmg = 0;
usaca_counties = QString();
ve_prov = QString();
vucc_grids = QString();
web = QString();
wwff_ref = QString();
}

QSO::~QSO()
{
delete(util);
Expand Down
1 change: 1 addition & 0 deletions src/qso.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class QSO : public QObject

public:
QSO();
QSO(const QSO& other);
~QSO();
void setLogLevel (const DebugLogLevel _b);
void setRealTime(const bool _rt); // Not QSO info but KLog status
Expand Down
Loading

0 comments on commit c873456

Please sign in to comment.