Validate contest QSO details before allowing logging

Basic  validation, must  have  non-empty exchange  sent and  received.
Abstracted log view window widget  behaviour into a base class. Turned
on  auto  resize  to  row  height in  log  view  windows  and  enabled
alternating colours. Convert  empty fields to NULL  when inserting new
log table  rows to signify missing  data. Trap insert row  errors when
adding  to contest  log table  so  that logging  can be  held back  if
constraints are not met. Re-factored  log QSO processing to try insert
row into log table  first and pop up a message  box if constraints are
not met, this pops  up the Log QSO window in case  it was initiated by
an auto log event.
This commit is contained in:
Bill Somerville
2018-11-23 01:18:39 +00:00
parent a488c64e43
commit c81b3c8e65
16 changed files with 349 additions and 207 deletions
+24 -16
View File
@@ -1228,10 +1228,10 @@ void MainWindow::setDecodedTextFont (QFont const& font)
m_msgAvgWidget->changeFont (font);
}
if (m_foxLogWindow) {
m_foxLogWindow->change_font (font);
m_foxLogWindow->set_log_view_font (font);
}
if (m_contestLogWindow) {
m_contestLogWindow->change_font (font);
m_contestLogWindow->set_log_view_font (font);
}
updateGeometry ();
}
@@ -5331,9 +5331,16 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button
default: break;
}
using SpOp = Configuration::SpecialOperatingActivity;
auto special_op = m_config.special_op_id ();
if (SpecOp::NONE < special_op && special_op < SpecOp::FOX)
{
if (!m_cabrilloLog) m_cabrilloLog.reset (new CabrilloLog {&m_config});
}
m_logDlg->initLogQSO (m_hisCall, grid, m_modeTx, m_rptSent, m_rptRcvd,
m_dateTimeQSOOn, dateTimeQSOOff, m_freqNominal +
ui->TxFreqSpinBox->value(), m_noSuffix, m_xSent, m_xRcvd);
ui->TxFreqSpinBox->value(), m_noSuffix, m_xSent, m_xRcvd,
m_cabrilloLog.data ());
}
void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
@@ -5350,15 +5357,6 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
tr ("Cannot open \"%1\"").arg (m_logBook.path ()));
}
if (SpecOp::NONE < m_config.special_op_id() && SpecOp::FOX > m_config.special_op_id()) {
if (!m_cabrilloLog) m_cabrilloLog.reset (new CabrilloLog {&m_config});
m_cabrilloLog->add_QSO (m_freqNominal, QDateTime::currentDateTimeUtc (), m_hisCall, m_xSent, m_xRcvd);
m_xSent="";
m_xRcvd="";
ui->sbSerialNumber->setValue (ui->sbSerialNumber->value () + 1);
}
m_messageClient->qso_logged (QSO_date_off, call, grid, dial_freq, mode, rpt_sent, rpt_received
, tx_power, comments, name, QSO_date_on, operator_call, my_call, my_grid);
m_messageClient->logged_ADIF (ADIF);
@@ -5378,6 +5376,15 @@ void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call,
if (m_config.clear_DX () and SpecOp::HOUND != m_config.special_op_id()) clearDX ();
m_dateTimeQSOOn = QDateTime {};
using SpOp = Configuration::SpecialOperatingActivity;
auto special_op = m_config.special_op_id ();
if (SpecOp::NONE < special_op && special_op < SpecOp::FOX)
{
ui->sbSerialNumber->setValue (ui->sbSerialNumber->value () + 1);
}
m_xSent.clear ();
m_xRcvd.clear ();
}
qint64 MainWindow::nWidgets(QString t)
@@ -6125,11 +6132,12 @@ void MainWindow::on_reset_fox_log_action_triggered ()
void MainWindow::on_reset_cabrillo_log_action_triggered ()
{
if (MessageBox::Yes == MessageBox::query_message(this, tr("Confirm Erase"),
tr("Are you sure you want to erase file cabrillo.log"
" and start a new Cabrillo log?")))
if (MessageBox::Yes == MessageBox::query_message (this, tr ("Confirm Reset"),
tr ("Are you sure you want to erase your contest log?"),
tr ("Doing this will remove all QSO records for the current contest. "
"They will be kept in the ADIF log file but will not be available "
"for export in your Cabrillo log.")))
{
QFile {m_config.writeable_data_dir ().absoluteFilePath ("cabrillo.log")}.remove ();
ui->sbSerialNumber->setValue (1);
if (!m_cabrilloLog) m_cabrilloLog.reset (new CabrilloLog {&m_config});
m_cabrilloLog->reset ();