Generic handling of keyboard modifiers via UDP and double-clicks

This  change opens  up  all  keyboard modifier  options  to UDP  Reply
messages as well as double-clicks of decoded messages.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8168 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2017-10-13 22:34:36 +00:00
parent 6424b4986f
commit 895ff4dcc0
4 changed files with 18 additions and 18 deletions

View File

@ -63,10 +63,7 @@ void DisplayText::setContentFont(QFont const& font)
void DisplayText::mouseDoubleClickEvent(QMouseEvent *e)
{
bool shift = (e->modifiers() & Qt::ShiftModifier);
bool ctrl = (e->modifiers() & Qt::ControlModifier);
bool alt = (e->modifiers() & Qt::AltModifier);
emit(selectCallsign(shift,ctrl,alt));
Q_EMIT selectCallsign(e->modifiers ());
QTextEdit::mouseDoubleClickEvent(e);
}

View File

@ -26,7 +26,7 @@ public:
QColor color_TxMsg, bool bFastMode);
void displayQSY(QString text);
Q_SIGNAL void selectCallsign (bool shift, bool ctrl, bool alt);
Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers);
Q_SIGNAL void erased ();
Q_SLOT void appendText (QString const& text, QColor bg = Qt::white);

View File

@ -551,10 +551,8 @@ 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->decodedTextBrowser2,SIGNAL(selectCallsign(bool,bool,bool)),this,
SLOT(doubleClickOnCall(bool,bool,bool)));
connect(ui->decodedTextBrowser,SIGNAL(selectCallsign(bool,bool,bool)),this,
SLOT(doubleClickOnCall2(bool,bool,bool)));
connect (ui->decodedTextBrowser2, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall);
connect (ui->decodedTextBrowser, &DisplayText::selectCallsign, this, &MainWindow::doubleClickOnCall2);
connect (ui->decodedTextBrowser, &DisplayText::erased, this, &MainWindow::band_activity_cleared);
connect (ui->decodedTextBrowser2, &DisplayText::erased, this, &MainWindow::rx_frequency_activity_cleared);
@ -3729,15 +3727,15 @@ void MainWindow::on_txb6_clicked()
if (m_transmitting) m_restart=true;
}
void MainWindow::doubleClickOnCall2(bool shift, bool ctrl, bool alt)
void MainWindow::doubleClickOnCall2(Qt::KeyboardModifiers modifiers)
{
set_dateTimeQSO(-1); // reset our QSO start time
m_decodedText2=true;
doubleClickOnCall(shift,ctrl,alt);
doubleClickOnCall(modifiers);
m_decodedText2=false;
}
void MainWindow::doubleClickOnCall(bool shift, bool ctrl, bool alt)
void MainWindow::doubleClickOnCall(Qt::KeyboardModifiers modifiers)
{
QTextCursor cursor;
if(m_mode=="ISCAT") {
@ -3754,11 +3752,16 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl, bool alt)
DecodedText message {cursor.block ().text (), ("MSK144" == m_mode || "FT8" == m_mode) &&
ui->cbVHFcontest->isChecked(), m_config.my_grid ()};
m_bDoubleClicked = true;
processMessage (message, shift, ctrl, alt);
processMessage (message, modifiers);
}
void MainWindow::processMessage(DecodedText const& message, bool shift, bool ctrl, bool alt)
void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifiers modifiers)
{
// decode keyboard modifiers we are interested in
auto shift = modifiers.testFlag (Qt::ShiftModifier);
auto ctrl = modifiers.testFlag (Qt::ControlModifier);
// auto alt = modifiers.testFlag (Qt::AltModifier);
// basic mode sanity checks
auto const& parts = message.string ().split (' ', QString::SkipEmptyParts);
if (parts.size () < 5) return;
@ -6246,7 +6249,7 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de
DecodedText message {messages.mid (start, position - start), ("MSK144" == m_mode || "FT8" == m_mode) &&
ui->cbVHFcontest->isChecked(), m_config.my_grid ()};
Qt::KeyboardModifiers kbmod {modifiers << 24};
processMessage (message, kbmod & Qt::ControlModifier,kbmod & Qt::AltModifier);
processMessage (message, kbmod);
tx_watchdog (false);
QApplication::alert (this);
}

View File

@ -107,8 +107,8 @@ public slots:
void diskDat();
void freezeDecode(int n);
void guiUpdate();
void doubleClickOnCall(bool shift, bool ctrl, bool alt);
void doubleClickOnCall2(bool shift, bool ctrl, bool alt);
void doubleClickOnCall (Qt::KeyboardModifiers);
void doubleClickOnCall2(Qt::KeyboardModifiers);
void readFromStdout();
void p1ReadFromStdout();
void setXIT(int n, Frequency base = 0u);
@ -602,7 +602,7 @@ private:
void pskPost(DecodedText const& decodedtext);
void displayDialFrequency ();
void transmitDisplay (bool);
void processMessage(DecodedText const&, bool shift=false, bool ctrl = false, bool alt = false);
void processMessage(DecodedText const&, Qt::KeyboardModifiers = 0);
void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text, bool low_confidence, quint8 modifiers);
void replayDecodes ();
void postDecode (bool is_new, QString const& message);