mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
ping sound media doesn't get recreated on every message
This commit is contained in:
parent
cca065f0f9
commit
625e33d654
|
@ -364,6 +364,7 @@ void TwitchMessageBuilder::appendUsername()
|
||||||
void TwitchMessageBuilder::parseHighlights()
|
void TwitchMessageBuilder::parseHighlights()
|
||||||
{
|
{
|
||||||
static auto player = new QMediaPlayer;
|
static auto player = new QMediaPlayer;
|
||||||
|
static QUrl currentPlayerUrl;
|
||||||
SettingsManager &settings = SettingsManager::getInstance();
|
SettingsManager &settings = SettingsManager::getInstance();
|
||||||
static pajlada::Settings::Setting<std::string> currentUser("/accounts/current");
|
static pajlada::Settings::Setting<std::string> currentUser("/accounts/current");
|
||||||
|
|
||||||
|
@ -374,10 +375,18 @@ void TwitchMessageBuilder::parseHighlights()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update the media player url if necessary
|
||||||
|
QUrl highlightSoundUrl;
|
||||||
if (settings.customHighlightSound) {
|
if (settings.customHighlightSound) {
|
||||||
player->setMedia(QUrl(settings.pathHighlightSound.get()));
|
highlightSoundUrl = QUrl(settings.pathHighlightSound.get());
|
||||||
} else {
|
} else {
|
||||||
player->setMedia(QUrl("qrc:/sounds/ping2.wav"));
|
highlightSoundUrl = QUrl("qrc:/sounds/ping2.wav");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentPlayerUrl != highlightSoundUrl) {
|
||||||
|
player->setMedia(highlightSoundUrl);
|
||||||
|
|
||||||
|
currentPlayerUrl = highlightSoundUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Highlight {
|
struct Highlight {
|
||||||
|
|
Loading…
Reference in a new issue