QTfrontend/main.cpp
changeset 6167 728cabee2c9f
parent 6160 863d3edf5690
child 6174 2d5717595471
--- a/QTfrontend/main.cpp	Fri Oct 21 08:03:42 2011 +0200
+++ b/QTfrontend/main.cpp	Fri Oct 21 08:41:21 2011 +0200
@@ -406,25 +406,21 @@
         themes.sort();
         for(int i = themes.size() - 1; i >= 0; --i)
         {
-            QFile * tmpfile =
-            HWDataManager::instance().findFileForRead(
-                                QString("Themes/%1/icon.png").arg(themes.at(i))
-                            );
+            QString file = HWDataManager::instance().findFileForRead(
+                QString("Themes/%1/icon.png").arg(themes.at(i))
+            );
 
-            if(tmpfile->exists())
+            if(QFile::exists(file))
             { // load icon
                 QPair<QIcon, QIcon> ic;
-                ic.first = QIcon(tmpfile->fileName());
+                ic.first = QIcon(file);
 
-                QFile * previewIconFile =
+                // load preview icon
+                ic.second = QIcon(
                     HWDataManager::instance().findFileForRead(
-                            QString("Themes/%1/icon@2x.png").arg(themes.at(i))
-                        );
-
-                ic.second = QIcon(previewIconFile->fileName());
-
-                // this QFile is not needed any further
-                delete previewIconFile;
+                        QString("Themes/%1/icon@2x.png").arg(themes.at(i))
+                    )
+                );
 
                 icons.prepend(ic);
             }
@@ -432,9 +428,6 @@
             {
                 themes.removeAt(i);
             }
-
-            // this QFile is not needed any further
-            delete tmpfile;
         }
 
         themesModel = new ThemesModel(themes);
@@ -465,9 +458,13 @@
         QString cc = settings.value("misc/locale", QString()).toString();
         if(cc.isEmpty())
             cc = QLocale::system().name();
-        QFile * tmpfile = HWDataManager::instance().findFileForRead(
-                                            QString("Locale/hedgewars_" + cc));
-        Translator.load(tmpfile->fileName());
+
+        // load locale file into translator
+        Translator.load(
+            HWDataManager::instance().findFileForRead(
+                QString("Locale/hedgewars_" + cc)
+            )
+        );
         app.installTranslator(&Translator);
     }