mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-10-31 23:57:10 -04:00
First attempt at a time based Tx watchdog
The watchdog configuration is now a spin box of minutes with a special first value of disabled. WSJT-X counts down minutes on the minute, if the countdown reaches zero any attempt to transmit is aborted. The countdown is reset by any mouse press or key press event inside the main window or if the Tx message changes (auto sequencing). The status bar now shows the Tx watchdog countdown if it is active. This information is shown to the right of the progress bar text. The warning message boxes triggered within the GUI update routine now no longer block the GUI updates. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6840 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
9fe40bd8b8
commit
b4b89485de
@ -534,7 +534,7 @@ private:
|
||||
bool miles_;
|
||||
bool quick_call_;
|
||||
bool disable_TX_on_73_;
|
||||
bool watchdog_;
|
||||
int watchdog_;
|
||||
bool TX_messages_;
|
||||
bool enable_VHF_features_;
|
||||
bool decode_at_52s_;
|
||||
@ -623,7 +623,7 @@ bool Configuration::clear_DX () const {return m_->clear_DX_;}
|
||||
bool Configuration::miles () const {return m_->miles_;}
|
||||
bool Configuration::quick_call () const {return m_->quick_call_;}
|
||||
bool Configuration::disable_TX_on_73 () const {return m_->disable_TX_on_73_;}
|
||||
bool Configuration::watchdog () const {return m_->watchdog_;}
|
||||
int Configuration::watchdog () const {return m_->watchdog_;}
|
||||
bool Configuration::TX_messages () const {return m_->TX_messages_;}
|
||||
bool Configuration::enable_VHF_features () const {return m_->enable_VHF_features_;}
|
||||
bool Configuration::decode_at_52s () const {return m_->decode_at_52s_;}
|
||||
@ -1054,7 +1054,7 @@ void Configuration::impl::initialize_models ()
|
||||
ui_->miles_check_box->setChecked (miles_);
|
||||
ui_->quick_call_check_box->setChecked (quick_call_);
|
||||
ui_->disable_TX_on_73_check_box->setChecked (disable_TX_on_73_);
|
||||
ui_->watchdog_check_box->setChecked (watchdog_);
|
||||
ui_->tx_watchdog_spin_box->setValue (watchdog_);
|
||||
ui_->TX_messages_check_box->setChecked (TX_messages_);
|
||||
ui_->enable_VHF_features_check_box->setChecked(enable_VHF_features_);
|
||||
ui_->decode_at_52s_check_box->setChecked(decode_at_52s_);
|
||||
@ -1282,7 +1282,7 @@ void Configuration::impl::read_settings ()
|
||||
miles_ = settings_->value ("Miles", false).toBool ();
|
||||
quick_call_ = settings_->value ("QuickCall", false).toBool ();
|
||||
disable_TX_on_73_ = settings_->value ("73TxDisable", false).toBool ();
|
||||
watchdog_ = settings_->value ("Runaway", false).toBool ();
|
||||
watchdog_ = settings_->value ("TxWatchdog", 6).toInt ();
|
||||
TX_messages_ = settings_->value ("Tx2QSO", true).toBool ();
|
||||
enable_VHF_features_ = settings_->value("VHFUHF",false).toBool ();
|
||||
decode_at_52s_ = settings_->value("Decode52",false).toBool ();
|
||||
@ -1376,7 +1376,7 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("Miles", miles_);
|
||||
settings_->setValue ("QuickCall", quick_call_);
|
||||
settings_->setValue ("73TxDisable", disable_TX_on_73_);
|
||||
settings_->setValue ("Runaway", watchdog_);
|
||||
settings_->setValue ("TxWatchdog", watchdog_);
|
||||
settings_->setValue ("Tx2QSO", TX_messages_);
|
||||
settings_->setValue ("CATForceDTR", rig_params_.force_dtr);
|
||||
settings_->setValue ("DTR", rig_params_.dtr_high);
|
||||
@ -1777,7 +1777,7 @@ void Configuration::impl::accept ()
|
||||
miles_ = ui_->miles_check_box->isChecked ();
|
||||
quick_call_ = ui_->quick_call_check_box->isChecked ();
|
||||
disable_TX_on_73_ = ui_->disable_TX_on_73_check_box->isChecked ();
|
||||
watchdog_ = ui_->watchdog_check_box->isChecked ();
|
||||
watchdog_ = ui_->tx_watchdog_spin_box->value ();
|
||||
TX_messages_ = ui_->TX_messages_check_box->isChecked ();
|
||||
data_mode_ = static_cast<DataMode> (ui_->TX_mode_button_group->checkedId ());
|
||||
save_directory_ = ui_->save_path_display_label->text ();
|
||||
|
@ -113,7 +113,7 @@ public:
|
||||
bool miles () const;
|
||||
bool quick_call () const;
|
||||
bool disable_TX_on_73 () const;
|
||||
bool watchdog () const;
|
||||
int watchdog () const;
|
||||
bool TX_messages () const;
|
||||
bool split_mode () const;
|
||||
bool enable_VHF_features () const;
|
||||
|
215
Configuration.ui
215
Configuration.ui
@ -132,6 +132,16 @@
|
||||
<string>Display</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="insert_blank_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Include a separator line between periods in the band activity window.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Blank line between decoding periods</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="DXCC_check_box">
|
||||
<property name="toolTip">
|
||||
@ -145,13 +155,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="insert_blank_check_box">
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="miles_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Include a separator line between periods in the band activity window.</string>
|
||||
<string>Show distance to DX station in miles rather than kilometers.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Blank line between decoding periods</string>
|
||||
<string>Display dista&nce in miles</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="TX_messages_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Show outgoing transmitted messages in the Rx frequency window.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Tx messages to Rx frequency window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -192,39 +225,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="miles_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Show distance to DX station in miles rather than kilometers.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Display dista&nce in miles</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="TX_messages_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Show outgoing transmitted messages in the Rx frequency window.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Tx messages to Rx frequency window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -255,47 +255,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="monitor_last_used_check_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Check this if you wish to automatically return to the last monitored frequency when monitor is enabled, leave it unchecked if you wish to have the current rig frequency maintained.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Monitor returns to last used frequency</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="disable_TX_on_73_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Turns off automatic transmissions after sending a 73 or any other free
|
||||
text message.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Di&sable Tx after sending 73</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="watchdog_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Stop transmitting automatically after five periods.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Runaway Tx &watchdog</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="quick_call_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Automatic transmission mode.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Doubl&e-click on call sets Tx enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="monitor_off_check_box">
|
||||
<property name="toolTip">
|
||||
@ -309,6 +268,13 @@ text message.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="decode_at_52s_check_box">
|
||||
<property name="text">
|
||||
<string>Decode at t = 52 s</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
@ -368,6 +334,13 @@ quiet period when decoding is done.</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="single_decode_check_box">
|
||||
<property name="text">
|
||||
<string>Single decode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="tx_QSY_check_box">
|
||||
<property name="toolTip">
|
||||
@ -378,17 +351,80 @@ quiet period when decoding is done.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="decode_at_52s_check_box">
|
||||
<item row="4" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_10">
|
||||
<property name="text">
|
||||
<string>Tx watchdog:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>tx_watchdog_spin_box</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="tx_watchdog_spin_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Number of minutes before unattended transmissions are aborted</p></body></html></string>
|
||||
</property>
|
||||
<property name="specialValueText">
|
||||
<string>Disabled</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> minutes</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>6</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="monitor_last_used_check_box">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Check this if you wish to automatically return to the last monitored frequency when monitor is enabled, leave it unchecked if you wish to have the current rig frequency maintained.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Decode at t = 52 s</string>
|
||||
<string>Monitor returns to last used frequency</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QCheckBox" name="single_decode_check_box">
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="quick_call_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Automatic transmission mode.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Single decode</string>
|
||||
<string>Doubl&e-click on call sets Tx enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="disable_TX_on_73_check_box">
|
||||
<property name="toolTip">
|
||||
<string>Turns off automatic transmissions after sending a 73 or any other free
|
||||
text message.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Di&sable Tx after sending 73</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -2376,10 +2412,7 @@ soundcard changes</string>
|
||||
<tabstop>font_push_button</tabstop>
|
||||
<tabstop>decoded_text_font_push_button</tabstop>
|
||||
<tabstop>monitor_off_check_box</tabstop>
|
||||
<tabstop>quick_call_check_box</tabstop>
|
||||
<tabstop>tx_QSY_check_box</tabstop>
|
||||
<tabstop>disable_TX_on_73_check_box</tabstop>
|
||||
<tabstop>watchdog_check_box</tabstop>
|
||||
<tabstop>decode_at_52s_check_box</tabstop>
|
||||
<tabstop>offset_Rx_freq_check_box</tabstop>
|
||||
<tabstop>CW_id_after_73_check_box</tabstop>
|
||||
@ -2522,11 +2555,11 @@ soundcard changes</string>
|
||||
</connections>
|
||||
<buttongroups>
|
||||
<buttongroup name="split_mode_button_group"/>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
<buttongroup name="CAT_stop_bits_button_group"/>
|
||||
<buttongroup name="TX_mode_button_group"/>
|
||||
<buttongroup name="TX_audio_source_button_group"/>
|
||||
<buttongroup name="CAT_handshake_button_group"/>
|
||||
<buttongroup name="CAT_data_bits_button_group"/>
|
||||
<buttongroup name="PTT_method_button_group"/>
|
||||
</buttongroups>
|
||||
</ui>
|
||||
|
205
mainwindow.cpp
205
mainwindow.cpp
@ -143,6 +143,13 @@ namespace
|
||||
&& ((type < 6 && msg_parts.contains ("73"))
|
||||
|| (type == 6 && !msg_parts.filter ("73").isEmpty ()));
|
||||
}
|
||||
|
||||
int ms_to_next_minute ()
|
||||
{
|
||||
auto const& now = QDateTime::currentDateTime ();
|
||||
auto const& time = now.time ();
|
||||
return now.msecsTo (QDateTime {now.date (), QTime {time.hour (), time.minute (), 0}}.addSecs (60));
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------- MainWindow constructor
|
||||
@ -192,7 +199,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
m_inGain {0},
|
||||
m_secID {0},
|
||||
m_repeatMsg {0},
|
||||
m_watchdogLimit {6},
|
||||
m_nSubMode {0},
|
||||
m_nclearave {1},
|
||||
m_pctx {0},
|
||||
@ -423,7 +429,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
// text message, send + empty text means send the current free
|
||||
// text message without change, !send + empty text means clear
|
||||
// the current free text message
|
||||
qDebug () << "Free text UDP message - text:" << text << "send:" << send << "text empty:" << text.isEmpty ();
|
||||
if (0 == ui->tabWidget->currentIndex ()) {
|
||||
if (!text.isEmpty ()) {
|
||||
ui->tx5->setCurrentText (text);
|
||||
@ -507,7 +512,6 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
});
|
||||
|
||||
setWindowTitle (program_title ());
|
||||
createStatusBar();
|
||||
|
||||
connect(&proc_jt9, &QProcess::readyReadStandardOutput, this, &MainWindow::readFromStdout);
|
||||
connect(&proc_jt9, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
|
||||
@ -654,6 +658,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
|
||||
readSettings(); //Restore user's setup params
|
||||
|
||||
createStatusBar();
|
||||
|
||||
m_audioThread.start (m_audioThreadPriority);
|
||||
|
||||
#ifdef WIN32
|
||||
@ -834,10 +840,42 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
m_wideGraph->setModeTx(m_modeTx);
|
||||
ui->sbSubmode->setValue(m_nSubMode);
|
||||
|
||||
connect (&minuteTimer, &QTimer::timeout, this, &MainWindow::on_the_minute);
|
||||
minuteTimer.setSingleShot (true);
|
||||
minuteTimer.start (ms_to_next_minute ());
|
||||
|
||||
// this must be the last statement of constructor
|
||||
if (!m_valid) throw std::runtime_error {"Fatal initialization exception"};
|
||||
}
|
||||
|
||||
void MainWindow::on_the_minute ()
|
||||
{
|
||||
if (minuteTimer.isSingleShot ())
|
||||
{
|
||||
minuteTimer.setSingleShot (false);
|
||||
minuteTimer.start (60 * 1000); // run free
|
||||
}
|
||||
else
|
||||
{
|
||||
auto const& ms = ms_to_next_minute ();
|
||||
if (qAbs (60 * 1000 - ms) > 1000) // correct drift
|
||||
{
|
||||
minuteTimer.setSingleShot (true);
|
||||
minuteTimer.start (ms);
|
||||
}
|
||||
}
|
||||
|
||||
if (m_repeatMsg < m_config.watchdog ()) ++m_repeatMsg;
|
||||
if (!m_mode.startsWith ("WSPR") && m_config.watchdog () != 0)
|
||||
{
|
||||
updateProgressBarFormat (true);
|
||||
}
|
||||
else
|
||||
{
|
||||
updateProgressBarFormat (false);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------- MainWindow destructor
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
@ -1392,7 +1430,7 @@ void MainWindow::updateProgressBarFormat (bool wd_in_use)
|
||||
{
|
||||
if (wd_in_use)
|
||||
{
|
||||
progressBar->setFormat (QString {"%v/%m WD:%1"}.arg (m_watchdogLimit - m_repeatMsg));
|
||||
progressBar->setFormat (QString {"%v/%m WD:%1m"}.arg (m_config.watchdog () - m_repeatMsg));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1400,28 +1438,8 @@ void MainWindow::updateProgressBarFormat (bool wd_in_use)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::mousePressEvent (QMouseEvent * e)
|
||||
{
|
||||
if (!m_mode.startsWith ("WSPR") && m_mode!="Echo" && m_config.watchdog ()) {
|
||||
m_repeatMsg = 0; // reset Tx watchdog
|
||||
updateProgressBarFormat (true);
|
||||
}
|
||||
else {
|
||||
updateProgressBarFormat (false);
|
||||
}
|
||||
QMainWindow::mousePressEvent (e);
|
||||
}
|
||||
|
||||
void MainWindow::keyPressEvent (QKeyEvent * e)
|
||||
{
|
||||
if (!m_mode.startsWith ("WSPR") && m_mode!="Echo" && m_config.watchdog ()) {
|
||||
m_repeatMsg = 0; // reset Tx watchdog
|
||||
updateProgressBarFormat (true);
|
||||
}
|
||||
else {
|
||||
updateProgressBarFormat (false);
|
||||
}
|
||||
|
||||
int n;
|
||||
switch(e->key())
|
||||
{
|
||||
@ -1570,17 +1588,35 @@ void MainWindow::statusChanged()
|
||||
<< ui->rptSpinBox->value() << ";" << m_modeTx << endl;
|
||||
f.close();
|
||||
} else {
|
||||
msgBox("Cannot open \"" + f.fileName () + "\" for writing:" + f.errorString ());
|
||||
msgBox (tr ("Cannot open \"%1\" for writing: %2").arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
}
|
||||
|
||||
bool MainWindow::eventFilter(QObject *object, QEvent *event) //eventFilter()
|
||||
bool MainWindow::eventFilter (QObject * object, QEvent * event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
MainWindow::keyPressEvent(keyEvent);
|
||||
return QObject::eventFilter(object, event);
|
||||
}
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::KeyPress:
|
||||
// fall through
|
||||
case QEvent::MouseButtonPress:
|
||||
if (m_repeatMsg && !m_mode.startsWith ("WSPR") && m_config.watchdog () != 0) {
|
||||
m_repeatMsg = 0; // reset Tx watchdog
|
||||
updateProgressBarFormat (true);
|
||||
}
|
||||
break;
|
||||
|
||||
case QEvent::ChildAdded:
|
||||
// ensure our child widgets get added to our event filter
|
||||
add_child_to_event_filter (static_cast<QChildEvent *> (event)->child ());
|
||||
break;
|
||||
|
||||
case QEvent::ChildRemoved:
|
||||
// ensure our child widgets get d=removed from our event filter
|
||||
remove_child_from_event_filter (static_cast<QChildEvent *> (event)->child ());
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
return QObject::eventFilter(object, event);
|
||||
}
|
||||
|
||||
@ -1592,7 +1628,6 @@ void MainWindow::createStatusBar() //createStatusBar
|
||||
tx_status_label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||
statusBar()->addWidget(tx_status_label);
|
||||
|
||||
|
||||
mode_label->setAlignment(Qt::AlignHCenter);
|
||||
mode_label->setMinimumSize(QSize(80,18));
|
||||
mode_label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||
@ -1610,7 +1645,7 @@ void MainWindow::createStatusBar() //createStatusBar
|
||||
|
||||
statusBar()->addWidget(progressBar);
|
||||
progressBar->setMinimumSize (QSize {150, 18});
|
||||
updateProgressBarFormat (!m_mode.startsWith ("WSPR") && m_mode!="Echo" && m_config.watchdog ());
|
||||
updateProgressBarFormat (!m_mode.startsWith ("WSPR") && m_config.watchdog () != 0);
|
||||
}
|
||||
|
||||
void MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::ExitStatus status)
|
||||
@ -1684,11 +1719,11 @@ void MainWindow::on_stopButton_clicked() //stopButton
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::msgBox(QString t) //msgBox
|
||||
void MainWindow::msgBox (QString const& text)
|
||||
{
|
||||
msgBox0.setText(t);
|
||||
msgBox0.setText (text);
|
||||
QApplication::alert (this);
|
||||
msgBox0.exec();
|
||||
msgBox0.exec ();
|
||||
}
|
||||
|
||||
void MainWindow::on_actionOnline_User_Guide_triggered() //Display manual
|
||||
@ -2149,7 +2184,7 @@ void::MainWindow::fast_decode_done()
|
||||
out << message.mid(0,n-2) << endl;
|
||||
f.close();
|
||||
} else {
|
||||
msgBox("Cannot open \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||
msgBox (tr ("Cannot open \"%1\" for append: %2").arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
|
||||
if(m_mode=="JT9" or m_mode=="JTMSK" or m_mode=="MSK144") {
|
||||
@ -2236,7 +2271,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
||||
out << t.mid(0,n-2) << endl;
|
||||
f.close();
|
||||
} else {
|
||||
msgBox("Cannot open \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||
msgBox (tr ("Cannot open \"%1\" for append: %2").arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
|
||||
if (m_config.insert_blank () && m_blankLine)
|
||||
@ -2485,13 +2520,23 @@ void MainWindow::guiUpdate()
|
||||
if (m_auto) auto_tx_mode (false);
|
||||
if(onAirFreq!=m_onAirFreq0) {
|
||||
m_onAirFreq0=onAirFreq;
|
||||
QString t="Please choose another Tx frequency.\n";
|
||||
t+="WSJT-X will not knowingly transmit another\n";
|
||||
t+="mode in the WSPR sub-band on 30 m.";
|
||||
msgBox(t);
|
||||
auto const& message = tr ("Please choose another Tx frequency.\n"
|
||||
"WSJT-X will not knowingly transmit another\n"
|
||||
"mode in the WSPR sub-band on 30 m.");
|
||||
QTimer::singleShot (0, [=] {msgBox (message);}); // don't block guiUpdate
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_mode.startsWith ("WSPR") && m_config.watchdog() != 0
|
||||
&& m_repeatMsg >= m_config. watchdog ()) {
|
||||
m_bTxTime=false;
|
||||
if (m_tune) stop_tuning ();
|
||||
if (m_auto) auto_tx_mode (false);
|
||||
QTimer::singleShot (0, [=] {msgBox ("Runaway Tx watchdog");}); // don't block guiUpdate
|
||||
m_repeatMsg = 0;
|
||||
updateProgressBarFormat (true);
|
||||
}
|
||||
|
||||
float fTR=float((nsec%m_TRperiod))/m_TRperiod;
|
||||
// if(g_iptt==0 and ((m_bTxTime and fTR<0.4) or m_tune )) {
|
||||
if(g_iptt==0 and ((m_bTxTime and fTR<99) or m_tune )) { //### Allow late starts
|
||||
@ -2622,7 +2667,9 @@ void MainWindow::guiUpdate()
|
||||
}
|
||||
else
|
||||
{
|
||||
msgBox("Cannot open \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||
auto const& message = tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ());
|
||||
QTimer::singleShot (0, [=] {msgBox (message);}); // don't block guiUpdate
|
||||
}
|
||||
if (m_config.TX_messages ())
|
||||
{
|
||||
@ -2702,18 +2749,13 @@ void MainWindow::guiUpdate()
|
||||
if (g_iptt == 1 && m_iptt0 == 0)
|
||||
{
|
||||
auto const& current_message = QString::fromLatin1 (msgsent);
|
||||
if(!m_mode.startsWith ("WSPR") && m_mode!="Echo" && m_config.watchdog ()) {
|
||||
if (current_message == m_msgSent0) {
|
||||
m_repeatMsg++;
|
||||
} else {
|
||||
if(!m_mode.startsWith ("WSPR") && m_config.watchdog () != 0) {
|
||||
if (current_message != m_msgSent0) {
|
||||
m_repeatMsg=0; // in case we are auto sequencing
|
||||
m_msgSent0 = current_message;
|
||||
}
|
||||
updateProgressBarFormat (true);
|
||||
}
|
||||
else {
|
||||
updateProgressBarFormat (false);
|
||||
}
|
||||
|
||||
if(!m_tune) {
|
||||
QFile f {m_dataDir.absoluteFilePath ("ALL.TXT")};
|
||||
@ -2725,8 +2767,9 @@ void MainWindow::guiUpdate()
|
||||
<< ": " << m_currentMessage << endl;
|
||||
f.close();
|
||||
} else {
|
||||
msgBox("Cannot open \"" + f.fileName () + "\" for append:" +
|
||||
f.errorString ());
|
||||
auto const& message = tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f.fileName ()).arg(f.errorString ());
|
||||
QTimer::singleShot (0, [=] {msgBox (message);}); // don't block guiUpdate
|
||||
}
|
||||
}
|
||||
|
||||
@ -2844,7 +2887,8 @@ void MainWindow::startTx2()
|
||||
<< m_currentMessage << " " + m_mode << endl;
|
||||
f.close();
|
||||
} else {
|
||||
msgBox("Cannot open \"" + f.fileName () + "\" for append:" + f.errorString ());
|
||||
msgBox (tr ("Cannot open \"%1\" for append: %2")
|
||||
.arg (f.fileName ()).arg (f.errorString ()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2870,17 +2914,6 @@ void MainWindow::stopTx2()
|
||||
on_stopTxButton_clicked();
|
||||
m_nTx73=0;
|
||||
}
|
||||
if (!m_mode.startsWith ("WSPR") && m_mode!="Echo" && m_config.watchdog()) {
|
||||
if (m_repeatMsg >= m_watchdogLimit) {
|
||||
on_stopTxButton_clicked();
|
||||
msgBox("Runaway Tx watchdog");
|
||||
m_repeatMsg = 0;
|
||||
}
|
||||
updateProgressBarFormat (true);
|
||||
}
|
||||
else {
|
||||
updateProgressBarFormat (false);
|
||||
}
|
||||
if(m_mode.startsWith ("WSPR") and m_ntr==-1 and !m_tuneup) {
|
||||
m_wideGraph->setWSPRtransmitted();
|
||||
WSPR_scheduling ();
|
||||
@ -4136,6 +4169,7 @@ void MainWindow::WSPR_config(bool b)
|
||||
auto_tx_label->setText (m_config.quick_call () ? "Auto-Tx-Enable Armed" : "Auto-Tx-Enable Disarmed");
|
||||
m_bSimplex = false;
|
||||
}
|
||||
auto_tx_label->setVisible (!b);
|
||||
enable_DXCC_entity (m_config.DXCC ()); // sets text window proportions and (re)inits the logbook
|
||||
}
|
||||
|
||||
@ -5574,3 +5608,46 @@ void MainWindow::statusUpdate () const
|
||||
m_hisGrid);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::childEvent (QChildEvent * e)
|
||||
{
|
||||
if (e->child ()->isWidgetType ())
|
||||
{
|
||||
switch (e->type ())
|
||||
{
|
||||
case QEvent::ChildAdded: add_child_to_event_filter (e->child ()); break;
|
||||
case QEvent::ChildRemoved: remove_child_from_event_filter (e->child ()); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
QMainWindow::childEvent (e);
|
||||
}
|
||||
|
||||
// add widget and any child widgets to our event filter so that we can
|
||||
// take action on key press ad mouse press events anywhere in the main window
|
||||
void MainWindow::add_child_to_event_filter (QObject * target)
|
||||
{
|
||||
if (target && target->isWidgetType ())
|
||||
{
|
||||
target->installEventFilter (this);
|
||||
}
|
||||
auto const& children = target->children ();
|
||||
for (auto iter = children.begin (); iter != children.end (); ++iter)
|
||||
{
|
||||
add_child_to_event_filter (*iter);
|
||||
}
|
||||
}
|
||||
|
||||
// recursively remove widget and any child widgets from our event filter
|
||||
void MainWindow::remove_child_from_event_filter (QObject * target)
|
||||
{
|
||||
auto const& children = target->children ();
|
||||
for (auto iter = children.begin (); iter != children.end (); ++iter)
|
||||
{
|
||||
remove_child_from_event_filter (*iter);
|
||||
}
|
||||
if (target && target->isWidgetType ())
|
||||
{
|
||||
target->removeEventFilter (this);
|
||||
}
|
||||
}
|
||||
|
13
mainwindow.h
13
mainwindow.h
@ -113,9 +113,9 @@ public slots:
|
||||
|
||||
protected:
|
||||
void keyPressEvent (QKeyEvent *) override;
|
||||
void mousePressEvent (QMouseEvent *) override;
|
||||
void closeEvent(QCloseEvent*) override;
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
void closeEvent(QCloseEvent *) override;
|
||||
void childEvent(QChildEvent *) override;
|
||||
bool eventFilter(QObject *, QEvent *) override;
|
||||
|
||||
private slots:
|
||||
void on_tx1_editingFinished();
|
||||
@ -351,7 +351,6 @@ private:
|
||||
qint32 m_ncw;
|
||||
qint32 m_secID;
|
||||
qint32 m_repeatMsg;
|
||||
qint32 m_watchdogLimit;
|
||||
qint32 m_nSubMode;
|
||||
qint32 m_nclearave;
|
||||
qint32 m_minSync;
|
||||
@ -458,6 +457,7 @@ private:
|
||||
QTimer tuneATU_Timer;
|
||||
QTimer TxAgainTimer;
|
||||
QTimer RxQSYTimer;
|
||||
QTimer minuteTimer;
|
||||
|
||||
QString m_path;
|
||||
QString m_baseCall;
|
||||
@ -514,7 +514,7 @@ private:
|
||||
void writeSettings();
|
||||
void createStatusBar();
|
||||
void updateStatusBar();
|
||||
void msgBox(QString t);
|
||||
void msgBox(QString const&);
|
||||
void genStdMsgs(QString rpt);
|
||||
void clearDX ();
|
||||
void lookup();
|
||||
@ -558,6 +558,9 @@ private:
|
||||
void subProcessError (QProcess *, QProcess::ProcessError);
|
||||
void statusUpdate () const;
|
||||
void updateProgressBarFormat (bool wd_in_use);
|
||||
void on_the_minute ();
|
||||
void add_child_to_event_filter (QObject *);
|
||||
void remove_child_from_event_filter (QObject *);
|
||||
};
|
||||
|
||||
extern int killbyname(const char* progName);
|
||||
|
@ -2,14 +2,6 @@
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>896</width>
|
||||
<height>565</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WSJT-X by K1JT</string>
|
||||
</property>
|
||||
@ -2284,14 +2276,6 @@ QPushButton[state="ok"] {
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menuBar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>896</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
<property name="title">
|
||||
<string>File</string>
|
||||
|
Loading…
Reference in New Issue
Block a user