23 #include "ircsounds.h"
25 #include "irc/configuration/ircconfig.h"
26 #include "templatedpathresolver.h"
29 #include <QSoundEffect>
35 if (gIRCConfig.sounds.bUseNicknameUsedSound)
37 QString path = gIRCConfig.sounds.nicknameUsedSound;
38 sounds.insert(NicknameUsed, loadIfExists(path));
41 if (gIRCConfig.sounds.bUsePrivateMessageReceivedSound)
43 QString path = gIRCConfig.sounds.privateMessageReceivedSound;
44 sounds.insert(PrivateMessageReceived, loadIfExists(path));
48 QSoundEffect *IRCSounds::loadIfExists(
const QString &path)
51 if (fileInfo.isFile())
53 auto sfx =
new QSoundEffect();
54 sfx->setSource(QUrl::fromLocalFile(fileInfo.absoluteFilePath()));
62 auto pSound = sounds[sound];
63 if (pSound !=
nullptr)
67 void IRCSounds::unload()
69 for (
auto sfx : sounds)