Added message alerts
This commit is contained in:
parent
4290dd6e2f
commit
571aa6446d
@ -7232,6 +7232,18 @@ void MainWindow::buildQueryMenu(QMenu * menu){
|
||||
addMessageText(QString("%1|").arg(selectedCall), true);
|
||||
});
|
||||
|
||||
auto alertAction = menu->addAction("!message - Please display this message in an alert dialog and ACK if acknowledged");
|
||||
alertAction->setDisabled(isAllCall);
|
||||
connect(alertAction, &QAction::triggered, this, [this](){
|
||||
|
||||
QString selectedCall = callsignSelected();
|
||||
if(selectedCall.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1!").arg(selectedCall), true);
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
auto agnAction = menu->addAction("AGN? - Please repeat your last transmission");
|
||||
@ -8633,6 +8645,8 @@ void MainWindow::displayActivity(bool force){
|
||||
if(Varicode::checksum16Valid(checksum, message)){
|
||||
buffer.cmd.text = message;
|
||||
m_rxCommandQueue.append(buffer.cmd);
|
||||
} else {
|
||||
qDebug() << "Buffered message failed checksum...discarding";
|
||||
}
|
||||
|
||||
// regardless of valid or not, remove the "complete" buffered message from the buffer cache
|
||||
@ -8653,7 +8667,7 @@ void MainWindow::displayActivity(bool force){
|
||||
|
||||
bool isAllCall = d.to == "ALLCALL";
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
qDebug() << "processing command" << d.from << d.to << d.cmd << d.freq;
|
||||
#endif
|
||||
|
||||
@ -8735,6 +8749,35 @@ void MainWindow::displayActivity(bool force){
|
||||
// TODO: jsherer - perhaps parse d.text and ensure it is a valid message as well as prefix it with our call...
|
||||
reply = QString("%1 ACK\n%2 DE %1").arg(d.from).arg(d.text);
|
||||
}
|
||||
// PROCESS ALERT
|
||||
else if(d.cmd == "!" && !isAllCall){
|
||||
|
||||
QMessageBox * msgBox = new QMessageBox(this);
|
||||
msgBox->setIcon(QMessageBox::Information);
|
||||
|
||||
auto header = QString("Message from %3 at %1 (%2):");
|
||||
header = header.arg(d.utcTimestamp.time().toString());
|
||||
header = header.arg(d.freq);
|
||||
header = header.arg(d.from);
|
||||
msgBox->setText(header);
|
||||
msgBox->setInformativeText(d.text);
|
||||
|
||||
|
||||
auto ab = msgBox->addButton("ACK", QMessageBox::AcceptRole);
|
||||
auto db = msgBox->addButton("Discard", QMessageBox::NoRole);
|
||||
|
||||
connect(msgBox, &QMessageBox::buttonClicked, this, [this, d, db, ab](QAbstractButton * btn){
|
||||
if(btn != ab){
|
||||
return;
|
||||
}
|
||||
addMessageText(QString("%1 ACK").arg(d.from));
|
||||
toggleTx(true);
|
||||
});
|
||||
|
||||
msgBox->show();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if(reply.isEmpty()){
|
||||
continue;
|
||||
|
@ -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, 23, 24, 25, 26, 27, 28, 29, 30, 31};
|
||||
|
||||
QSet<int> buffered_cmds = {6, 7};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user