From 51d21a45ecd45ba10ce4345ef8b0a0b4175edcba Mon Sep 17 00:00:00 2001 From: TrickyLeifa <26681464+TrickyLeifa@users.noreply.github.com> Date: Wed, 17 Jun 2026 14:47:40 +0200 Subject: [PATCH 1/4] Added callword sfx filepath to options Resolve #821 --- data/ui/options_dialog.ui | 74 +++++++++++++++++++++++---------- src/courtroom.cpp | 10 ++++- src/options.cpp | 10 +++++ src/options.h | 3 ++ src/widgets/aooptionsdialog.cpp | 2 + src/widgets/aooptionsdialog.h | 1 + 6 files changed, 77 insertions(+), 23 deletions(-) diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui index dbb61713d..a7ea2f883 100644 --- a/data/ui/options_dialog.ui +++ b/data/ui/options_dialog.ui @@ -6,12 +6,12 @@ 0 0 - 450 + 478 415 - Qt::NoContextMenu + Qt::ContextMenuPolicy::NoContextMenu Settings @@ -20,10 +20,10 @@ - Qt::NoFocus + Qt::FocusPolicy::NoFocus - 0 + 1 @@ -39,8 +39,8 @@ 0 - -585 - 394 + 0 + 422 902 @@ -104,10 +104,10 @@ - 1 + 1.000000000000000 - 8 + 8.000000000000000 @@ -131,7 +131,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -195,7 +195,7 @@ Chat Rate Limit: - Qt::PlainText + Qt::TextFormat::PlainText @@ -212,7 +212,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -266,7 +266,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -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, a general alert beep will be played instead.</p></body></html> + + + true + + + @@ -657,7 +681,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -684,7 +708,7 @@ - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -816,6 +840,9 @@ + + Qt::Orientation::Vertical + 40 @@ -852,8 +879,11 @@ + + Qt::Orientation::Vertical + - QSizePolicy::Fixed + QSizePolicy::Policy::Fixed @@ -1108,7 +1138,7 @@ Default: 0. - QFrame::NoFrame + QFrame::Shape::NoFrame @@ -1122,7 +1152,7 @@ Default: 0. - QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Save + QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::RestoreDefaults|QDialogButtonBox::StandardButton::Save diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 3057d0a10..508121c8b 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3421,7 +3421,15 @@ 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 { + qApp->beep(); + } + // 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; From dbb1ae0305a8463c148a28c71aa10962ecebe55e Mon Sep 17 00:00:00 2001 From: TrickyLeifa <26681464+TrickyLeifa@users.noreply.github.com> Date: Wed, 17 Jun 2026 22:01:29 +0200 Subject: [PATCH 2/4] Update courtroom.cpp --- src/courtroom.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 508121c8b..1f76817f1 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3426,7 +3426,8 @@ void Courtroom::handle_callwords() { modcall_player->play(l_filepath); } - else { + else + { qApp->beep(); } From 62d1e938adc3e6f0d4678700bca2ef234cb63384 Mon Sep 17 00:00:00 2001 From: TrickyLeifa <26681464+TrickyLeifa@users.noreply.github.com> Date: Fri, 19 Jun 2026 21:38:23 +0200 Subject: [PATCH 3/4] Update options_dialog.ui --- data/ui/options_dialog.ui | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui index a7ea2f883..47a2ed887 100644 --- a/data/ui/options_dialog.ui +++ b/data/ui/options_dialog.ui @@ -11,7 +11,7 @@ - Qt::ContextMenuPolicy::NoContextMenu + Qt::NoContextMenu Settings @@ -20,10 +20,10 @@ - Qt::FocusPolicy::NoFocus + Qt::NoFocus - 1 + 0 @@ -131,7 +131,7 @@ - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -195,7 +195,7 @@ Chat Rate Limit: - Qt::TextFormat::PlainText + Qt::PlainText @@ -212,7 +212,7 @@ - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -266,7 +266,7 @@ - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -681,7 +681,7 @@ - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -708,7 +708,7 @@ - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -841,7 +841,7 @@ - Qt::Orientation::Vertical + Qt::Vertical @@ -880,10 +880,10 @@ - Qt::Orientation::Vertical + Qt::Vertical - QSizePolicy::Policy::Fixed + QSizePolicy::Fixed @@ -1138,7 +1138,7 @@ Default: 0. - QFrame::Shape::NoFrame + QFrame::NoFrame @@ -1152,7 +1152,7 @@ Default: 0. - QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::RestoreDefaults|QDialogButtonBox::StandardButton::Save + QDialogButtonBox::Cancel|QDialogButtonBox::RestoreDefaults|QDialogButtonBox::Save From 57e1cd40742a4d9fee5a86332f58fdcc6a486350 Mon Sep 17 00:00:00 2001 From: TrickyLeifa <26681464+TrickyLeifa@users.noreply.github.com> Date: Sat, 20 Jun 2026 07:00:21 +0200 Subject: [PATCH 4/4] Replaced OS beep with current theme's callword sound NOTE: If the theme points to the wrong sound, it'll still fail to play. --- data/ui/options_dialog.ui | 2 +- src/courtroom.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/ui/options_dialog.ui b/data/ui/options_dialog.ui index 47a2ed887..3dd3389ef 100644 --- a/data/ui/options_dialog.ui +++ b/data/ui/options_dialog.ui @@ -654,7 +654,7 @@ - <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, a general alert beep will be played instead.</p></body></html> + <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 diff --git a/src/courtroom.cpp b/src/courtroom.cpp index 1f76817f1..cd64b61ab 100644 --- a/src/courtroom.cpp +++ b/src/courtroom.cpp @@ -3428,7 +3428,7 @@ void Courtroom::handle_callwords() } else { - qApp->beep(); + modcall_player->findAndPlaySfx(ao_app->get_court_sfx("word_call")); } // Make the window flash