mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-23 18:02:29 -04:00
Made the UDP message to change the free text message optionally send ASAP
This message now has the ability to simply change the free text message or to change the message and send it ASAP. The message_aggregator reference UDP server application exercises this feature by sending a new free text message on any edit and requesting it be sent by WSJT-X when editing is finished i,e, RETURN pressed or focus moved away. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5445 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
0f7708a98a
commit
4bf1471d2b
@ -218,8 +218,11 @@ public:
|
|||||||
auto form_layout = new QFormLayout;
|
auto form_layout = new QFormLayout;
|
||||||
form_layout->addRow (tr ("Free text:"), message_line_edit_);
|
form_layout->addRow (tr ("Free text:"), message_line_edit_);
|
||||||
message_line_edit_->setValidator (new QRegExpValidator {message_alphabet, this});
|
message_line_edit_->setValidator (new QRegExpValidator {message_alphabet, this});
|
||||||
|
connect (message_line_edit_, &QLineEdit::textEdited, [this] (QString const& text) {
|
||||||
|
Q_EMIT do_free_text (id_, text, false);
|
||||||
|
});
|
||||||
connect (message_line_edit_, &QLineEdit::editingFinished, [this] () {
|
connect (message_line_edit_, &QLineEdit::editingFinished, [this] () {
|
||||||
Q_EMIT do_free_text (id_, message_line_edit_->text ());
|
Q_EMIT do_free_text (id_, message_line_edit_->text (), true);
|
||||||
});
|
});
|
||||||
control_layout->addLayout (form_layout);
|
control_layout->addLayout (form_layout);
|
||||||
control_layout->addWidget (auto_off_button_);
|
control_layout->addWidget (auto_off_button_);
|
||||||
@ -285,7 +288,7 @@ public:
|
|||||||
|
|
||||||
Q_SIGNAL void do_reply (QModelIndex const&);
|
Q_SIGNAL void do_reply (QModelIndex const&);
|
||||||
Q_SIGNAL void do_halt_tx (QString const& id, bool auto_only);
|
Q_SIGNAL void do_halt_tx (QString const& id, bool auto_only);
|
||||||
Q_SIGNAL void do_free_text (QString const& id, QString const& text);
|
Q_SIGNAL void do_free_text (QString const& id, QString const& text, bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class DecodesFilterModel final
|
class DecodesFilterModel final
|
||||||
|
@ -137,12 +137,15 @@ void MessageClient::impl::parse_message (QByteArray const& msg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case NetworkMessage::FreeText:
|
case NetworkMessage::FreeText:
|
||||||
if (check_status (in) != Fail)
|
{
|
||||||
{
|
QByteArray message;
|
||||||
QByteArray message;
|
bool send {true};
|
||||||
in >> message;
|
in >> message >> send;
|
||||||
Q_EMIT self_->free_text (QString::fromUtf8 (message));
|
if (check_status (in) != Fail)
|
||||||
}
|
{
|
||||||
|
Q_EMIT self_->free_text (QString::fromUtf8 (message), send);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -75,7 +75,7 @@ public:
|
|||||||
|
|
||||||
// this signal is emitted if the server has requested a new free
|
// this signal is emitted if the server has requested a new free
|
||||||
// message text
|
// message text
|
||||||
Q_SIGNAL void free_text (QString const&);
|
Q_SIGNAL void free_text (QString const&, bool send);
|
||||||
|
|
||||||
// this signal is emitted when network errors occur or if a host
|
// this signal is emitted when network errors occur or if a host
|
||||||
// lookup fails
|
// lookup fails
|
||||||
|
@ -356,14 +356,14 @@ void MessageServer::halt_tx (QString const& id, bool auto_only)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageServer::free_text (QString const& id, QString const& text)
|
void MessageServer::free_text (QString const& id, QString const& text, bool send)
|
||||||
{
|
{
|
||||||
auto iter = m_->clients_.find (id);
|
auto iter = m_->clients_.find (id);
|
||||||
if (iter != std::end (m_->clients_))
|
if (iter != std::end (m_->clients_))
|
||||||
{
|
{
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
NetworkMessage::Builder out {&message, NetworkMessage::FreeText, id};
|
NetworkMessage::Builder out {&message, NetworkMessage::FreeText, id};
|
||||||
out << text.toUtf8 ();
|
out << text.toUtf8 () << send;
|
||||||
if (impl::OK == m_->check_status (out))
|
if (impl::OK == m_->check_status (out))
|
||||||
{
|
{
|
||||||
m_->writeDatagram (message, iter.value ().sender_address_, (*iter).sender_port_);
|
m_->writeDatagram (message, iter.value ().sender_address_, (*iter).sender_port_);
|
||||||
|
@ -52,8 +52,9 @@ public:
|
|||||||
// auto_only just disables auto Tx, otherwise halt is immediate
|
// auto_only just disables auto Tx, otherwise halt is immediate
|
||||||
Q_SLOT void halt_tx (QString const& id, bool auto_only);
|
Q_SLOT void halt_tx (QString const& id, bool auto_only);
|
||||||
|
|
||||||
// ask the client with identification 'id' to set the free text message
|
// ask the client with identification 'id' to set the free text
|
||||||
Q_SLOT void free_text (QString const& id, QString const& text);
|
// message and optionally send it ASAP
|
||||||
|
Q_SLOT void free_text (QString const& id, QString const& text, bool send);
|
||||||
|
|
||||||
// the following signals are emitted when a client broadcasts the
|
// the following signals are emitted when a client broadcasts the
|
||||||
// matching message
|
// matching message
|
||||||
|
@ -196,16 +196,17 @@
|
|||||||
* Free Text In 9
|
* Free Text In 9
|
||||||
* Id (unique key) utf8
|
* Id (unique key) utf8
|
||||||
* Text utf8
|
* Text utf8
|
||||||
|
* Send bool
|
||||||
*
|
*
|
||||||
* This message allows the server to set the current free text
|
* This message allows the server to set the current free text
|
||||||
* message content. Sending this message is equivalent to typing
|
* message content. Sending this message is equivalent to typing
|
||||||
* a new message (old contents are discarded) in to the WSJT-X
|
* a new message (old contents are discarded) in to the WSJT-X
|
||||||
* free text message field or "Tx5" field (both are updated) and
|
* free text message field or "Tx5" field (both are updated) and
|
||||||
* then clicking the "Next" radio button for the "Tx5" field if
|
* if the Send flag is set then clicking the "Now" radio button
|
||||||
* tab one is current or clicking the "Free msg" radio button if
|
* for the "Tx5" field if tab one is current or clicking the
|
||||||
* tab two is current. It is the responsibility of the sender to
|
* "Free msg" radio button if tab two is current. It is the
|
||||||
* limit the length of the message text and to legal message
|
* responsibility of the sender to limit the length of the
|
||||||
* characters.
|
* message text and to limit it to legal message characters.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
|
@ -203,14 +203,18 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect (m_messageClient, &MessageClient::error, this, &MainWindow::networkError);
|
connect (m_messageClient, &MessageClient::error, this, &MainWindow::networkError);
|
||||||
connect (m_messageClient, &MessageClient::free_text, [this] (QString const& text) {
|
connect (m_messageClient, &MessageClient::free_text, [this] (QString const& text, bool send) {
|
||||||
if (m_config.accept_udp_requests ()) {
|
if (m_config.accept_udp_requests ()) {
|
||||||
if (0 == ui->tabWidget->currentIndex ()) {
|
if (0 == ui->tabWidget->currentIndex ()) {
|
||||||
ui->tx5->setCurrentText (text);
|
ui->tx5->setCurrentText (text);
|
||||||
ui->txrb5->click ();
|
if (send) {
|
||||||
} else {
|
ui->txb5->click ();
|
||||||
|
}
|
||||||
|
} else if (1 == ui->tabWidget->currentIndex ()) {
|
||||||
ui->freeTextMsg->setCurrentText (text);
|
ui->freeTextMsg->setCurrentText (text);
|
||||||
ui->rbFreeText->click ();
|
if (send) {
|
||||||
|
ui->rbFreeText->click ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user