Add new CabrilloLogWindow widget and integrate it into the application

This commit is contained in:
Bill Somerville 2018-11-12 04:44:03 +00:00
parent df4dbd546b
commit 3b26b40d81
6 changed files with 271 additions and 266 deletions

View File

@ -1,126 +1,110 @@
#include "ExportCabrillo.h"
#include "SettingsGroup.hpp"
#include "MessageBox.hpp"
#include <QApplication>
#include <QDebug>
#include <QFileDialog>
#include <QDir>
#include <QDebug>
#include "SettingsGroup.hpp"
#include "Configuration.hpp"
#include "MessageBox.hpp"
#include "models/CabrilloLog.hpp"
#include "ui_ExportCabrillo.h"
#include "moc_ExportCabrillo.cpp"
ExportCabrillo::ExportCabrillo(QSettings *settings, QWidget *parent) :
QDialog(parent),
ExportCabrillo::ExportCabrillo (QSettings * settings, Configuration const * configuration
, CabrilloLog const * log, QWidget * parent)
: QDialog {parent},
settings_ {settings},
ui(new Ui::ExportCabrillo)
configuration_ {configuration},
log_ {log},
ui {new Ui::ExportCabrillo}
{
ui->setupUi(this);
read_settings();
setWindowTitle(QApplication::applicationName() + " - Export Cabrillo");
ui->setupUi (this);
read_settings ();
setWindowTitle (QApplication::applicationName() + " - Export Cabrillo");
connect (ui->buttonBox, &QDialogButtonBox::accepted, this, &ExportCabrillo::save_log);
}
ExportCabrillo::~ExportCabrillo()
ExportCabrillo::~ExportCabrillo ()
{
if(isVisible()) write_settings();
delete ui;
write_settings ();
}
void ExportCabrillo::closeEvent (QCloseEvent * e)
{
write_settings();
QWidget::closeEvent(e);
}
void ExportCabrillo::read_settings ()
{
SettingsGroup group {settings_, "ExportCabrillo"};
restoreGeometry (settings_->value("window/geometry").toByteArray());
ui->lineEdit_1->setText(settings_->value("Location").toString());
ui->lineEdit_2->setText(settings_->value("Contest").toString());
ui->lineEdit_3->setText(settings_->value("Callsign").toString());
ui->lineEdit_4->setText(settings_->value("Category-Operator").toString());
ui->lineEdit_5->setText(settings_->value("Category-Transmitter").toString());
ui->lineEdit_6->setText(settings_->value("Category-Power").toString());
ui->lineEdit_7->setText(settings_->value("Category-Assisted").toString());
ui->lineEdit_8->setText(settings_->value("Category-Band").toString());
ui->lineEdit_9->setText(settings_->value("Claimed-Score").toString());
ui->lineEdit_10->setText(settings_->value("Operators").toString());
ui->lineEdit_11->setText(settings_->value("Club").toString());
ui->lineEdit_12->setText(settings_->value("Name").toString());
ui->lineEdit_13->setText(settings_->value("Address1").toString());
ui->lineEdit_14->setText(settings_->value("Address2").toString());
ui->location_line_edit->setText(settings_->value("Location").toString());
ui->contest_line_edit->setText(settings_->value("Contest").toString());
ui->call_line_edit->setText(settings_->value("Callsign").toString());
ui->category_op_line_edit->setText(settings_->value("Category-Operator").toString());
ui->category_xmtr_line_edit->setText(settings_->value("Category-Transmitter").toString());
ui->category_pwr_line_edit->setText(settings_->value("Category-Power").toString());
ui->category_assisted_line_edit->setText(settings_->value("Category-Assisted").toString());
ui->category_band_line_edit->setText(settings_->value("Category-Band").toString());
ui->claimed_line_edit->setText(settings_->value("Claimed-Score").toString());
ui->operators_line_edit->setText(settings_->value("Operators").toString());
ui->club_line_edit->setText(settings_->value("Club").toString());
ui->name_line_edit->setText(settings_->value("Name").toString());
ui->addr_1_line_edit->setText(settings_->value("Address1").toString());
ui->addr_2_line_edit->setText(settings_->value("Address2").toString());
}
void ExportCabrillo::write_settings ()
{
SettingsGroup group {settings_, "ExportCabrillo"};
settings_->setValue ("window/geometry", saveGeometry ());
settings_->setValue("Location",ui->lineEdit_1->text());
settings_->setValue("Contest",ui->lineEdit_2->text());
settings_->setValue("Callsign",ui->lineEdit_3->text());
settings_->setValue("Category-Operator",ui->lineEdit_4->text());
settings_->setValue("Category-Transmitter",ui->lineEdit_5->text());
settings_->setValue("Category-Power",ui->lineEdit_6->text());
settings_->setValue("Category-Assisted",ui->lineEdit_7->text());
settings_->setValue("Category-Band",ui->lineEdit_8->text());
settings_->setValue("Claimed-Score",ui->lineEdit_9->text());
settings_->setValue("Operators",ui->lineEdit_10->text());
settings_->setValue("Club",ui->lineEdit_11->text());
settings_->setValue("Name",ui->lineEdit_12->text());
settings_->setValue("Address1",ui->lineEdit_13->text());
settings_->setValue("Address2",ui->lineEdit_14->text());
settings_->setValue("Location",ui->location_line_edit->text());
settings_->setValue("Contest",ui->contest_line_edit->text());
settings_->setValue("Callsign",ui->call_line_edit->text());
settings_->setValue("Category-Operator",ui->category_op_line_edit->text());
settings_->setValue("Category-Transmitter",ui->category_xmtr_line_edit->text());
settings_->setValue("Category-Power",ui->category_pwr_line_edit->text());
settings_->setValue("Category-Assisted",ui->category_assisted_line_edit->text());
settings_->setValue("Category-Band",ui->category_band_line_edit->text());
settings_->setValue("Claimed-Score",ui->claimed_line_edit->text());
settings_->setValue("Operators",ui->operators_line_edit->text());
settings_->setValue("Club",ui->club_line_edit->text());
settings_->setValue("Name",ui->name_line_edit->text());
settings_->setValue("Address1",ui->addr_1_line_edit->text());
settings_->setValue("Address2",ui->addr_2_line_edit->text());
}
void ExportCabrillo::setFile(QString t)
void ExportCabrillo::save_log ()
{
m_CabLog=t;
}
void ExportCabrillo::on_pbSaveAs_clicked()
{
QString fname;
QFileDialog saveAs(this);
saveAs.setFileMode(QFileDialog::AnyFile);
fname=saveAs.getSaveFileName(this, "Save File", "","Cabrillo Log (*.log)");
auto fname = QFileDialog::getSaveFileName (this
, tr ("Save Log File")
, configuration_->writeable_data_dir ().absolutePath ()
, tr ("Cabrillo Log (*.log)"));
if (fname.size ())
{
QFile f {fname};
if (f.open(QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out(&f);
out << "START-OF-LOG:3.0" << endl
<< "LOCATION: " << ui->lineEdit_1->text() << endl
<< "CONTEST: " << ui->lineEdit_2->text() << endl
<< "CALLSIGN: " << ui->lineEdit_3->text() << endl
<< "CATEGORY-OPERATOR: " << ui->lineEdit_4->text() << endl
<< "CATEGORY-TRANSMITTER: " << ui->lineEdit_5->text() << endl
<< "CATEGORY-POWER: " << ui->lineEdit_6->text() << endl
<< "CATEGORY-ASSISTED: " << ui->lineEdit_7->text() << endl
<< "CATEGORY-BAND: " << ui->lineEdit_8->text() << endl
<< "CLAIMED-SCORE: " << ui->lineEdit_9->text() << endl
<< "OPERATORS: " << ui->lineEdit_10->text() << endl
<< "CLUB: " << ui->lineEdit_11->text() << endl
<< "NAME: " << ui->lineEdit_12->text() << endl
<< "ADDRESS: " << ui->lineEdit_13->text() << endl
<< "ADDRESS: " << ui->lineEdit_14->text() << endl;
QFile f2(m_CabLog);
if(f2.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream s(&f2);
QString t=s.readAll();
out << t << "END-OF-LOG:" << endl;
f2.close();
}
f.close();
if (f.open (QIODevice::WriteOnly | QIODevice::Text)) {
QTextStream out {&f};
out << "START-OF-LOG:3.0\n"
<< "LOCATION: " << ui->location_line_edit->text() << '\n'
<< "CONTEST: " << ui->contest_line_edit->text() << '\n'
<< "CALLSIGN: " << ui->call_line_edit->text() << '\n'
<< "CATEGORY-OPERATOR: " << ui->category_op_line_edit->text() << '\n'
<< "CATEGORY-TRANSMITTER: " << ui->category_xmtr_line_edit->text() << '\n'
<< "CATEGORY-POWER: " << ui->category_pwr_line_edit->text() << '\n'
<< "CATEGORY-ASSISTED: " << ui->category_assisted_line_edit->text() << '\n'
<< "CATEGORY-BAND: " << ui->category_band_line_edit->text() << '\n'
<< "CLAIMED-SCORE: " << ui->claimed_line_edit->text() << '\n'
<< "OPERATORS: " << ui->operators_line_edit->text() << '\n'
<< "CLUB: " << ui->club_line_edit->text() << '\n'
<< "NAME: " << ui->name_line_edit->text() << '\n'
<< "ADDRESS: " << ui->addr_1_line_edit->text() << '\n'
<< "ADDRESS: " << ui->addr_2_line_edit->text() << '\n';
if (log_) log_->export_qsos (out);
out << "END-OF-LOG:" << endl;
return;
} else {
auto const& message = tr ("Cannot open \"%1\" for writing: %2")
.arg (f.fileName ()).arg (f.errorString ());
MessageBox::warning_message (this, tr ("Export Cabrillo File Error"), message);
}
write_settings();
}
void ExportCabrillo::accept()
{
write_settings();
QDialog::accept();
}
setResult (Rejected);
}

View File

@ -1,37 +1,34 @@
// -*- Mode: C++ -*-
#ifndef EXPORTCABRILLO_H
#define EXPORTCABRILLO_H
#include <QDialog>
#include <QSettings>
#include <QScopedPointer>
class QSettings;
class Configuration;
class CabrilloLog;
namespace Ui {
class ExportCabrillo;
class ExportCabrillo;
}
class ExportCabrillo : public QDialog
class ExportCabrillo final
: public QDialog
{
Q_OBJECT
public:
explicit ExportCabrillo(QSettings *settings, QWidget *parent = 0);
void setFile(QString t);
~ExportCabrillo();
public slots:
void accept();
protected:
void closeEvent (QCloseEvent *) override;
private slots:
void on_pbSaveAs_clicked();
explicit ExportCabrillo (QSettings *, Configuration const *
, CabrilloLog const *, QWidget * parent = nullptr);
~ExportCabrillo ();
private:
QSettings * settings_;
QString m_CabLog;
void read_settings();
void write_settings();
Ui::ExportCabrillo *ui;
void save_log ();
QSettings * settings_;
Configuration const * configuration_;
CabrilloLog const * log_;
QScopedPointer<Ui::ExportCabrillo> ui;
};
#endif // EXPORTCABRILLO_H
#endif

View File

@ -2,29 +2,24 @@
<ui version="4.0">
<class>ExportCabrillo</class>
<widget class="QDialog" name="ExportCabrillo">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>330</width>
<height>407</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_1">
<widget class="QLabel" name="location_label">
<property name="text">
<string>Location:</string>
</property>
<property name="buddy">
<cstring>location_line_edit</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_1">
<widget class="QLineEdit" name="location_line_edit">
<property name="text">
<string>SNJ</string>
</property>
@ -34,14 +29,17 @@
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="contest_label">
<property name="text">
<string>Contest:</string>
</property>
<property name="buddy">
<cstring>contest_line_edit</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEdit_2">
<widget class="QLineEdit" name="contest_line_edit">
<property name="text">
<string>ARRL-RTTY</string>
</property>
@ -51,14 +49,17 @@
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="call_label">
<property name="text">
<string>Callsign:</string>
</property>
<property name="buddy">
<cstring>call_line_edit</cstring>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEdit_3">
<widget class="QLineEdit" name="call_line_edit">
<property name="text">
<string/>
</property>
@ -68,14 +69,17 @@
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_4">
<widget class="QLabel" name="category_op_label">
<property name="text">
<string>Category-Operator: </string>
</property>
<property name="buddy">
<cstring>category_op_line_edit</cstring>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="lineEdit_4">
<widget class="QLineEdit" name="category_op_line_edit">
<property name="text">
<string>SINGLE-OP</string>
</property>
@ -85,14 +89,17 @@
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_5">
<widget class="QLabel" name="category_xmtr_label">
<property name="text">
<string>Category-Transmitter:</string>
</property>
<property name="buddy">
<cstring>category_xmtr_line_edit</cstring>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="lineEdit_5">
<widget class="QLineEdit" name="category_xmtr_line_edit">
<property name="text">
<string>ONE</string>
</property>
@ -102,14 +109,17 @@
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_6">
<widget class="QLabel" name="category_pwr_label">
<property name="text">
<string>Category-Power:</string>
</property>
<property name="buddy">
<cstring>category_pwr_line_edit</cstring>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="lineEdit_6">
<widget class="QLineEdit" name="category_pwr_line_edit">
<property name="text">
<string>LOW</string>
</property>
@ -119,14 +129,17 @@
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_7">
<widget class="QLabel" name="category_assisted_label">
<property name="text">
<string>Category-Assisted:</string>
</property>
<property name="buddy">
<cstring>category_assisted_line_edit</cstring>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QLineEdit" name="lineEdit_7">
<widget class="QLineEdit" name="category_assisted_line_edit">
<property name="text">
<string>NON-ASSISTED</string>
</property>
@ -136,14 +149,17 @@
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_8">
<widget class="QLabel" name="category_band_label">
<property name="text">
<string>Category-Band:</string>
</property>
<property name="buddy">
<cstring>category_band_line_edit</cstring>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QLineEdit" name="lineEdit_8">
<widget class="QLineEdit" name="category_band_line_edit">
<property name="text">
<string>ALL</string>
</property>
@ -153,14 +169,17 @@
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_9">
<widget class="QLabel" name="claimed_label">
<property name="text">
<string>Claimed-Score:</string>
</property>
<property name="buddy">
<cstring>claimed_line_edit</cstring>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="lineEdit_9">
<widget class="QLineEdit" name="claimed_line_edit">
<property name="text">
<string/>
</property>
@ -170,14 +189,17 @@
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_10">
<widget class="QLabel" name="operators_label">
<property name="text">
<string>Operators:</string>
</property>
<property name="buddy">
<cstring>operators_line_edit</cstring>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="lineEdit_10">
<widget class="QLineEdit" name="operators_line_edit">
<property name="text">
<string/>
</property>
@ -187,28 +209,34 @@
</widget>
</item>
<item row="10" column="0">
<widget class="QLabel" name="label_11">
<widget class="QLabel" name="club_label">
<property name="text">
<string>Club:</string>
</property>
<property name="buddy">
<cstring>club_line_edit</cstring>
</property>
</widget>
</item>
<item row="10" column="1">
<widget class="QLineEdit" name="lineEdit_11">
<widget class="QLineEdit" name="club_line_edit">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_12">
<widget class="QLabel" name="name_label">
<property name="text">
<string>Name:</string>
</property>
<property name="buddy">
<cstring>name_line_edit</cstring>
</property>
</widget>
</item>
<item row="11" column="1">
<widget class="QLineEdit" name="lineEdit_12">
<widget class="QLineEdit" name="name_line_edit">
<property name="text">
<string/>
</property>
@ -218,28 +246,34 @@
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_13">
<widget class="QLabel" name="addr_1_label">
<property name="text">
<string>Address:</string>
</property>
<property name="buddy">
<cstring>addr_1_line_edit</cstring>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLineEdit" name="lineEdit_13">
<widget class="QLineEdit" name="addr_1_line_edit">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="13" column="0">
<widget class="QLabel" name="label_14">
<widget class="QLabel" name="addr_2_label">
<property name="text">
<string>Address:</string>
</property>
<property name="buddy">
<cstring>addr_2_line_edit</cstring>
</property>
</widget>
</item>
<item row="13" column="1">
<widget class="QLineEdit" name="lineEdit_14">
<widget class="QLineEdit" name="addr_2_line_edit">
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
@ -247,20 +281,13 @@
</item>
</layout>
</item>
<item row="1" column="1">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pbSaveAs">
<property name="text">
<string>Save As</string>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
</property>
</widget>
</item>

View File

@ -64,8 +64,10 @@
#include "LotWUsers.hpp"
#include "logbook/AD1CCty.hpp"
#include "models/FoxLog.hpp"
#include "models/CabrilloLog.hpp"
#include "FoxLogWindow.hpp"
#include "CabrilloLogWindow.hpp"
#include "ExportCabrillo.h"
#include "ui_mainwindow.h"
#include "moc_mainwindow.cpp"
@ -1036,6 +1038,7 @@ void MainWindow::writeSettings()
m_settings->setValue ("AstroDisplayed", m_astroWidget && m_astroWidget->isVisible());
m_settings->setValue ("MsgAvgDisplayed", m_msgAvgWidget && m_msgAvgWidget->isVisible ());
m_settings->setValue ("FoxLogDisplayed", m_foxLogWindow && m_foxLogWindow->isVisible ());
m_settings->setValue ("ContestLogDisplayed", m_contestLogWindow && m_contestLogWindow->isVisible ());
m_settings->setValue ("FreeText", ui->freeTextMsg->currentText ());
m_settings->setValue("ShowMenus",ui->cbMenus->isChecked());
m_settings->setValue("CallFirst",ui->cbFirst->isChecked());
@ -1112,6 +1115,7 @@ void MainWindow::readSettings()
auto displayAstro = m_settings->value ("AstroDisplayed", false).toBool ();
auto displayMsgAvg = m_settings->value ("MsgAvgDisplayed", false).toBool ();
auto displayFoxLog = m_settings->value ("FoxLogDisplayed", false).toBool ();
auto displayContestLog = m_settings->value ("ContestLogDisplayed", false).toBool ();
if (m_settings->contains ("FreeText")) ui->freeTextMsg->setCurrentText (
m_settings->value ("FreeText").toString ());
ui->cbMenus->setChecked(m_settings->value("ShowMenus",true).toBool());
@ -1202,7 +1206,8 @@ void MainWindow::readSettings()
checkMSK144ContestType();
if(displayMsgAvg) on_actionMessage_averaging_triggered();
if (displayFoxLog) on_actionFox_Log_triggered ();
if (displayFoxLog) on_fox_log_action_triggered ();
if (displayContestLog) on_contest_log_action_triggered ();
}
void MainWindow::checkMSK144ContestType()
@ -1246,6 +1251,9 @@ void MainWindow::setDecodedTextFont (QFont const& font)
if (m_foxLogWindow) {
m_foxLogWindow->change_font (font);
}
if (m_contestLogWindow) {
m_contestLogWindow->change_font (font);
}
updateGeometry ();
}
@ -2424,12 +2432,9 @@ void MainWindow::on_actionAstronomical_data_toggled (bool checked)
}
}
void MainWindow::on_actionFox_Log_triggered()
void MainWindow::on_fox_log_action_triggered()
{
if (!m_foxLog)
{
m_foxLog.reset (new FoxLog);
}
if (!m_foxLog) m_foxLog.reset (new FoxLog);
if (!m_foxLogWindow)
{
m_foxLogWindow.reset (new FoxLogWindow {m_settings, &m_config, m_foxLog->model ()});
@ -2442,6 +2447,21 @@ void MainWindow::on_actionFox_Log_triggered()
m_foxLogWindow->activateWindow ();
}
void MainWindow::on_contest_log_action_triggered()
{
if (!m_cabrilloLog) m_cabrilloLog.reset (new CabrilloLog {&m_config});
if (!m_contestLogWindow)
{
m_contestLogWindow.reset (new CabrilloLogWindow {m_settings, &m_config, m_cabrilloLog->model ()});
// Connect signals from contest log window
connect (this, &MainWindow::finished, m_contestLogWindow.data (), &CabrilloLogWindow::close);
}
m_contestLogWindow->showNormal ();
m_contestLogWindow->raise ();
m_contestLogWindow->activateWindow ();
}
void MainWindow::on_actionColors_triggered()
{
if (!m_colorHighlighting)
@ -3791,10 +3811,6 @@ void MainWindow::guiUpdate()
if(nsec != m_sec0) {
// if((!m_msgAvgWidget or (m_msgAvgWidget and !m_msgAvgWidget->isVisible()))
// and (SpecOp::NONE < m_config.special_op_id()) and (SpecOp::HOUND > m_config.special_op_id())) on_actionFox_Log_triggered();
if (SpecOp::FOX == m_config.special_op_id() && (!m_foxLogWindow || !m_foxLogWindow->isVisible ()))
{
on_actionFox_Log_triggered();
}
if(m_freqNominal!=0 and m_freqNominal<50000000 and m_config.enable_VHF_features()) {
if(!m_bVHFwarned) vhfWarning();
} else {
@ -5336,41 +5352,6 @@ void MainWindow::on_logQSOButton_clicked() //Log QSO button
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);
if(SpecOp::NONE < m_config.special_op_id() and SpecOp::FOX > m_config.special_op_id()) {
int n=ui->sbSerialNumber->value();
ui->sbSerialNumber->setValue(n+1);
cabLog(); //Call the Cabrillo contest logger
}
}
void MainWindow::cabLog()
{
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("cabrillo.log")};
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
int nfreq=m_freqNominal/1000;
if(m_freqNominal>50000000) nfreq=m_freqNominal/1000000;
QString t;
t.sprintf("QSO: %5d DG ",nfreq);
t=t + QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hhmm ") +
m_config.my_callsign().leftJustified(13,' ') + m_xSent.leftJustified(14,' ') +
m_hisCall.leftJustified(13,' ') + m_xRcvd;
QTextStream out(&f);
out << t << endl;
f.close();
if(m_msgAvgWidget != NULL and m_msgAvgWidget->isVisible()) {
QString band;
band.sprintf(" %5d ",nfreq);
t=QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hhmm ") + band +
m_hisCall.leftJustified(13,' ') + m_xSent.leftJustified(14,' ') + m_xRcvd;
m_msgAvgWidget->contestAddLog((qint32) m_config.special_op_id(),t);
}
m_xSent="";
m_xRcvd="";
} else {
MessageBox::warning_message (this, tr("File Open Error"),
tr("Cannot open \"%1\" for append: %2").arg(f.fileName()).arg(f.errorString()));
}
}
void MainWindow::acceptQSO (QDateTime const& QSO_date_off, QString const& call, QString const& grid
@ -5387,6 +5368,15 @@ 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);
@ -5532,7 +5522,7 @@ void MainWindow::on_actionFT8_triggered()
ui->TxFreqSpinBox->setValue(300);
displayWidgets(nWidgets("111010000100111000010000000000100"));
ui->labDXped->setText("Fox");
on_actionFox_Log_triggered();
on_fox_log_action_triggered();
}
if(SpecOp::HOUND == m_config.special_op_id()) {
ui->txFirstCheckBox->setChecked(false);
@ -5565,6 +5555,7 @@ void MainWindow::on_actionFT8_triggered()
ui->labDXped->setVisible(true);
ui->labDXped->setText(t0);
}
on_contest_log_action_triggered();
}
if((SpecOp::FOX==m_config.special_op_id() or SpecOp::HOUND==m_config.special_op_id()) and !m_config.split_mode() and !m_bWarnedSplit) {
@ -6138,35 +6129,38 @@ void MainWindow::on_actionErase_ALL_TXT_triggered() //Erase ALL.TXT
}
}
void MainWindow::on_actionErase_FoxQSO_txt_triggered()
void MainWindow::on_reset_fox_log_action_triggered ()
{
int ret = MessageBox::query_message(this, tr("Confirm Erase"),
tr("Are you sure you want to erase file FoxQSO.txt?"));
int ret = MessageBox::query_message(this, tr("Confirm Reset"),
tr("Are you sure you want to erase file FoxQSO.txt and start a new Fox log?"));
if(ret==MessageBox::Yes) {
QFile f{m_config.writeable_data_dir().absoluteFilePath("FoxQSO.txt")};
f.remove();
ui->sbSerialNumber->setValue(1);
if (!m_foxLog) m_foxLog.reset (new FoxLog);
m_foxLog->reset ();
}
}
void MainWindow::on_actionErase_cabrillo_log_triggered()
void MainWindow::on_reset_cabrillo_log_action_triggered ()
{
int ret = MessageBox::query_message(this, tr("Confirm Erase"),
tr("Are you sure you want to erase file cabrillo.log?"));
if(ret==MessageBox::Yes) {
QFile f{m_config.writeable_data_dir().absoluteFilePath("cabrillo.log")};
f.remove();
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?")))
{
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 ();
}
}
void MainWindow::on_actionExport_Cabrillo_log_triggered()
{
if(!m_exportCabrillo) {
m_exportCabrillo.reset(new ExportCabrillo{m_settings});
if (!m_cabrilloLog) m_cabrilloLog.reset (new CabrilloLog {&m_config});
if (QDialog::Accepted == ExportCabrillo {m_settings, &m_config, m_cabrilloLog.data ()}.exec())
{
MessageBox::information_message (this, tr ("Cabrillo Log saved"));
}
QString CabLog=m_config.writeable_data_dir ().absoluteFilePath ("cabrillo.log");
m_exportCabrillo->setFile(CabLog);
m_exportCabrillo->exec();
}
@ -8061,10 +8055,7 @@ void MainWindow::houndCallers()
m_nHoundsCalling++; // Number of accepted Hounds to be sorted
}
}
if(m_foxLogWindow && m_foxLogWindow->isVisible ())
{
m_foxLogWindow->callers (nTotal);
}
if(m_foxLogWindow) m_foxLogWindow->callers (nTotal);
// Sort and display accumulated list of Hound callers
if(t.length()>30) {
@ -8225,10 +8216,8 @@ list2Done:
m_hisGrid=m_foxQSO[hc1].grid;
m_rptSent=m_foxQSO[hc1].sent;
m_rptRcvd=m_foxQSO[hc1].rcvd;
if (!m_foxLogWindow)
{
on_actionFox_Log_triggered ();
}
if (!m_foxLog) m_foxLog.reset (new FoxLog);
if (!m_foxLogWindow) on_fox_log_action_triggered ();
if (m_foxLog->add_QSO (QSO_time, m_hisCall, m_hisGrid, m_rptSent, m_rptRcvd, m_lastBand))
{
writeFoxQSO (QString {" Log: %1 %2 %3 %4 %5"}.arg (m_hisCall).arg (m_hisGrid)
@ -8292,7 +8281,7 @@ Transmit:
if(age < 3600) break;
m_foxRateQueue.dequeue();
}
if (m_foxLogWindow && m_foxLogWindow->isVisible ())
if (m_foxLogWindow)
{
m_foxLogWindow->rate (m_foxRateQueue.size ());
m_foxLogWindow->queued (m_foxQSOinProgress.count ());

View File

@ -36,7 +36,6 @@
#include "astro.h"
#include "MessageBox.hpp"
#include "NetworkAccessManager.hpp"
#include "ExportCabrillo.h"
#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
@ -69,8 +68,10 @@ class WideGraph;
class LogQSO;
class Transceiver;
class MessageAveraging;
class FoxLogWindow;
class FoxLog;
class FoxLogWindow;
class CabrilloLog;
class CabrilloLogWindow;
class ColorHighlighting;
class MessageClient;
class QTime;
@ -203,8 +204,8 @@ private slots:
void on_actionDeepestDecode_toggled (bool);
void bumpFqso(int n);
void on_actionErase_ALL_TXT_triggered();
void on_actionErase_FoxQSO_txt_triggered();
void on_actionErase_cabrillo_log_triggered();
void on_reset_fox_log_action_triggered ();
void on_reset_cabrillo_log_action_triggered ();
void on_actionErase_wsjtx_log_adi_triggered();
void on_actionExport_Cabrillo_log_triggered();
void startTx2();
@ -248,7 +249,8 @@ private slots:
void stopTuneATU();
void auto_tx_mode(bool);
void on_actionMessage_averaging_triggered();
void on_actionFox_Log_triggered();
void on_contest_log_action_triggered ();
void on_fox_log_action_triggered ();
void on_actionColors_triggered();
void on_actionInclude_averaging_toggled (bool);
void on_actionInclude_correlation_toggled (bool);
@ -364,8 +366,9 @@ private:
QScopedPointer<MessageAveraging> m_msgAvgWidget;
QScopedPointer<FoxLog> m_foxLog;
QScopedPointer<FoxLogWindow> m_foxLogWindow;
QScopedPointer<CabrilloLog> m_cabrilloLog;
QScopedPointer<CabrilloLogWindow> m_contestLogWindow;
QScopedPointer<ColorHighlighting> m_colorHighlighting;
QScopedPointer<ExportCabrillo> m_exportCabrillo;
Transceiver::TransceiverState m_rigState;
Frequency m_lastDialFreq;
QString m_lastBand;
@ -696,7 +699,6 @@ private:
QString WSPR_hhmm(int n);
void fast_config(bool b);
void CQTxFreq();
void cabLog();
void useNextCall();
void abortQSO();
void mouseTimerTick();

View File

@ -1035,8 +1035,8 @@ QLabel[oob=&quot;true&quot;] {
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="suffix">
<string/>
<property name="prefix">
<string>Tx# </string>
</property>
<property name="minimum">
<number>1</number>
@ -2646,9 +2646,9 @@ QPushButton[state=&quot;ok&quot;] {
<addaction name="separator"/>
<addaction name="actionDelete_all_wav_files_in_SaveDir"/>
<addaction name="actionErase_ALL_TXT"/>
<addaction name="actionErase_FoxQSO_txt"/>
<addaction name="reset_fox_log_action"/>
<addaction name="actionErase_wsjtx_log_adi"/>
<addaction name="actionErase_cabrillo_log"/>
<addaction name="reset_cabrillo_log_action"/>
<addaction name="actionExport_Cabrillo_log"/>
<addaction name="actionOpen_log_directory"/>
<addaction name="separator"/>
@ -2666,7 +2666,8 @@ QPushButton[state=&quot;ok&quot;] {
<addaction name="actionMessage_averaging"/>
<addaction name="actionEcho_Graph"/>
<addaction name="actionFast_Graph"/>
<addaction name="actionFox_Log"/>
<addaction name="contest_log_action"/>
<addaction name="fox_log_action"/>
<addaction name="actionColors"/>
<addaction name="separator"/>
</widget>
@ -3304,20 +3305,20 @@ QPushButton[state=&quot;ok&quot;] {
<string>Shift+F1</string>
</property>
</action>
<action name="actionFox_Log">
<action name="fox_log_action">
<property name="checkable">
<bool>false</bool>
</property>
<property name="text">
<string>Fox or Contest Log</string>
</property>
<property name="iconText">
<string>Fox or Contest Log</string>
</property>
<property name="toolTip">
<string>Fox or Contest Log</string>
<string>Fox log</string>
</property>
</action>
<action name="actionErase_FoxQSO_txt">
<action name="reset_fox_log_action">
<property name="text">
<string>Erase FoxQSO.txt</string>
<string>Reset Fox log ...</string>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Ths will erase the file FoxQSO.txt and delete the Fox log file which is used for dupe detection.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</action>
<action name="actionFT8_DXpedition_Mode_User_Guide">
@ -3325,9 +3326,9 @@ QPushButton[state=&quot;ok&quot;] {
<string>FT8 DXpedition Mode User Guide</string>
</property>
</action>
<action name="actionErase_cabrillo_log">
<action name="reset_cabrillo_log_action">
<property name="text">
<string>Erase cabrillo.log</string>
<string>Reset Cabrillo log ...</string>
</property>
</action>
<action name="actionColors">
@ -3342,7 +3343,7 @@ QPushButton[state=&quot;ok&quot;] {
</action>
<action name="actionExport_Cabrillo_log">
<property name="text">
<string>Export Cabrillo log</string>
<string>Export Cabrillo log ...</string>
</property>
</action>
<action name="actionQuick_Start_Guide_v2">
@ -3350,6 +3351,11 @@ QPushButton[state=&quot;ok&quot;] {
<string>Quick-Start Guide to WSJT-X 2.0</string>
</property>
</action>
<action name="contest_log_action">
<property name="text">
<string>Contest log</string>
</property>
</action>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>