Added notification for CQ messages

This commit is contained in:
Jordan Sherer 2018-11-15 15:03:05 -05:00
parent 1052dd3f9f
commit 04394273dd
5 changed files with 160 additions and 65 deletions

View File

@ -463,6 +463,9 @@ 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_cq_path_select_push_button_clicked();
Q_SLOT void on_sound_cq_path_test_push_button_clicked();
Q_SLOT void on_sound_cq_path_reset_push_button_clicked();
Q_SLOT void on_sound_dm_path_select_push_button_clicked();
Q_SLOT void on_sound_dm_path_test_push_button_clicked();
Q_SLOT void on_sound_dm_path_reset_push_button_clicked();
@ -517,6 +520,7 @@ private:
QDir default_azel_directory_;
QDir azel_directory_;
QString sound_cq_path_; // cq message sound file
QString sound_dm_path_; // directed message sound file
QString sound_am_path_; // alert message sound file
@ -810,6 +814,7 @@ 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_cq_path() const {return m_->sound_cq_path_;}
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;}
@ -1332,6 +1337,7 @@ 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_cq_path_display_label->setText(sound_cq_path_);
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_);
@ -1536,6 +1542,7 @@ 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_cq_path_ = settings_->value ("SoundCQPath", "").toString ();
sound_dm_path_ = settings_->value ("SoundDMPath", "").toString ();
sound_am_path_ = settings_->value ("SoundAMPath", "").toString ();
@ -1739,6 +1746,7 @@ 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 ("SoundCQPath", sound_cq_path_);
settings_->setValue ("SoundDMPath", sound_dm_path_);
settings_->setValue ("SoundAMPath", sound_am_path_);
@ -2284,6 +2292,7 @@ void Configuration::impl::accept ()
data_mode_ = static_cast<DataMode> (ui_->TX_mode_button_group->checkedId ());
save_directory_ = ui_->save_path_display_label->text ();
azel_directory_ = ui_->azel_path_display_label->text ();
sound_cq_path_ = ui_->sound_cq_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 ();
@ -2952,6 +2961,37 @@ void Configuration::impl::on_azel_path_select_push_button_clicked (bool /* check
}
}
void Configuration::impl::on_sound_cq_path_select_push_button_clicked(){
QStringList filters;
filters << "Audio files (*.wav)"
<< "Any files (*)";
QFileDialog fd {this, tr ("Sound File"), ui_->sound_cq_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_cq_path_display_label->setText(fd.selectedFiles().at(0));
}
}
}
void Configuration::impl::on_sound_cq_path_test_push_button_clicked(){
auto path = ui_->sound_cq_path_display_label->text();
if(path.isEmpty()){
return;
}
QSound::play(path);
}
void Configuration::impl::on_sound_cq_path_reset_push_button_clicked(){
ui_->sound_cq_path_display_label->clear();
}
void Configuration::impl::on_sound_dm_path_select_push_button_clicked(){
QStringList filters;
filters << "Audio files (*.wav)"

View File

@ -180,6 +180,7 @@ public:
QStringListModel const * macros () const;
QDir save_directory () const;
QDir azel_directory () const;
QString sound_cq_path() const;
QString sound_dm_path() const;
QString sound_am_path() const;
QString rig_name () const;

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>800</width>
<height>525</height>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
@ -63,7 +63,7 @@
<x>0</x>
<y>0</y>
<width>738</width>
<height>378</height>
<height>453</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
@ -1243,7 +1243,7 @@ a few, particularly some Kenwood rigs, require it).</string>
<rect>
<x>0</x>
<y>0</y>
<width>718</width>
<width>237</width>
<height>436</height>
</rect>
</property>
@ -1662,7 +1662,7 @@ radio interface behave as expected.</string>
<x>0</x>
<y>0</y>
<width>760</width>
<height>427</height>
<height>502</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_29">
@ -2420,7 +2420,7 @@ for assessing propagation and system performance.</string>
<x>0</x>
<y>0</y>
<width>760</width>
<height>427</height>
<height>502</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_31">
@ -2755,71 +2755,38 @@ QListView::item:hover {
<property name="rightMargin">
<number>0</number>
</property>
<item row="1" column="4">
<widget class="QPushButton" name="sound_am_path_reset_push_button">
<item row="6" column="3">
<widget class="QPushButton" name="sound_am_path_test_push_button">
<property name="text">
<string>Clear</string>
<string>Test</string>
</property>
</widget>
</item>
<item row="0" column="4">
<item row="5" column="4">
<widget class="QPushButton" name="sound_dm_path_reset_push_button">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="sound_dm_path_display_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<item row="6" column="4">
<widget class="QPushButton" name="sound_am_path_reset_push_button">
<property name="text">
<string>TextLabel</string>
<string>Clear</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="sound_am_path_select_push_button">
<item row="3" column="0">
<widget class="QLabel" name="sound_cq_path_label">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="sound_am_path_label">
<property name="text">
<string>Reply Dialog Message Received:</string>
<string>CQ Message Received:</string>
</property>
<property name="buddy">
<cstring>azel_path_select_push_button</cstring>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="sound_dm_path_select_push_button">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="sound_dm_path_label">
<property name="text">
<string>Directed Message Received:</string>
</property>
<property name="buddy">
<cstring>azel_path_select_push_button</cstring>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="6" column="1">
<widget class="QLabel" name="sound_am_path_display_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
@ -2835,20 +2802,100 @@ QListView::item:hover {
</property>
</widget>
</item>
<item row="0" column="3">
<item row="6" column="0">
<widget class="QLabel" name="sound_am_path_label">
<property name="text">
<string>Relay/Alert Message Received:</string>
</property>
<property name="buddy">
<cstring>azel_path_select_push_button</cstring>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QPushButton" name="sound_dm_path_select_push_button">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="sound_dm_path_display_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="6" column="2">
<widget class="QPushButton" name="sound_am_path_select_push_button">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="sound_dm_path_label">
<property name="text">
<string>Directed Message Received:</string>
</property>
<property name="buddy">
<cstring>azel_path_select_push_button</cstring>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QPushButton" name="sound_dm_path_test_push_button">
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QPushButton" name="sound_am_path_test_push_button">
<item row="3" column="1">
<widget class="QLabel" name="sound_cq_path_display_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QPushButton" name="sound_cq_path_select_push_button">
<property name="text">
<string>Select</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="sound_cq_path_test_push_button">
<property name="text">
<string>Test</string>
</property>
</widget>
</item>
<item row="3" column="4">
<widget class="QPushButton" name="sound_cq_path_reset_push_button">
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -2951,7 +2998,7 @@ QListView::item:hover {
<x>0</x>
<y>0</y>
<width>738</width>
<height>303</height>
<height>378</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_15">
@ -3205,8 +3252,8 @@ QListView::item:hover {
<rect>
<x>0</x>
<y>0</y>
<width>738</width>
<height>450</height>
<width>233</width>
<height>253</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">
@ -3409,8 +3456,8 @@ QListView::item:hover {
<rect>
<x>0</x>
<y>0</y>
<width>738</width>
<height>450</height>
<width>277</width>
<height>93</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_8">

View File

@ -3710,6 +3710,9 @@ void MainWindow::readFromStdout() //readFromStdout
// it is not processed elsewhere, so we need to just log it here.
logCallActivity(cd, true);
// play cq notification
playSoundNotification(m_config.sound_cq_path());
} else {
// convert HEARTBEAT to a directed command and process...
cmd.from = cd.call;
@ -3933,6 +3936,15 @@ void MainWindow::readFromStdout() //readFromStdout
// See MainWindow::postDecode for displaying the latest decodes
}
void MainWindow::playSoundNotification(const QString &path){
if(path.isEmpty()){
return;
}
qDebug() << "Trying to play sound file" << path;
QSound::play(path);
}
bool MainWindow::hasExistingMessageBuffer(int offset, bool drift, int *pPrevOffset){
if(m_messageBuffer.contains(offset)){
@ -8796,10 +8808,7 @@ void MainWindow::processCommandActivity() {
});
if(!isAllCall){
auto wav = m_config.sound_dm_path();
if(!wav.isEmpty()){
QSound::play(wav);
}
playSoundNotification(m_config.sound_dm_path());
}
writeDirectedCommandToFile(d);
@ -9172,10 +9181,7 @@ void MainWindow::processAlertReplyForCommand(CommandDetail d, QString from, QStr
}
});
auto wav = m_config.sound_am_path();
if(!wav.isEmpty()){
QSound::play(wav);
}
playSoundNotification(m_config.sound_am_path());
msgBox->setModal(false);
msgBox->show();

View File

@ -130,6 +130,7 @@ public slots:
void msgAvgDecode2();
void fastPick(int x0, int x1, int y);
void playSoundNotification(const QString &path);
bool hasExistingMessageBuffer(int offset, bool drift, int *pPrevOffset);
void logCallActivity(CallDetail d, bool spot=true);
QString lookupCallInCompoundCache(QString const &call);