Added checkbox to enable / disable all notifications
This commit is contained in:
parent
48a11bf491
commit
fed50180eb
@ -434,6 +434,7 @@ private:
|
||||
void delete_stations ();
|
||||
void insert_station ();
|
||||
|
||||
Q_SLOT void on_notifications_check_box_toggled(bool checked);
|
||||
Q_SLOT void on_font_push_button_clicked ();
|
||||
Q_SLOT void on_tableFontButton_clicked();
|
||||
Q_SLOT void on_PTT_port_combo_box_activated (int);
|
||||
@ -534,6 +535,7 @@ private:
|
||||
|
||||
Type2MsgGen type_2_msg_gen_;
|
||||
|
||||
bool enable_notifications_;
|
||||
QMap<QString, bool> notifications_enabled_;
|
||||
QMap<QString, QString> notifications_paths_;
|
||||
|
||||
@ -733,8 +735,12 @@ QAudioDeviceInfo const& Configuration::audio_output_device () const {return m_->
|
||||
AudioDevice::Channel Configuration::audio_output_channel () const {return m_->audio_output_channel_;}
|
||||
QAudioDeviceInfo const& Configuration::notification_audio_output_device () const {return m_->notification_audio_output_device_;}
|
||||
AudioDevice::Channel Configuration::notification_audio_output_channel () const {return m_->notification_audio_output_channel_;}
|
||||
bool Configuration::notifications_enabled() const { return m_->notifications_enabled_.values().contains(true); }
|
||||
bool Configuration::notifications_enabled() const { return m_->enable_notifications_; }
|
||||
QString Configuration::notification_path(const QString &key) const {
|
||||
if(!m_->enable_notifications_){
|
||||
return "";
|
||||
}
|
||||
|
||||
if(!m_->notifications_enabled_.value(key, false)){
|
||||
return "";
|
||||
}
|
||||
@ -1587,6 +1593,9 @@ void Configuration::impl::initialize_models ()
|
||||
//
|
||||
// setup notifications table view
|
||||
//
|
||||
ui_->notifications_check_box->setChecked(enable_notifications_);
|
||||
on_notifications_check_box_toggled(enable_notifications_);
|
||||
|
||||
QList<QPair<QString, QString>> notifyRows = {
|
||||
{"notify_cq", "CQ Message Received"},
|
||||
{"notify_hb", "HB Message Received"},
|
||||
@ -2001,6 +2010,7 @@ void Configuration::impl::read_settings ()
|
||||
|
||||
|
||||
// notifications
|
||||
enable_notifications_ = settings_->value("EnableNotifications", false).toBool();
|
||||
notifications_enabled_.clear();
|
||||
notifications_paths_.clear();
|
||||
settings_->beginGroup("Notifications");
|
||||
@ -2182,6 +2192,7 @@ void Configuration::impl::write_settings ()
|
||||
settings_->setValue ("AutoGrid", use_dynamic_info_);
|
||||
|
||||
// notifications
|
||||
settings_->setValue("EnableNotifications", enable_notifications_);
|
||||
settings_->beginGroup("Notifications");
|
||||
{
|
||||
foreach(auto key, notifications_enabled_.keys()){
|
||||
@ -2414,6 +2425,13 @@ bool Configuration::impl::validate ()
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ui_->notification_sound_output_combo_box->currentIndex () < 0
|
||||
&& !QAudioDeviceInfo::availableDevices (QAudio::AudioOutput).empty ())
|
||||
{
|
||||
MessageBox::critical_message (this, tr ("Invalid notification audio out device"));
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!ui_->PTT_method_button_group->checkedButton ()->isEnabled ())
|
||||
{
|
||||
MessageBox::critical_message (this, tr ("Invalid PTT method"));
|
||||
@ -2822,6 +2840,8 @@ void Configuration::impl::accept ()
|
||||
use_dynamic_info_ = ui_->use_dynamic_grid->isChecked();
|
||||
|
||||
// notifications
|
||||
enable_notifications_ = ui_->notifications_check_box->isChecked();
|
||||
|
||||
for(int i = 0; i < ui_->notifications_table_widget->rowCount(); i++){
|
||||
// event
|
||||
auto eventItem = ui_->notifications_table_widget->item(i, 0);
|
||||
@ -2869,6 +2889,10 @@ void Configuration::impl::reject ()
|
||||
QDialog::reject ();
|
||||
}
|
||||
|
||||
void Configuration::impl::on_notifications_check_box_toggled(bool checked){
|
||||
ui_->notifications_table_widget->setEnabled(checked);
|
||||
}
|
||||
|
||||
void Configuration::impl::on_font_push_button_clicked ()
|
||||
{
|
||||
next_font_ = QFontDialog::getFont (0, next_font_, this
|
||||
|
@ -3154,6 +3154,13 @@ QListView::item:hover {
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="notifications_check_box">
|
||||
<property name="text">
|
||||
<string>Enable Notifications</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableWidget" name="notifications_table_widget">
|
||||
<property name="editTriggers">
|
||||
|
Loading…
Reference in New Issue
Block a user