[PC-BSD Commits] r4601 - in pcbsd/trunk/SysInstaller: . phases

svn at pcbsd.org svn at pcbsd.org
Wed Oct 7 12:32:55 PDT 2009


Author: kris
Date: 2009-10-07 12:32:55 -0700 (Wed, 07 Oct 2009)
New Revision: 4601

Added:
   pcbsd/trunk/SysInstaller/globals.h
Modified:
   pcbsd/trunk/SysInstaller/main.cpp
   pcbsd/trunk/SysInstaller/phases/anteinstall.cpp
Log:

Added new globals.h file, which we'll use to define a few things for the backend, and
updated phases/anteinstall.cpp to load our languages from the backend



Modified: pcbsd/trunk/SysInstaller/main.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/main.cpp	2009-10-07 18:20:59 UTC (rev 4600)
+++ pcbsd/trunk/SysInstaller/main.cpp	2009-10-07 19:32:55 UTC (rev 4601)
@@ -1,8 +1,10 @@
 #include <QtGui/QApplication>
+#include "globals.h"
 #include "installer.h"
 
 #include "custom/manhattanstyle.h"
 
+
 int main(int argc, char *argv[])
 {
     QApplication application(argc, argv);

Modified: pcbsd/trunk/SysInstaller/phases/anteinstall.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/phases/anteinstall.cpp	2009-10-07 18:20:59 UTC (rev 4600)
+++ pcbsd/trunk/SysInstaller/phases/anteinstall.cpp	2009-10-07 19:32:55 UTC (rev 4601)
@@ -1,7 +1,9 @@
 #include <QtGui/QFileDialog>
 #include <QtGui/QInputDialog>
+#include <QProcess>
 
 #include "anteinstall.h"
+#include "globals.h"
 
 
 AnteInstall::AnteInstall(QWidget *parent) : QStackedWidget(parent)
@@ -73,13 +75,29 @@
 void AnteInstall::loadLanguages()
 {
     QStringList languages;
+    QString langcode, line, langdesc;
 
-    // load languages into "languages" stringlist
-    // <ForTest>
-    languages.append("English US");
-    languages.append("English UK");
-    languages.append("English KE");
-    // </ForTestT>
+    // Create process to load the languages from the backend
+    QProcess getLangProc;
+    QString prog = PCSYSINSTALL;
+    QStringList args;
+    args << "query-langs";
+    getLangProc.setReadChannel(QProcess::StandardOutput);
+    getLangProc.start(prog, args);
+
+    // Wait for the process to finish
+    if ( getLangProc.waitForFinished() )
+    {
+      // load languages into "languages" stringlist
+      while (getLangProc.canReadLine()) {
+        line = getLangProc.readLine();
+        langcode = line;
+        langcode.truncate(line.indexOf(" ") ); 
+        langdesc = line.remove(0, line.indexOf(" ") + 1);
+        languages.append(langdesc + "(" + langcode + ")");
+      }
+    }
+
     comboLanguage->addItems(languages);
 }
 



More information about the Commits mailing list