Skip to content

Commit

Permalink
Fixing #176 - Fixed misunderstanding _SENT Status Values
Browse files Browse the repository at this point in the history
  • Loading branch information
foldynl committed Mar 1, 2023
1 parent 69b62b9 commit 11f821b
Show file tree
Hide file tree
Showing 9 changed files with 286 additions and 92 deletions.
29 changes: 13 additions & 16 deletions logformat/AdiFormat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,10 @@ QString AdiFormat::parseQslRcvd(const QString &value) {

qCDebug(function_parameters)<<value;

if (!value.isEmpty()) {
switch (value.at(0).toLatin1()) {
if (!value.isEmpty())
{
switch (value.toUpper().at(0).toLatin1())
{
case 'Y': return "Y";
case 'N': return "N";
case 'R': return "R";
Expand All @@ -660,18 +662,18 @@ QString AdiFormat::parseQslRcvd(const QString &value) {
default: return "N";
}
}
else {
return "N";
}
return "N";
}

QString AdiFormat::parseQslSent(const QString &value) {
FCT_IDENTIFICATION;

qCDebug(function_parameters)<<value;

if (!value.isEmpty()) {
switch (value.at(0).toLatin1()) {
if (!value.isEmpty())
{
switch (value.toUpper().at(0).toLatin1())
{
case 'Y': return "Y";
case 'N': return "N";
case 'R': return "R";
Expand All @@ -680,9 +682,7 @@ QString AdiFormat::parseQslSent(const QString &value) {
default: return "N";
}
}
else {
return "N";
}
return "N";
}

QString AdiFormat::parseUploadStatus(const QString &value)
Expand All @@ -693,16 +693,13 @@ QString AdiFormat::parseUploadStatus(const QString &value)

if (!value.isEmpty())
{
switch (value.at(0).toLatin1())
switch (value.toUpper().at(0).toLatin1())
{
case 'Y': return "Y";
case 'N': return "N";
case 'M': return "M";
default: return "N";
default: QString();
}
}
else
{
return "N";
}
return QString();
}
2 changes: 1 addition & 1 deletion ui/ClublogDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void ClublogDialog::upload()
" rst_sent, rst_rcvd, notes, "
" gridsquare, vucc_grids, sat_name ";
QString query_from = "FROM contacts ";
QString query_where = "WHERE (clublog_qso_upload_status <> 'Y' OR clublog_qso_upload_status is NULL) ";
QString query_where = "WHERE (clublog_qso_upload_status = 'M' OR clublog_qso_upload_status is NULL) ";
QString query_order = " ORDER BY start_time ";

saveDialogState();
Expand Down
2 changes: 1 addition & 1 deletion ui/Eqsldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void EqslDialog::upload()
" sat_mode, sat_name, "
" my_cnty, my_gridsquare ";
QString query_from = "FROM contacts ";
QString query_where = "WHERE (eqsl_qsl_sent <> 'Y' OR eqsl_qsl_sent is NULL) ";
QString query_where = "WHERE (eqsl_qsl_sent in ('R', 'Q') OR eqsl_qsl_sent is NULL) ";
QString query_order = " ORDER BY start_time ";

saveDialogState();
Expand Down
2 changes: 1 addition & 1 deletion ui/LotwDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void LotwDialog::upload() {
" rst_sent, rst_rcvd, my_state, my_cnty, "
" my_vucc_grids "
"FROM contacts ";
QString query_where = "WHERE (lotw_qsl_sent <> 'Y' OR lotw_qsl_sent is NULL) "
QString query_where = "WHERE (lotw_qsl_sent in ('R','Q') OR lotw_qsl_sent is NULL) "
" AND (prop_mode NOT IN ('INTERNET', 'RPT', 'ECH', 'IRL') OR prop_mode IS NULL) ";
QString query_order = " ORDER BY start_time ";

Expand Down
69 changes: 62 additions & 7 deletions ui/NewContactWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ NewContactWidget::NewContactWidget(QWidget *parent) :
ui->qslSentBox->addItem(tr("Queued"), QVariant("Q"));
ui->qslSentBox->addItem(tr("Ignored"), QVariant("I"));

/**************************/
/* QSL Send LoTW Combo Content */
/**************************/
/* do no use DEFINE_CONTACT_FIELDS_ENUMS for it because
* DEFINE_CONTACT_FIELDS_ENUMS has a different ordering.
* Ordering below is optimized for a new Contact Widget only
*/
ui->eQSLSentBox->addItem(tr("No"), QVariant("N"));
ui->eQSLSentBox->addItem(tr("Yes"), QVariant("Y"));
ui->eQSLSentBox->addItem(tr("Requested"), QVariant("R"));
ui->eQSLSentBox->addItem(tr("Queued"), QVariant("Q"));
ui->eQSLSentBox->addItem(tr("Ignored"), QVariant("I"));

/**************************/
/* QSL Send eQSL Combo Content */
/**************************/
/* do no use DEFINE_CONTACT_FIELDS_ENUMS for it because
* DEFINE_CONTACT_FIELDS_ENUMS has a different ordering.
* Ordering below is optimized for a new Contact Widget only
*/
ui->lotwQslSentBox->addItem(tr("No"), QVariant("N"));
ui->lotwQslSentBox->addItem(tr("Yes"), QVariant("Y"));
ui->lotwQslSentBox->addItem(tr("Requested"), QVariant("R"));
ui->lotwQslSentBox->addItem(tr("Queued"), QVariant("Q"));
ui->lotwQslSentBox->addItem(tr("Ignored"), QVariant("I"));

/*****************************/
/* QSL SendVia Combo Content */
/*****************************/
Expand Down Expand Up @@ -274,6 +300,17 @@ NewContactWidget::NewContactWidget(QWidget *parent) :
connectFieldChanged();
}

void NewContactWidget::setComboBaseData(QComboBox *combo, const QString &data)
{
FCT_IDENTIFICATION;

int index = combo->findData(data);
if ( index != -1 )
{
combo->setCurrentIndex(index);
}
}

void NewContactWidget::readWidgetSettings()
{
FCT_IDENTIFICATION;
Expand All @@ -284,11 +321,17 @@ void NewContactWidget::readWidgetSettings()
realRigFreq = settings.value("newcontact/frequency", 3.5).toDouble();
double power = settings.value("newcontact/power", 100).toDouble();
int tabIndex = settings.value("newcontact/tabindex", 0).toInt();
QString qslSent = settings.value("newcontact/qslsent", "Q").toString();
QString eqslQslSent = settings.value("newcontact/eqslqslsent", "Q").toString();
QString lotwQslSent = settings.value("newcontact/lotwqslsent", "Q").toString();

ui->modeEdit->setCurrentText(mode);
ui->submodeEdit->setCurrentText(submode);
ui->powerEdit->setValue(power);
ui->tabWidget_2->setCurrentIndex(tabIndex);
setComboBaseData(ui->qslSentBox, qslSent);
setComboBaseData(ui->lotwQslSentBox, lotwQslSent);
setComboBaseData(ui->eQSLSentBox, eqslQslSent);
}

void NewContactWidget::writeWidgetSetting()
Expand All @@ -301,6 +344,9 @@ void NewContactWidget::writeWidgetSetting()
settings.setValue("newcontact/frequency", realRigFreq);
settings.setValue("newcontact/power", ui->powerEdit->value());
settings.setValue("newcontact/tabindex", ui->tabWidget_2->currentIndex());
settings.setValue("newcontact/qslsent", ui->qslSentBox->itemData(ui->qslSentBox->currentIndex()));
settings.setValue("newcontact/eqslqslsent", ui->eQSLSentBox->itemData(ui->eQSLSentBox->currentIndex()));
settings.setValue("newcontact/eqslqslsent", ui->lotwQslSentBox->itemData(ui->lotwQslSentBox->currentIndex()));
}

/* function read global setting, called when starting or when Setting is reloaded */
Expand Down Expand Up @@ -879,7 +925,6 @@ void NewContactWidget::resetContact()
ui->distanceInfo->clear();
ui->bearingInfo->clear();
ui->partnerLocTimeInfo->clear();
ui->qslSentBox->setCurrentIndex(0);
ui->qslSentViaBox->setCurrentIndex(0);
ui->cqEdit->clear();
ui->ituEdit->clear();
Expand Down Expand Up @@ -926,14 +971,19 @@ void NewContactWidget::addAddlFields(QSqlRecord &record, const StationProfile &p
record.setValue("qsl_sent", ui->qslSentBox->itemData(ui->qslSentBox->currentIndex()));
}

if ( record.value("lotw_qsl_sent").toString().isEmpty() )
{
record.setValue("lotw_qsl_sent", ui->lotwQslSentBox->itemData(ui->lotwQslSentBox->currentIndex()));
}

if ( record.value("eqsl_qsl_sent").toString().isEmpty() )
{
record.setValue("eqsl_qsl_sent", ui->eQSLSentBox->itemData(ui->eQSLSentBox->currentIndex()));
}

record.setValue("qsl_rcvd", "N");
record.setValue("lotw_qsl_sent", "N");
record.setValue("lotw_qsl_rcvd", "N");
record.setValue("eqsl_qsl_rcvd", "N");
record.setValue("eqsl_qsl_sent", "N");
record.setValue("hrdlog_qso_upload_status", "N");
record.setValue("qrzcom_qsoupload_status", "N");
record.setValue("clublog_qso_upload_status", "N");

/* isNull is not necessary to use because NULL Text fields are empty */
if ( record.value("my_gridsquare").toString().isEmpty()
Expand Down Expand Up @@ -1304,6 +1354,12 @@ void NewContactWidget::connectFieldChanged()
connect(ui->qslSentBox, &QComboBox::currentTextChanged,
this, &NewContactWidget::formFieldChangedString);

connect(ui->lotwQslSentBox, &QComboBox::currentTextChanged,
this, &NewContactWidget::formFieldChangedString);

connect(ui->eQSLSentBox, &QComboBox::currentTextChanged,
this, &NewContactWidget::formFieldChangedString);

connect(ui->qslSentViaBox, &QComboBox::currentTextChanged,
this, &NewContactWidget::formFieldChangedString);

Expand Down Expand Up @@ -1443,7 +1499,6 @@ void NewContactWidget::saveContact()
record.setValue("sig_info_intl", ui->sigInfoEdit->text());
}

record.setValue("qsl_sent", ui->qslSentBox->itemData(ui->qslSentBox->currentIndex()));

if ( ! ui->qslSentViaBox->currentText().isEmpty() )
{
Expand Down
2 changes: 2 additions & 0 deletions ui/NewContactWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <QWidget>
#include <QSqlRecord>
#include <QCompleter>
#include <QComboBox>
#include "data/Data.h"
#include "core/Gridsquare.h"
#include "data/DxSpot.h"
Expand Down Expand Up @@ -135,6 +136,7 @@ private slots:
void changeCallsignManually(const QString &, double);
void __changeFrequency(VFOID, double vfoFreq, double ritFreq, double xitFreq);
void showRXTXFreqs(bool);
void setComboBaseData(QComboBox *, const QString &);

private:
Rig* rig;
Expand Down
Loading

0 comments on commit 11f821b

Please sign in to comment.