diff --git a/Configuration.cpp b/Configuration.cpp index eb7ab5c..0dfe0fc 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -460,6 +460,10 @@ private: void delete_selected_macros (QModelIndexList); Q_SLOT void on_save_path_select_push_button_clicked (bool); Q_SLOT void on_azel_path_select_push_button_clicked (bool); + Q_SLOT void on_sound_dm_path_select_push_button_clicked(); + Q_SLOT void on_sound_dm_path_reset_push_button_clicked(); + Q_SLOT void on_sound_am_path_select_push_button_clicked(); + Q_SLOT void on_sound_am_path_reset_push_button_clicked(); Q_SLOT void on_calibration_intercept_spin_box_valueChanged (double); Q_SLOT void on_calibration_slope_ppm_spin_box_valueChanged (double); Q_SLOT void handle_transceiver_update (TransceiverState const&, unsigned sequence_number); @@ -503,6 +507,9 @@ private: QDir default_azel_directory_; QDir azel_directory_; + QString sound_dm_path_; // directed message sound file + QString sound_am_path_; // alert message sound file + QFont font_; QFont next_font_; @@ -766,6 +773,8 @@ QStringListModel * Configuration::macros () {return &m_->macros_;} QStringListModel const * Configuration::macros () const {return &m_->macros_;} QDir Configuration::save_directory () const {return m_->save_directory_;} QDir Configuration::azel_directory () const {return m_->azel_directory_;} +QString Configuration::sound_dm_path() const {return m_->sound_dm_path_;} +QString Configuration::sound_am_path() const {return m_->sound_am_path_;} QString Configuration::rig_name () const {return m_->rig_params_.rig_name;} bool Configuration::pwrBandTxMemory () const {return m_->pwrBandTxMemory_;} bool Configuration::pwrBandTuneMemory () const {return m_->pwrBandTuneMemory_;} @@ -1277,6 +1286,8 @@ void Configuration::impl::initialize_models () ui_->PTT_method_button_group->button (rig_params_.ptt_type)->setChecked (true); ui_->save_path_display_label->setText (save_directory_.absolutePath ()); ui_->azel_path_display_label->setText (azel_directory_.absolutePath ()); + ui_->sound_dm_path_display_label->setText(sound_dm_path_); + ui_->sound_am_path_display_label->setText(sound_am_path_); ui_->CW_id_after_73_check_box->setChecked (id_after_73_); ui_->tx_QSY_check_box->setChecked (tx_QSY_allowed_); ui_->psk_reporter_check_box->setChecked (spot_to_reporting_networks_); @@ -1448,6 +1459,8 @@ void Configuration::impl::read_settings () RxBandwidth_ = settings_->value ("RxBandwidth", 2500).toInt (); save_directory_ = settings_->value ("SaveDir", default_save_directory_.absolutePath ()).toString (); azel_directory_ = settings_->value ("AzElDir", default_azel_directory_.absolutePath ()).toString (); + sound_dm_path_ = settings_->value ("SoundDMPath", "").toString (); + sound_am_path_ = settings_->value ("SoundAMPath", "").toString (); { // @@ -1633,6 +1646,8 @@ void Configuration::impl::write_settings () settings_->setValue ("PTTport", rig_params_.ptt_port); settings_->setValue ("SaveDir", save_directory_.absolutePath ()); settings_->setValue ("AzElDir", azel_directory_.absolutePath ()); + settings_->setValue ("SoundDMPath", sound_dm_path_); + settings_->setValue ("SoundAMPath", sound_am_path_); if (default_audio_input_device_selected_) { @@ -2122,6 +2137,8 @@ void Configuration::impl::accept () data_mode_ = static_cast (ui_->TX_mode_button_group->checkedId ()); save_directory_ = ui_->save_path_display_label->text (); azel_directory_ = ui_->azel_path_display_label->text (); + sound_dm_path_ = ui_->sound_dm_path_display_label->text(); + sound_am_path_ = ui_->sound_am_path_display_label->text(); enable_VHF_features_ = ui_->enable_VHF_features_check_box->isChecked (); decode_at_52s_ = ui_->decode_at_52s_check_box->isChecked (); single_decode_ = ui_->single_decode_check_box->isChecked (); @@ -2709,6 +2726,50 @@ void Configuration::impl::on_azel_path_select_push_button_clicked (bool /* check } } +void Configuration::impl::on_sound_dm_path_select_push_button_clicked(){ + QStringList filters; + filters << "Audio files (*.wav)" + << "Any files (*)"; + + QFileDialog fd {this, tr ("Sound File"), ui_->sound_dm_path_display_label->text ()}; + fd.setNameFilters(filters); + + if (fd.exec ()) { + if (fd.selectedFiles ().size ()) { + if(rig_params_.ptt_type == TransceiverFactory::PTT_method_VOX){ + QMessageBox::warning(this, "Notifications Sounds Warning", "You have enabled notification sounds while using VOX. To avoid transmitting these notification sounds, please make sure your rig is using a different sound card than your system."); + } + ui_->sound_dm_path_display_label->setText(fd.selectedFiles().at(0)); + } + } +} + +void Configuration::impl::on_sound_dm_path_reset_push_button_clicked(){ + ui_->sound_dm_path_display_label->clear(); +} + +void Configuration::impl::on_sound_am_path_select_push_button_clicked(){ + QStringList filters; + filters << "Audio files (*.wav)" + << "Any files (*)"; + + QFileDialog fd {this, tr ("Sound File"), ui_->sound_am_path_display_label->text ()}; + fd.setNameFilters(filters); + + if (fd.exec ()) { + if (fd.selectedFiles ().size ()) { + if(rig_params_.ptt_type == TransceiverFactory::PTT_method_VOX){ + QMessageBox::warning(this, "Notifications Sounds Warning", "You have enabled notification sounds while using VOX. To avoid transmitting these notification sounds, please make sure your rig is using a different sound card than your system."); + } + ui_->sound_am_path_display_label->setText(fd.selectedFiles().at(0)); + } + } +} + +void Configuration::impl::on_sound_am_path_reset_push_button_clicked(){ + ui_->sound_am_path_display_label->clear(); +} + void Configuration::impl::on_calibration_intercept_spin_box_valueChanged (double) { rig_active_ = false; // force reset diff --git a/Configuration.hpp b/Configuration.hpp index 5de2981..8648ec4 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -175,6 +175,8 @@ public: QStringListModel const * macros () const; QDir save_directory () const; QDir azel_directory () const; + QString sound_dm_path() const; + QString sound_am_path() const; QString rig_name () const; Type2MsgGen type_2_msg_gen () const; QColor color_CQ () const; diff --git a/Configuration.ui b/Configuration.ui index 40e7941..cab5446 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -1790,6 +1790,95 @@ both here. + + + + Notification Sounds + + + + + + Directed Message Received: + + + azel_path_select_push_button + + + + + + + + 1 + 0 + + + + background-color: rgb(255, 255, 255); + + + TextLabel + + + + + + + Select + + + + + + + Clear + + + + + + + Alert Message Received: + + + azel_path_select_push_button + + + + + + + Select + + + + + + + Clear + + + + + + + + 1 + 0 + + + + background-color: rgb(255, 255, 255); + + + TextLabel + + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 3b80343..997a52d 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include "APRSISClient.h" #include "revision_utils.hpp" @@ -9318,6 +9319,11 @@ void MainWindow::processCommandActivity() { {"SNR", QVariant(ad.snr)}, {"UTC", QVariant(ad.utcTimestamp.toMSecsSinceEpoch())} }); + + auto wav = m_config.sound_dm_path(); + if(!wav.isEmpty()){ + QSound::play(wav); + } } // and mark the offset as a directed offset so future free text is displayed @@ -9489,6 +9495,11 @@ void MainWindow::processCommandActivity() { enqueueMessage(PriorityHigh, QString("%1 ACK").arg(d.from), d.freq, nullptr); }); + auto wav = m_config.sound_am_path(); + if(!wav.isEmpty()){ + QSound::play(wav); + } + msgBox->show(); // make sure this is explicit