From 081bc0380b1047c2b92907719274c8799f9ebcc5 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Wed, 29 Aug 2018 12:32:09 -0400 Subject: [PATCH] Added reply message to configuration --- Configuration.cpp | 22 +++++++++++++++++++++- Configuration.hpp | 1 + Configuration.ui | 44 ++++++++++++++++++++++++++++++++------------ mainwindow.cpp | 16 ++++++++++++---- 4 files changed, 66 insertions(+), 17 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 7730802..65bd7c1 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -454,6 +454,7 @@ private: Q_SLOT void on_PTT_method_button_group_buttonClicked (int); Q_SLOT void on_station_message_line_edit_textChanged(QString const&); Q_SLOT void on_qth_message_line_edit_textChanged(QString const&); + Q_SLOT void on_reply_message_line_edit_textChanged(QString const&); Q_SLOT void on_add_macro_line_edit_editingFinished (); Q_SLOT void delete_macro (); void delete_selected_macros (QModelIndexList); @@ -556,6 +557,7 @@ private: QString my_station_; int my_dBm_; QString my_qth_; + QString reply_; int callsign_aging_; int activity_aging_; QColor color_CQ_; @@ -872,6 +874,11 @@ QString Configuration::my_qth() const return m_->my_qth_; } +QString Configuration::reply() const +{ + return m_->reply_; +} + int Configuration::callsign_aging() const { return m_->callsign_aging_; @@ -1032,6 +1039,7 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory, ui_->add_macro_line_edit->setValidator (new QRegExpValidator {message_alphabet, this}); ui_->station_message_line_edit->setValidator (new QRegExpValidator {message_alphabet, this}); ui_->qth_message_line_edit->setValidator (new QRegExpValidator {message_alphabet, this}); + ui_->reply_message_line_edit->setValidator (new QRegExpValidator {message_alphabet, this}); ui_->udp_server_port_spin_box->setMinimum (1); ui_->udp_server_port_spin_box->setMaximum (std::numeric_limits::max ()); @@ -1251,11 +1259,12 @@ void Configuration::impl::initialize_models () ui_->grid_line_edit->setPalette (pal); ui_->auto_switch_bands_check_box->setChecked(auto_switch_bands_); ui_->callsign_line_edit->setText (my_callsign_); - ui_->grid_line_edit->setText (my_grid_); + 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_->qth_message_line_edit->setText (my_qth_.toUpper()); + ui_->reply_message_line_edit->setText (reply_.toUpper()); ui_->use_dynamic_grid->setChecked(use_dynamic_info_); ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_CQ_.name())); ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_MyCall_.name())); @@ -1385,6 +1394,7 @@ void Configuration::impl::read_settings () callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); activity_aging_ = settings_->value ("ActivityAging", 2).toInt (); my_qth_ = settings_->value("MyQTH", QString {}).toString(); + reply_ = settings_->value("Reply", QString {"HW CPY?"}).toString(); next_color_CQ_ = color_CQ_ = settings_->value("colorCQ","#66ff66").toString(); next_color_MyCall_ = color_MyCall_ = settings_->value("colorMyCall","#ff6666").toString(); next_color_ReceivedMsg_ = color_ReceivedMsg_ = settings_->value("colorReceivedMsg","#ffeaa7").toString(); @@ -1578,6 +1588,7 @@ void Configuration::impl::write_settings () settings_->setValue ("MyStation", my_station_); settings_->setValue ("MyPower", my_dBm_); settings_->setValue ("MyQTH", my_qth_); + settings_->setValue ("Reply", reply_); settings_->setValue ("CallsignAging", callsign_aging_); settings_->setValue ("ActivityAging", activity_aging_); settings_->setValue("colorCQ",color_CQ_); @@ -2038,6 +2049,7 @@ void Configuration::impl::accept () my_callsign_ = ui_->callsign_line_edit->text (); my_grid_ = ui_->grid_line_edit->text (); my_station_ = ui_->station_message_line_edit->text().toUpper(); + reply_ = ui_->reply_message_line_edit->text().toUpper(); my_dBm_ = ui_->station_power_combo_box->currentData().toInt(); my_qth_ = ui_->qth_message_line_edit->text().toUpper(); callsign_aging_ = ui_->callsign_aging_spin_box->value(); @@ -2350,6 +2362,14 @@ void Configuration::impl::on_qth_message_line_edit_textChanged(QString const &te } } +void Configuration::impl::on_reply_message_line_edit_textChanged(QString const &text) +{ + QString upper = text.toUpper(); + if(text != upper){ + ui_->reply_message_line_edit->setText (upper); + } +} + void Configuration::impl::on_add_macro_line_edit_editingFinished () { ui_->add_macro_line_edit->setText (ui_->add_macro_line_edit->text ().toUpper ()); diff --git a/Configuration.hpp b/Configuration.hpp index e72ea5a..41aa76a 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -102,6 +102,7 @@ public: int activity_aging() const; int callsign_aging() const; QString my_qth () const; + QString reply () const; QFont text_font () const; QFont decoded_text_font () const; qint32 id_interval () const; diff --git a/Configuration.ui b/Configuration.ui index e73dbe3..f199a50 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -175,48 +175,68 @@ 0 - + + + <html><head/><body><p>Station location message</p></body></html> + QTH Message: - + <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 Description Message</p></body></html> + - Station Message: + QTC Message: - + <html><head/><body><p>Station message that is transmitted in response to &quot;&amp;&quot; directed queries.</p></body></html> - + Station Power: - + <html><head/><body><p>Approximate or average station transmit power to be sent in response to &quot;%&quot; directed queries. </p></body></html> + + + + Reply Message: + + + + + + + HW CPY? + + + @@ -368,7 +388,7 @@ true - false + false <html><head/><body><p>Some rigs are not able to process CAT commands while transmitting. This means that if you are operating in split mode you may have to uncheck this option.</p></body></html> @@ -3172,12 +3192,12 @@ soundcard changes + + + + - - - - diff --git a/mainwindow.cpp b/mainwindow.cpp index 9ecbd22..6f73ceb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -7218,7 +7218,7 @@ void MainWindow::on_replyMacroButton_clicked(){ if(call.isEmpty()){ return; } - addMessageText(QString("%1 ").arg(call)); + addMessageText(QString("%1 %2").arg(call).arg(m_config.reply())); } void MainWindow::on_qthMacroButton_clicked(){ @@ -7290,9 +7290,8 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ // for now, we're going to omit displaying the call...delete this if we want the other functionality call = ""; - auto sendReplyAction = menu->addAction(QString("Send a message to selected callsign")); - - connect(sendReplyAction, &QAction::triggered, this, [this](){ + auto callAction = menu->addAction(QString("Send a directed message to selected callsign")); + connect(callAction, &QAction::triggered, this, [this](){ QString selectedCall = callsignSelected(); if(selectedCall.isEmpty()){ @@ -7302,6 +7301,15 @@ void MainWindow::buildQueryMenu(QMenu * menu, QString call){ addMessageText(QString("%1 ").arg(selectedCall), true); }); + auto sendReplyAction = menu->addAction(QString("%1 Reply - Send reply message to selected callsign").arg(call).trimmed()); + connect(sendReplyAction, &QAction::triggered, this, [this](){ + QString selectedCall = callsignSelected(); + if(selectedCall.isEmpty()){ + return; + } + + addMessageText(QString("%1 %2").arg(selectedCall).arg(m_config.reply()), true); + }); auto sendSNRAction = menu->addAction(QString("%1 SNR - Send a signal report to the selected callsign").arg(call).trimmed()); sendSNRAction->setEnabled(m_callActivity.contains(call));