23 #include "ircsounds.h" 25 #include "irc/configuration/ircconfig.h" 34 if (gIRCConfig.sounds.bUseNicknameUsedSound)
36 QString path = gIRCConfig.sounds.nicknameUsedSound;
37 sounds.insert(NicknameUsed, loadIfExists(path));
40 if (gIRCConfig.sounds.bUsePrivateMessageReceivedSound)
42 QString path = gIRCConfig.sounds.privateMessageReceivedSound;
43 sounds.insert(PrivateMessageReceived, loadIfExists(path));
47 QSound *IRCSounds::loadIfExists(
const QString &path)
49 QFileInfo fileInfo(path);
50 if (fileInfo.isFile())
51 return new QSound(path);
58 QSound *pSound = sounds[sound];
59 if (pSound !=
nullptr)
63 void IRCSounds::unload()
65 QMap<SoundType, QSound *>::iterator it;
66 for (it = sounds.begin(); it != sounds.end(); ++it)
68 if (it.value() !=
nullptr)
void loadFromConfig()
Reloads all sounds using paths stored in config.
void playIfAvailable(SoundType sound)
Plays given sound.