Added configuration option to enable/disable writing of ALL.TXT / DIRECTED.TXT
This commit is contained in:
parent
0bd3d47584
commit
ab3a927c2a
@ -631,6 +631,7 @@ private:
|
||||
qint32 RxBandwidth_;
|
||||
double degrade_;
|
||||
double txDelay_;
|
||||
bool write_logs_;
|
||||
bool reset_activity_;
|
||||
bool check_for_updates_;
|
||||
bool id_after_73_;
|
||||
@ -778,6 +779,7 @@ qint32 Configuration::aggressive() const {return m_->aggressive_;}
|
||||
double Configuration::degrade() const {return m_->degrade_;}
|
||||
double Configuration::txDelay() const {return m_->txDelay_;}
|
||||
qint32 Configuration::RxBandwidth() const {return m_->RxBandwidth_;}
|
||||
bool Configuration::write_logs() const { return m_->write_logs_;}
|
||||
bool Configuration::reset_activity() const { return m_->reset_activity_;}
|
||||
bool Configuration::check_for_updates() const { return m_->check_for_updates_; }
|
||||
bool Configuration::id_after_73 () const {return m_->id_after_73_;}
|
||||
@ -1498,6 +1500,7 @@ void Configuration::impl::initialize_models ()
|
||||
ui_->PTT_method_button_group->button (rig_params_.ptt_type)->setChecked (true);
|
||||
ui_->save_path_display_label->setText (save_directory_.absolutePath ());
|
||||
ui_->azel_path_display_label->setText (azel_directory_.absolutePath ());
|
||||
ui_->write_logs_check_box->setChecked (write_logs_);
|
||||
ui_->reset_activity_check_box->setChecked (reset_activity_);
|
||||
ui_->checkForUpdates_checkBox->setChecked (check_for_updates_);
|
||||
ui_->CW_id_after_73_check_box->setChecked (id_after_73_);
|
||||
@ -1928,6 +1931,7 @@ void Configuration::impl::read_settings ()
|
||||
monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool ();
|
||||
monitor_last_used_ = settings_->value ("MonitorLastUsed", false).toBool ();
|
||||
spot_to_reporting_networks_ = settings_->value ("PSKReporter", true).toBool ();
|
||||
write_logs_ = settings_->value("WriteLogs", true).toBool();
|
||||
reset_activity_ = settings_->value("ResetActivity", false).toBool();
|
||||
check_for_updates_ = settings_->value("CheckForUpdates", true).toBool();
|
||||
id_after_73_ = settings_->value ("After73", false).toBool ();
|
||||
@ -2139,6 +2143,7 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("MonitorOFF", monitor_off_at_startup_);
|
||||
settings_->setValue ("MonitorLastUsed", monitor_last_used_);
|
||||
settings_->setValue ("PSKReporter", spot_to_reporting_networks_);
|
||||
settings_->setValue ("WriteLogs", write_logs_);
|
||||
settings_->setValue ("ResetActivity", reset_activity_);
|
||||
settings_->setValue ("CheckForUpdates", check_for_updates_);
|
||||
settings_->setValue ("After73", id_after_73_);
|
||||
@ -2751,6 +2756,7 @@ void Configuration::impl::accept ()
|
||||
aggressive_ = ui_->sbAggressive->value ();
|
||||
degrade_ = ui_->sbDegrade->value ();
|
||||
RxBandwidth_ = ui_->sbBandwidth->value ();
|
||||
write_logs_ = ui_->write_logs_check_box->isChecked();
|
||||
reset_activity_ = ui_->reset_activity_check_box->isChecked();
|
||||
check_for_updates_ = ui_->checkForUpdates_checkBox->isChecked();
|
||||
id_after_73_ = ui_->CW_id_after_73_check_box->isChecked ();
|
||||
|
@ -129,6 +129,7 @@ public:
|
||||
qint32 RxBandwidth() const;
|
||||
double degrade() const;
|
||||
double txDelay() const;
|
||||
bool write_logs() const;
|
||||
bool reset_activity() const;
|
||||
bool check_for_updates() const;
|
||||
bool id_after_73 () const;
|
||||
|
@ -39,7 +39,7 @@
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget_2">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="stationTab">
|
||||
<attribute name="title">
|
||||
@ -281,8 +281,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>615</width>
|
||||
<height>508</height>
|
||||
<width>724</width>
|
||||
<height>537</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_26">
|
||||
@ -383,6 +383,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="write_logs_check_box">
|
||||
<property name="text">
|
||||
<string>Write log files (ALL.TXT, DIRECTED.TXT, etc) of decoded text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="spellcheck_check_box">
|
||||
<property name="text">
|
||||
@ -796,8 +803,8 @@ text message.</string>
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>616</width>
|
||||
<height>331</height>
|
||||
<width>738</width>
|
||||
<height>461</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_16">
|
||||
|
147
mainwindow.cpp
147
mainwindow.cpp
@ -4657,53 +4657,6 @@ void MainWindow::decodeCheckHangingDecoder(){
|
||||
initDecoderSubprocess();
|
||||
}
|
||||
|
||||
void MainWindow::writeAllTxt(QString message, int bits)
|
||||
{
|
||||
// Write decoded text to file "ALL.TXT".
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
if(m_RxLog==1) {
|
||||
out << DriftingDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss")
|
||||
<< " " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) << " MHz "
|
||||
<< "JS8" << endl;
|
||||
m_RxLog=0;
|
||||
}
|
||||
auto dt = DecodedText(message, bits, m_nSubMode);
|
||||
out << dt.message() << endl;
|
||||
f.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Open Error")
|
||||
, tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::writeMsgTxt(QString message, int snr)
|
||||
{
|
||||
// Write decoded text to file "DIRECTED.TXT".
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("DIRECTED.TXT")};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
|
||||
QStringList output = {
|
||||
DriftingDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss"),
|
||||
Radio::frequency_MHz_string(m_freqNominal),
|
||||
QString::number(currentFreqOffset()),
|
||||
Varicode::formatSNR(snr),
|
||||
message
|
||||
};
|
||||
|
||||
out << output.join("\t") << endl;
|
||||
|
||||
f.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Open Error")
|
||||
, tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime MainWindow::nextTransmitCycle(){
|
||||
auto timestamp = DriftingDateTime::currentDateTimeUtc();
|
||||
|
||||
@ -9498,19 +9451,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
|
||||
}
|
||||
|
||||
if(s.frequency () < 30000000u && !m_mode.startsWith ("WSPR")) {
|
||||
// Write freq changes to ALL.TXT only below 30 MHz.
|
||||
QFile f2 {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
|
||||
if (f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f2);
|
||||
out << DriftingDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss")
|
||||
<< " " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) << " MHz "
|
||||
<< "JS8" << endl;
|
||||
f2.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Error")
|
||||
,tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f2.fileName ()).arg (f2.errorString ()));
|
||||
}
|
||||
write_frequency_entry("ALL.TXT");
|
||||
}
|
||||
|
||||
if (m_config.spot_to_reporting_networks ()) {
|
||||
@ -13173,8 +13114,38 @@ void MainWindow::on_measure_check_box_stateChanged (int state)
|
||||
m_config.enable_calibration (Qt::Checked != state);
|
||||
}
|
||||
|
||||
void MainWindow::write_frequency_entry (QString const& file_name){
|
||||
if(!m_config.write_logs()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Write freq changes to ALL.TXT only below 30 MHz.
|
||||
QFile f2 {m_config.writeable_data_dir ().absoluteFilePath (file_name)};
|
||||
if (f2.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f2);
|
||||
out << DriftingDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss")
|
||||
<< " " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) << " MHz "
|
||||
<< "JS8" << endl;
|
||||
f2.close();
|
||||
} else {
|
||||
auto const& message = tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f2.fileName ()).arg (f2.errorString ());
|
||||
#if QT_VERSION >= 0x050400
|
||||
QTimer::singleShot (0, [=] { // don't block guiUpdate
|
||||
MessageBox::warning_message (this, tr ("Log File Error"), message);
|
||||
});
|
||||
#else
|
||||
MessageBox::warning_message (this, tr ("Log File Error"), message);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::write_transmit_entry (QString const& file_name)
|
||||
{
|
||||
if(!m_config.write_logs()){
|
||||
return;
|
||||
}
|
||||
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath (file_name)};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append))
|
||||
{
|
||||
@ -13201,3 +13172,59 @@ void MainWindow::write_transmit_entry (QString const& file_name)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::writeAllTxt(QString message, int bits)
|
||||
{
|
||||
if(!m_config.write_logs()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Write decoded text to file "ALL.TXT".
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("ALL.TXT")};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
if(m_RxLog==1) {
|
||||
out << DriftingDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss")
|
||||
<< " " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) << " MHz "
|
||||
<< "JS8" << endl;
|
||||
m_RxLog=0;
|
||||
}
|
||||
auto dt = DecodedText(message, bits, m_nSubMode);
|
||||
out << dt.message() << endl;
|
||||
f.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Open Error")
|
||||
, tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::writeMsgTxt(QString message, int snr)
|
||||
{
|
||||
if(!m_config.write_logs()){
|
||||
return;
|
||||
}
|
||||
|
||||
// Write decoded text to file "DIRECTED.TXT".
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("DIRECTED.TXT")};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
|
||||
QStringList output = {
|
||||
DriftingDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss"),
|
||||
Radio::frequency_MHz_string(m_freqNominal),
|
||||
QString::number(currentFreqOffset()),
|
||||
Varicode::formatSNR(snr),
|
||||
message
|
||||
};
|
||||
|
||||
out << output.join("\t") << endl;
|
||||
|
||||
f.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Open Error")
|
||||
, tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
}
|
||||
|
@ -1046,6 +1046,7 @@ private:
|
||||
void vhfWarning();
|
||||
QChar current_submode () const; // returns QChar {0} if sub mode is
|
||||
// not appropriate
|
||||
void write_frequency_entry (QString const& file_name);
|
||||
void write_transmit_entry (QString const& file_name);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user