Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 40 additions & 10 deletions data/ui/options_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<width>478</width>
<height>415</height>
</rect>
</property>
Expand Down Expand Up @@ -39,8 +39,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-585</y>
<width>394</width>
<y>0</y>
<width>422</width>
<height>902</height>
</rect>
</property>
Expand Down Expand Up @@ -104,10 +104,10 @@
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="theme_scaling_factor_sb">
<property name="minimum">
<number>1</number>
<double>1.000000000000000</double>
</property>
<property name="maximum">
<number>8</number>
<double>8.000000000000000</double>
</property>
</widget>
</item>
Expand Down Expand Up @@ -623,11 +623,8 @@
<attribute name="title">
<string>Callwords</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QPlainTextEdit" name="callwords_textbox"/>
</item>
<item>
<layout class="QFormLayout" name="formLayout_4">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="callwords_explain_lbl">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Enter as many callwords as you would like. These are case insensitive. Make sure to leave every callword in its own line!&lt;br/&gt;&lt;br/&gt;Do not leave a line with a space at the end -- you will be alerted everytime someone uses a space in their messages.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
Expand All @@ -637,6 +634,33 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QPlainTextEdit" name="callwords_textbox"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="callwords_sfx_lbl">
<property name="text">
<string>Sound</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="callwords_sfx">
<property name="placeholderText">
<string>Filepath</string>
Comment thread
WisoAltred marked this conversation as resolved.
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="callwords_sfx_explain">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;When a callword is triggered, the sound provided will be played instead of a general alert beep.&lt;/p&gt;&lt;p&gt;If the sound's filepath is invalid, the current theme's callword sound will be played instead.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="audio_tab">
Expand Down Expand Up @@ -816,6 +840,9 @@
<layout class="QGridLayout" name="mount_buttons_layout">
<item row="2" column="5">
<spacer name="mount_buttons_spacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
Expand Down Expand Up @@ -852,6 +879,9 @@
</item>
<item row="2" column="2">
<spacer name="mount_buttons_spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
Expand Down
11 changes: 10 additions & 1 deletion src/courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Comment thread
WisoAltred marked this conversation as resolved.
}
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
Expand Down
10 changes: 10 additions & 0 deletions src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions src/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/widgets/aooptionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,8 @@ void AOOptionsDialog::setupUI()
// people to put a billion entries in.
FROM_UI(QPlainTextEdit, callwords_textbox);
registerOption<QPlainTextEdit, QStringList>("callwords_textbox", &Options::callwords, &Options::setCallwords);
FROM_UI(QLineEdit, callwords_sfx);
registerOption<QLineEdit, QString>("callwords_sfx", &Options::callwordSfx, &Options::setCallwordSfx);

// Audio tab.
FROM_UI(QComboBox, audio_device_combobox);
Expand Down
1 change: 1 addition & 0 deletions src/widgets/aooptionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading