From fa7b30888d136b9db830acc0941d0d4cf280193c Mon Sep 17 00:00:00 2001 From: d Date: Sun, 23 Jun 2024 00:37:23 +0200 Subject: [PATCH] bug fix and database work bugfix log table updated altitude and my_altitude fields added --- src/Changelog | 41 +++++++++++++ src/adif.cpp | 6 +- src/adif.h | 2 +- src/database.cpp | 70 +++++++++++++++++++--- src/database.h | 4 +- src/dxcluster/dxcluster.h | 4 +- src/dxcluster/dxclusterassistant.h | 6 +- src/dxcluster/dxspot.h | 6 +- src/inputwidgets/mainwindowinputothers.cpp | 68 +++++++++++---------- src/inputwidgets/mainwindowmydatatab.cpp | 28 ++++----- src/mainwindow.cpp | 5 +- src/qso.cpp | 45 ++++++++++++-- src/qso.h | 10 +++- src/tips-for-devel.txt | 25 ++++++++ 14 files changed, 244 insertions(+), 76 deletions(-) diff --git a/src/Changelog b/src/Changelog index 056b5e28..41a96b22 100644 --- a/src/Changelog +++ b/src/Changelog @@ -1,3 +1,43 @@ +added: altitude +added: my_altitude +gridsquare_ext +my_gridsquare_ext +hamlogeu_qso_upload_date +hamlogeu_qso_upload_status +hamqth_qso_upload_date +hamqth_qso_upload_status +my_arrl_sect +my_pota_ref +my_wwff_ref +pota_ref +wwff_ref + + + +ADDRESS_INTL +COMMENT_INTL +COUNTRY_INTL +MY_ANTENNA_INTL +MY_CITY_INTL +MY_COUNTRY_INTL +MY_NAME_INTL +MY_POSTAL_CODE_INTL +MY_RIG_INTL +MY_SIG_INTL +MY_SIG_INFO_INTL +MY_STREET_INTL +NAME_INTL +NOTES_INTL +QSLMSG_INTL +QTH_INTL +RIG_INTL +SIG_INTL +SIG_INFO_INTL + + +BUG: Detect the need to update the DB https://github.com/ea4k/klog/issues/721 +BUG: When entering/modifying a QSO thre is an error related to awarddxcc table not existing + 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 @@ -34,6 +74,7 @@ TBD - 2.4 - Enhancement: Function to import QSOs from WSJTX. - Enhancement: Added all the modes/submodes of ADIF 3.1.4 - Enhancement: Added many tests to test code before releasing. +- Enhancement: ADIF Added SUBMM band. - BugFix: Fixed the ISO name for Togo. - BugFix: Country fix read failed with complex prefixes. - Bugfix: CQ & ITU zones may be wrong for callsigns from specific DXCC if coming from WSJTX. diff --git a/src/adif.cpp b/src/adif.cpp index 0a91f501..ea926f7f 100644 --- a/src/adif.cpp +++ b/src/adif.cpp @@ -212,7 +212,7 @@ void Adif::setARRLSect() "ME", "MB", "MAR", "MDC", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NM", "NLI", "NL", "NC", "ND", "NTX", "NFL", "NNJ", "NNY", "NT", "NWT", "OH", "OK", "ON", - "ONE", "ONN", "ONS", "ORG", "OR", "PAC", "PR", "QC", + "ONE", "ONN", "ONS", "ORG", "OR", "PAC", "PE", "PR", "QC", "RI", "SV", "SDG", "SF", "SJV", "SB", "SCV", "SK", "SC", "SD", "STX", "SFL", "SNJ", "TN", "VI", "UT", "VT", "VA", "WCF", "WTX", "WV", "WMA", "WNY", "WPA", "WWA", "WI", "WY"}; @@ -368,14 +368,14 @@ bool Adif::isValidQSO_COMPLETE(const QString &_s) return ((_s == "Y") || (_s == "N") || (_s == "NIL") || (_s == "?")); } -bool Adif::Adif::isValidPOTA(const QString &_s) +bool Adif::isValidPOTA(const QString &_s) { if (_s.length()<1) return false; return true; } -bool isValidWWFF_Ref(const QString &_s) +bool Adif::isValidWWFF_Ref(const QString &_s) { if (_s.length()<1) return false; diff --git a/src/adif.h b/src/adif.h index c6b3623c..64c4cb17 100644 --- a/src/adif.h +++ b/src/adif.h @@ -56,10 +56,10 @@ class Adif : public QObject { bool isValidITUz(const QString &_b); // 1-90 bool isValidDXCC(const QString &_b); // 0-522 bool isValidAge(const QString &_b); // 0-120 + bool isValidDistance(const QString &_b); //>0.0 bool isValidAnt_EL(const QString &_b); //>=0-360 bool isValidAnt_AZ(const QString &_b); //>=-90-90 bool isValidA_Index(const QString &_b); //0-400 - bool isValidDistance(const QString &_b); //>0 bool isValidIOTA_islandID(const QString &_b); //1-99999999 bool isValidNRBursts(const QString &_b); //>0 bool isValidPings(const QString &_b); //>0 diff --git a/src/database.cpp b/src/database.cpp index 8a66ad97..b18d716b 100644 --- a/src/database.cpp +++ b/src/database.cpp @@ -455,14 +455,17 @@ bool DataBase::createTableLog(bool temp) "ituz INTEGER, " "dxcc INTEGER, " "address VARCHAR, " + "address_intl VARCHAR, " "age INTEGER, " "cnty VARCHAR, " "comment VARCHAR, " + "comment_intl VARCHAR, " "a_index INTEGER, " + "altitude REAL, " "ant_az INTEGER, " "ant_el INTEGER, " "ant_path INTEGER, " - "arrl_sect INTEGER, " + "arrl_sect VARCHAR(3), " "award_submitted VARCHAR, " "award_granted VARCHAR, " "band_rx INTEGER, " @@ -474,6 +477,7 @@ bool DataBase::createTableLog(bool temp) "contacted_op VARCHAR(40), " "contest_id VARCHAR, " "country VARCHAR, " + "country_intl VARCHAR, " "credit_submitted VARCHAR, " "credit_granted VARCHAR, " "darc_dok VARCHAR," @@ -490,6 +494,11 @@ bool DataBase::createTableLog(bool temp) "freq VARCHAR, " "freq_rx VARCHAR, " "gridsquare VARCHAR, " + "gridsquare_ext VARCHAR, " + "hamlogeu_qso_upload_date DATETIME, " + "hamlogeu_qso_upload_status VARCHAR(1), " + "hamqth_qso_upload_date DATETIME, " + "hamqth_qso_upload_status VARCHAR(1), " "hrdlog_qso_upload_date DATETIME, " "hrdlog_qso_upload_status VARCHAR(1), " "iota VARCHAR(6), " @@ -503,42 +512,58 @@ bool DataBase::createTableLog(bool temp) "lotw_qsl_sent VARCHAR(1), " "max_bursts INTEGER, " "ms_shower VARCHAR, " - "my_antenna VARCHAR," + "my_altitude REAL, " + "my_antenna VARCHAR, " + "my_antenna_intl VARCHAR, " + "arrl_sect VARCHAR(3), " "my_city VARCHAR, " + "my_city_intl VARCHAR, " "my_cnty VARCHAR, " "my_country INTEGER, " + "my_country_intl INTEGER, " "my_cq_zone INTEGER, " "my_dxcc INTEGER, " "my_fists INTEGER, " "my_gridsquare VARCHAR, " + "my_gridsquare_ext VARCHAR, " "my_iota VARCHAR(6), " "my_iota_island_id VARCHAR, " "my_itu_zone INTEGER ," "my_lat VARCHAR(11), " "my_lon VARCHAR(11), " "my_name VARCHAR, " + "my_name_intl VARCHAR, " + "my_pota_ref VARCHAR, " "my_postal_code VARCHAR ," + "my_postal_code_intl VARCHAR ," "my_rig VARCHAR, " + "my_rig_intl VARCHAR, " "my_sig VARCHAR, " + "my_sig_intl VARCHAR, " "my_sig_info VARCHAR, " + "my_sig_info_intl VARCHAR, " "my_sota_ref VARCHAR, " "my_state VARCHAR, " "my_street VARCHAR, " "my_usaca_counties VARCHAR, " "my_vucc_grids VARCHAR, " + "my_wwff_ref VARCHAR(11), " "name VARCHAR, " "notes VARCHAR, " + "notes_intl VARCHAR, " "nr_bursts INTEGER, " "nr_pings INTEGER, " "operator VARCHAR, " "owner_callsign VARCHAR, " "pfx VARCHAR, " + "pota_ref VARCHAR, " "precedence VARCHAR, " "prop_mode VARCHAR, " "public_key VARCHAR, " "qrzcom_qso_upload_date DATETIME, " "qrzcom_qso_upload_status VARCHAR(1), " "qslmsg VARCHAR, " + "qslmsg_intl VARCHAR, " "qslrdate DATETIME, " "qslsdate DATETIME, " "qsl_rcvd VARCHAR(1), " @@ -549,14 +574,18 @@ bool DataBase::createTableLog(bool temp) "qso_complete VARCHAR(1), " "qso_random INTEGER, " "qth VARCHAR, " + "qth_intl VARCHAR, " "region VARCHAR, " "rig VARCHAR, " + "rig_intl VARCHAR, " "rx_pwr REAL, " "sat_mode VARCHAR, " "sat_name VARCHAR, " "sfi INTEGER, " "sig VARCHAR, " + "sig_intl VARCHAR, " "sig_info VARCHAR, " + "sig_info_intl VARCHAR, " "silent_key VARCHAR(1), " "skcc VARCHAR, " "sota_ref VARCHAR, " @@ -575,6 +604,7 @@ bool DataBase::createTableLog(bool temp) "ten_ten INTEGER, " "tx_pwr REAL, " "web VARCHAR, " + "wwff_ref VARCHAR(11), " "qso_date_off DATETIME, " //2020-01-01 "marked VARCHAR(1), " "lognumber INTEGER NOT NULL, " @@ -2964,6 +2994,7 @@ bool DataBase::populateTableBand(const bool NoTmp) //To add a band, just create another line: execQuery(Q_FUNC_INFO, QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('0', '0', '0', 'Light')").arg(tableName)); + execQuery(Q_FUNC_INFO, QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('SUBMM', '300000', '7500000', 'SUBMM')").arg(tableName)); execQuery(Q_FUNC_INFO, QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('1mm', '241000', '250000', '241G')").arg(tableName)); execQuery(Q_FUNC_INFO, QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('2mm', '142000', '149000', '142G')").arg(tableName)); execQuery(Q_FUNC_INFO, QString("INSERT INTO %1 (name, lower, upper, cabrillo) VALUES ('2.5mm', '119980', '120020', '119G')").arg(tableName)); @@ -3187,17 +3218,40 @@ bool DataBase::updateTo006() return updateDBVersion(softVersion, "0.006"); } -bool DataBase::updateTableLog(const int _v) +bool DataBase::updateTableLog(const int _version) { //qDebug() << Q_FUNC_INFO; - if (_v!=6) + // _version helps to identify which update we need to run + if ((_version!=6) && (_version!=7)) return false; + QString queryString; + QString oldFields; // This variable holds the list of fields BEFORE the update. + // Updates are usually done to add ADIF fields to the DB. + // We need to move all the table except the new values that are included in this release: + switch (_version) + { + case 6: + oldFields = "qso_date, call, rst_sent, rst_rcvd, bandid, modeid, srx, stx, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, ant_path, arrl_sect, band_rx, checkcontest, class, contacted_op, contest_id, country, credit_submitted, credit_granted, distance, email, eq_call, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd, eqsl_qsl_sent, force_init, freq, freq_rx, gridsquare, iota, iota_island_id, k_index, lat, lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd, lotw_qsl_sent, max_bursts, ms_shower, my_city, my_cnty, my_country, my_cq_zone, my_gridsquare, my_iota, my_iota_island_id, my_lat, my_lon, my_name, my_rig, my_sig, my_sig_info, my_state, my_street, name, notes, nr_bursts, nr_pings, operator, owner_callsign, pfx, precedence, prop_mode, public_key, qslmsg, qslrdate, qslsdate, qsl_rcvd, qsl_sent, qsl_rcvd_via, qsl_sent_via, qsl_via, qso_complete, qso_random, qth, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, srx_string, stx_string, state, station_callsign, swl, ten_ten, tx_pwr, web, qso_date_off, marked, lognumber"; + break; + case 7: + oldFields = "qso_date, call, rst_sent, rst_rcvd, bandid, modeid, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, ant_path, arrl_sect, award_submitted, award_granted, band_rx, checkcontest, class, clublog_qso_upload_date, clublog_qso_upload_status,cont,contacted_op, contest_id, country, credit_submitted, credit_granted, darc_dok,distance, email, eq_call, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd,eqsl_qsl_sent,fists, fists_cc, force_init, freq, freq_rx, gridsquare, hrdlog_qso_upload_date, hrdlog_qso_upload_status, iota, iota_island_id, k_index, lat, lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd,lotw_qsl_sent,max_bursts, ms_shower, my_antenna,my_city, my_cnty, my_country, my_cq_zone, my_dxcc, my_fists, my_gridsquare, my_iota, my_iota_island_id, my_itu_zone my_lat, my_lon, my_name, my_postal_code, my_rig, my_sig, my_sig_info, my_sota_ref, my_state, my_street, my_usaca_counties, my_vucc_grids, name, notes, nr_bursts, nr_pings, operator, owner_callsign, pfx, precedence, prop_mode, public_key, qrzcom_qso_upload_date, qrzcom_qso_upload_status,qslmsg, qslrdate, qslsdate, qsl_rcvd,qsl_sent,qsl_rcvd_via,qsl_sent_via,qsl_via, qso_complete,qso_random, qth, region, rig, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, silent_key,skcc, sota_ref, srx_string, srx, stx_string, stx, state, station_callsign, submode,swl, uksmg, usaca_counties, ve_prov, vucc_grids, ten_ten, tx_pwr, web, qso_date_off, marked, lognumber"; + break; + default: + // We should never reach this value but if we reach it, weexit the function + return false; + break; + } + queryString = QString ("INSERT INTO logtemp (%1) SELECT %2 FROM log").arg(oldFields).arg(oldFields); + // Everything is ready, we can: + // - create the temp table for log, + // - move the data from the old table to the new one, taking into account the version + // - rename drop the old table + // - rename the new table temp as the regular log table + if (createTableLog(false)) return false; - QString queryString = QString ("INSERT INTO logtemp (qso_date, call, rst_sent, rst_rcvd, bandid, modeid, srx, stx, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, ant_path, arrl_sect, band_rx, checkcontest, class, contacted_op, contest_id, country, credit_submitted, credit_granted, distance, email, eq_call, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd, eqsl_qsl_sent, force_init, freq, freq_rx, gridsquare, iota, iota_island_id, k_index, lat, lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd, lotw_qsl_sent, max_bursts, ms_shower, my_city, my_cnty, my_country, my_cq_zone, my_gridsquare, my_iota, my_iota_island_id, my_lat, my_lon, my_name, my_rig, my_sig, my_sig_info, my_state, my_street, name, notes, nr_bursts, nr_pings, operator, owner_callsign, pfx, precedence, prop_mode, public_key, qslmsg, qslrdate, qslsdate, qsl_rcvd, qsl_sent, qsl_rcvd_via, qsl_sent_via, qsl_via, qso_complete, qso_random, qth, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, srx_string, stx_string, state, station_callsign, swl, ten_ten, tx_pwr, web, qso_date_off, marked, lognumber) SELECT qso_date, call, rst_sent, rst_rcvd, bandid, modeid, srx, stx, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, ant_path, arrl_sect, band_rx, checkcontest, class, contacted_op, contest_id, country, credit_submitted, credit_granted, distance, email, eq_call, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd, eqsl_qsl_sent, force_init, freq, freq_rx, gridsquare, iota, iota_island_id, k_index, lat, lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd, lotw_qsl_sent, max_bursts, ms_shower, my_city, my_cnty, my_country, my_cq_zone, my_gridsquare, my_iota, my_iota_island_id, my_lat, my_lon, my_name, my_rig, my_sig, my_sig_info, my_state, my_street, name, notes, nr_bursts, nr_pings, operator, owner_callsign, pfx, precedence, prop_mode, public_key, qslmsg, qslrdate, qslsdate, qsl_rcvd, qsl_sent, qsl_rcvd_via, qsl_sent_via, qsl_via, qso_complete, qso_random, qth, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, srx_string, stx_string, state, station_callsign, swl, ten_ten, tx_pwr, web, qso_date_off, marked, lognumber FROM log"); - if (!execQuery(Q_FUNC_INFO, queryString)) return false; @@ -4203,7 +4257,6 @@ bool DataBase::updateTo007() } - bool DataBase::updateTo008() {// Updates the DB to 0.0.8 //qDebug() << "DataBase::updateTo008: latestRead: " << getDBVersion() ; @@ -5958,6 +6011,9 @@ bool DataBase::updateTo026() if (!updateTheModeTableAndSyncLog()) return false; //qDebug() << Q_FUNC_INFO << " - 40" ; + if (!updateTableLog(7)) + return false; + //qDebug() << Q_FUNC_INFO << " - 50" ; return updateDBVersion(softVersion, "0.026"); } diff --git a/src/database.h b/src/database.h index 59d6e04f..6a031b0c 100644 --- a/src/database.h +++ b/src/database.h @@ -154,9 +154,9 @@ class DataBase : public QObject bool updateTo023(); // Fixes the cabrillo fields in the table band bool updateTo024(); // Fixes the entity table fixinf the DL id bool updateTo025(); // Adds modes from ADIF 3.1.3 - bool updateTo026(); // Recreates entity to make UTC a real + bool updateTo026(); // KLog-2.4: Recreates entity to make UTC a real & add new ADIF fields - bool updateTableLog(const int _v); + bool updateTableLog(const int _version); bool updateDBVersion(QString _softV, QString _dbV); bool createTheBandQuickReference(); diff --git a/src/dxcluster/dxcluster.h b/src/dxcluster/dxcluster.h index 23aad35c..6bcecefb 100644 --- a/src/dxcluster/dxcluster.h +++ b/src/dxcluster/dxcluster.h @@ -1,5 +1,5 @@ -#ifndef KLOG_DXCLUSTER_H -#define KLOG_DXCLUSTER_H +#ifndef KLOG_CLUSTER_DXCLUSTER_H +#define KLOG_CLUSTER_DXCLUSTER_H /*************************************************************************** dxcluster.h - description ------------------- diff --git a/src/dxcluster/dxclusterassistant.h b/src/dxcluster/dxclusterassistant.h index 8586927c..4c6ee511 100644 --- a/src/dxcluster/dxclusterassistant.h +++ b/src/dxcluster/dxclusterassistant.h @@ -1,5 +1,5 @@ -#ifndef DXCLUSTERASSISTANT_H -#define DXCLUSTERASSISTANT_H +#ifndef KLOG_CLUSTER_DXCLUSTERASSISTANT_H +#define KLOG_CLUSTER_DXCLUSTERASSISTANT_H /*************************************************************************** dxclusterassistant.h - description ------------------- @@ -71,4 +71,4 @@ class DXClusterAssistant : public QWidget QList list; }; -#endif // DXCLUSTERASSISTANT_H +#endif // KLOG_CLUSTER_DXCLUSTERASSISTANT_H diff --git a/src/dxcluster/dxspot.h b/src/dxcluster/dxspot.h index 1b35c867..21524d40 100644 --- a/src/dxcluster/dxspot.h +++ b/src/dxcluster/dxspot.h @@ -1,5 +1,5 @@ -#ifndef DXSPOT_H -#define DXSPOT_H +#ifndef KLOG_CLUSTER_DXSPOT_H +#define KLOG_CLUSTER_DXSPOT_H /*************************************************************************** dxspot.h - description ------------------- @@ -79,4 +79,4 @@ class DXSpot : public QObject bool valid; }; -#endif // DXSPOT_H +#endif // KLOG_CLUSTER_DXSPOT_H diff --git a/src/inputwidgets/mainwindowinputothers.cpp b/src/inputwidgets/mainwindowinputothers.cpp index 9b882d0c..0e948c73 100644 --- a/src/inputwidgets/mainwindowinputothers.cpp +++ b/src/inputwidgets/mainwindowinputothers.cpp @@ -174,9 +174,10 @@ void MainWindowInputOthers::clear(bool _full) userDefinedADIFComboBox->setCurrentIndex (0); userDefinedADIFValueLineEdit->clear (); sota_ref = QString(); + distance = 0.0; age = 0; - + vucc_grids = QString(); pota_ref = QString(); sig = QString(); sig_info = QString(); @@ -335,16 +336,7 @@ void MainWindowInputOthers::clearIOTA() bool MainWindowInputOthers::isIOTAModified() { logEvent (Q_FUNC_INFO, "Start", Debug); - if ((iotaContinentComboBox->currentIndex()>0) || (iotaNumberLineEdit->text()).toInt()>0) - { - logEvent (Q_FUNC_INFO, "END-True", Debug); - return true; - } - else - { - logEvent (Q_FUNC_INFO, "END-False", Debug); - return false; - } + return ((iotaContinentComboBox->currentIndex()>0) || (iotaNumberLineEdit->text()).toInt()>0); } void MainWindowInputOthers::setIOTA(const QString &_qs) @@ -600,22 +592,30 @@ bool MainWindowInputOthers::setUserADIFTypeComboBox(const QString &_value) { userDefinedADIFComboBox->setCurrentIndex (1); } - else if (_value == "SIG") + else if (_value == "DISTANCE") { userDefinedADIFComboBox->setCurrentIndex (2); } - else if (_value == "SIG_INFO") + else if (_value == "POTA_REF") { userDefinedADIFComboBox->setCurrentIndex (3); } - else if (_value == "POTA_REF") + else if (_value == "SIG") { userDefinedADIFComboBox->setCurrentIndex (4); } - else if (_value == "WWFF_REF") + else if (_value == "SIG_INFO") { userDefinedADIFComboBox->setCurrentIndex (5); } + else if (_value == "VUCC_GRIDS") + { + userDefinedADIFComboBox->setCurrentIndex (6); + } + else if (_value == "WWFF_REF") + { + userDefinedADIFComboBox->setCurrentIndex (7); + } else { logEvent (Q_FUNC_INFO, "END-1", Debug); @@ -641,21 +641,21 @@ QString MainWindowInputOthers::getUserADIFTypeComboBox() return "AGE"; case 3: logEvent (Q_FUNC_INFO, "END-3", Debug); - return "VUCC_GRIDS"; - case 4: - logEvent (Q_FUNC_INFO, "END-4", Debug); return "DISTANCE"; - case 5: + case 4: logEvent (Q_FUNC_INFO, "END-4", Debug); return "POTA_REF"; - case 6: - logEvent (Q_FUNC_INFO, "END-4", Debug); + case 5: + logEvent (Q_FUNC_INFO, "END-5", Debug); return "SIG"; - case 7: - logEvent (Q_FUNC_INFO, "END-4", Debug); + case 6: + logEvent (Q_FUNC_INFO, "END-6", Debug); return "SIG_INFO"; + case 7: + logEvent (Q_FUNC_INFO, "END-7", Debug); + return "VUCC_GRIDS"; case 8: - logEvent (Q_FUNC_INFO, "END-4", Debug); + logEvent (Q_FUNC_INFO, "END-8", Debug); return "WWFF_REF"; default: logEvent (Q_FUNC_INFO, "END", Debug); @@ -679,8 +679,11 @@ QString MainWindowInputOthers::getUserADIFValue() bool MainWindowInputOthers::setInitialADIFValues() { logEvent (Q_FUNC_INFO, "END-", Debug); - adifValidTypes << "01-" + tr("SOTA Ref") << "02-" + tr ("Age") << "03-" + tr ("VUCC grids") - << "04-" + tr("Distance"); + adifValidTypes<< "01-" + tr("SOTA Ref") << "02-" + tr ("Age") + << "03-" + tr("Distance") << "04-" + tr("POTA Ref") + << "05-" + tr("SIG") << "06-" + tr("SIG Info") + << "07-" + tr ("VUCC grids") << "08-" + tr("WWFF Ref"); + userDefinedADIFComboBox->clear (); userDefinedADIFComboBox->addItems (adifValidTypes); logEvent (Q_FUNC_INFO, "END", Debug); @@ -864,23 +867,24 @@ void MainWindowInputOthers::slotSetCurrentUSerData() distance = userDefinedADIFValueLineEdit->text().toDouble(); } if (currentTag == "POTA_REF") - { - setPOTA_REF(userDefinedADIFValueLineEdit->text()); - //pota_ref = userDefinedADIFValueLineEdit->text(); + { + pota_ref = userDefinedADIFValueLineEdit->text(); } if (currentTag == "SIG") { - setSIG(userDefinedADIFValueLineEdit->text()); + sig = userDefinedADIFValueLineEdit->text(); + //setSIG(userDefinedADIFValueLineEdit->text()); //sig = userDefinedADIFValueLineEdit->text(); } if (currentTag == "SIG_INFO") { - sig = userDefinedADIFValueLineEdit->text(); + sig_info = userDefinedADIFValueLineEdit->text(); } if (currentTag == "WWFF_REF") { //wwff_ref = userDefinedADIFValueLineEdit->text(); - setWWFF_Ref(userDefinedADIFValueLineEdit->text()); + wwff_ref = userDefinedADIFValueLineEdit->text(); + //setWWFF_Ref(userDefinedADIFValueLineEdit->text()); } logEvent (Q_FUNC_INFO, "END", Debug); } diff --git a/src/inputwidgets/mainwindowmydatatab.cpp b/src/inputwidgets/mainwindowmydatatab.cpp index 4457600d..7c67992b 100644 --- a/src/inputwidgets/mainwindowmydatatab.cpp +++ b/src/inputwidgets/mainwindowmydatatab.cpp @@ -482,7 +482,12 @@ bool MainWindowMyDataTab::setInitialADIFValues() //qDebug() << Q_FUNC_INFO; logEvent (Q_FUNC_INFO, "Start", Debug); adifValidTypes.clear (); - adifValidTypes << "01-" + tr("My Rig") << "02-" + tr("My Antenna") << "03-" + tr("My SOTA_Ref")<< "04-" + tr("My VUCC_GRIDS"); + adifValidTypes << "01-" + tr("My Rig") << "02-" + tr("My Antenna") + << "03-" + tr("My POTA Ref") << "04-" + tr("My SIG") + << "05-" + tr("My SIG Info") << "06-" + tr("My SOTA Ref") + << "07-" + tr("My VUCC_GRIDS") + << "08-" + tr("My WWFF Ref"); + myUserADIFComboBox->clear (); myUserADIFComboBox->addItems (adifValidTypes); return true; @@ -712,9 +717,10 @@ QString MainWindowMyDataTab::getMySig_info() bool MainWindowMyDataTab::setMyWWFF_Ref(const QString &_op) { Adif adif(Q_FUNC_INFO); + if (!adif.isValidWWFF_Ref(_op)) return false; - my_pota_ref = _op; + my_wwff_ref = _op; slotMyUserADIFComboBoxChanged(); return true; } @@ -796,7 +802,8 @@ void MainWindowMyDataTab::slotSetCurrentMyUSerData() } else if (currentTag == "MY_POTA_REF") { - setMyPota_ref(myUserADIFLineEdit->text()); + my_pota_ref = myUserADIFLineEdit->text(); + //setMyPota_ref(myUserADIFLineEdit->text()); } else if (currentTag == "MY_SIG") { @@ -812,15 +819,13 @@ void MainWindowMyDataTab::slotSetCurrentMyUSerData() } else if (currentTag == "MY_VUCC_GRIDS") { - //if (checkMyVUCC_GRIDS(myUserADIFLineEdit->text())) - //{} - my_vucc_grids = myUserADIFLineEdit->text().toUpper(); myUserADIFLineEdit->setText (my_vucc_grids); } else if (currentTag == "MY_WWFF_REF") { - setMyWWFF_Ref(myUserADIFLineEdit->text()); + my_wwff_ref = myUserADIFLineEdit->text(); + //setMyWWFF_Ref(myUserADIFLineEdit->text()); } myUserADIFLineEdit->setCursorPosition (currentPos); } @@ -836,14 +841,7 @@ void MainWindowMyDataTab::setModify(const bool _modify) bool MainWindowMyDataTab::getDarkMode() { logEvent (Q_FUNC_INFO, "Start", Debug); - if (operatorLineEdit->palette().color (QPalette::Base) == "#646464") - { - return true; - } - else - { - return false; - } + return (operatorLineEdit->palette().color (QPalette::Base) == "#646464"); } void MainWindowMyDataTab::setLogLevel (const DebugLogLevel _b) diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f03f09ea..f289907e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1284,7 +1284,10 @@ bool MainWindow::readQSOFromUI() qso->setContinent (dataProxy->getContinentShortNameFromEntity(dxcc)); qso->setName (QSOTabWidget->getName()); - qso->setDistance (infoWidget->getDistance ()); + if (othersTabWidget->getDistance()>0.0) + qso->setDistance(othersTabWidget->getDistance()); + else + qso->setDistance (infoWidget->getDistance ()); qso->setGridSquare (QSOTabWidget->getDXLocator()); qso->setMyGridSquare (myDataTabWidget->getMyLocator()); diff --git a/src/qso.cpp b/src/qso.cpp index 61b9d16e..07402191 100644 --- a/src/qso.cpp +++ b/src/qso.cpp @@ -86,6 +86,7 @@ void QSO::clear() // VARIABLES for ADIF ////////// address = QString(); age = 0; + altitude = 0.0; a_index = 0; ant_az = 0.0; ant_el = 0.0; @@ -141,6 +142,7 @@ void QSO::clear() max_bursts = 0; mode = QString(); ms_shower = QString(); + my_altitude = 0.0; my_antenna = QString(); my_arrl_sect = QString(); my_city = QString(); @@ -1286,6 +1288,17 @@ double QSO::getAge() return age; } +bool QSO::setAltitude(const double _c) +{ + altitude = _c; + return true; +} + +double QSO::getAltitude() +{ + return altitude; +} + bool QSO::setIOTA(const QString &_c) { if (_c.length()>0) @@ -2038,6 +2051,16 @@ bool QSO::getQSORandom() return qso_random; } +bool QSO::setMyAltitude(const double _c) +{ + my_altitude = _c; +} + +double QSO::getMyAltitude() +{ + return my_altitude; +} + bool QSO::setMyCity(const QString &_c) { my_city = _c; @@ -2584,6 +2607,7 @@ QString QSO::getMyWWFF_Ref() // helper functions for hash, returns original function but takes string data as imput bool QSO::setAge(const QString &data) { return setAge(data.toDouble()); } +bool QSO::setAltitude(const QString &data) { return setAltitude(data.toDouble()); }; bool QSO::setA_Index(const QString& data) { return setA_Index(data.toInt()); } bool QSO::setAnt_az(const QString& data) { return setAnt_az(data.toDouble()); } bool QSO::setAnt_el(const QString& data) { return setAnt_el(data.toDouble()); } @@ -2597,6 +2621,7 @@ bool QSO::setIotaID(const QString& data) { return setIotaID(data.toInt()); } bool QSO::setItuZone(const QString& data) { return setItuZone(data.toInt()); } bool QSO::setK_Index(const QString& data) { return setK_Index(data.toInt()); } bool QSO::setMaxBursts(const QString& data) { return setMaxBursts(data.toInt()); } +bool QSO::setMyAltitude(const QString &data) { return setMyAltitude(data.toDouble()); }; bool QSO::setMyCQZone(const QString& data) { return setMyCQZone(data.toInt()); } bool QSO::setMyDXCC(const QString& data) { return setMyDXCC(data.toInt()); } bool QSO::setMyIotaID(const QString& data) { return setMyIotaID(data.toInt()); } @@ -2651,6 +2676,7 @@ void QSO::InitializeHash() { SetDataHash = { {"ADDRESS", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setAddress)}, {"AGE", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setAge)}, + {"ALTITUDE", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setAltitude)}, {"A_INDEX", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setA_Index)}, {"ANT_AZ", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setAnt_az)}, {"ANT_EL", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setAnt_el)}, @@ -2704,6 +2730,7 @@ void QSO::InitializeHash() { {"MAX_BURSTS", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setMaxBursts)}, {"MODE", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setMode)}, {"MS_SHOWER", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setMsShower)}, + {"MY_ALTITUDE", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setMyAltitude)}, {"MY_ANTENNA", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setMyAntenna)}, {"MY_ARRL_SECT", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setMyArrlSect)}, {"MY_CITY", decltype(std::mem_fn(&QSO::decltype_function))(&QSO::setMyCity)}, @@ -2879,13 +2906,13 @@ QString QSO::getAddQueryString() { // submode is not used, keep it empty. // mode field is populated with the submode return QString( "INSERT INTO log (" - "qso_date, call, rst_sent, rst_rcvd, bandid, modeid, cqz, ituz, dxcc, address, age, cnty, comment, a_index, ant_az, ant_el, " + "qso_date, call, rst_sent, rst_rcvd, bandid, modeid, cqz, ituz, dxcc, address, age, altitude, cnty, comment, a_index, ant_az, ant_el, " "ant_path, arrl_sect, award_submitted, award_granted, band_rx, checkcontest, class, clublog_qso_upload_date, " "clublog_qso_upload_status, cont, contacted_op, contest_id, country, credit_submitted, credit_granted, darc_dok, " "distance, email, eq_call, eqsl_qslrdate, eqsl_qslsdate, eqsl_qsl_rcvd, eqsl_qsl_sent, fists, fists_cc, " "force_init, freq, freq_rx, gridsquare, hrdlog_qso_upload_date, hrdlog_qso_upload_status, " "iota, iota_island_id, k_index, lat, lon, lotw_qslrdate, lotw_qslsdate, lotw_qsl_rcvd, lotw_qsl_sent, max_bursts, ms_shower, " - "my_antenna, my_city, my_cnty, my_country, my_cq_zone, my_dxcc, my_fists, my_gridsquare, my_iota, my_iota_island_id," + "my_antenna, my_altitude, my_city, my_cnty, my_country, my_cq_zone, my_dxcc, my_fists, my_gridsquare, my_iota, my_iota_island_id," " my_itu_zone, my_lat, " "my_lon, my_name, my_postal_code, my_rig, my_sig, my_sig_info, my_sota_ref, my_state, my_street, " "my_usaca_counties, my_vucc_grids, name, " @@ -2894,13 +2921,13 @@ QString QSO::getAddQueryString() "qth, region, rig, rx_pwr, sat_mode, sat_name, sfi, sig, sig_info, silent_key, skcc, sota_ref, srx_string, srx, stx_string, stx, state, " "station_callsign, swl, uksmg, usaca_counties, ve_prov, vucc_grids, ten_ten, tx_pwr, web, qso_date_off, marked, lognumber) " "VALUES (" - ":qso_date, :call, :rst_sent, :rst_rcvd, :bandid, :modeid, :cqz, :ituz, :dxcc, :address, :age, :cnty, :comment, :a_index, :ant_az, :ant_el, " + ":qso_date, :call, :rst_sent, :rst_rcvd, :bandid, :modeid, :cqz, :ituz, :dxcc, :address, :age, :altitude, :cnty, :comment, :a_index, :ant_az, :ant_el, " ":ant_path, :arrl_sect, :award_submitted, :award_granted, :band_rx, :checkcontest, :class, :clublog_qso_upload_date, :clublog_qso_upload_status, :cont, " ":contacted_op, :contest_id, :country, :credit_submitted, :credit_granted, :darc_dok, :distance, :email, :eq_call, :eqsl_qslrdate, :eqsl_qslsdate, " ":eqsl_qsl_rcvd, :eqsl_qsl_sent, :fists, :fists_cc, :force_init, :freq_tx, :freq_rx, :gridsquare, :hrdlog_qso_upload_date, " ":hrdlog_qso_upload_status, " ":iota, :iota_island_id, :k_index, :lat, :lon, :lotw_qslrdate, :lotw_qslsdate, :lotw_qsl_rcvd, :lotw_qsl_sent, :max_bursts, :ms_shower, " - ":my_antenna, :my_city, :my_cnty, :my_country, :my_cq_zone, :my_dxcc, :my_fists, :my_gridsquare, :my_iota, :my_iota_island_id, :my_itu_zone, :my_lat, " + ":my_antenna, :my_altitude, :my_city, :my_cnty, :my_country, :my_cq_zone, :my_dxcc, :my_fists, :my_gridsquare, :my_iota, :my_iota_island_id, :my_itu_zone, :my_lat, " ":my_lon, :my_name, :my_postal_code, :my_rig, :my_sig, :my_sig_info, :my_sota_ref, :my_state, :my_street, :my_usaca_counties, :my_vucc_grids, :name, " ":notes, :nr_bursts, :nr_pings, :operator, :owner_callsign, :pfx, :precedence, :prop_mode, :public_key, :qrzcom_qso_upload_date, " ":qrzcom_qso_upload_status, :qslmsg, :qslrdate, :qslsdate, :qsl_rcvd, :qsl_sent, :qsl_rcvd_via, :qsl_sent_via, :qsl_via, :qso_complete, :qso_random, " @@ -2914,7 +2941,7 @@ QString QSO::getModifyQueryString() // mode field is populated with the submode return QString("UPDATE log SET call = :call, qso_date = :qso_date, rst_sent = :rst_sent, rst_rcvd = :rst_rcvd, " "bandid = :bandid, modeid = :modeid, cqz = :cqz, ituz = :ituz, dxcc = :dxcc, address = :address, " - "age = :age, cnty = :cnty, comment = :comment, a_index = :a_index, ant_az = :ant_az, ant_el = :ant_el, " + "age = :age, altitude = :altitude, cnty = :cnty, comment = :comment, a_index = :a_index, ant_az = :ant_az, ant_el = :ant_el, " "ant_path = :ant_path, arrl_sect = :arrl_sect, award_submitted = :award_submitted, " "award_granted = :award_granted, band_rx = :band_rx, checkcontest = :checkcontest, class = :class, " "clublog_qso_upload_date = :clublog_qso_upload_date, clublog_qso_upload_status = :clublog_qso_upload_status, " @@ -2927,7 +2954,7 @@ QString QSO::getModifyQueryString() "hrdlog_qso_upload_status = :hrdlog_qso_upload_status, iota = :iota, iota_island_id = :iota_island_id, " "k_index = :k_index, lat = :lat, lon = :lon, lotw_qslrdate = :lotw_qslrdate, lotw_qslsdate = :lotw_qslsdate, " "lotw_qsl_rcvd = :lotw_qsl_rcvd, lotw_qsl_sent = :lotw_qsl_sent, max_bursts = :max_bursts, " - "ms_shower = :ms_shower, my_antenna = :my_antenna, my_city = :my_city, my_cnty = :my_cnty, " + "ms_shower = :ms_shower, my_antenna = :my_antenna, my_altitude = :my_altitude, my_city = :my_city, my_cnty = :my_cnty, " "my_country = :my_country, my_cq_zone = :my_cq_zone, my_dxcc = :my_dxcc, my_fists = :my_fists, " "my_gridsquare = :my_gridsquare, 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, " @@ -3135,6 +3162,7 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s) query.bindValue(":dxcc", getDXCC()); query.bindValue(":address", getAddress()); query.bindValue(":age", getAge()); + query.bindValue(":altitude", getAltitude()); query.bindValue(":cnty", getCounty()); query.bindValue(":comment", getComment()); query.bindValue(":a_index", getA_Index()); @@ -3187,6 +3215,7 @@ QSqlQuery QSO::getPreparedQuery(const QString &_s) query.bindValue(":lotw_qsl_sent", getLoTWQSL_SENT()); query.bindValue(":max_bursts", getMaxBursts()); query.bindValue(":ms_shower", getMsShower()); + query.bindValue(":my_altitude", getMyAltitude()); query.bindValue(":my_antenna", getMyAntenna()); query.bindValue(":my_city", getMyCity()); @@ -3309,6 +3338,7 @@ QString QSO::getADIF() adifStr.append(adif->getADIFField ("ADDRESS", address)); if (age>0.0) //Only relevant if Age >0 adifStr.append(adif->getADIFField ("AGE", QString::number(age))); + adifStr.append(adif->getADIFField ("ALTITUDE", QString::number(getAltitude()))); adifStr.append(adif->getADIFField ("CNTY", county)); adifStr.append(adif->getADIFField ("COMMENT", comment)); if ((adif->isValidA_Index(QString::number(a_index))) && (a_index>0)) @@ -3386,6 +3416,7 @@ QString QSO::getADIF() adifStr.append(adif->getADIFField ("max_bursts", QString::number(getMaxBursts()) )); adifStr.append(adif->getADIFField ("ms_shower", ms_shower)); + adifStr.append(adif->getADIFField ("my_altitude", QString::number(getMyAltitude()))); adifStr.append(adif->getADIFField ("my_antenna", my_antenna)); adifStr.append(adif->getADIFField ("my_city", my_city)); @@ -3600,6 +3631,7 @@ bool QSO::fromDB(int _qsoId) setAddress((query.value(rec.indexOf("address"))).toString()); setAge((query.value(rec.indexOf("age"))).toDouble()); + setAltitude((query.value(rec.indexOf("altitude"))).toDouble()); setCounty((query.value(rec.indexOf("cnty"))).toString()); setA_Index((query.value(rec.indexOf("a_index"))).toInt()); @@ -3671,6 +3703,7 @@ bool QSO::fromDB(int _qsoId) setMaxBursts((query.value(rec.indexOf("max_bursts"))).toInt()); setMsShower((query.value(rec.indexOf("ms_shower"))).toString()); + setMyAltitude((query.value(rec.indexOf("my_altitude"))).toDouble()); setMyCity((query.value(rec.indexOf("my_city"))).toString()); setMyCounty((query.value(rec.indexOf("my_cnty"))).toString()); setMyCountry((query.value(rec.indexOf("my_country"))).toString()); diff --git a/src/qso.h b/src/qso.h index 12f366e6..06ce222d 100644 --- a/src/qso.h +++ b/src/qso.h @@ -233,6 +233,8 @@ class QSO : public QObject bool setAddress(const QString &_c); QString getAddress(); + bool setAltitude(const double _c); + double getAltitude(); bool setA_Index(const int _i); int getA_Index(); bool setAnt_az(const double _c); @@ -315,6 +317,8 @@ class QSO : public QObject QString getMsShower(); bool setQSORandom(bool _k); bool getQSORandom(); + bool setMyAltitude(const double _c); + double getMyAltitude(); bool setMyCity(const QString &_c); QString getMyCity(); bool setMyCounty(const QString &_c); @@ -394,6 +398,8 @@ class QSO : public QObject bool setWeb(const QString &_c); QString getWeb(); + + int toDB(int _qsoId = 0); bool fromDB(int _qsoId); //bool add(); @@ -423,7 +429,7 @@ class QSO : public QObject int qsoId, logId, dxcc, a_index, k_index, cqz, fists, fists_cc, my_fists, iota_ID, itu_zone, nr_bursts, max_bursts, nr_pings, my_cqz, my_itu_zone, my_dxcc, my_iota_ID, srx, stx, uksmg; int ten_ten, sfi; - double freq_tx, freq_rx, pwr_rx, pwr_tx, age, ant_el, ant_az, distance; + double freq_tx, freq_rx, pwr_rx, pwr_tx, age, ant_el, ant_az, distance, altitude, my_altitude; QString satName, satMode, callsign, stationCallsign, operatorCall, propMode, band, band_rx, mode, gridsquare, my_gridsquare, qth, name, RST_tx, RST_rx; QString qsl_rcvd, qsl_sent, qslSenVia, qslRecVia, qslVia, check, clase; @@ -458,6 +464,7 @@ class QSO : public QObject //Overloaded helper functions to accept string data for nonstring functions bool setAge(const QString &data); + bool setAltitude(const QString &data); bool setA_Index(const QString &data); bool setAnt_az(const QString &data); bool setAnt_el(const QString &data); @@ -471,6 +478,7 @@ class QSO : public QObject bool setItuZone(const QString &data); bool setK_Index(const QString &data); bool setMaxBursts(const QString &data); + bool setMyAltitude(const QString &data); bool setMyCQZone(const QString &data); bool setMyDXCC(const QString &data); bool setMyIotaID(const QString &data); diff --git a/src/tips-for-devel.txt b/src/tips-for-devel.txt index 6ea67126..e01d116d 100644 --- a/src/tips-for-devel.txt +++ b/src/tips-for-devel.txt @@ -10,3 +10,28 @@ select count (distinct dxcc) from log DELETED ENTITIES: http://www.ng3k.com/Dxcc/dxccde.html +PROCESS to add a new ADIF field: +1.- Add it to: bool DataBase::createTableLog(bool temp) +2.- Ensure the bool DataBase::updateIfNeeded() runs to update the log table +3.- class QSO (.h) + - Add the variable: altitude + - Add the set & get: + bool setAltitude(const double _c); + double getAltitude();setAltitude / getAltitude + - Add the helper: + bool setAltitude(const QString &data); + +3.- class QSO (.cpp) + - Implement the setters/getter + - clear() (add the variable) + - Add it to: + - void QSO::InitializeHash() + - QString QSO::getAddQueryString() + - QString QSO::getModifyQueryString() + - QSqlQuery QSO::getPreparedQuery(const QString &_s) + - QString QSO::getADIF() + - bool QSO::fromDB(int _qsoId) + +4.- class ADIF (.cpp) + Add it to: + - void Adif::InitializeHash()