From ace80589b8b42c18452e9cbd6f19c95fd31a3ebd Mon Sep 17 00:00:00 2001 From: aa5sh <84428382+aa5sh@users.noreply.github.com> Date: Sat, 14 Dec 2024 21:40:47 -0600 Subject: [PATCH] LoTW Upload Station Profiles Since adding the County to the Station Profile I have experienced tQSL errors due to county not matching my location in tQSL. So I added logic to allow the user to select the station profile. Since the station profile name isn't stored in the contact, I linked on the fields taht seemed to matter to tQSL. --- ui/LotwDialog.cpp | 21 ++++++++++++++++++--- ui/LotwDialog.ui | 13 ++++++++++++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/ui/LotwDialog.cpp b/ui/LotwDialog.cpp index fa23d2c5..42c4eea8 100644 --- a/ui/LotwDialog.cpp +++ b/ui/LotwDialog.cpp @@ -33,6 +33,11 @@ LotwDialog::LotwDialog(QWidget *parent) : ui->myGridCombo->setModel(new SqlListModel("SELECT DISTINCT UPPER(my_gridsquare) FROM contacts WHERE station_callsign ='" + ui->myCallsignCombo->currentText() + "' ORDER BY my_gridsquare", "")); + + ui->myStationCombo->setModel(new SqlListModel("SELECT profile_name FROM station_profiles WHERE callsign ='" + + ui->myCallsignCombo->currentText() + +"' ORDER BY profile_name", "")); + /* Download */ ui->qslRadioButton->setChecked(true); ui->qsoRadioButton->setChecked(false); @@ -114,14 +119,20 @@ void LotwDialog::upload() { qslSentStatuses << "'N'"; } - QString query_string = "SELECT callsign, freq, band, freq_rx, " + QString query_string = "SELECT contacts.callsign, freq, band, freq_rx, " " mode, submode, start_time, prop_mode, " " sat_name, station_callsign, operator, " " rst_sent, rst_rcvd, my_state, my_cnty, " " my_vucc_grids " - "FROM contacts "; + "FROM contacts inner join station_profiles on contacts.station_callsign = station_profiles.callsign " + "and (contacts.my_cnty = station_profiles.county or contacts.my_cnty is null) " + "and (contacts.my_pota_ref = station_profiles.pota or contacts.my_pota_ref is null) " + "and (contacts.my_itu_zone = station_profiles.ituz or contacts.my_itu_zone is null) " + "and (contacts.my_cq_zone = station_profiles.cqz or contacts.my_cq_zone is null) " + "and (contacts.my_iota = station_profiles.iota or contacts.my_iota is null)"; QString query_where = QString("WHERE (upper(lotw_qsl_sent) in (%1) OR lotw_qsl_sent is NULL) " - " AND (upper(prop_mode) NOT IN ('INTERNET', 'RPT', 'ECH', 'IRL') OR prop_mode IS NULL) ").arg(qslSentStatuses.join(",")); + " AND (upper(prop_mode) NOT IN ('INTERNET', 'RPT', 'ECH', 'IRL') OR prop_mode IS NULL) ").arg(qslSentStatuses.join(",")) + " " + " AND station_profiles.profile_name = '" + ui->myStationCombo->currentText() + "'"; QString query_order = " ORDER BY start_time "; saveDialogState(); @@ -219,6 +230,10 @@ void LotwDialog::upload() { void LotwDialog::uploadCallsignChanged(const QString &my_callsign) { ui->myGridCombo->setModel(new SqlListModel("SELECT DISTINCT UPPER(my_gridsquare) FROM contacts WHERE station_callsign ='" + my_callsign + "' ORDER BY my_gridsquare", "")); + + ui->myStationCombo->setModel(new SqlListModel("SELECT profile_name FROM station_profiles WHERE callsign ='" + + ui->myCallsignCombo->currentText() + +"' ORDER BY profile_name", "")); } void LotwDialog::saveDialogState() diff --git a/ui/LotwDialog.ui b/ui/LotwDialog.ui index 0a468313..7ede081a 100644 --- a/ui/LotwDialog.ui +++ b/ui/LotwDialog.ui @@ -34,7 +34,15 @@ - + + + + My Station + + + + + Show Selection @@ -53,6 +61,9 @@ Include QSOs with Sent Status + + +