[PC-BSD Commits] r16466 - in pcbsd/current/src-qt4: pc-firstbootgui pc-installgui

svn at pcbsd.org svn at pcbsd.org
Thu Apr 19 10:08:48 PDT 2012


Author: kris
Date: 2012-04-19 17:08:48 +0000 (Thu, 19 Apr 2012)
New Revision: 16466

Modified:
   pcbsd/current/src-qt4/pc-firstbootgui/backend.cpp
   pcbsd/current/src-qt4/pc-installgui/backend.cpp
Log:

Fix both GUI's to show the proper UTF8 formatted language names



Modified: pcbsd/current/src-qt4/pc-firstbootgui/backend.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-firstbootgui/backend.cpp	2012-04-19 16:56:26 UTC (rev 16465)
+++ pcbsd/current/src-qt4/pc-firstbootgui/backend.cpp	2012-04-19 17:08:48 UTC (rev 16466)
@@ -1,4 +1,5 @@
 #include <QApplication>
+#include <QFile>
 
 #include "backend.h"
 
@@ -100,17 +101,22 @@
     QStringList _languages;
     QString code, desc, line;
 
-    Process p(QStringList() << "query-langs");
+    QFile mFile;
+    mFile.setFileName("/usr/share/pc-sysinstall/conf/avail-langs");
+    if ( ! mFile.open(QIODevice::ReadOnly | QIODevice::Text))
+       return QStringList();
 
-    if (p.waitForFinished()) {
-        while (p.canReadLine()) {
-            line = p.readLine();
-            code = line;
-            code.truncate(line.indexOf(" "));
-            desc = line.remove(0, line.indexOf(" "));
-            _languages.append(desc.simplified() + " - (" + code.simplified() + ")");
-        }
+    // Read in the meta-file for categories
+    QTextStream in(&mFile);
+    in.setCodec("UTF-8");
+    while ( !in.atEnd() ) {
+       line = in.readLine();
+       code = line;
+       code.truncate(line.indexOf(" "));
+       desc = line.remove(0, line.indexOf(" "));
+        _languages.append(desc.simplified() + " - (" + code.simplified() + ")");
     }
+    mFile.close();
     return _languages;
 }
 

Modified: pcbsd/current/src-qt4/pc-installgui/backend.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-installgui/backend.cpp	2012-04-19 16:56:26 UTC (rev 16465)
+++ pcbsd/current/src-qt4/pc-installgui/backend.cpp	2012-04-19 17:08:48 UTC (rev 16466)
@@ -1,4 +1,5 @@
 #include <QApplication>
+#include <QFile>
 
 #include "backend.h"
 
@@ -100,17 +101,22 @@
     QStringList _languages;
     QString code, desc, line;
 
-    Process p(QStringList() << "query-langs");
+    QFile mFile;
+    mFile.setFileName("/usr/share/pc-sysinstall/conf/avail-langs");
+    if ( ! mFile.open(QIODevice::ReadOnly | QIODevice::Text))
+       return QStringList();
 
-    if (p.waitForFinished()) {
-        while (p.canReadLine()) {
-            line = p.readLine();
-            code = line;
-            code.truncate(line.indexOf(" "));
-            desc = line.remove(0, line.indexOf(" "));
-            _languages.append(desc.simplified() + " - (" + code.simplified() + ")");
-        }
+    // Read in the meta-file for categories
+    QTextStream in(&mFile);
+    in.setCodec("UTF-8");
+    while ( !in.atEnd() ) {
+       line = in.readLine();
+       code = line;
+       code.truncate(line.indexOf(" "));
+       desc = line.remove(0, line.indexOf(" "));
+        _languages.append(desc.simplified() + " - (" + code.simplified() + ")");
     }
+    mFile.close();
     return _languages;
 }
 



More information about the Commits mailing list