mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-02-03 09:44:24 -05:00
Allow partial processing of UDP Reply messages for non-CQ/QRZ messages
This allows external programs to set up a QSO, for example to tail-end a QSO, but unlike double-clicking a non-CQ/QRZ decode in WSJT-X directly it will not enable auto Tx. This last constraint is to make fully automating WSJT-X using UDP messages impossible. It is expected that programs like JTAlert will, without change, allow users to set up a QSO with any station from the JTAlert UI although for non-CQ/QRZ decodes a QSO can only be started by pushing the "Enable Tx" button in WSJT-X. Thanks to Mike, W9MDB, for the patch that this change is based on, the implementation committed is considerably simpler than his proposed change. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8574 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
63658b3c1f
commit
39c7b11108
@ -6529,63 +6529,58 @@ void MainWindow::replyToCQ (QTime time, qint32 snr, float delta_time, quint32 de
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (message_text.contains (QRegularExpression {R"(^(CQ |CQDX |QRZ ))"}))
|
QString format_string {"%1 %2 %3 %4 %5 %6"};
|
||||||
|
auto const& time_string = time.toString ("~" == mode || "&" == mode ? "hhmmss" : "hhmm");
|
||||||
|
auto cqtext = format_string
|
||||||
|
.arg (time_string)
|
||||||
|
.arg (snr, 3)
|
||||||
|
.arg (delta_time, 4, 'f', 1)
|
||||||
|
.arg (delta_frequency, 4)
|
||||||
|
.arg (mode, -2)
|
||||||
|
.arg (message_text);
|
||||||
|
auto messages = ui->decodedTextBrowser->toPlainText ();
|
||||||
|
auto position = messages.lastIndexOf (cqtext);
|
||||||
|
if (position < 0)
|
||||||
{
|
{
|
||||||
// a message we are willing to accept
|
// try again with with -0.0 delta time
|
||||||
QString format_string {"%1 %2 %3 %4 %5 %6"};
|
position = messages.lastIndexOf (format_string
|
||||||
auto const& time_string = time.toString ("~" == mode || "&" == mode ? "hhmmss" : "hhmm");
|
.arg (time_string)
|
||||||
auto cqtext = format_string
|
.arg (snr, 3)
|
||||||
.arg (time_string)
|
.arg ('-' + QString::number (delta_time, 'f', 1), 4)
|
||||||
.arg (snr, 3)
|
.arg (delta_frequency, 4)
|
||||||
.arg (delta_time, 4, 'f', 1)
|
.arg (mode, -2)
|
||||||
.arg (delta_frequency, 4)
|
.arg (message_text));
|
||||||
.arg (mode, -2)
|
}
|
||||||
.arg (message_text);
|
if (position >= 0)
|
||||||
auto messages = ui->decodedTextBrowser->toPlainText ();
|
{
|
||||||
auto position = messages.lastIndexOf (cqtext);
|
if (m_config.udpWindowToFront ())
|
||||||
if (position < 0)
|
|
||||||
{
|
{
|
||||||
// try again with with -0.0 delta time
|
show ();
|
||||||
position = messages.lastIndexOf (format_string
|
raise ();
|
||||||
.arg (time_string)
|
activateWindow ();
|
||||||
.arg (snr, 3)
|
|
||||||
.arg ('-' + QString::number (delta_time, 'f', 1), 4)
|
|
||||||
.arg (delta_frequency, 4)
|
|
||||||
.arg (mode, -2)
|
|
||||||
.arg (message_text));
|
|
||||||
}
|
}
|
||||||
if (position >= 0)
|
if (m_config.udpWindowRestore () && isMinimized ())
|
||||||
{
|
{
|
||||||
if (m_config.udpWindowToFront ())
|
showNormal ();
|
||||||
{
|
raise ();
|
||||||
show ();
|
|
||||||
raise ();
|
|
||||||
activateWindow ();
|
|
||||||
}
|
|
||||||
if (m_config.udpWindowRestore () && isMinimized ())
|
|
||||||
{
|
|
||||||
showNormal ();
|
|
||||||
raise ();
|
|
||||||
}
|
|
||||||
// find the linefeed at the end of the line
|
|
||||||
position = ui->decodedTextBrowser->toPlainText().indexOf(QChar::LineFeed,position);
|
|
||||||
m_bDoubleClicked = true;
|
|
||||||
auto start = messages.left (position).lastIndexOf (QChar::LineFeed) + 1;
|
|
||||||
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);
|
|
||||||
tx_watchdog (false);
|
|
||||||
QApplication::alert (this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
qDebug () << "reply to CQ request ignored, decode not found:" << cqtext;
|
|
||||||
}
|
}
|
||||||
|
// find the linefeed at the end of the line
|
||||||
|
position = ui->decodedTextBrowser->toPlainText().indexOf(QChar::LineFeed,position);
|
||||||
|
if (message_text.contains (QRegularExpression {R"(^(CQ |CQDX |QRZ ))"})) {
|
||||||
|
// a message we are willing to accept and auto reply to
|
||||||
|
m_bDoubleClicked = true;
|
||||||
|
}
|
||||||
|
auto start = messages.left (position).lastIndexOf (QChar::LineFeed) + 1;
|
||||||
|
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);
|
||||||
|
tx_watchdog (false);
|
||||||
|
QApplication::alert (this);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug () << "rejecting UDP request to reply as decode is not a CQ or QRZ";
|
qDebug () << "process reply message ignored, decode not found:" << cqtext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user