Fixed #73: disable HB and CQ while in QSO

This commit is contained in:
Jordan Sherer 2019-02-09 16:26:24 -05:00
parent 0664704eaf
commit ce66e86b48
5 changed files with 43 additions and 3 deletions

View File

@ -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 ();

View File

@ -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;

View File

@ -36,7 +36,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">
@ -279,7 +279,7 @@
<x>0</x>
<y>0</y>
<width>724</width>
<height>617</height>
<height>646</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_26">
@ -380,6 +380,13 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="heartbeat_qso_pause_check_box">
<property name="text">
<string>Pause heartbeat transmissions while in a QSO (i.e., callsign is selected)</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="spellcheck_check_box">
<property name="text">

View File

@ -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);

View File

@ -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;