From f5ce9f0e308d5a364d257243aa07c8c592f58aa7 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Sat, 3 Nov 2018 22:38:27 -0400 Subject: [PATCH] Added TU short command --- mainwindow.cpp | 19 ++++++++++++++++--- varicode.cpp | 7 ++++--- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index eebc2bd..610aa84 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -6564,7 +6564,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ menu->addSeparator(); - auto snrQueryAction = menu->addAction(QString("%1 SNR? - What is my signal report?").arg(call)); + auto snrQueryAction = menu->addAction(QString("%1 SNR? - What is my signal report?").arg(call).trimmed()); snrQueryAction->setDisabled(isAllCall); connect(snrQueryAction, &QAction::triggered, this, [this](){ @@ -6578,7 +6578,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ if(m_config.transmit_directed()) toggleTx(true); }); - auto qthQueryAction = menu->addAction(QString("%1 QTH? - What is your QTH message?").arg(call)); + auto qthQueryAction = menu->addAction(QString("%1 QTH? - What is your QTH message?").arg(call).trimmed()); qthQueryAction->setDisabled(isAllCall); connect(qthQueryAction, &QAction::triggered, this, [this](){ @@ -6592,7 +6592,7 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ if(m_config.transmit_directed()) toggleTx(true); }); - auto gridQueryAction = menu->addAction(QString("%1 GRID? - What is your current grid locator?").arg(call)); + auto gridQueryAction = menu->addAction(QString("%1 GRID? - What is your current grid locator?").arg(call).trimmed()); gridQueryAction->setDisabled(isAllCall); connect(gridQueryAction, &QAction::triggered, this, [this](){ @@ -6805,6 +6805,19 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ if(m_config.transmit_directed()) toggleTx(true); }); + auto tuAction = menu->addAction(QString("%1 TU - Thank You").arg(call).trimmed()); + connect(tuAction, &QAction::triggered, this, [this](){ + + QString selectedCall = callsignSelected(); + if(selectedCall.isEmpty()){ + return; + } + + addMessageText(QString("%1 TU").arg(selectedCall), true); + + if(m_config.transmit_directed()) toggleTx(true); + }); + auto qrzAction = menu->addAction(QString("%1 QRZ? - Who is calling me?").arg(call).trimmed()); connect(qrzAction, &QAction::triggered, this, [this](){ diff --git a/varicode.cpp b/varicode.cpp index a29ea1a..c380f07 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -65,7 +65,8 @@ QMap directed_cmds = { //{"!", 7 }, // alert message //{"$", 3 }, // query station(s) heard - //{"=", 9 }, // unused + + {" TU", 9 }, // thank you {" ACTIVE", 10 }, // i have been active in the past 10 minutes {" IDLE", 11 }, // i have not been active in the past 10 minutes @@ -96,7 +97,7 @@ QMap directed_cmds = { {" ", 31 }, // send freetext }; -QSet allowed_cmds = {-1, 0, 1, 2, 3, 4, 5, 6, /*7,*/ 8, /*9,*/ 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; +QSet allowed_cmds = {-1, 0, 1, 2, 3, 4, 5, 6, /*7,*/ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; QSet buffered_cmds = {3, 5, /*6,*/ /*7,*/ 8, 13, 14, 15}; @@ -111,7 +112,7 @@ QMap checksum_cmds = { }; QString callsign_pattern = QString("(?[@]?[A-Z0-9/]+)"); -QString optional_cmd_pattern = QString("(?\\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_cmd_pattern = QString("(?\\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|TU)(?=[ ]|$))|[?*^&@#> ]))?"); QString optional_grid_pattern = QString("(?\\s?[A-R]{2}[0-9]{2})?"); QString optional_extended_grid_pattern = QString("^(?\\s?(?:[A-R]{2}[0-9]{2}(?:[A-X]{2}(?:[0-9]{2})?)*))?"); QString optional_num_pattern = QString("(?(?<=SNR|HEARTBEAT ACK)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");