Wee, now frontend is able to load translation file physfslayer
authorunc0rr
Sun, 04 Nov 2012 23:56:27 +0400
branchphysfslayer
changeset 7931 5a27ed7f17b7
parent 7928 88fde28bbda6
child 7951 c64c0b413ff7
Wee, now frontend is able to load translation file
QTfrontend/main.cpp
QTfrontend/util/FileEngine.cpp
--- a/QTfrontend/main.cpp	Sat Nov 03 00:34:35 2012 +0400
+++ b/QTfrontend/main.cpp	Sun Nov 04 23:56:27 2012 +0400
@@ -221,8 +221,10 @@
         return 1;
     }
 
+    // setup PhysFS
     engine.mount(datadir->absolutePath());
     engine.mount(cfgdir->absolutePath() + "/Data");
+    engine.mount(cfgdir->absolutePath());
     engine.setWriteDir(cfgdir->absolutePath());
 
     DataManager & dataMgr = DataManager::instance();
@@ -235,11 +237,8 @@
             cc = QLocale::system().name();
 
         // load locale file into translator
-        Translator.load(
-            dataMgr.findFileForRead(
-                QString("physfs://Locale/hedgewars_" + cc)
-            )
-        );
+        if(!Translator.load(QString("physfs://Locale/hedgewars_%1").arg(cc)))
+            qWarning("Failed to install translation");
         app.installTranslator(&Translator);
     }
 
--- a/QTfrontend/util/FileEngine.cpp	Sat Nov 03 00:34:35 2012 +0400
+++ b/QTfrontend/util/FileEngine.cpp	Sun Nov 04 23:56:27 2012 +0400
@@ -167,10 +167,12 @@
         _filename = file.mid(FileEngineHandler::scheme.size());
     else
         _filename = file;
+
     PHYSFS_Stat stat;
     if (PHYSFS_stat(_filename.toUtf8().constData(), &stat) != 0) {
         _size = stat.filesize;
         _datetime = QDateTime::fromTime_t(stat.modtime);
+        _flags |= QAbstractFileEngine::ReadUserPerm;
         _flags |= QAbstractFileEngine::ExistsFlag;
 
         switch (stat.filetype)