QTfrontend/ui/page/pageeditteam.cpp
changeset 6196 c16e84558f71
parent 6195 6c9ada03602d
child 6200 6a4ace88d85a
--- a/QTfrontend/ui/page/pageeditteam.cpp	Mon Oct 24 06:10:28 2011 +0200
+++ b/QTfrontend/ui/page/pageeditteam.cpp	Mon Oct 24 06:54:46 2011 +0200
@@ -27,13 +27,15 @@
 #include <QToolBox>
 #include <QMessageBox>
 
-#include "pageeditteam.h"
 #include "sdlkeys.h"
 #include "SquareLabel.h"
 #include "hats.h"
 #include "HWApplication.h"
+
 #include "HWDataManager.h"
 
+#include "pageeditteam.h"
+
 QLayout * PageEditTeam::bodyLayoutDefinition()
 {
     QGridLayout * pageLayout = new QGridLayout();
@@ -336,18 +338,18 @@
 
 void PageEditTeam::CBFort_activated(const QString & fortname)
 {
-    QFile tmp;
-    tmp.setFileName(cfgdir->absolutePath() + "/Data/Forts/" + fortname + "L.png");
-    if (!tmp.exists()) tmp.setFileName(datadir->absolutePath() + "/Forts/" + fortname + "L.png");
-    QPixmap pix(QFileInfo(tmp).absoluteFilePath());
+    HWDataManager & dataMgr = HWDataManager::instance();
+    QPixmap pix(dataMgr.findFileForRead("Forts/" + fortname + "L.png"));
     FortPreview->setPixmap(pix);
 }
 
 void PageEditTeam::testSound()
 {
+    HWDataManager & dataMgr = HWDataManager::instance();
+
     QString voiceDir = QString("Sounds/voices/") + CBVoicepack->currentText();
 
-    QStringList list = HWDataManager::instance().entryList(
+    QStringList list = dataMgr.entryList(
             voiceDir,
             QDir::Files,
             QStringList() <<
@@ -360,7 +362,7 @@
 
     if (!list.isEmpty())
         SDLInteraction::instance().playSoundFile(
-            HWDataManager::instance().findFileForRead(voiceDir + "/" +
+            dataMgr.findFileForRead(voiceDir + "/" +
                 list[rand() % list.size()])
         );
 }