[PC-BSD Commits] r5045 - pcbsd/trunk/SysInstaller

svn at pcbsd.org svn at pcbsd.org
Tue Nov 17 11:28:50 PST 2009


Author: kris
Date: 2009-11-17 11:28:50 -0800 (Tue, 17 Nov 2009)
New Revision: 5045

Modified:
   pcbsd/trunk/SysInstaller/backend.cpp
Log:

Load key variants in the SysInstaller



Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp	2009-11-17 19:03:14 UTC (rev 5044)
+++ pcbsd/trunk/SysInstaller/backend.cpp	2009-11-17 19:28:50 UTC (rev 5045)
@@ -42,11 +42,31 @@
 
 QStringList Backend::keyVariants(const QString &layout)
 {
-    QStringList variants;
+    QStringList _variants;
+    QString code, desc, line, laycode;
 
-    //load variations returns by script
+    // Get the code we should search for
+    laycode = layout;
+    laycode = laycode.remove(0, layout.indexOf("(") + 1);
+    laycode.truncate(laycode.indexOf(")") );
 
-    return variants;
+    Process p(QStringList() << "xkeyboard-variants");
+
+    if (p.waitForFinished()) {
+        while (p.canReadLine()) {
+            line = p.readLine();
+            // Look for variants for this particular layout
+            if ( line.indexOf(laycode + ":") != -1 )
+            {
+              code = line.simplified();
+              code.truncate(code.indexOf(" "));
+              desc = line.remove(0, line.indexOf(": ") + 1);
+              _variants.append(desc.simplified() + " - (" + code.simplified() + ")");
+            }
+        }
+    }
+
+    return _variants;
 }
 
 QStringList Backend::bootableMedia()



More information about the Commits mailing list