From 03f351551d5c37d0f67e8f1f3c640501f6365eda Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 31 Jan 2019 10:53:17 -0500 Subject: [PATCH] Removed QTC as it was confusing and redundant. QTH is now the 'station message' --- Configuration.cpp | 27 ++--- Configuration.hpp | 5 +- Configuration.ui | 69 +++++------- mainwindow.cpp | 87 +++------------ mainwindow.h | 1 - mainwindow.ui | 276 ++++++++++++++++++++++------------------------ varicode.cpp | 16 ++- 7 files changed, 190 insertions(+), 291 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 943cace..a8dfebc 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -583,13 +583,12 @@ private: bool frequency_calibration_disabled_; // not persistent unsigned transceiver_command_number_; QString dynamic_grid_; - QString dynamic_qtc_; + QString dynamic_qth_; // configuration fields that we publish bool auto_switch_bands_; QString my_callsign_; QString my_grid_; - QString my_station_; QStringList my_groups_; QStringList auto_whitelist_; QString my_qth_; @@ -951,15 +950,6 @@ QString Configuration::my_grid() const return grid.trimmed(); } -QString Configuration::my_station() const -{ - auto station = m_->my_station_; - if(m_->use_dynamic_info_ && !m_->dynamic_qtc_.isEmpty()){ - station = m_->dynamic_qtc_; - } - return station.trimmed(); -} - QSet Configuration::my_groups() const { return QSet::fromList(m_->my_groups_); } @@ -984,7 +974,12 @@ QSet Configuration::auto_whitelist() const { QString Configuration::my_qth() const { - return m_->my_qth_.trimmed(); + auto qth = m_->my_qth_; + if(m_->use_dynamic_info_ && !m_->dynamic_qth_.isEmpty()){ + qth = m_->dynamic_qth_; + } + + return qth.trimmed(); } QString Configuration::cq_message() const @@ -1012,9 +1007,9 @@ void Configuration::set_dynamic_location (QString const& grid_descriptor) m_->dynamic_grid_ = grid_descriptor.trimmed (); } -void Configuration::set_dynamic_station_message(QString const& qtc) +void Configuration::set_dynamic_station_qth(QString const& qth) { - m_->dynamic_qtc_ = qtc.trimmed (); + m_->dynamic_qth_ = qth.trimmed (); } namespace @@ -1365,7 +1360,6 @@ void Configuration::impl::initialize_models () ui_->grid_line_edit->setText (my_grid_.toUpper()); ui_->callsign_aging_spin_box->setValue(callsign_aging_); ui_->activity_aging_spin_box->setValue(activity_aging_); - ui_->station_message_line_edit->setText (my_station_.toUpper()); ui_->groups_line_edit->setText(my_groups_.join(", ")); ui_->auto_whitelist_line_edit->setText(auto_whitelist_.join(", ")); ui_->qth_message_line_edit->setText (my_qth_.toUpper()); @@ -1510,7 +1504,6 @@ void Configuration::impl::read_settings () auto_switch_bands_ = settings_->value("AutoSwitchBands", false).toBool(); my_callsign_ = settings_->value ("MyCall", QString {}).toString (); my_grid_ = settings_->value ("MyGrid", QString {}).toString (); - my_station_ = settings_->value("MyStation", QString {}).toString(); my_groups_ = settings_->value("MyGroups", QStringList{}).toStringList(); auto_whitelist_ = settings_->value("AutoWhitelist", QStringList{}).toStringList(); callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); @@ -1771,7 +1764,6 @@ void Configuration::impl::write_settings () settings_->setValue ("AutoSwitchBands", auto_switch_bands_); settings_->setValue ("MyCall", my_callsign_); settings_->setValue ("MyGrid", my_grid_); - settings_->setValue ("MyStation", my_station_); settings_->setValue ("MyGroups", my_groups_); settings_->setValue ("AutoWhitelist", auto_whitelist_); settings_->setValue ("MyQTH", my_qth_); @@ -2363,7 +2355,6 @@ void Configuration::impl::accept () auto_switch_bands_ = ui_->auto_switch_bands_check_box->isChecked(); my_callsign_ = ui_->callsign_line_edit->text ().toUpper(); my_grid_ = ui_->grid_line_edit->text ().toUpper(); - my_station_ = ui_->station_message_line_edit->text().toUpper(); my_groups_ = splitGroups(ui_->groups_line_edit->text().toUpper().trimmed(), true); auto_whitelist_ = splitCalls(ui_->auto_whitelist_line_edit->text().toUpper().trimmed()); cq_ = ui_->cq_message_line_edit->text().toUpper(); diff --git a/Configuration.hpp b/Configuration.hpp index 4cf8fb7..56119af 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -97,7 +97,6 @@ public: bool use_dynamic_grid() const; QString my_callsign () const; QString my_grid () const; - QString my_station () const; QSet my_groups() const; void addGroup(QString const &group); void removeGroup(QString const &group); @@ -233,8 +232,8 @@ public: // Set the dynamic grid which is only used if configuration setting is enabled. void set_dynamic_location (QString const&); - // Set the dynamic statios message which is only used if configuration setting is enabled. - void set_dynamic_station_message(QString const& qtc); + // Set the dynamic station qth message which is only used if configuration setting is enabled. + void set_dynamic_station_qth(QString const& qth); // This method queries if a CAT and PTT connection is operational. diff --git a/Configuration.ui b/Configuration.ui index bb57b8d..a13ccac 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -36,7 +36,7 @@ - 0 + 1 @@ -187,23 +187,6 @@ Station Messages - - - - <html><head/><body><p>Station Description Message</p></body></html> - - - Station Detail (QTC) Message: - - - - - - - CQCQCQ <MYGRID4> - - - @@ -211,13 +194,6 @@ - - - - <html><head/><body><p>Station location message that is transmitted in response to &quot;@&quot; directed queries.</p></body></html> - - - @@ -225,27 +201,34 @@ + + + + CQ Message: + + + + + + + CQCQCQ <MYGRID4> + + + + + + + <html><head/><body><p>Station location message that is transmitted in response to &quot;@&quot; directed queries.</p></body></html> + + + <html><head/><body><p>Station location message</p></body></html> - Station Location (QTH) Message: - - - - - - - <html><head/><body><p>Station message that is transmitted in response to &quot;&amp;&quot; directed queries.</p></body></html> - - - - - - - CQ Message: + Station Message (QTH & Equipment): @@ -386,7 +369,7 @@ - Immediately transmit CQ, Reply, QTC, QTH, Saved, and Directed messages from the menu + Immediately transmit CQ, Reply, QTH, Saved, and Directed messages from the menu @@ -4117,12 +4100,12 @@ soundcard changes - + - + diff --git a/mainwindow.cpp b/mainwindow.cpp index 256e2b7..8397d50 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7070,17 +7070,6 @@ void MainWindow::on_qthMacroButton_clicked(){ if(m_config.transmit_directed()) toggleTx(true); } -void MainWindow::on_qtcMacroButton_clicked(){ - QString qtc = m_config.my_station(); - if(qtc.isEmpty()){ - return; - } - - addMessageText(QString("QTC %1").arg(replaceMacros(qtc, buildMacroValues(), true))); - - if(m_config.transmit_directed()) toggleTx(true); -} - void MainWindow::setShowColumn(QString tableKey, QString columnKey, bool value){ m_showColumnsCache[tableKey + columnKey] = QVariant(value); displayBandActivity(); @@ -7206,7 +7195,6 @@ 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(); @@ -7254,21 +7242,7 @@ 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()); + auto qthAction = menu->addAction(QString("%1 QTH - Send my station message").arg(call).trimmed()); qthAction->setDisabled(emptyQTH); connect(qthAction, &QAction::triggered, this, [this](){ @@ -7313,7 +7287,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).trimmed()); + auto qthQueryAction = menu->addAction(QString("%1 QTH? - What is your station message?").arg(call).trimmed()); qthQueryAction->setDisabled(isAllCall); connect(qthQueryAction, &QAction::triggered, this, [this](){ @@ -7341,20 +7315,6 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ if(m_config.transmit_directed()) toggleTx(true); }); - auto stationMessageQueryAction = menu->addAction(QString("%1 QTC? - What is your station message?").arg(call).trimmed()); - stationMessageQueryAction->setDisabled(isAllCall); - connect(stationMessageQueryAction, &QAction::triggered, this, [this](){ - - QString selectedCall = callsignSelected(); - if(selectedCall.isEmpty()){ - return; - } - - addMessageText(QString("%1 QTC?").arg(selectedCall), true); - - if(m_config.transmit_directed()) toggleTx(true); - }); - auto stationIdleQueryAction = menu->addAction(QString("%1 STATUS? - What is the status of your station (auto, hb, version, etc)?").arg(call).trimmed()); stationIdleQueryAction->setDisabled(isAllCall); connect(stationIdleQueryAction, &QAction::triggered, this, [this](){ @@ -7639,7 +7599,6 @@ QMap MainWindow::buildMacroValues(){ {"", m_config.my_callsign()}, {"", m_config.my_grid().left(4)}, {"", m_config.my_grid().left(12)}, - {"", m_config.my_station()}, {"", m_config.my_qth()}, {"", m_config.cq_message()}, {"", m_config.reply_message()}, @@ -7659,7 +7618,6 @@ QMap MainWindow::buildMacroValues(){ } // these macros can have recursive macros - values[""] = replaceMacros(values[""], values, false); values[""] = replaceMacros(values[""], values, false); values[""] = replaceMacros(values[""], values, false); values[""] = replaceMacros(values[""], values, false); @@ -8598,7 +8556,7 @@ bool MainWindow::shortList(QString callsign) void MainWindow::pskSetLocal () { psk_Reporter->setLocalStation(m_config.my_callsign (), m_config.my_grid (), - m_config.my_station(), QString {"JS8Call v" + version() }.simplified ()); + m_config.my_qth(), QString {"JS8Call v" + version() }.simplified ()); } void MainWindow::aprsSetLocal () @@ -8893,7 +8851,6 @@ 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); ui->queryButton->setDisabled(isTransmitting || emptyCallsign); @@ -9822,15 +9779,6 @@ void MainWindow::processCommandActivity() { reply = QString("%1 GRID %2").arg(d.from).arg(grid); } - // QUERIED STATION MESSAGE - else if (d.cmd == " QTC?" && !isAllCall) { - QString qtc = m_config.my_station(); - if(qtc.isEmpty()) { - continue; - } - reply = QString("%1 QTC %2").arg(d.from).arg(replaceMacros(qtc, buildMacroValues(), true)); - } - // QUERIED STATIONS HEARD else if (d.cmd == " HEARING?" && !isAllCall) { int i = 0; @@ -10017,18 +9965,7 @@ void MainWindow::processCommandActivity() { // PROCESS BUFFERED QUERY MSGS else if (d.cmd == " QUERY MSGS" && ui->autoReplyButton->isChecked()){ auto who = d.from; -#if 0 - QString key; - if(d.text.isEmpty()){ - key = who; - } else { - QStringList segs = d.text.trimmed().split(" "); - if(segs.isEmpty()){ - continue; - } - key = segs.first(); - } -#endif + auto cmd = auto inbox = Inbox(inboxPath()); if(!inbox.open()){ @@ -10050,6 +9987,8 @@ void MainWindow::processCommandActivity() { break; } } + + reply = replies.join("\n"); } // PROCESS BUFFERED QUERY CALL @@ -11011,8 +10950,8 @@ void MainWindow::networkMessage(Message const &message) // STATION.GET_CALLSIGN - Get the current callsign // STATION.GET_GRID - Get the current grid locator // STATION.SET_GRID - Set the current grid locator - // STATION.GET_QTC - Get the current station message - // STATION.SET_QTC - Set the current station message + // STATION.GET_QTH - Get the current station qth + // STATION.SET_QTH - Set the current station qth if(type == "STATION.GET_CALLSIGN"){ sendNetworkMessage("STATION.CALLSIGN", m_config.my_callsign()); return; @@ -11029,14 +10968,14 @@ void MainWindow::networkMessage(Message const &message) return; } - if(type == "STATION.GET_QTC"){ - sendNetworkMessage("STATION.QTC", m_config.my_station()); + if(type == "STATION.GET_QTH"){ + sendNetworkMessage("STATION.QTH", m_config.my_qth()); return; } - if(type == "STATION.SET_QTC"){ - m_config.set_dynamic_station_message(message.value()); - sendNetworkMessage("STATION.QTC", m_config.my_station()); + if(type == "STATION.SET_QTH"){ + m_config.set_dynamic_station_qth(message.value()); + sendNetworkMessage("STATION.QTH", m_config.my_qth()); return; } diff --git a/mainwindow.h b/mainwindow.h index eb2f6c4..65b9309 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -293,7 +293,6 @@ private slots: void on_replyMacroButton_clicked(); void on_snrMacroButton_clicked(); void on_qthMacroButton_clicked(); - void on_qtcMacroButton_clicked(); void setShowColumn(QString tableKey, QString columnKey, bool value); bool showColumn(QString tableKey, QString columnKey, bool default_=true); void buildShowColumnsMenu(QMenu *menu, QString tableKey); diff --git a/mainwindow.ui b/mainwindow.ui index 7659a71..df8c59e 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1315,7 +1315,131 @@ QTextEdit[transmitting="true"] { 0 + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 10 + + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Send a saved message</p></body></html> + + + Saved + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Reply to a CQ</p></body></html> + + + Reply + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Send an SNR message</p></body></html> + + + SNR + + + + + + + 75 + 30 + + + + <html><head/><body><p>Stop transmitting</p></body></html> + + + Halt + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Send your station location message</p></body></html> + + + QTH + + + + + + + + 0 + 30 + + + + <html><head/><body><p align="justify">Send a Heartbeat message</p></body></html> + + + true + + + QPushButton:checked { + font-weight:bold; + color:black; +} + + + HB + + + true + + + + false @@ -1350,55 +1474,7 @@ color:#222; - - - - - 75 - 30 - - - - <html><head/><body><p>Stop transmitting</p></body></html> - - - Halt - - - - - - - Qt::Horizontal - - - QSizePolicy::Preferred - - - - 20 - 10 - - - - - - - - - 0 - 30 - - - - <html><head/><body><p>Send your station location message</p></body></html> - - - QTH - - - - + @@ -1420,8 +1496,8 @@ color:#222; - - + + 0 @@ -1429,14 +1505,14 @@ color:#222; - <html><head/><body><p>Send an SNR message</p></body></html> + <html><head/><body><p>Send a directed message to another station</p></body></html> - SNR + Directed - + Qt::Horizontal @@ -1452,22 +1528,6 @@ color:#222; - - - - - 0 - 30 - - - - <html><head/><body><p>Reply to a CQ</p></body></html> - - - Reply - - - @@ -1499,82 +1559,6 @@ color:#222; - - - - - 0 - 30 - - - - <html><head/><body><p>Send your station message</p></body></html> - - - QTC - - - - - - - - 0 - 30 - - - - <html><head/><body><p>Send a saved message</p></body></html> - - - Saved - - - - - - - - 0 - 30 - - - - <html><head/><body><p>Send a directed message to another station</p></body></html> - - - Directed - - - - - - - - 0 - 30 - - - - <html><head/><body><p align="justify">Send a Heartbeat message</p></body></html> - - - true - - - QPushButton:checked { - font-weight:bold; - color:black; -} - - - HB - - - true - - - diff --git a/varicode.cpp b/varicode.cpp index 07edb9f..699ac4c 100644 --- a/varicode.cpp +++ b/varicode.cpp @@ -51,7 +51,7 @@ QMap directed_cmds = { {" QTH?", 1 }, // query qth - {" QTC?", 2 }, // query station message + //{" ", 2 }, // unused {" HEARING?", 3 }, // query station calls heard @@ -73,14 +73,16 @@ QMap directed_cmds = { {" QUERY", 11 }, // generic query - {" QUERY MSGS", 12 }, // do you have any stored messages? + {" QUERY MSGS", 12 }, // do you have any stored messages? {" QUERY CALL", 13 }, // can you transmit a ping to callsign? {" APRS:", 14 }, // send an aprs packet {" GRID", 15 }, // this is my current grid locator - {" QTC", 16 }, // this is my qtc message + + //{" ", 16 }, // unused + {" QTH", 17 }, // this is my qth message {" FB", 18 }, // fine business @@ -89,7 +91,9 @@ QMap directed_cmds = { {" RR", 21 }, // roger roger {" QSL?", 22 }, // do you copy? {" QSL", 23 }, // i copy + // {" ", 24 }, // unused + {" SNR", 25 }, // seen a station at the provided snr {" NO", 26 }, // negative confirm {" YES", 27 }, // confirm @@ -101,10 +105,10 @@ QMap directed_cmds = { }; // commands allowed to be processed -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}; // commands that result in an autoreply -QSet autoreply_cmds = {0, 1, 2, 3, 4, 6, 10, 12, 13, 30}; +QSet autoreply_cmds = {0, 1, 3, 4, 6, 10, 12, 13, 30}; // commands that should be buffered QSet buffered_cmds = {3, 5, /*6,*/ /*7,*/ 10, 11, 12, 13, 14, 15}; @@ -124,7 +128,7 @@ QMap checksum_cmds = { }; QString callsign_pattern = QString("(?[@]?[A-Z0-9/]+)"); -QString optional_cmd_pattern = QString("(?\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|MSG TO[:]|SNR[?]|QTC[?]|QTH[?]|GRID[?]|STATUS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|QTC|GRID|TU)(?=[ ]|$))|[?> ]))?"); +QString optional_cmd_pattern = QString("(?\\s?(?:AGN[?]|QSL[?]|HW CPY[?]|APRS[:]|MSG TO[:]|SNR[?]|QTH[?]|GRID[?]|STATUS[?]|HEARING[?]|(?:(?:STATUS|HEARING|QUERY CALL|QUERY MSGS|QUERY|ACK|73|YES|NO|SNR|QSL|RR|SK|FB|QTH|GRID|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|ACK)\\s?[-+]?(?:3[01]|[0-2]?[0-9]))?");