Adapt brach to changes proposed by G4WJS

This commit is contained in:
phl0
2020-06-27 00:17:03 +02:00
committed by Bill Somerville
parent 6cbc91b653
commit 2a31d12d39
8 changed files with 118 additions and 279 deletions
+50 -167
View File
@@ -15,6 +15,37 @@
#include "ui_logqso.h"
#include "moc_logqso.cpp"
namespace
{
struct PropMode
{
char const * id_;
char const * name_;
};
constexpr PropMode prop_modes[] =
{
{"", ""}
, {"AS", QT_TRANSLATE_NOOP ("LogQSO", "Aircraft scatter")}
, {"AUE", QT_TRANSLATE_NOOP ("LogQSO", "Aurora-E")}
, {"AUR", QT_TRANSLATE_NOOP ("LogQSO", "Aurora")}
, {"BS", QT_TRANSLATE_NOOP ("LogQSO", "Back scatter")}
, {"ECH", QT_TRANSLATE_NOOP ("LogQSO", "Echolink")}
, {"EME", QT_TRANSLATE_NOOP ("LogQSO", "Earth-moon-earth")}
, {"ES", QT_TRANSLATE_NOOP ("LogQSO", "Sporadic E")}
, {"F2", QT_TRANSLATE_NOOP ("LogQSO", "F2 Reflection")}
, {"FAI", QT_TRANSLATE_NOOP ("LogQSO", "Field aligned irregularities")}
, {"INTERNET", QT_TRANSLATE_NOOP ("LogQSO", "Internet-assisted")}
, {"ION", QT_TRANSLATE_NOOP ("LogQSO", "Ionoscatter")}
, {"IRL", QT_TRANSLATE_NOOP ("LogQSO", "IRLP")}
, {"MS", QT_TRANSLATE_NOOP ("LogQSO", "Meteor scatter")}
, {"RPT", QT_TRANSLATE_NOOP ("LogQSO", "Non-satellite repeater or transponder")}
, {"RS", QT_TRANSLATE_NOOP ("LogQSO", "Rain scatter")}
, {"SAT", QT_TRANSLATE_NOOP ("LogQSO", "Satellite")}
, {"TEP", QT_TRANSLATE_NOOP ("LogQSO", "Trans-equatorial")}
, {"TR", QT_TRANSLATE_NOOP ("LogQSO", "Troposheric ducting")}
};
}
LogQSO::LogQSO(QString const& programTitle, QSettings * settings
, Configuration const * config, LogBook * log, QWidget *parent)
: QDialog {parent, Qt::WindowStaysOnTopHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint}
@@ -25,6 +56,10 @@ LogQSO::LogQSO(QString const& programTitle, QSettings * settings
{
ui->setupUi(this);
setWindowTitle(programTitle + " - Log QSO");
for (auto const& prop_mode : prop_modes)
{
ui->comboBoxPropMode->addItem (prop_mode.name_, prop_mode.id_);
}
loadSettings ();
ui->grid->setValidator (new MaidenheadLocatorValidator {this});
}
@@ -42,7 +77,12 @@ void LogQSO::loadSettings ()
ui->cbPropMode->setChecked (m_settings->value ("SavePropMode", false).toBool ());
m_txPower = m_settings->value ("TxPower", "").toString ();
m_comments = m_settings->value ("LogComments", "").toString();
m_propmode = m_settings->value ("PropMode", "").toString();
int prop_index {0};
if (ui->cbPropMode->isChecked ())
{
prop_index = ui->comboBoxPropMode->findData (m_settings->value ("PropMode", "").toString());
}
ui->comboBoxPropMode->setCurrentIndex (prop_index);
m_settings->endGroup ();
}
@@ -55,65 +95,7 @@ void LogQSO::storeSettings () const
m_settings->setValue ("SavePropMode", ui->cbPropMode->isChecked ());
m_settings->setValue ("TxPower", m_txPower);
m_settings->setValue ("LogComments", m_comments);
switch (ui->comboBoxPropMode->currentIndex()) {
case 0:
m_settings->setValue ("PropMode", "");
break;
case 1:
m_settings->setValue ("PropMode", "AS");
break;
case 2:
m_settings->setValue ("PropMode", "AUE");
break;
case 3:
m_settings->setValue ("PropMode", "AUR");
break;
case 4:
m_settings->setValue ("PropMode", "BS");
break;
case 5:
m_settings->setValue ("PropMode", "ECH");
break;
case 6:
m_settings->setValue ("PropMode", "EME");
break;
case 7:
m_settings->setValue ("PropMode", "ES");
break;
case 8:
m_settings->setValue ("PropMode", "F2");
break;
case 9:
m_settings->setValue ("PropMode", "FAI");
break;
case 10:
m_settings->setValue ("PropMode", "INTERNET");
break;
case 11:
m_settings->setValue ("PropMode", "ION");
break;
case 12:
m_settings->setValue ("PropMode", "IRL");
break;
case 13:
m_settings->setValue ("PropMode", "MS");
break;
case 14:
m_settings->setValue ("PropMode", "RPT");
break;
case 15:
m_settings->setValue ("PropMode", "RS");
break;
case 16:
m_settings->setValue ("PropMode", "SAT");
break;
case 17:
m_settings->setValue ("PropMode", "TEP");
break;
case 18:
m_settings->setValue ("PropMode", "TR");
break;
}
m_settings->setValue ("PropMode", ui->comboBoxPropMode->currentData ());
m_settings->endGroup ();
}
@@ -142,51 +124,6 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
{
ui->comments->clear ();
}
if (ui->cbPropMode->isChecked ())
{
if (m_propmode == "")
ui->comboBoxPropMode->setCurrentIndex(0);
if (m_propmode == "AS")
ui->comboBoxPropMode->setCurrentIndex(1);
if (m_propmode == "AUE")
ui->comboBoxPropMode->setCurrentIndex(2);
if (m_propmode == "AUR")
ui->comboBoxPropMode->setCurrentIndex(3);
if (m_propmode == "BS")
ui->comboBoxPropMode->setCurrentIndex(4);
if (m_propmode == "ECH")
ui->comboBoxPropMode->setCurrentIndex(5);
if (m_propmode == "EME")
ui->comboBoxPropMode->setCurrentIndex(6);
if (m_propmode == "ES")
ui->comboBoxPropMode->setCurrentIndex(7);
if (m_propmode == "F2")
ui->comboBoxPropMode->setCurrentIndex(8);
if (m_propmode == "FAI")
ui->comboBoxPropMode->setCurrentIndex(9);
if (m_propmode == "INTERNET")
ui->comboBoxPropMode->setCurrentIndex(10);
if (m_propmode == "ION")
ui->comboBoxPropMode->setCurrentIndex(11);
if (m_propmode == "IRL")
ui->comboBoxPropMode->setCurrentIndex(12);
if (m_propmode == "MS")
ui->comboBoxPropMode->setCurrentIndex(13);
if (m_propmode == "RPT")
ui->comboBoxPropMode->setCurrentIndex(14);
if (m_propmode == "RS")
ui->comboBoxPropMode->setCurrentIndex(15);
if (m_propmode == "SAT")
ui->comboBoxPropMode->setCurrentIndex(16);
if (m_propmode == "TEP")
ui->comboBoxPropMode->setCurrentIndex(17);
if (m_propmode == "TR")
ui->comboBoxPropMode->setCurrentIndex(18);
}
else
{
ui->comboBoxPropMode->setCurrentIndex(0);
}
if (m_config->report_in_comments()) {
auto t=mode;
if(rptSent!="") t+=" Sent: " + rptSent;
@@ -207,6 +144,10 @@ void LogQSO::initLogQSO(QString const& hisCall, QString const& hisGrid, QString
ui->loggedOperator->setText(m_config->opCall());
ui->exchSent->setText (xSent);
ui->exchRcvd->setText (xRcvd);
if (!ui->cbPropMode->isChecked ())
{
ui->comboBoxPropMode->setCurrentIndex (-1);
}
using SpOp = Configuration::SpecialOperatingActivity;
auto special_op = m_config->special_op_id ();
@@ -240,65 +181,6 @@ void LogQSO::accept()
auto operator_call = ui->loggedOperator->text ();
auto xsent = ui->exchSent->text ();
auto xrcvd = ui->exchRcvd->text ();
switch (ui->comboBoxPropMode->currentIndex()) {
case 0:
m_propmode = "";
break;
case 1:
m_propmode = "AS";
break;
case 2:
m_propmode = "AUE";
break;
case 3:
m_propmode = "AUR";
break;
case 4:
m_propmode = "BS";
break;
case 5:
m_propmode = "ECH";
break;
case 6:
m_propmode = "EME";
break;
case 7:
m_propmode = "ES";
break;
case 8:
m_propmode = "F2";
break;
case 9:
m_propmode = "FAI";
break;
case 10:
m_propmode = "INTERNET";
break;
case 11:
m_propmode = "ION";
break;
case 12:
m_propmode = "IRL";
break;
case 13:
m_propmode = "MS";
break;
case 14:
m_propmode = "RPT";
break;
case 15:
m_propmode = "RS";
break;
case 16:
m_propmode = "SAT";
break;
case 17:
m_propmode = "TEP";
break;
case 18:
m_propmode = "TR";
break;
}
using SpOp = Configuration::SpecialOperatingActivity;
auto special_op = m_config->special_op_id ();
@@ -344,6 +226,7 @@ void LogQSO::accept()
}
}
auto const& prop_mode = ui->comboBoxPropMode->currentData ().toString ();
//Log this QSO to file "wsjtx.log"
static QFile f {QDir {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}.absoluteFilePath ("wsjtx.log")};
if(!f.open(QIODevice::Text | QIODevice::Append)) {
@@ -357,7 +240,7 @@ void LogQSO::accept()
dateTimeOff.time().toString("hh:mm:ss,") + hisCall + "," +
hisGrid + "," + strDialFreq + "," + mode +
"," + rptSent + "," + rptRcvd + "," + m_txPower +
"," + m_comments + "," + name + "," + m_propmode;
"," + m_comments + "," + name + "," + prop_mode;
QTextStream out(&f);
out << logEntry <<
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
@@ -386,7 +269,7 @@ void LogQSO::accept()
, m_myGrid
, xsent
, xrcvd
, m_propmode
, prop_mode
, m_log->QSOToADIF (hisCall
, hisGrid
, mode
@@ -404,7 +287,7 @@ void LogQSO::accept()
, operator_call
, xsent
, xrcvd
, m_propmode));
, prop_mode));
QDialog::accept();
}