#include "soundplayer.h" QMap SoundPlayer::map; QSound *SoundPlayer::current = 0; void SoundPlayer::play(const QString &filename) { if (current && !current->isFinished()) current->stop(); if (map.contains(filename)) current = map.value(filename); else { current = new QSound(filename); map[filename] = current; } current->play(); } void SoundPlayer::playClick() { play(":/sounds/button.wav"); } void SoundPlayer::playStart() { play(":/sounds/start.wav"); } void SoundPlayer::playStop() { play(":/sounds/stop.wav"); } void SoundPlayer::playError1() { play(":/sounds/error1.wav"); } void SoundPlayer::playError2() { play(":/sounds/error2.wav"); }