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

svn at pcbsd.org svn at pcbsd.org
Tue Nov 24 12:41:31 PST 2009


Author: kris
Date: 2009-11-24 12:41:31 -0800 (Tue, 24 Nov 2009)
New Revision: 5140

Modified:
   pcbsd/trunk/SysInstaller/backend.cpp
   pcbsd/trunk/SysInstaller/backend.h
   pcbsd/trunk/SysInstaller/sysinstaller.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
   pcbsd/trunk/SysInstaller/sysinstaller.ui
Log:

Setup a saved buffer variable, which keeps our keyVariants in memory, so there isn't a small slowdown when
clicking around the UI



Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp	2009-11-24 20:27:59 UTC (rev 5139)
+++ pcbsd/trunk/SysInstaller/backend.cpp	2009-11-24 20:41:31 UTC (rev 5140)
@@ -57,27 +57,34 @@
 }
 
 // Function which gets the key Variants for the target layout
-QStringList Backend::keyVariants(const QString &layout)
+QStringList Backend::keyVariants(const QString &layout, QStringList &savedKeyVariants)
 {
     QStringList _variants;
     QString code, desc, line;
 
-    Process p(QStringList() << "xkeyboard-variants");
-
-    if (p.waitForFinished()) {
+    if ( savedKeyVariants.empty() )
+    {
+      Process p(QStringList() << "xkeyboard-variants");
+      if (p.waitForFinished()) {
         while (p.canReadLine()) {
             line = p.readLine();
-            // Look for variants for this particular layout
-            if ( line.indexOf(" " + layout + ":") != -1 )
-            {
-              code = line.simplified();
-              code.truncate(code.indexOf(" "));
-              desc = line.remove(0, line.indexOf(": ") + 1);
-              _variants.append(desc.simplified() + " - (" + code.simplified() + ")");
-            }
+            savedKeyVariants << line;
         }
+      }
     }
 
+    for (int i = 0; i < savedKeyVariants.size(); ++i) {
+       // Look for variants for this particular layout
+       line = savedKeyVariants.at(i);
+       if ( line.indexOf(" " + layout + ":") != -1 )
+       {
+         code = line.simplified();
+         code.truncate(code.indexOf(" "));
+         desc = line.remove(0, line.indexOf(": ") + 1);
+         _variants.append(desc.simplified() + " - (" + code.simplified() + ")");
+       }
+    }
+
     return _variants;
 }
 

Modified: pcbsd/trunk/SysInstaller/backend.h
===================================================================
--- pcbsd/trunk/SysInstaller/backend.h	2009-11-24 20:27:59 UTC (rev 5139)
+++ pcbsd/trunk/SysInstaller/backend.h	2009-11-24 20:41:31 UTC (rev 5140)
@@ -39,7 +39,7 @@
 public:
     static QStringList languages();
     static QStringList keyLayouts();
-    static QStringList keyVariants(const QString &);
+    static QStringList keyVariants(const QString &, QStringList &savedKeyVariants);
     static QStringList bootableMedia();
     static QStringList networkDevices();
     static QStringList timezones();

Modified: pcbsd/trunk/SysInstaller/sysinstaller.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-24 20:27:59 UTC (rev 5139)
+++ pcbsd/trunk/SysInstaller/sysinstaller.cpp	2009-11-24 20:41:31 UTC (rev 5140)
@@ -270,7 +270,7 @@
     laycode = laycode.remove(0, laycode.indexOf("(") + 1);
     laycode.truncate(laycode.indexOf(")") );
 
-    listKbVariants->addItems(Scripts::Backend::keyVariants(laycode));
+    listKbVariants->addItems(Scripts::Backend::keyVariants(laycode, savedKeyVariants));
      
     if ( laycode == "us" )
       listKbVariants->setCurrentRow(2);

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-24 20:27:59 UTC (rev 5139)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-24 20:41:31 UTC (rev 5140)
@@ -107,6 +107,8 @@
     QList<QStringList> sysPartitions; // Our lists which contains partition info
     QList<QStringList> sysFinalDiskLayout; // Our lists which contains the final disk layout
     int systemMemory; // Ammount of system RAM we have in MB
+    QStringList savedKeyVariants; // Temp variable to keep key variants in memory
+
 };
 
 #endif // SYSINSTALLER_H

Modified: pcbsd/trunk/SysInstaller/sysinstaller.ui
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.ui	2009-11-24 20:27:59 UTC (rev 5139)
+++ pcbsd/trunk/SysInstaller/sysinstaller.ui	2009-11-24 20:41:31 UTC (rev 5140)
@@ -2026,7 +2026,7 @@
                    </property>
                    <property name="sizeHint" stdset="0">
                     <size>
-                     <width>163</width>
+                     <width>161</width>
                      <height>388</height>
                     </size>
                    </property>
@@ -2040,7 +2040,7 @@
                    <property name="sizeHint" stdset="0">
                     <size>
                      <width>418</width>
-                     <height>178</height>
+                     <height>184</height>
                     </size>
                    </property>
                   </spacer>
@@ -2052,7 +2052,7 @@
                    </property>
                    <property name="sizeHint" stdset="0">
                     <size>
-                     <width>162</width>
+                     <width>160</width>
                      <height>368</height>
                     </size>
                    </property>
@@ -2080,8 +2080,7 @@
                        <font/>
                       </property>
                       <property name="text">
-                       <string>Automatic syncronization with internet 
-Network Time Servers (NTP)</string>
+                       <string>Automatic syncronization with internet Time Servers (NTP)</string>
                       </property>
                       <property name="checked">
                        <bool>true</bool>
@@ -2099,7 +2098,7 @@
                    <property name="sizeHint" stdset="0">
                     <size>
                      <width>418</width>
-                     <height>178</height>
+                     <height>183</height>
                     </size>
                    </property>
                   </spacer>



More information about the Commits mailing list