Added an option to configuration for persistent band/call/rx activity

This commit is contained in:
Jordan Sherer 2019-06-12 23:54:02 -04:00
parent 63627b8b92
commit d91f96da42
5 changed files with 87 additions and 70 deletions

View File

@ -629,6 +629,7 @@ private:
qint32 RxBandwidth_; qint32 RxBandwidth_;
double degrade_; double degrade_;
double txDelay_; double txDelay_;
bool reset_activity_;
bool check_for_updates_; bool check_for_updates_;
bool id_after_73_; bool id_after_73_;
bool tx_qsy_allowed_; bool tx_qsy_allowed_;
@ -753,6 +754,7 @@ qint32 Configuration::aggressive() const {return m_->aggressive_;}
double Configuration::degrade() const {return m_->degrade_;} double Configuration::degrade() const {return m_->degrade_;}
double Configuration::txDelay() const {return m_->txDelay_;} double Configuration::txDelay() const {return m_->txDelay_;}
qint32 Configuration::RxBandwidth() const {return m_->RxBandwidth_;} qint32 Configuration::RxBandwidth() const {return m_->RxBandwidth_;}
bool Configuration::reset_activity() const { return m_->reset_activity_;}
bool Configuration::check_for_updates() const { return m_->check_for_updates_; } bool Configuration::check_for_updates() const { return m_->check_for_updates_; }
bool Configuration::id_after_73 () const {return m_->id_after_73_;} bool Configuration::id_after_73 () const {return m_->id_after_73_;}
bool Configuration::tx_qsy_allowed () const {return m_->tx_qsy_allowed_;} bool Configuration::tx_qsy_allowed () const {return m_->tx_qsy_allowed_;}
@ -1432,6 +1434,7 @@ void Configuration::impl::initialize_models ()
ui_->sound_cq_path_display_label->setText(sound_cq_path_); ui_->sound_cq_path_display_label->setText(sound_cq_path_);
ui_->sound_dm_path_display_label->setText(sound_dm_path_); ui_->sound_dm_path_display_label->setText(sound_dm_path_);
ui_->sound_am_path_display_label->setText(sound_am_path_); ui_->sound_am_path_display_label->setText(sound_am_path_);
ui_->reset_activity_check_box->setChecked (reset_activity_);
ui_->checkForUpdates_checkBox->setChecked (check_for_updates_); ui_->checkForUpdates_checkBox->setChecked (check_for_updates_);
ui_->CW_id_after_73_check_box->setChecked (id_after_73_); ui_->CW_id_after_73_check_box->setChecked (id_after_73_);
ui_->tx_qsy_check_box->setChecked (tx_qsy_allowed_); ui_->tx_qsy_check_box->setChecked (tx_qsy_allowed_);
@ -1716,6 +1719,7 @@ void Configuration::impl::read_settings ()
monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool (); monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool ();
monitor_last_used_ = settings_->value ("MonitorLastUsed", false).toBool (); monitor_last_used_ = settings_->value ("MonitorLastUsed", false).toBool ();
spot_to_reporting_networks_ = settings_->value ("PSKReporter", true).toBool (); spot_to_reporting_networks_ = settings_->value ("PSKReporter", true).toBool ();
reset_activity_ = settings_->value("ResetActivity", false).toBool();
check_for_updates_ = settings_->value("CheckForUpdates", true).toBool(); check_for_updates_ = settings_->value("CheckForUpdates", true).toBool();
id_after_73_ = settings_->value ("After73", false).toBool (); id_after_73_ = settings_->value ("After73", false).toBool ();
tx_qsy_allowed_ = settings_->value ("TxQSYAllowed", false).toBool (); tx_qsy_allowed_ = settings_->value ("TxQSYAllowed", false).toBool ();
@ -1895,6 +1899,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("MonitorOFF", monitor_off_at_startup_); settings_->setValue ("MonitorOFF", monitor_off_at_startup_);
settings_->setValue ("MonitorLastUsed", monitor_last_used_); settings_->setValue ("MonitorLastUsed", monitor_last_used_);
settings_->setValue ("PSKReporter", spot_to_reporting_networks_); settings_->setValue ("PSKReporter", spot_to_reporting_networks_);
settings_->setValue ("ResetActivity", reset_activity_);
settings_->setValue ("CheckForUpdates", check_for_updates_); settings_->setValue ("CheckForUpdates", check_for_updates_);
settings_->setValue ("After73", id_after_73_); settings_->setValue ("After73", id_after_73_);
settings_->setValue ("TxQSYAllowed", tx_qsy_allowed_); settings_->setValue ("TxQSYAllowed", tx_qsy_allowed_);
@ -2439,6 +2444,7 @@ void Configuration::impl::accept ()
aggressive_ = ui_->sbAggressive->value (); aggressive_ = ui_->sbAggressive->value ();
degrade_ = ui_->sbDegrade->value (); degrade_ = ui_->sbDegrade->value ();
RxBandwidth_ = ui_->sbBandwidth->value (); RxBandwidth_ = ui_->sbBandwidth->value ();
reset_activity_ = ui_->reset_activity_check_box->isChecked();
check_for_updates_ = ui_->checkForUpdates_checkBox->isChecked(); check_for_updates_ = ui_->checkForUpdates_checkBox->isChecked();
id_after_73_ = ui_->CW_id_after_73_check_box->isChecked (); id_after_73_ = ui_->CW_id_after_73_check_box->isChecked ();
tx_qsy_allowed_ = ui_->tx_qsy_check_box->isChecked (); tx_qsy_allowed_ = ui_->tx_qsy_check_box->isChecked ();

View File

@ -119,6 +119,7 @@ public:
qint32 RxBandwidth() const; qint32 RxBandwidth() const;
double degrade() const; double degrade() const;
double txDelay() const; double txDelay() const;
bool reset_activity() const;
bool check_for_updates() const; bool check_for_updates() const;
bool id_after_73 () const; bool id_after_73 () const;
bool tx_qsy_allowed () const; bool tx_qsy_allowed () const;

View File

@ -36,7 +36,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget_2"> <widget class="QTabWidget" name="tabWidget_2">
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>1</number>
</property> </property>
<widget class="QWidget" name="stationTab"> <widget class="QWidget" name="stationTab">
<attribute name="title"> <attribute name="title">
@ -279,7 +279,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>724</width> <width>724</width>
<height>779</height> <height>808</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_26"> <layout class="QVBoxLayout" name="verticalLayout_26">
@ -401,6 +401,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="reset_activity_check_box">
<property name="text">
<string>Reset the Band Activity, Call Activity, and RX history at startup</string>
</property>
</widget>
</item>
<item> <item>
<widget class="QCheckBox" name="checkForUpdates_checkBox"> <widget class="QCheckBox" name="checkForUpdates_checkBox">
<property name="text"> <property name="text">

View File

@ -392,6 +392,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
m_multi_settings {multi_settings}, m_multi_settings {multi_settings},
m_configurations_button {0}, m_configurations_button {0},
m_settings {multi_settings->settings ()}, m_settings {multi_settings->settings ()},
m_settings_read {false},
ui(new Ui::MainWindow), ui(new Ui::MainWindow),
m_config {temp_directory, m_settings, this}, m_config {temp_directory, m_settings, this},
m_WSPR_band_hopping {m_settings, &m_config, this}, m_WSPR_band_hopping {m_settings, &m_config, this},
@ -1651,7 +1652,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
m_txTextDirtyDebounce.setSingleShot(true); m_txTextDirtyDebounce.setSingleShot(true);
connect(&m_txTextDirtyDebounce, &QTimer::timeout, this, &MainWindow::refreshTextDisplay); connect(&m_txTextDirtyDebounce, &QTimer::timeout, this, &MainWindow::refreshTextDisplay);
QTimer::singleShot(0, this, &MainWindow::initializeDummyData); QTimer::singleShot(500, this, &MainWindow::initializeDummyData);
// this must be the last statement of constructor // this must be the last statement of constructor
if (!m_valid) throw std::runtime_error {"Fatal initialization exception"}; if (!m_valid) throw std::runtime_error {"Fatal initialization exception"};
@ -2190,8 +2191,7 @@ void MainWindow::readSettings()
ui->actionShow_Tooltips->setChecked(m_settings->value("ShowTooltips", true).toBool()); ui->actionShow_Tooltips->setChecked(m_settings->value("ShowTooltips", true).toBool());
ui->actionShow_Statusbar->setChecked(m_settings->value("ShowStatusbar",true).toBool()); ui->actionShow_Statusbar->setChecked(m_settings->value("ShowStatusbar",true).toBool());
ui->statusBar->setVisible(ui->actionShow_Statusbar->isChecked()); ui->statusBar->setVisible(ui->actionShow_Statusbar->isChecked());
ui->textEditRX->setHtml(m_settings->value("RXActivity", "").toString()); ui->textEditRX->setHtml(m_config.reset_activity() ? "" : m_settings->value("RXActivity", "").toString());
m_settings->endGroup(); m_settings->endGroup();
// do this outside of settings group because it uses groups internally // do this outside of settings group because it uses groups internally
@ -2288,41 +2288,47 @@ void MainWindow::readSettings()
m_audioThreadPriority = static_cast<QThread::Priority> (m_settings->value ("Audio/ThreadPriority", QThread::HighPriority).toInt () % 8); m_audioThreadPriority = static_cast<QThread::Priority> (m_settings->value ("Audio/ThreadPriority", QThread::HighPriority).toInt () % 8);
m_settings->endGroup (); m_settings->endGroup ();
m_settings->beginGroup("CallActivity"); if(m_config.reset_activity()){
foreach(auto call, m_settings->allKeys()){ // NOOP
} else {
m_settings->beginGroup("CallActivity");
foreach(auto call, m_settings->allKeys()){
auto values = m_settings->value(call).toMap(); auto values = m_settings->value(call).toMap();
auto snr = values.value("snr", -64).toInt(); auto snr = values.value("snr", -64).toInt();
auto grid = values.value("grid", "").toString(); auto grid = values.value("grid", "").toString();
auto freq = values.value("freq", 0).toInt(); auto freq = values.value("freq", 0).toInt();
#if CACHE_CALL_DATETIME_AS_STRINGS #if CACHE_CALL_DATETIME_AS_STRINGS
auto ackTimestampStr = values.value("ackTimestamp", "").toString(); auto ackTimestampStr = values.value("ackTimestamp", "").toString();
auto ackTimestamp = QDateTime::fromString(ackTimestampStr, "yyyy-MM-dd hh:mm:ss"); auto ackTimestamp = QDateTime::fromString(ackTimestampStr, "yyyy-MM-dd hh:mm:ss");
ackTimestamp.setUtcOffset(0); ackTimestamp.setUtcOffset(0);
auto utcTimestampStr = values.value("utcTimestamp", "").toString(); auto utcTimestampStr = values.value("utcTimestamp", "").toString();
auto utcTimestamp = QDateTime::fromString(utcTimestampStr, "yyyy-MM-dd hh:mm:ss"); auto utcTimestamp = QDateTime::fromString(utcTimestampStr, "yyyy-MM-dd hh:mm:ss");
utcTimestamp.setUtcOffset(0); utcTimestamp.setUtcOffset(0);
#else #else
auto ackTimestamp = values.value("ackTimestamp").toDateTime(); auto ackTimestamp = values.value("ackTimestamp").toDateTime();
auto utcTimestamp = values.value("utcTimestamp").toDateTime(); auto utcTimestamp = values.value("utcTimestamp").toDateTime();
#endif #endif
CallDetail cd = {}; CallDetail cd = {};
cd.call = call; cd.call = call;
cd.snr = snr; cd.snr = snr;
cd.grid = grid; cd.grid = grid;
cd.freq = freq; cd.freq = freq;
cd.ackTimestamp = ackTimestamp; cd.ackTimestamp = ackTimestamp;
cd.utcTimestamp = utcTimestamp; cd.utcTimestamp = utcTimestamp;
logCallActivity(cd, false); logCallActivity(cd, false);
}
m_settings->endGroup();
} }
m_settings->endGroup();
if (displayMsgAvg) on_actionMessage_averaging_triggered(); if (displayMsgAvg) on_actionMessage_averaging_triggered();
m_settings_read = true;
} }
void MainWindow::set_application_font (QFont const& font) void MainWindow::set_application_font (QFont const& font)
@ -3228,6 +3234,38 @@ Radio::Frequency MainWindow::dialFrequency() {
m_rigState.tx_frequency () : m_rigState.frequency ()}; m_rigState.tx_frequency () : m_rigState.frequency ()};
} }
void MainWindow::updateCurrentBand(){
QVariant state = ui->readFreq->property("state");
if(!state.isValid()){
return;
}
auto dial_frequency = dialFrequency();
auto const& band_name = m_config.bands ()->find(dial_frequency);
if (m_lastBand == band_name){
return;
}
cacheActivity(m_lastBand);
// clear activity on startup if asked or on when the previous band is not empty
if(m_config.reset_activity() || !m_lastBand.isEmpty()){
clearActivity();
}
// only change this when necessary as we get called a lot and it
// would trash any user input to the band combo box line edit
ui->bandComboBox->setCurrentText (band_name);
m_wideGraph->setRxBand (band_name);
qDebug() << "setting band" << band_name;
m_lastBand = band_name;
band_changed(dial_frequency);
restoreActivity(m_lastBand);
}
void MainWindow::displayDialFrequency (){ void MainWindow::displayDialFrequency (){
#if 0 #if 0
qDebug() << "rx nominal" << m_freqNominal; qDebug() << "rx nominal" << m_freqNominal;
@ -3240,48 +3278,6 @@ void MainWindow::displayDialFrequency (){
// lookup band // lookup band
auto const& band_name = m_config.bands ()->find (dial_frequency); auto const& band_name = m_config.bands ()->find (dial_frequency);
if (m_lastBand != band_name){
cacheActivity(m_lastBand);
// don't clear activity on startup
if(!m_lastBand.isEmpty()){
clearActivity();
}
// only change this when necessary as we get called a lot and it
// would trash any user input to the band combo box line edit
ui->bandComboBox->setCurrentText (band_name);
m_wideGraph->setRxBand (band_name);
m_lastBand = band_name;
band_changed(dial_frequency);
restoreActivity(m_lastBand);
}
// TODO: jsherer - this doesn't validate anything else right? we are disabling this because as long as you're in a band, it's valid.
/*
// search working frequencies for one we are within 10kHz of (1 Mhz
// of on VHF and up)
bool valid {false};
quint64 min_offset {99999999};
for (auto const& item : *m_config.frequencies ())
{
// we need to do specific checks for above and below here to
// ensure that we can use unsigned Radio::Frequency since we
// potentially use the full 64-bit unsigned range.
auto const& working_frequency = item.frequency_;
auto const& offset = dial_frequency > working_frequency ?
dial_frequency - working_frequency :
working_frequency - dial_frequency;
if (offset < min_offset) {
min_offset = offset;
}
}
if (min_offset < 10000u || (m_config.enable_VHF_features() && min_offset < 1000000u)) {
valid = true;
}
*/
bool valid = !band_name.isEmpty(); bool valid = !band_name.isEmpty();
update_dynamic_property (ui->labDialFreq, "oob", !valid); update_dynamic_property (ui->labDialFreq, "oob", !valid);
@ -5874,6 +5870,7 @@ void MainWindow::restoreActivity(QString key){
} }
void MainWindow::clearActivity(){ void MainWindow::clearActivity(){
qDebug() << "clear activity";
m_bandActivity.clear(); m_bandActivity.clear();
m_callActivity.clear(); m_callActivity.clear();
m_callSeenHeartbeat.clear(); m_callSeenHeartbeat.clear();
@ -8871,6 +8868,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
m_tx_when_ready = false; m_tx_when_ready = false;
} }
m_rigState = s; m_rigState = s;
auto old_freqNominal = m_freqNominal; auto old_freqNominal = m_freqNominal;
if (!old_freqNominal) if (!old_freqNominal)
{ {
@ -8878,6 +8876,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
// with bogus Tx frequencies // with bogus Tx frequencies
m_freqNominal = s.frequency (); m_freqNominal = s.frequency ();
} }
if (old_state.online () == false && s.online () == true) if (old_state.online () == false && s.online () == true)
{ {
// initializing // initializing
@ -8885,6 +8884,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
ui->autoReplyButton->setChecked(!m_config.autoreply_off_at_startup()); ui->autoReplyButton->setChecked(!m_config.autoreply_off_at_startup());
} }
if (s.frequency () != old_state.frequency () || s.split () != m_splitMode) if (s.frequency () != old_state.frequency () || s.split () != m_splitMode)
{ {
m_splitMode = s.split (); m_splitMode = s.split ();
@ -8943,6 +8943,7 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
// ensure frequency display is correct // ensure frequency display is correct
if (m_astroWidget && old_state.ptt () != s.ptt ()) setRig (); if (m_astroWidget && old_state.ptt () != s.ptt ()) setRig ();
updateCurrentBand();
displayDialFrequency (); displayDialFrequency ();
update_dynamic_property (ui->readFreq, "state", "ok"); update_dynamic_property (ui->readFreq, "state", "ok");
ui->readFreq->setEnabled (false); ui->readFreq->setEnabled (false);

View File

@ -462,6 +462,7 @@ private:
MultiSettings * m_multi_settings; MultiSettings * m_multi_settings;
QPushButton * m_configurations_button; QPushButton * m_configurations_button;
QSettings * m_settings; QSettings * m_settings;
bool m_settings_read;
QScopedPointer<Ui::MainWindow> ui; QScopedPointer<Ui::MainWindow> ui;
// other windows // other windows
@ -940,6 +941,7 @@ private:
void pskLogReport(QString mode, int offset, int snr, QString callsign, QString grid); void pskLogReport(QString mode, int offset, int snr, QString callsign, QString grid);
void aprsLogReport(int offset, int snr, QString callsign, QString grid); void aprsLogReport(int offset, int snr, QString callsign, QString grid);
Radio::Frequency dialFrequency(); Radio::Frequency dialFrequency();
void updateCurrentBand();
void displayDialFrequency (); void displayDialFrequency ();
void transmitDisplay (bool); void transmitDisplay (bool);
void locationChange(QString const& location); void locationChange(QString const& location);