mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Add option to play highlight sounds even if Chatterino is focused.
This is off by default
This commit is contained in:
parent
8b25d37a37
commit
23651fd513
4 changed files with 9 additions and 1 deletions
|
@ -36,6 +36,7 @@ SettingsManager::SettingsManager()
|
||||||
, highlightProperties(this->settingsItems, "highlightProperties",
|
, highlightProperties(this->settingsItems, "highlightProperties",
|
||||||
QMap<QString, QPair<bool, bool>>())
|
QMap<QString, QPair<bool, bool>>())
|
||||||
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
|
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
|
||||||
|
, highlightAlwaysPlaySound("/highlighting/alwaysPlaySound", false)
|
||||||
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
|
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
|
||||||
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
|
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
|
||||||
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)
|
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)
|
||||||
|
|
|
@ -50,6 +50,7 @@ public:
|
||||||
Setting<QString> pathHighlightSound;
|
Setting<QString> pathHighlightSound;
|
||||||
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
|
||||||
Setting<QString> highlightUserBlacklist;
|
Setting<QString> highlightUserBlacklist;
|
||||||
|
pajlada::Settings::Setting<bool> highlightAlwaysPlaySound;
|
||||||
Setting<bool> enableTwitchEmotes;
|
Setting<bool> enableTwitchEmotes;
|
||||||
Setting<bool> enableBttvEmotes;
|
Setting<bool> enableBttvEmotes;
|
||||||
Setting<bool> enableFfzEmotes;
|
Setting<bool> enableFfzEmotes;
|
||||||
|
|
|
@ -412,6 +412,9 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
bool doHighlight = false;
|
bool doHighlight = false;
|
||||||
bool playSound = false;
|
bool playSound = false;
|
||||||
bool doAlert = false;
|
bool doAlert = false;
|
||||||
|
|
||||||
|
bool hasFocus = (QApplication::focusWidget() != nullptr);
|
||||||
|
|
||||||
if (!blackList.contains(this->ircMessage->nick(), Qt::CaseInsensitive)) {
|
if (!blackList.contains(this->ircMessage->nick(), Qt::CaseInsensitive)) {
|
||||||
for (const Highlight &highlight : activeHighlights) {
|
for (const Highlight &highlight : activeHighlights) {
|
||||||
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
|
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
|
||||||
|
@ -437,7 +440,7 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
|
|
||||||
this->setHighlight(doHighlight);
|
this->setHighlight(doHighlight);
|
||||||
|
|
||||||
if (playSound) {
|
if (playSound && (!hasFocus || settings.highlightAlwaysPlaySound)) {
|
||||||
player->play();
|
player->play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -484,6 +484,9 @@ void SettingsDialog::addTabs()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
vbox->addLayout(soundForm);
|
vbox->addLayout(soundForm);
|
||||||
|
vbox->addWidget(
|
||||||
|
createCheckbox("Always play highlight sound (Even if Chatterino is focused)",
|
||||||
|
settings.highlightAlwaysPlaySound));
|
||||||
auto layoutVbox = new QVBoxLayout();
|
auto layoutVbox = new QVBoxLayout();
|
||||||
auto btnHbox = new QHBoxLayout();
|
auto btnHbox = new QHBoxLayout();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue