From ce66e86b48e2360ecb0d650cf6efeb5f19850d1d Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Sat, 9 Feb 2019 16:26:24 -0500 Subject: [PATCH] Fixed #73: disable HB and CQ while in QSO --- Configuration.cpp | 6 ++++++ Configuration.hpp | 1 + Configuration.ui | 11 +++++++++-- mainwindow.cpp | 26 +++++++++++++++++++++++++- mainwindow.h | 2 ++ 5 files changed, 43 insertions(+), 3 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index dc08907..3571262 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -634,6 +634,7 @@ private: bool transmit_directed_; bool autoreply_off_at_startup_; bool heartbeat_anywhere_; + bool heartbeat_qso_pause_; bool relay_disabled_; bool monitor_off_at_startup_; bool monitor_last_used_; @@ -767,6 +768,7 @@ void Configuration::set_spot_to_reporting_networks (bool spot) bool Configuration::transmit_directed() const { return m_->transmit_directed_; } bool Configuration::autoreply_off_at_startup () const {return m_->autoreply_off_at_startup_;} bool Configuration::heartbeat_anywhere() const { return m_->heartbeat_anywhere_;} +bool Configuration::heartbeat_qso_pause() const { return m_->heartbeat_qso_pause_;} bool Configuration::relay_off() const { return m_->relay_disabled_; } bool Configuration::monitor_off_at_startup () const {return m_->monitor_off_at_startup_;} bool Configuration::monitor_last_used () const {return m_->rig_is_dummy_ || m_->monitor_last_used_;} @@ -1398,6 +1400,7 @@ void Configuration::impl::initialize_models () ui_->transmit_directed_check_box->setChecked(transmit_directed_); ui_->autoreply_off_check_box->setChecked (autoreply_off_at_startup_); ui_->heartbeat_anywhere_check_box->setChecked(heartbeat_anywhere_); + ui_->heartbeat_qso_pause_check_box->setChecked(heartbeat_qso_pause_); ui_->relay_disabled_check_box->setChecked(relay_disabled_); ui_->monitor_off_check_box->setChecked (monitor_off_at_startup_); ui_->monitor_last_used_check_box->setChecked (monitor_last_used_); @@ -1663,6 +1666,7 @@ void Configuration::impl::read_settings () transmit_directed_ = settings_->value ("TransmitDirected", true).toBool(); autoreply_off_at_startup_ = settings_->value ("AutoreplyOFF", false).toBool (); heartbeat_anywhere_ = settings_->value("BeaconAnywhere", false).toBool(); + heartbeat_qso_pause_ = settings_->value("HeartbeatQSOPause", true).toBool(); relay_disabled_ = settings_->value ("RelayOFF", false).toBool (); monitor_off_at_startup_ = settings_->value ("MonitorOFF", false).toBool (); monitor_last_used_ = settings_->value ("MonitorLastUsed", false).toBool (); @@ -1834,6 +1838,7 @@ void Configuration::impl::write_settings () settings_->setValue ("TransmitDirected", transmit_directed_); settings_->setValue ("AutoreplyOFF", autoreply_off_at_startup_); settings_->setValue ("BeaconAnywhere", heartbeat_anywhere_); + settings_->setValue ("HeartbeatQSOPause", heartbeat_qso_pause_); settings_->setValue ("RelayOFF", relay_disabled_); settings_->setValue ("MonitorOFF", monitor_off_at_startup_); settings_->setValue ("MonitorLastUsed", monitor_last_used_); @@ -2375,6 +2380,7 @@ void Configuration::impl::accept () transmit_directed_ = ui_->transmit_directed_check_box->isChecked(); autoreply_off_at_startup_ = ui_->autoreply_off_check_box->isChecked (); heartbeat_anywhere_ = ui_->heartbeat_anywhere_check_box->isChecked(); + heartbeat_qso_pause_ = ui_->heartbeat_qso_pause_check_box->isChecked(); relay_disabled_ = ui_->relay_disabled_check_box->isChecked(); monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked (); monitor_last_used_ = ui_->monitor_last_used_check_box->isChecked (); diff --git a/Configuration.hpp b/Configuration.hpp index 3a14ee4..a4a6050 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -125,6 +125,7 @@ public: bool transmit_directed() const; bool autoreply_off_at_startup () const; bool heartbeat_anywhere() const; + bool heartbeat_qso_pause() const; bool relay_off() const; bool monitor_off_at_startup () const; bool monitor_last_used () const; diff --git a/Configuration.ui b/Configuration.ui index 86f33c4..fc103f4 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -36,7 +36,7 @@ - 0 + 1 @@ -279,7 +279,7 @@ 0 0 724 - 617 + 646 @@ -380,6 +380,13 @@ + + + + Pause heartbeat transmissions while in a QSO (i.e., callsign is selected) + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 3771be7..9234008 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7084,6 +7084,8 @@ void MainWindow::sendHeartbeatAck(QString to, int snr, QString extra){ void MainWindow::on_hbMacroButton_toggled(bool checked){ if(checked){ + clearCallsignSelected(); + if(m_hbInterval){ m_nextHeartbeat = nextTransmitCycle().addSecs(m_hbInterval * 60); @@ -7123,6 +7125,8 @@ void MainWindow::sendCQ(bool repeat){ void MainWindow::on_cqMacroButton_toggled(bool checked){ if(checked){ + clearCallsignSelected(); + if(m_cqInterval){ m_nextCQ = nextTransmitCycle().addSecs(m_cqInterval * 60); @@ -7930,8 +7934,28 @@ void MainWindow::on_tableWidgetRXAll_selectionChanged(const QItemSelection &/*se auto placeholderText = QString("Type your outgoing messages here."); auto selectedCall = callsignSelected(); - if(!selectedCall.isEmpty()){ + if(selectedCall.isEmpty()){ + // try to restore hb + if(m_hbPaused){ + ui->hbMacroButton->setChecked(true); + m_hbPaused = false; + } + } else { placeholderText = QString("Type your outgoing directed message to %1 here.").arg(selectedCall); + + // TODO: jsherer - move this to a generic "callsign changed" signal + if(m_config.heartbeat_qso_pause()){ + // don't hb if we select a callsign... (but we should keep track so if we deselect, we restore our hb) + if(ui->hbMacroButton->isChecked()){ + ui->hbMacroButton->setChecked(false); + m_hbPaused = true; + } + + // don't cq if we select a callsign... (and it will not be restored otherwise) + if(ui->cqMacroButton->isChecked()){ + ui->cqMacroButton->setChecked(false); + } + } } ui->extFreeTextMsgEdit->setPlaceholderText(placeholderText); diff --git a/mainwindow.h b/mainwindow.h index 88f7b05..747f76e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -859,6 +859,8 @@ private: bool m_hbHidden; int m_hbInterval; int m_cqInterval; + bool m_hbPaused; + bool m_cqPaused; QDateTime m_nextHeartbeat; QDateTime m_nextCQ; QDateTime m_dateTimeQSOOn;