Remove Tab 1/2 differences from UDP interface

The UDP "Free  text" message comamnd should  not expose implementation
differences between tab one and tab two. The "send next" capability is
not available on  tab two so use  of it has been removed  from the UDP
interface.

The ability  to trigger  the immediate  (or in next  Tx period  if the
current period  is Rx) sending  of the  current free text  message has
been added to the UDP interface. This is done by sending a "Free text"
UDP message containing an empty text message with the "Send" flag set.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5725 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-07-27 11:34:11 +00:00
parent 8ed8b9eb13
commit 16c5e08197
3 changed files with 50 additions and 23 deletions

View File

@ -222,7 +222,7 @@ public:
Q_EMIT do_free_text (id_, text, false);
});
connect (message_line_edit_, &QLineEdit::editingFinished, [this] () {
Q_EMIT do_free_text (id_, message_line_edit_->text (), !message_line_edit_->text ().isEmpty ());
Q_EMIT do_free_text (id_, message_line_edit_->text (), true);
});
control_layout->addLayout (form_layout);
control_layout->addWidget (auto_off_button_);

View File

@ -199,14 +199,29 @@
* Send bool
*
* This message allows the server to set the current free text
* message content. Sending this message is equivalent to typing
* a new message (old contents are discarded) in to the WSJT-X
* free text message field or "Tx5" field (both are updated) and
* if the Send flag is set then clicking the "Now" radio button
* for the "Tx5" field if tab one is current or clicking the
* "Free msg" radio button if tab two is current. It is the
* responsibility of the sender to limit the length of the
* message text and to limit it to legal message characters.
* message content. Sending this message with a non-empty "Text"
* field is equivalent to typing a new message (old contents are
* discarded) in to the WSJT-X free text message field or "Tx5"
* field (both are updated) and if the "Send" flag is set then
* clicking the "Now" radio button for the "Tx5" field if tab one
* is current or clicking the "Free msg" radio button if tab two
* is current.
*
* It is the responsibility of the sender to limit the length of
* the message text and to limit it to legal message
* characters. Despite this, it may be difficult for the sender
* to determine the maximum message length without reimplementing
* the complete message encoding protocol. Because of this is may
* be better to allow any reasonable message length and to let
* the WSJT-X application encode and possibly truncate the actual
* on-air message.
*
* If the message text is empty the meaning of the message is
* refined to send the current free text unchanged when the
* "Send" flag is set or to clear the current free text when the
* "Send" flag is unset. Note that this API does not include a
* command to determine the contents of the current free text
* message.
*/
#include <QDataStream>

View File

@ -201,22 +201,34 @@ MainWindow::MainWindow(bool multiple, QSettings * settings, QSharedMemory *shdme
});
connect (m_messageClient, &MessageClient::error, this, &MainWindow::networkError);
connect (m_messageClient, &MessageClient::free_text, [this] (QString const& text, bool send) {
if (m_config.accept_udp_requests ()) {
if (0 == ui->tabWidget->currentIndex ()) {
ui->tx5->setCurrentText (text);
if (send) {
ui->txb5->click ();
} else {
ui->txrb5->click ();
}
} else if (1 == ui->tabWidget->currentIndex ()) {
ui->freeTextMsg->setCurrentText (text);
if (send) {
ui->rbFreeText->click ();
if (m_config.accept_udp_requests ()) {
// send + non-empty text means set and send the free text
// message, !send + non-empty text means set the current free
// 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);
}
if (send) {
ui->txb5->click ();
} else if (text.isEmpty ()) {
ui->tx5->setCurrentText (text);
}
} else if (1 == ui->tabWidget->currentIndex ()) {
if (!text.isEmpty ()) {
ui->freeTextMsg->setCurrentText (text);
}
if (send) {
ui->rbFreeText->click ();
} else if (text.isEmpty ()) {
ui->freeTextMsg->setCurrentText (text);
}
}
}
}
});
});
// Hook up WSPR band hopping
connect (ui->band_hopping_schedule_push_button, &QPushButton::clicked