Add option to play highlight sounds even if Chatterino is focused.

This is off by default
This commit is contained in:
Rasmus Karlsson 2017-10-08 15:58:28 +02:00
parent 8b25d37a37
commit 23651fd513
4 changed files with 9 additions and 1 deletions

View file

@ -36,6 +36,7 @@ SettingsManager::SettingsManager()
, highlightProperties(this->settingsItems, "highlightProperties",
QMap<QString, QPair<bool, bool>>())
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
, highlightAlwaysPlaySound("/highlighting/alwaysPlaySound", false)
, enableTwitchEmotes(this->settingsItems, "enableTwitchEmotes", true)
, enableBttvEmotes(this->settingsItems, "enableBttvEmotes", true)
, enableFfzEmotes(this->settingsItems, "enableFfzEmotes", true)

View file

@ -50,6 +50,7 @@ public:
Setting<QString> pathHighlightSound;
Setting<QMap<QString, QPair<bool, bool>>> highlightProperties;
Setting<QString> highlightUserBlacklist;
pajlada::Settings::Setting<bool> highlightAlwaysPlaySound;
Setting<bool> enableTwitchEmotes;
Setting<bool> enableBttvEmotes;
Setting<bool> enableFfzEmotes;

View file

@ -412,6 +412,9 @@ void TwitchMessageBuilder::parseHighlights()
bool doHighlight = false;
bool playSound = false;
bool doAlert = false;
bool hasFocus = (QApplication::focusWidget() != nullptr);
if (!blackList.contains(this->ircMessage->nick(), Qt::CaseInsensitive)) {
for (const Highlight &highlight : activeHighlights) {
if (this->originalMessage.contains(highlight.target, Qt::CaseInsensitive)) {
@ -437,7 +440,7 @@ void TwitchMessageBuilder::parseHighlights()
this->setHighlight(doHighlight);
if (playSound) {
if (playSound && (!hasFocus || settings.highlightAlwaysPlaySound)) {
player->play();
}

View file

@ -484,6 +484,9 @@ void SettingsDialog::addTabs()
}
});
vbox->addLayout(soundForm);
vbox->addWidget(
createCheckbox("Always play highlight sound (Even if Chatterino is focused)",
settings.highlightAlwaysPlaySound));
auto layoutVbox = new QVBoxLayout();
auto btnHbox = new QHBoxLayout();