From ebd7f465fdcf56720612cc388c9bd372f5c50ae7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 6 Feb 2018 20:27:00 +0000 Subject: [PATCH] As a trial: single-click on a decode to select a new DX Call; double-click to also Enable Tx. Thanks to W9MDB for this patch, which also removes the option *Double-click on call sets Tx Enable*. Please test and report any perceived issues! git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8462 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- Configuration.cpp | 6 --- Configuration.ui | 11 ----- displaytext.cpp | 36 +++++++++++++++- displaytext.h | 12 +++++- doc/user_guide/en/tutorial-example1.adoc | 9 ++-- mainwindow.cpp | 54 +++++++++++++++++------- mainwindow.h | 4 ++ 7 files changed, 93 insertions(+), 39 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index b1cab5b65..15e7d2f18 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -558,7 +558,6 @@ private: bool ppfx_; bool clear_DX_; bool miles_; - bool quick_call_; bool disable_TX_on_73_; int watchdog_; bool TX_messages_; @@ -659,7 +658,6 @@ bool Configuration::DXCC () const {return m_->DXCC_;} bool Configuration::ppfx() const {return m_->ppfx_;} 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_;} int Configuration::watchdog () const {return m_->watchdog_;} bool Configuration::TX_messages () const {return m_->TX_messages_;} @@ -1147,7 +1145,6 @@ void Configuration::impl::initialize_models () ui_->ppfx_check_box->setChecked (ppfx_); ui_->clear_DX_check_box->setChecked (clear_DX_); 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_->tx_watchdog_spin_box->setValue (watchdog_); ui_->TX_messages_check_box->setChecked (TX_messages_); @@ -1384,7 +1381,6 @@ void Configuration::impl::read_settings () ppfx_ = settings_->value ("PrincipalPrefix", false).toBool (); clear_DX_ = settings_->value ("ClearCallGrid", false).toBool (); 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 ("TxWatchdog", 6).toInt (); TX_messages_ = settings_->value ("Tx2QSO", true).toBool (); @@ -1482,7 +1478,6 @@ void Configuration::impl::write_settings () settings_->setValue ("PrincipalPrefix", ppfx_); settings_->setValue ("ClearCallGrid", clear_DX_); settings_->setValue ("Miles", miles_); - settings_->setValue ("QuickCall", quick_call_); settings_->setValue ("73TxDisable", disable_TX_on_73_); settings_->setValue ("TxWatchdog", watchdog_); settings_->setValue ("Tx2QSO", TX_messages_); @@ -1889,7 +1884,6 @@ void Configuration::impl::accept () ppfx_ = ui_->ppfx_check_box->isChecked (); clear_DX_ = ui_->clear_DX_check_box->isChecked (); 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_->tx_watchdog_spin_box->value (); TX_messages_ = ui_->TX_messages_check_box->isChecked (); diff --git a/Configuration.ui b/Configuration.ui index 2c1f9b173..63f487265 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -450,16 +450,6 @@ quiet period when decoding is done. - - - Automatic transmission mode. - - - Doubl&e-click on call sets Tx enable - - - - Turns off automatic transmissions after sending a 73 or any other free @@ -2624,7 +2614,6 @@ soundcard changes decoded_text_font_push_button monitor_off_check_box monitor_last_used_check_box - quick_call_check_box tx_watchdog_spin_box CW_id_after_73_check_box enable_VHF_features_check_box diff --git a/displaytext.cpp b/displaytext.cpp index 0fa3682d7..4f3c36737 100644 --- a/displaytext.cpp +++ b/displaytext.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "qt_helpers.hpp" @@ -32,6 +33,8 @@ DisplayText::DisplayText(QWidget *parent) delete menu; }); connect (erase_action_, &QAction::triggered, this, &DisplayText::erase); + qTimerMouseClick=new QTimer(); + connect(qTimerMouseClick,SIGNAL(timeout()),this,SLOT(mouseTimeout())); } void DisplayText::erase () @@ -61,9 +64,40 @@ void DisplayText::setContentFont(QFont const& font) ensureCursorVisible (); } +void DisplayText::mouseTimeout() +{ + qTimerMouseClick->stop(); + Q_EMIT selectCallsignSingleClick(mouseKeyboardModifiers); +} + +void DisplayText::mousePressEvent(QMouseEvent *e) +{ + qTimerMouseClick->stop(); + mouseStartPos = QCursor::pos(); + mouseKeyboardModifiers = e->modifiers(); + selectedLength = textCursor().selectedText().length(); + QTextEdit::mousePressEvent(e); +} + +void DisplayText::mouseReleaseEvent(QMouseEvent *e) +{ + // If our mouse doesn't move then it's the single click event we want + QPoint mouseChanged = mouseStartPos-QCursor::pos(); + if (e->button() == Qt::LeftButton + && mouseKeyboardModifiers == Qt::NoModifier + && selectedLength == 0 + && mouseChanged.x() == 0 + && mouseChanged.y() == 0) + { + qTimerMouseClick->start(500); + } + QTextEdit::mouseReleaseEvent(e); +} + void DisplayText::mouseDoubleClickEvent(QMouseEvent *e) { - Q_EMIT selectCallsign(e->modifiers ()); + qTimerMouseClick->stop(); + Q_EMIT selectCallsignDoubleClick(e->modifiers ()); QTextEdit::mouseDoubleClickEvent(e); } diff --git a/displaytext.h b/displaytext.h index 0e027d9eb..a6871b75c 100644 --- a/displaytext.h +++ b/displaytext.h @@ -27,13 +27,16 @@ public: void displayQSY(QString text); void displayFoxToBeCalled(QString t, QColor bg); - Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers); + Q_SIGNAL void selectCallsignDoubleClick (Qt::KeyboardModifiers); + Q_SIGNAL void selectCallsignSingleClick (Qt::KeyboardModifiers); Q_SIGNAL void erased (); Q_SLOT void appendText (QString const& text, QColor bg = Qt::white); Q_SLOT void erase (); protected: + void mousePressEvent(QMouseEvent *e); + void mouseReleaseEvent(QMouseEvent *e); void mouseDoubleClickEvent(QMouseEvent *e); private: @@ -43,6 +46,13 @@ private: QFont char_font_; QAction * erase_action_; + QTimer *qTimerMouseClick; + QPoint mouseStartPos; + int selectedLength; + Qt::KeyboardModifiers mouseKeyboardModifiers; +private slots: + void mouseTimeout (); + }; #endif // DISPLAYTEXT_H diff --git a/doc/user_guide/en/tutorial-example1.adoc b/doc/user_guide/en/tutorial-example1.adoc index 470d5d9c8..8ad5d73bb 100644 --- a/doc/user_guide/en/tutorial-example1.adoc +++ b/doc/user_guide/en/tutorial-example1.adoc @@ -40,8 +40,8 @@ try clicking with the mouse on the decoded text lines and on the waterfall spectral display. You should be able to confirm the following behavior: -- Double-click on either of the decoded lines highlighted in -green. This action produces the following results: +- Click or double-click on either of the decoded lines highlighted in +green. These actions produce the following results: ** Callsign and locator of a station calling CQ are copied to the *DX Call* and *DX Grid* entry fields. @@ -57,9 +57,8 @@ station. ** The *Gen Msg* ("`generated message`") radio button at bottom right of the main window is selected. -** If you had checked *Double-click on call sets Tx Enable* on the -*Setup* menu, *Enable Tx* would be activated and a transmission would -start automatically at the proper time. +** *Double-click* does all of the above and also activates *Enable Tx* +so that a transmission will start automatically at the proper time. ** You can modify the double-click behavior by holding down the *Shift* key to move only the Tx frequency or the *Ctrl* key to move diff --git a/mainwindow.cpp b/mainwindow.cpp index e7c233fcb..3954c1d59 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -557,11 +557,13 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, txMsgButtonGroup->addButton(ui->txrb6,6); set_dateTimeQSO(-1); connect(txMsgButtonGroup,SIGNAL(buttonClicked(int)),SLOT(set_ntx(int))); - connect (ui->decodedTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall2); - connect (ui->decodedTextBrowser2, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall); - connect (ui->textBrowser4, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnFoxQueue); - connect (ui->decodedTextBrowser, &DisplayText::erased, this, &MainWindow::band_activity_cleared); + connect (ui->decodedTextBrowser2, &DisplayText::selectCallsignDoubleClick, this, &MainWindow::doubleClickOnCall2); + connect (ui->decodedTextBrowser2, &DisplayText::selectCallsignSingleClick, this, &MainWindow::singleClickOnCall2); + connect (ui->decodedTextBrowser, &DisplayText::selectCallsignDoubleClick, this, &MainWindow::doubleClickOnCall); + connect (ui->decodedTextBrowser, &DisplayText::selectCallsignSingleClick, this, &MainWindow::singleClickOnCall); + connect (ui->decodedTextBrowser, &DisplayText::erased, this, &MainWindow::band_activity_cleared); connect (ui->decodedTextBrowser2, &DisplayText::erased, this, &MainWindow::rx_frequency_activity_cleared); + connect (ui->textBrowser4, &DisplayText::selectCallsignDoubleClick, this, &MainWindow::doubleClickOnFoxQueue); // initialize decoded text font and hook up font change signals // defer initialization until after construction otherwise menu @@ -3910,15 +3912,37 @@ void MainWindow::on_txb6_clicked() if (m_transmitting) m_restart=true; } -void MainWindow::doubleClickOnCall2(Qt::KeyboardModifiers modifiers) +void MainWindow::singleClickOnCall(Qt::KeyboardModifiers modifiers) { - set_dateTimeQSO(-1); // reset our QSO start time - m_decodedText2=true; - doubleClickOnCall(modifiers); - m_decodedText2=false; + m_bSingleClicked = true; + m_bDoubleClicked = false; + clickOnCall(modifiers); } void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers) +{ + m_bSingleClicked = false; + m_bDoubleClicked = true; + clickOnCall(modifiers); +} + +void MainWindow::singleClickOnCall2(Qt::KeyboardModifiers modifiers) +{ + m_decodedText2=true; + clickOnCall(modifiers); + m_decodedText2=false; +} + +void MainWindow::doubleClickOnCall2(Qt::KeyboardModifiers modifiers) +{ + set_dateTimeQSO(-1); // reset our QSO start time + m_bDoubleClicked=true; + m_decodedText2=true; + clickOnCall(modifiers); + m_decodedText2=false; +} + +void MainWindow::clickOnCall(Qt::KeyboardModifiers modifiers) { QTextCursor cursor; if(m_mode=="ISCAT") { @@ -3926,9 +3950,9 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers) "Double-click not presently implemented for ISCAT mode"); } if(m_decodedText2) { - cursor=ui->decodedTextBrowser->textCursor(); - } else { cursor=ui->decodedTextBrowser2->textCursor(); + } else { + cursor=ui->decodedTextBrowser->textCursor(); } if(modifiers==(Qt::ShiftModifier + Qt::ControlModifier + Qt::AltModifier)) { @@ -3946,7 +3970,6 @@ void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers) } DecodedText message {cursor.block().text(), ("MSK144" == m_mode || "FT8" == m_mode) && ui->cbVHFcontest->isChecked(), m_config.my_grid ()}; - m_bDoubleClicked = true; processMessage (message, modifiers); } @@ -4079,7 +4102,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie && firstcall != m_config.my_callsign () && firstcall != m_baseCall && firstcall != "DE") || "CQ" == firstcall || "QRZ" == firstcall || ctrl || shift) { - if (!m_holdTxFreq and (shift or ctrl)) { + if (!m_holdTxFreq or (m_holdTxFreq and (shift or ctrl))) { ui->TxFreqSpinBox->setValue(frequency); } if(m_mode != "JT4" && m_mode != "JT65" && !m_mode.startsWith ("JT9") && @@ -4325,9 +4348,10 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie } if(m_transmitting) m_restart=true; - if (ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isChecked () && !m_bDoubleClicked) return; - if(m_config.quick_call()) auto_tx_mode(true); + if (ui->cbAutoSeq->isVisible () && ui->cbAutoSeq->isChecked () && !m_bDoubleClicked && !m_bSingleClicked) return; + if(m_bDoubleClicked) auto_tx_mode(true); m_bDoubleClicked=false; + m_bSingleClicked=false; } void MainWindow::genCQMsg () diff --git a/mainwindow.h b/mainwindow.h index 0898ba252..2b36f5e2d 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -107,8 +107,11 @@ public slots: void diskDat(); void freezeDecode(int n); void guiUpdate(); + void clickOnCall (Qt::KeyboardModifiers); void doubleClickOnCall (Qt::KeyboardModifiers); void doubleClickOnCall2(Qt::KeyboardModifiers); + void singleClickOnCall(Qt::KeyboardModifiers); + void singleClickOnCall2(Qt::KeyboardModifiers); void doubleClickOnFoxQueue(Qt::KeyboardModifiers); void readFromStdout(); void p1ReadFromStdout(); @@ -480,6 +483,7 @@ private: bool m_bNoMoreFiles; bool m_bQRAsyncWarned; bool m_bDoubleClicked; + bool m_bSingleClicked; bool m_bCallingCQ; bool m_bAutoReply; bool m_bCheckedContest;