Automatic reply to AGN queries. Restore last message in the text area menu
This commit is contained in:
parent
7c656fac71
commit
17033f1044
@ -1077,8 +1077,23 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
auto clearAction2 = new QAction(QIcon::fromTheme("edit-clear"), QString("Clear"), ui->extFreeTextMsgEdit);
|
||||
connect(clearAction2, &QAction::triggered, this, [this](){ this->on_clearAction_triggered(ui->extFreeTextMsgEdit); });
|
||||
ui->extFreeTextMsgEdit->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
ui->extFreeTextMsgEdit->addAction(clearAction2);
|
||||
ui->extFreeTextMsgEdit->addAction(clearActionAll);
|
||||
|
||||
auto restoreAction = new QAction(QString("Restore Previous Message"), ui->extFreeTextMsgEdit);
|
||||
connect(restoreAction, &QAction::triggered, this, [this](){ this->restoreMessage(); });
|
||||
|
||||
ui->extFreeTextMsgEdit->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->extFreeTextMsgEdit, &QTableWidget::customContextMenuRequested, this, [this, clearAction2, clearActionAll, restoreAction](QPoint const &point){
|
||||
QMenu * menu = new QMenu(ui->extFreeTextMsgEdit);
|
||||
|
||||
restoreAction->setDisabled(m_lastTxMessage.isEmpty());
|
||||
menu->addAction(restoreAction);
|
||||
|
||||
menu->addSeparator();
|
||||
menu->addAction(clearAction2);
|
||||
menu->addAction(clearActionAll);
|
||||
|
||||
menu->popup(ui->extFreeTextMsgEdit->mapToGlobal(point));
|
||||
});
|
||||
|
||||
auto clearAction3 = new QAction(QIcon::fromTheme("edit-clear"), QString("Clear"), ui->tableWidgetRXAll);
|
||||
connect(clearAction3, &QAction::triggered, this, [this](){ this->on_clearAction_triggered(ui->tableWidgetRXAll); });
|
||||
@ -5440,6 +5455,7 @@ void MainWindow::clearActivity(){
|
||||
m_rxFrameBlockNumbers.clear();
|
||||
m_rxFrameQueue.clear();
|
||||
m_rxCommandQueue.clear();
|
||||
m_lastTxMessage.clear();
|
||||
|
||||
clearTableWidget(ui->tableWidgetCalls);
|
||||
|
||||
@ -5571,6 +5587,13 @@ void MainWindow::createMessageTransmitQueue(QString const& text){
|
||||
m_lastTxMessage = text;
|
||||
}
|
||||
|
||||
void MainWindow::restoreMessage(){
|
||||
if(m_lastTxMessage.isEmpty()){
|
||||
return;
|
||||
}
|
||||
addMessageText(m_lastTxMessage, true);
|
||||
}
|
||||
|
||||
void MainWindow::resetMessageTransmitQueue(){
|
||||
m_txFrameCount = 0;
|
||||
m_txFrameQueue.clear();
|
||||
@ -7097,6 +7120,7 @@ void MainWindow::on_clearAction_triggered(QObject * sender){
|
||||
|
||||
if(sender == ui->extFreeTextMsgEdit){
|
||||
resetMessage();
|
||||
m_lastTxMessage.clear();
|
||||
}
|
||||
|
||||
if(sender == ui->textEditRX){
|
||||
@ -8834,6 +8858,8 @@ void MainWindow::displayActivity(bool force){
|
||||
msgBox->show();
|
||||
|
||||
continue;
|
||||
} else if(d.cmd == " AGN?" && !isAllCall && !m_lastTxMessage.isEmpty()){
|
||||
reply = m_lastTxMessage;
|
||||
}
|
||||
|
||||
if(reply.isEmpty()){
|
||||
|
@ -127,6 +127,7 @@ public slots:
|
||||
void addMessageText(QString text, bool clear=false);
|
||||
void resetMessage();
|
||||
void resetMessageUI();
|
||||
void restoreMessage();
|
||||
void createMessage(QString const& text);
|
||||
void createMessageTransmitQueue(QString const& text);
|
||||
void resetMessageTransmitQueue();
|
||||
|
@ -39,11 +39,11 @@ QMap<QString, int> directed_cmds = {
|
||||
// any changes here need to be made also in the directed regular xpression for parsing
|
||||
|
||||
// directed queries
|
||||
{"?", 0 }, // query ack
|
||||
{"?", 0 }, // query snr
|
||||
{"@", 1 }, // query qth
|
||||
{"&", 2 }, // query station message
|
||||
{"$", 3 }, // query station(s) heard
|
||||
{"^", 4 }, // query snr
|
||||
// {"^", 4 }, // query ack
|
||||
{"%", 5 }, // query pwr
|
||||
{"|", 6 }, // relay message?
|
||||
{"!", 7 }, // alert message?
|
||||
@ -63,7 +63,7 @@ QMap<QString, int> directed_cmds = {
|
||||
{" ", 31 }, // send freetext
|
||||
};
|
||||
|
||||
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, 5, 6, 7, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||
QSet<int> allowed_cmds = {0, 1, 2, 3, 4, 5, 6, 7, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||
|
||||
QSet<int> buffered_cmds = {6, 7};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user