--- a/QTfrontend/ui/page/pageeditteam.cpp Fri Oct 21 04:11:26 2011 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp Fri Oct 21 07:00:49 2011 +0200
@@ -238,13 +238,12 @@
connect(CBFort, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(CBFort_activated(const QString &)));
}
-PageEditTeam::PageEditTeam(QWidget* parent, SDLInteraction * sdli) :
+PageEditTeam::PageEditTeam(QWidget* parent) :
AbstractPage(parent)
{
initPage();
m_playerHash = "0000000000000000000000000000000000000000";
- mySdli = sdli;
QDir tmpdir;
QStringList list;
@@ -401,22 +400,28 @@
void PageEditTeam::testSound()
{
- Mix_Chunk *sound;
- QDir tmpdir;
- mySdli->SDLMusicInit();
-
- tmpdir.cd(cfgdir->absolutePath());
- if (!tmpdir.cd("Data/Sounds/voices/"+CBVoicepack->currentText()))
+ QString voiceDir = QString("Sounds/voices/") + CBVoicepack->currentText();
+
+ QStringList list = HWDataManager::instance().entryList(
+ voiceDir,
+ QDir::Files/*,
+ QStringList() <<
+ "Illgetyou.ogg" <<
+ "Incoming.ogg" <<
+ "Stupid.ogg" <<
+ "Coward.ogg" <<
+ "Firstblood.ogg"*/
+ );
+
+ if (list.size())
{
- tmpdir.cd(datadir->absolutePath());
- tmpdir.cd("Sounds/voices");
- tmpdir.cd(CBVoicepack->currentText());
- }
+ QFile * tmpFile = HWDataManager::instance().findFileForRead(
+ voiceDir + "/" + list[rand() % list.size()]);
- QStringList list = tmpdir.entryList(QStringList() << "Illgetyou.ogg" << "Incoming.ogg" << "Stupid.ogg" << "Coward.ogg" << "Firstblood.ogg", QDir::Files);
- if (list.size()) {
- sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/" + list[rand() % list.size()]).toLocal8Bit().constData());
- Mix_PlayChannel(-1, sound, 0);
+ SDLInteraction::instance().playSoundFile(tmpFile->fileName());
+
+ // this QFile isn't needed any further
+ delete tmpFile;
}
}