Replaced character queries with textual queries to make it easier to read
This commit is contained in:
parent
65a2411c46
commit
9f7fd2e7e2
153
mainwindow.cpp
153
mainwindow.cpp
@ -2654,7 +2654,6 @@ bool MainWindow::eventFilter (QObject * object, QEvent * event)
|
||||
// fall through
|
||||
case QEvent::MouseButtonPress:
|
||||
// reset the Tx watchdog
|
||||
qDebug() << event;
|
||||
resetIdleTimer();
|
||||
tx_watchdog (false);
|
||||
break;
|
||||
@ -6269,6 +6268,30 @@ void MainWindow::on_replyMacroButton_clicked(){
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_snrMacroButton_clicked(){
|
||||
QString call = callsignSelected();
|
||||
if(call.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
auto now = DriftingDateTime::currentDateTimeUtc();
|
||||
int callsignAging = m_config.callsign_aging();
|
||||
if(!m_callActivity.contains(call)){
|
||||
return;
|
||||
}
|
||||
|
||||
auto cd = m_callActivity[call];
|
||||
if (callsignAging && cd.utcTimestamp.secsTo(now) / 60 >= callsignAging) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto snr = Varicode::formatSNR(cd.snr);
|
||||
|
||||
addMessageText(QString("%1 SNR %2").arg(call).arg(snr));
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
}
|
||||
|
||||
void MainWindow::on_qthMacroButton_clicked(){
|
||||
QString qth = m_config.my_qth();
|
||||
if(qth.isEmpty()){
|
||||
@ -6394,6 +6417,10 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
|
||||
auto grid = m_config.my_grid();
|
||||
|
||||
bool emptyQTC = m_config.my_station().isEmpty();
|
||||
bool emptyQTH = m_config.my_qth().isEmpty();
|
||||
bool emptyGrid = m_config.my_grid().isEmpty();
|
||||
|
||||
auto callAction = menu->addAction(QString("Send a directed message to selected callsign"));
|
||||
connect(callAction, &QAction::triggered, this, [this](){
|
||||
|
||||
@ -6438,9 +6465,52 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
auto qtcAction = menu->addAction(QString("%1 QTC - Send my station message").arg(call).trimmed());
|
||||
qtcAction->setDisabled(emptyQTC);
|
||||
connect(qtcAction, &QAction::triggered, this, [this](){
|
||||
|
||||
QString selectedCall = callsignSelected();
|
||||
if(selectedCall.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1 QTC %2").arg(selectedCall).arg(m_config.my_station()), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
auto qthAction = menu->addAction(QString("%1 QTH - Send my station location message").arg(call).trimmed());
|
||||
qthAction->setDisabled(emptyQTH);
|
||||
connect(qthAction, &QAction::triggered, this, [this](){
|
||||
|
||||
QString selectedCall = callsignSelected();
|
||||
if(selectedCall.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1 QTH %2").arg(selectedCall).arg(m_config.my_qth()), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
|
||||
auto gridAction = menu->addAction(QString("%1 GRID %2 - Send my current station Maidenhead grid locator").arg(call).arg(grid).trimmed());
|
||||
gridAction->setDisabled(emptyGrid);
|
||||
connect(gridAction, &QAction::triggered, this, [this](){
|
||||
|
||||
QString selectedCall = callsignSelected();
|
||||
if(selectedCall.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1 GRID %2").arg(selectedCall).arg(m_config.my_grid()), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
auto snrQueryAction = menu->addAction(QString("%1? - What is my signal report?").arg(call));
|
||||
auto snrQueryAction = menu->addAction(QString("%1 SNR? - What is my signal report?").arg(call));
|
||||
snrQueryAction->setDisabled(isAllCall);
|
||||
connect(snrQueryAction, &QAction::triggered, this, [this](){
|
||||
|
||||
@ -6449,12 +6519,12 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1?").arg(selectedCall), true);
|
||||
addMessageText(QString("%1 SNR?").arg(selectedCall), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
auto qthQueryAction = menu->addAction(QString("%1@ - What is your QTH message?").arg(call));
|
||||
auto qthQueryAction = menu->addAction(QString("%1 QTH? - What is your QTH message?").arg(call));
|
||||
qthQueryAction->setDisabled(isAllCall);
|
||||
connect(qthQueryAction, &QAction::triggered, this, [this](){
|
||||
|
||||
@ -6463,12 +6533,12 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1@").arg(selectedCall), true);
|
||||
addMessageText(QString("%1 QTH?").arg(selectedCall), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
auto gridQueryAction = menu->addAction(QString("%1^ - What is your current grid locator?").arg(call));
|
||||
auto gridQueryAction = menu->addAction(QString("%1 GRID? - What is your current grid locator?").arg(call));
|
||||
gridQueryAction->setDisabled(isAllCall);
|
||||
connect(gridQueryAction, &QAction::triggered, this, [this](){
|
||||
|
||||
@ -6477,12 +6547,12 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1^").arg(selectedCall), true);
|
||||
addMessageText(QString("%1 GRID?").arg(selectedCall), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
auto stationMessageQueryAction = menu->addAction(QString("%1&& - What is your station message?").arg(call).trimmed());
|
||||
auto stationMessageQueryAction = menu->addAction(QString("%1 QTC? - What is your station message?").arg(call).trimmed());
|
||||
stationMessageQueryAction->setDisabled(isAllCall);
|
||||
connect(stationMessageQueryAction, &QAction::triggered, this, [this](){
|
||||
|
||||
@ -6491,12 +6561,12 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1&").arg(selectedCall), true);
|
||||
addMessageText(QString("%1 QTC?").arg(selectedCall), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
auto stationIdleQueryAction = menu->addAction(QString("%1* - Is your station active or idle?").arg(call).trimmed());
|
||||
auto stationIdleQueryAction = menu->addAction(QString("%1 STATUS? - Is your station active or idle?").arg(call).trimmed());
|
||||
stationIdleQueryAction->setDisabled(isAllCall);
|
||||
connect(stationIdleQueryAction, &QAction::triggered, this, [this](){
|
||||
|
||||
@ -6505,7 +6575,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1*").arg(selectedCall), true);
|
||||
addMessageText(QString("%1 STATUS?").arg(selectedCall), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
@ -6575,56 +6645,6 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){
|
||||
addMessageText(QString("%1 HEARTBEAT REQ [CALLSIGN]?").arg(selectedCall), true, true);
|
||||
});
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
bool emptyQTC = m_config.my_station().isEmpty();
|
||||
bool emptyQTH = m_config.my_qth().isEmpty();
|
||||
bool emptyGrid = m_config.my_grid().isEmpty();
|
||||
|
||||
auto qtcAction = menu->addAction(QString("%1 QTC - Send my station message").arg(call).trimmed());
|
||||
qtcAction->setDisabled(emptyQTC);
|
||||
connect(qtcAction, &QAction::triggered, this, [this](){
|
||||
|
||||
QString selectedCall = callsignSelected();
|
||||
if(selectedCall.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1 QTC %2").arg(selectedCall).arg(m_config.my_station()), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
auto qthAction = menu->addAction(QString("%1 QTH - Send my station location message").arg(call).trimmed());
|
||||
qthAction->setDisabled(emptyQTH);
|
||||
connect(qthAction, &QAction::triggered, this, [this](){
|
||||
|
||||
QString selectedCall = callsignSelected();
|
||||
if(selectedCall.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1 QTH %2").arg(selectedCall).arg(m_config.my_qth()), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
|
||||
auto gridAction = menu->addAction(QString("%1 GRID %2 - Send my current station Maidenhead grid locator").arg(call).arg(grid).trimmed());
|
||||
gridAction->setDisabled(emptyGrid);
|
||||
connect(gridAction, &QAction::triggered, this, [this](){
|
||||
|
||||
QString selectedCall = callsignSelected();
|
||||
if(selectedCall.isEmpty()){
|
||||
return;
|
||||
}
|
||||
|
||||
addMessageText(QString("%1 GRID %2").arg(selectedCall).arg(m_config.my_grid()), true);
|
||||
|
||||
if(m_config.transmit_directed()) toggleTx(true);
|
||||
});
|
||||
|
||||
|
||||
menu->addSeparator();
|
||||
|
||||
auto agnAction = menu->addAction(QString("%1 AGN? - Please repeat your last transmission").arg(call).trimmed());
|
||||
@ -7933,6 +7953,7 @@ void MainWindow::updateButtonDisplay(){
|
||||
|
||||
ui->cqMacroButton->setDisabled(isTransmitting);
|
||||
ui->replyMacroButton->setDisabled(isTransmitting || emptyCallsign);
|
||||
ui->snrMacroButton->setDisabled(isTransmitting || emptyCallsign);
|
||||
ui->qtcMacroButton->setDisabled(isTransmitting || m_config.my_station().isEmpty());
|
||||
ui->qthMacroButton->setDisabled(isTransmitting || m_config.my_qth().isEmpty());
|
||||
ui->macrosMacroButton->setDisabled(isTransmitting);
|
||||
@ -8627,12 +8648,12 @@ void MainWindow::processCommandActivity() {
|
||||
int freq = -1;
|
||||
|
||||
// QUERIED SNR
|
||||
if (d.cmd == "?" && !isAllCall) {
|
||||
if (d.cmd == " SNR?" && !isAllCall) {
|
||||
reply = QString("%1 SNR %2").arg(d.from).arg(Varicode::formatSNR(d.snr));
|
||||
}
|
||||
|
||||
// QUERIED QTH
|
||||
else if (d.cmd == "@" && !isAllCall) {
|
||||
else if (d.cmd == " QTH?" && !isAllCall) {
|
||||
QString qth = m_config.my_qth();
|
||||
if (qth.isEmpty()) {
|
||||
continue;
|
||||
@ -8642,7 +8663,7 @@ void MainWindow::processCommandActivity() {
|
||||
}
|
||||
|
||||
// QUERIED ACTIVE
|
||||
else if (d.cmd == "*" && !isAllCall) {
|
||||
else if (d.cmd == " STATUS?" && !isAllCall) {
|
||||
if(m_idleMinutes < 10){
|
||||
reply = QString("%1 ACTIVE").arg(d.from);
|
||||
} else {
|
||||
@ -8651,7 +8672,7 @@ void MainWindow::processCommandActivity() {
|
||||
}
|
||||
|
||||
// QUERIED GRID
|
||||
else if (d.cmd == "^" && !isAllCall) {
|
||||
else if (d.cmd == " GRID?" && !isAllCall) {
|
||||
QString grid = m_config.my_grid();
|
||||
if (grid.isEmpty()) {
|
||||
continue;
|
||||
@ -8661,7 +8682,7 @@ void MainWindow::processCommandActivity() {
|
||||
}
|
||||
|
||||
// QUERIED STATION MESSAGE
|
||||
else if (d.cmd == "&" && !isAllCall) {
|
||||
else if (d.cmd == " QTC?" && !isAllCall) {
|
||||
reply = QString("%1 QTC %2").arg(d.from).arg(m_config.my_station());
|
||||
}
|
||||
|
||||
|
@ -267,6 +267,7 @@ private slots:
|
||||
void on_clearAction_triggered(QObject * sender);
|
||||
void on_cqMacroButton_clicked();
|
||||
void on_replyMacroButton_clicked();
|
||||
void on_snrMacroButton_clicked();
|
||||
void on_qthMacroButton_clicked();
|
||||
void on_qtcMacroButton_clicked();
|
||||
void setShowColumn(QString tableKey, QString columnKey, bool value);
|
||||
|
@ -1500,6 +1500,22 @@ QTextEdit[transmitting="true"] {
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="13">
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="11">
|
||||
<widget class="QPushButton" name="queryButton">
|
||||
<property name="minimumSize">
|
||||
@ -1647,6 +1663,22 @@ color:#555;
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QPushButton" name="snrMacroButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Send an SNR message</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SNR</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_5">
|
||||
|
17
varicode.cpp
17
varicode.cpp
@ -44,16 +44,17 @@ QString alphanumeric = {"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ /@"}; // callsign
|
||||
QMap<QString, int> directed_cmds = {
|
||||
// any changes here need to be made also in the directed regular xpression for parsing
|
||||
|
||||
{"?", 0 }, // query snr
|
||||
{"@", 1 }, // query qth
|
||||
{"&", 2 }, // query station message
|
||||
//{"$", 3 }, // query station(s) heard
|
||||
{"^", 4 }, // query grid
|
||||
{" SNR?", 0 }, // query snr
|
||||
{" QTH?", 1 }, // query qth
|
||||
{" QTC?", 2 }, // query station message
|
||||
{" GRID?", 4 }, // query grid
|
||||
{" STATUS?", 6 }, // query idle message
|
||||
|
||||
{">", 5 }, // relay message
|
||||
{"*", 6 }, // query idle message
|
||||
//{"!", 7 }, // alert message
|
||||
{"#", 8 }, // all or nothing message
|
||||
|
||||
//{"!", 7 }, // alert message
|
||||
//{"$", 3 }, // query station(s) heard
|
||||
//{"=", 9 }, // unused
|
||||
|
||||
{" ACTIVE", 10 }, // i have been active in the past 10 minutes
|
||||
@ -100,7 +101,7 @@ QMap<int, int> checksum_cmds = {
|
||||
};
|
||||
|
||||
QString callsign_pattern = QString("(?<callsign>[@]?[A-Z0-9/]+)");
|
||||
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:HEARTBEAT (ACK|REQ)|AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|QRZ[?]|(?:(?:ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|QTC|GRID|ACTIVE|IDLE)(?=[ ]|$))|[?@&$%#^>* ]))?");
|
||||
QString optional_cmd_pattern = QString("(?<cmd>\\s?(?:HEARTBEAT (ACK|REQ)|AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|QRZ[?]|SNR[?]|QTC[?]|QTH[?]|GRID[?]|STATUS[?]|(?:(?:ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|QTC|GRID|ACTIVE|IDLE)(?=[ ]|$))|[#> ]))?");
|
||||
QString optional_grid_pattern = QString("(?<grid>\\s?[A-R]{2}[0-9]{2})?");
|
||||
QString optional_extended_grid_pattern = QString("^(?<grid>\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?");
|
||||
QString optional_num_pattern = QString("(?<num>(?<=SNR|ACK)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");
|
||||
|
Loading…
Reference in New Issue
Block a user