Added configuration for groups
This commit is contained in:
		
							parent
							
								
									c4089c0af9
								
							
						
					
					
						commit
						47a7c06854
					
				| @ -454,6 +454,7 @@ private: | ||||
|   Q_SLOT void on_delete_macro_push_button_clicked (bool = false); | ||||
|   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_groups_line_edit_textChanged(QString const&); | ||||
|   Q_SLOT void on_qth_message_line_edit_textChanged(QString const&); | ||||
|   Q_SLOT void on_cq_message_line_edit_textChanged(QString const&); | ||||
|   Q_SLOT void on_reply_message_line_edit_textChanged(QString const&); | ||||
| @ -584,6 +585,7 @@ private: | ||||
|   QString my_callsign_; | ||||
|   QString my_grid_; | ||||
|   QString my_station_; | ||||
|   QStringList my_groups_; | ||||
|   QString my_qth_; | ||||
|   QString cq_; | ||||
|   QString reply_; | ||||
| @ -934,6 +936,10 @@ QString Configuration::my_station() const | ||||
|     return station.trimmed(); | ||||
| } | ||||
| 
 | ||||
| QStringList Configuration::my_groups() const { | ||||
|     return m_->my_groups_; | ||||
| } | ||||
| 
 | ||||
| QString Configuration::my_qth() const | ||||
| { | ||||
|     return m_->my_qth_.trimmed(); | ||||
| @ -1300,6 +1306,7 @@ void Configuration::impl::initialize_models () | ||||
|   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_->qth_message_line_edit->setText (my_qth_.toUpper()); | ||||
|   ui_->cq_message_line_edit->setText(cq_.toUpper()); | ||||
|   ui_->reply_message_line_edit->setText (reply_.toUpper()); | ||||
| @ -1437,6 +1444,7 @@ void Configuration::impl::read_settings () | ||||
|   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(); | ||||
|   callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); | ||||
|   activity_aging_ = settings_->value ("ActivityAging", 2).toInt (); | ||||
|   my_qth_ = settings_->value("MyQTH", QString {}).toString(); | ||||
| @ -1692,6 +1700,7 @@ void Configuration::impl::write_settings () | ||||
|   settings_->setValue ("MyCall", my_callsign_); | ||||
|   settings_->setValue ("MyGrid", my_grid_); | ||||
|   settings_->setValue ("MyStation", my_station_); | ||||
|   settings_->setValue ("MyGroups", my_groups_); | ||||
|   settings_->setValue ("MyQTH", my_qth_); | ||||
|   settings_->setValue ("CQMessage", cq_); | ||||
|   settings_->setValue ("Reply", reply_); | ||||
| @ -1948,6 +1957,24 @@ void Configuration::impl::set_rig_invariants () | ||||
|                                               || TransceiverFactory::basic_transceiver_name_ != rig); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| QStringList splitGroups(QString groupsString, bool filter){ | ||||
|     QStringList groups; | ||||
|     if(groupsString.isEmpty()){ | ||||
|         return groups; | ||||
|     } | ||||
| 
 | ||||
|     foreach(QString group, groupsString.split(",")){ | ||||
|         auto g = group.trimmed(); | ||||
|         if(filter && !g.startsWith("@")){ | ||||
|             continue; | ||||
|         } | ||||
|         groups.append(group.trimmed()); | ||||
|     } | ||||
| 
 | ||||
|     return groups; | ||||
| } | ||||
| 
 | ||||
| bool Configuration::impl::validate () | ||||
| { | ||||
|   if(!Varicode::isValidCallsign(ui_->callsign_line_edit->text(), nullptr)){ | ||||
| @ -1955,6 +1982,13 @@ bool Configuration::impl::validate () | ||||
|       return false; | ||||
|   } | ||||
| 
 | ||||
|   foreach(auto group, splitGroups(ui_->groups_line_edit->text(), false)){ | ||||
|       if(!Varicode::isCompoundCallsign(group)){ | ||||
|           MessageBox::critical_message (this, QString("%1 is not a valid group").arg(group)); | ||||
|           return false; | ||||
|       } | ||||
|   } | ||||
| 
 | ||||
|   if (ui_->sound_input_combo_box->currentIndex () < 0 | ||||
|       && !QAudioDeviceInfo::availableDevices (QAudio::AudioInput).empty ()) | ||||
|     { | ||||
| @ -2206,6 +2240,9 @@ 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(); | ||||
| 
 | ||||
|   my_groups_ = splitGroups(ui_->groups_line_edit->text().toUpper().trimmed(), true); | ||||
| 
 | ||||
|   cq_ = ui_->cq_message_line_edit->text().toUpper(); | ||||
|   reply_ = ui_->reply_message_line_edit->text().toUpper(); | ||||
|   my_qth_ = ui_->qth_message_line_edit->text().toUpper(); | ||||
| @ -2636,6 +2673,15 @@ void Configuration::impl::on_station_message_line_edit_textChanged(QString const | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void Configuration::impl::on_groups_line_edit_textChanged(QString const &text) | ||||
| { | ||||
|   QString upper = text.toUpper(); | ||||
|   if(text != upper){ | ||||
|     ui_->groups_line_edit->setText (upper); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| void Configuration::impl::on_qth_message_line_edit_textChanged(QString const &text) | ||||
| { | ||||
|   QString upper = text.toUpper(); | ||||
|  | ||||
| @ -98,6 +98,7 @@ public: | ||||
|   QString my_callsign () const; | ||||
|   QString my_grid () const; | ||||
|   QString my_station () const; | ||||
|   QStringList my_groups() const; | ||||
|   int activity_aging() const; | ||||
|   int callsign_aging() const; | ||||
|   QString my_qth () const; | ||||
|  | ||||
| @ -23,7 +23,7 @@ | ||||
|       <string>Select tab to change configuration parameters.</string> | ||||
|      </property> | ||||
|      <property name="currentIndex"> | ||||
|       <number>1</number> | ||||
|       <number>0</number> | ||||
|      </property> | ||||
|      <widget class="QWidget" name="general_tab"> | ||||
|       <attribute name="title"> | ||||
| @ -206,7 +206,7 @@ | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="3" column="0"> | ||||
|              <item row="4" column="0"> | ||||
|               <widget class="QLabel" name="label_15"> | ||||
|                <property name="toolTip"> | ||||
|                 <string><html><head/><body><p>Station Description Message</p></body></html></string> | ||||
| @ -216,7 +216,7 @@ | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="3" column="1"> | ||||
|              <item row="4" column="1"> | ||||
|               <widget class="QLineEdit" name="station_message_line_edit"> | ||||
|                <property name="toolTip"> | ||||
|                 <string><html><head/><body><p>Station message that is transmitted in response to &quot;&amp;&quot; directed queries.</p></body></html></string> | ||||
| @ -237,6 +237,23 @@ | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="5" column="0"> | ||||
|               <widget class="QLabel" name="label_23"> | ||||
|                <property name="text"> | ||||
|                 <string>Groups (comma separated):</string> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|              <item row="5" column="1"> | ||||
|               <widget class="QLineEdit" name="groups_line_edit"> | ||||
|                <property name="text"> | ||||
|                 <string>@ALLCALL, @GROUPCALL</string> | ||||
|                </property> | ||||
|                <property name="placeholderText"> | ||||
|                 <string/> | ||||
|                </property> | ||||
|               </widget> | ||||
|              </item> | ||||
|             </layout> | ||||
|            </widget> | ||||
|           </item> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Jordan Sherer
						Jordan Sherer