diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui index dbb61713d..3dd3389ef 100644 --- a/data/ui/options_dialog.ui +++ b/data/ui/options_dialog.ui @@ -6,7 +6,7 @@ 0 0 - 450 + 478 415 @@ -39,8 +39,8 @@ 0 - -585 - 394 + 0 + 422 902 @@ -104,10 +104,10 @@ - 1 + 1.000000000000000 - 8 + 8.000000000000000 @@ -623,11 +623,8 @@ Callwords - - - - - + + <html><head/><body><p>Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!<br/><br/>Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.</p></body></html> @@ -637,6 +634,33 @@ + + + + + + + Sound + + + + + + + Filepath + + + + + + + <html><head/><body><p>When a callword is triggered, the sound provided will be played instead of a general alert beep.</p><p>If the sound's filepath is invalid, the current theme's callword sound will be played instead.</p></body></html> + + + true + + + @@ -816,6 +840,9 @@ + + Qt::Vertical + 40 @@ -852,6 +879,9 @@ + + Qt::Vertical + QSizePolicy::Fixed diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3057d0a10..cd64b61ab 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3421,7 +3421,16 @@ void Courtroom::handle_callwords() if (f_message.contains(word, Qt::CaseInsensitive)) { // Play the call word sfx on the modcall_player sound container - modcall_player->findAndPlaySfx(ao_app->get_court_sfx("word_call")); + QString l_filepath = ao_app->get_sfx(Options::getInstance().callwordSfx()); + if (file_exists(l_filepath)) + { + modcall_player->play(l_filepath); + } + else + { + modcall_player->findAndPlaySfx(ao_app->get_court_sfx("word_call")); + } + // Make the window flash QApplication::alert(this); // Break the loop so we don't spam sound effects diff --git a/src/options.cpp b/src/options.cpp index 818ad8524..e87ba5a9a 100644 --- a/src/options.cpp +++ b/src/options.cpp @@ -634,6 +634,16 @@ void Options::setCallwords(QStringList value) config.setValue("callwords", value); } +QString Options::callwordSfx() const +{ + return config.value("callword_sfx").toString(); +} + +void Options::setCallwordSfx(QString value) +{ + config.setValue("callword_sfx", value); +} + QString Options::playerlistFormatString() const { return config.value("visuals/playerlist_format", "[{id}] {character} {displayname} {username}").toString(); diff --git a/src/options.h b/src/options.h index dfa7c2c3d..9b259edc4 100644 --- a/src/options.h +++ b/src/options.h @@ -257,6 +257,9 @@ class Options QStringList callwords() const; void setCallwords(QStringList value); + QString callwordSfx() const; + void setCallwordSfx(QString value); + QString playerlistFormatString() const; void setPlayerlistFormatString(QString value); diff --git a/src/widgets/aooptionsdialog.cpp b/src/widgets/aooptionsdialog.cpp index 81d5eb70a..d580caaf8 100644 --- a/src/widgets/aooptionsdialog.cpp +++ b/src/widgets/aooptionsdialog.cpp @@ -430,6 +430,8 @@ void AOOptionsDialog::setupUI() // people to put a billion entries in. FROM_UI(QPlainTextEdit, callwords_textbox); registerOption("callwords_textbox", &Options::callwords, &Options::setCallwords); + FROM_UI(QLineEdit, callwords_sfx); + registerOption("callwords_sfx", &Options::callwordSfx, &Options::setCallwordSfx); // Audio tab. FROM_UI(QComboBox, audio_device_combobox); diff --git a/src/widgets/aooptionsdialog.h b/src/widgets/aooptionsdialog.h index b89607dcb..b82829e5d 100644 --- a/src/widgets/aooptionsdialog.h +++ b/src/widgets/aooptionsdialog.h @@ -81,6 +81,7 @@ class AOOptionsDialog : public QDialog // The callwords tab QPlainTextEdit *ui_callwords_textbox; QCheckBox *ui_callwords_char_textbox; + QLineEdit *ui_callwords_sfx; // The audio tab QWidget *ui_audio_tab;