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())
52 return new QSound(path);
60 QSound* pSound = sounds[sound];
67 void IRCSounds::unload()
69 QMap<SoundType, QSound*>::iterator it;
70 for (it = sounds.begin(); it != sounds.end(); ++it)
72 if (it.value() != NULL)
void loadFromConfig()
Reloads all sounds using paths stored in config.
void playIfAvailable(SoundType sound)
Plays given sound.