[PC-BSD Commits] r7919 - pcbsd/current/src-qt4/pc-sysmanager

svn at pcbsd.org svn at pcbsd.org
Wed Oct 27 13:04:43 PDT 2010


Author: kris
Date: 2010-10-27 13:04:43 -0700 (Wed, 27 Oct 2010)
New Revision: 7919

Modified:
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h
   pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui
Log:

Added option to force enable of IBUS in system manager, also switch to using the new getters
and setters in libpcbsd



Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2010-10-27 19:56:45 UTC (rev 7918)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.cpp	2010-10-27 20:04:43 UTC (rev 7919)
@@ -43,6 +43,7 @@
 
     // Read any rc.conf settings
     //loadServSettings();
+
     //Load boot screen data
     loadBootData();
 
@@ -207,20 +208,26 @@
     // Change Settings here
     if ( checkKernATAPI->isChecked() )
     {
-	saveValue("/boot/loader.conf", "hw.ata.atapi_dma=", "hw.ata.atapi_dma=\"1\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "hw.ata.atapi_dma=", "hw.ata.atapi_dma=\"1\"" );
      } else {
-	saveValue("/boot/loader.conf", "hw.ata.atapi_dma=", "hw.ata.atapi_dma=\"0\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "hw.ata.atapi_dma=", "hw.ata.atapi_dma=\"0\"" );
      }
      
      int autobootDelay = checkKernDelay->value();
      if (autobootDelay == 0)
      {
 	 autobootDelay = -1;
-	 saveValue("/boot/loader.conf", "beastie_disable=", "beastie_disable=\"YES\"");
+	 Utils::setConfFileValue("/boot/loader.conf", "beastie_disable=", "beastie_disable=\"YES\"");
      }
-     else { saveValue("/boot/loader.conf", "beastie_disable=", "beastie_disable=\"NO\""); }
-     saveValue("/boot/loader.conf", "autoboot_delay=", "autoboot_delay=\"" + QString::number(autobootDelay) + "\"");
+     else { Utils::setConfFileValue("/boot/loader.conf", "beastie_disable=", "beastie_disable=\"NO\""); }
+     Utils::setConfFileValue("/boot/loader.conf", "autoboot_delay=", "autoboot_delay=\"" + QString::number(autobootDelay) + "\"");
     
+
+     if ( checkForceIbus->isChecked() )
+     		Utils::setConfFileValue(PREFIX + "/share/pcbsd/xstartup/enable-ibus.sh", "FORCEIBUS", "FORCEIBUS=\"YES\"", 1);
+     else
+     		Utils::setConfFileValue(PREFIX + "/share/pcbsd/xstartup/enable-ibus.sh", "FORCEIBUS", "FORCEIBUS=\"NO\"", 1);
+
 }
 
 
@@ -243,7 +250,7 @@
     if ( checkValue("/boot/loader.conf", "splash_pcx_load", "YES" ) ) { showBootCheck->setChecked(true); }
     else { showBootCheck->setChecked(false); }
      
-     QString bootDelay = getValue("/boot/loader.conf", "autoboot_delay");
+     QString bootDelay = Utils::getConfFileValue("/boot/loader.conf", "autoboot_delay");
      //Above function returns null if autoboot_delay isn't found, so set the default in this instance
      if ( bootDelay == QString::null) {
 	 checkKernDelay->setValue(10);
@@ -257,7 +264,7 @@
 // Checks the file for a string KEY, and sees if its set to VALUE
 bool PBSystemTab::checkValue( QString File, QString Key, QString Value )
 {
-    QString theValue = getValue(File, Key);
+    QString theValue = Utils::getConfFileValue(File, Key);
     if (theValue == Value) {
 	return TRUE;
     }
@@ -265,60 +272,6 @@
     
 }
 
-
-void PBSystemTab::saveValue( QString File, QString oldKey, QString newKey )
-{
-    
-    QString SavedFile;
-
-    int found = 0;
-    
-    // Load the old file, find the oldKey, remove it and replace with newKey
-    QFile file( File );
-    if ( file.open( QIODevice::ReadOnly ) ) {
-        QTextStream stream( &file );
-	stream.setCodec("UTF-8");
-        QString line;
-        while ( !stream.atEnd() ) {
-            line = stream.readLine(); // line of text excluding '\n'
-            
-        // If the KEY is found in the line, continue processing 
-	if ( line.indexOf(oldKey, 0) != -1 && found == 0 && line.indexOf("#") != 0)
-	{
-	    SavedFile = SavedFile + newKey + "\n";
-	    found = 1;
-	} else {
-	    SavedFile = SavedFile + line + "\n";
-	}
-	    
-	    
-	    
-        }
-	// Didnt find the key? Write it!
-	if ( found == 0)
-	{
-	    SavedFile = SavedFile + newKey;
-	}
-	
-        file.close();
-    }
-    
-    
-    // Save the new file
-    QFile fileout( File );
-    if ( fileout.open( QIODevice::WriteOnly ) ) {
-        QTextStream streamout( &fileout );
-	streamout.setCodec("UTF-8");
-                    streamout << SavedFile;
-        fileout.close();
-    }
-    
-    
-    
-}
-
-
-
 void PBSystemTab::fetchSourcePressed()
 {
     cvsUpUi = new CVSUpProgress();
@@ -340,35 +293,6 @@
     portsnapUI->show();
 }
 
-
-QString PBSystemTab::getValue( QString File, QString Key )
-{
-    QFile file( File );
-    if ( file.open( QIODevice::ReadOnly ) ) {
-        QTextStream stream( &file );
-	stream.setCodec("UTF-8");
-        QString line;
-        while ( !stream.atEnd() ) {
-            line = stream.readLine(); // line of text excluding '\n'
-            
-               // If the KEY is found in the line, continue processing 
-	if ( line.indexOf(Key, 0) != -1 && line.indexOf("#") != 0)
-	{
-	    line.remove(line.indexOf(Key, 0), Key.length());
-	    //Remove instances of " and =
-	    line.remove("\"");
-	    line.remove("=");
-	    
-	    return line;
-	}	    
-        }
-        file.close();
-    }
-    
-    return QString::null;
-}
-
-
 void PBSystemTab::customSplashPressed()
 {
     QString file = QFileDialog::getOpenFileName(this, tr("Select Splash"), "/home/" + username, "*.pcx");
@@ -407,14 +331,14 @@
     
     if ( showBootCheck->isChecked() )
     {
-	saveValue("/boot/loader.conf", "splash_pcx_load=", "splash_pcx_load=\"YES\"" );
-	saveValue("/boot/loader.conf", "vesa_load=", "vesa_load=\"YES\"" );
-	saveValue("/boot/loader.conf", "bitmap_load=", "bitmap_load=\"YES\"" );
-	saveValue("/boot/loader.conf", "bitmap_name=", "bitmap_name=\"/boot/loading-screen.pcx\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "splash_pcx_load=", "splash_pcx_load=\"YES\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "vesa_load=", "vesa_load=\"YES\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "bitmap_load=", "bitmap_load=\"YES\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "bitmap_name=", "bitmap_name=\"/boot/loading-screen.pcx\"" );
      } else {
-	saveValue("/boot/loader.conf", "splash_pcx_load=", "splash_pcx_load=\"NO\"" );
-	saveValue("/boot/loader.conf", "vesa_load=", "vesa_load=\"NO\"" );
-	saveValue("/boot/loader.conf", "bitmap_load=", "bitmap_load=\"NO\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "splash_pcx_load=", "splash_pcx_load=\"NO\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "vesa_load=", "vesa_load=\"NO\"" );
+	Utils::setConfFileValue("/boot/loader.conf", "bitmap_load=", "bitmap_load=\"NO\"" );
      }
 }
 
@@ -509,9 +433,12 @@
     }
     
     if ( checkValue("/boot/loader.conf", "splash_pcx_load", "YES" ) )
-    {
         	showBootCheck->setChecked(TRUE);
-    }
+
+    if ( Utils::getConfFileValue(QString(PREFIX + "/share/pcbsd/xstartup/enable-ibus.sh"), QString("FORCEIBUS") ) == QString("YES"))
+		checkForceIbus->setChecked(TRUE);
+    else
+		checkForceIbus->setChecked(FALSE);
 }
 
 void PBSystemTab::slotUpdateMirrorList() {

Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2010-10-27 19:56:45 UTC (rev 7918)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.h	2010-10-27 20:04:43 UTC (rev 7919)
@@ -49,7 +49,6 @@
 
     QMap <QString, QString> codeMap;
     bool checkValue( QString File, QString Key, QString Value );
-    void saveValue( QString File, QString oldKey, QString newKey );
 
 public slots:
     void ProgramInit();
@@ -130,7 +129,6 @@
     void showRebootRequired();
     void LoadKernSettings();
     void loadMirrorConfig();
-    QString getValue( QString File, QString Key );
     QString getLineFromCommandOutput(QString cmd);
     void saveMirrorConfig();
     bool sanityCheckSettings();

Modified: pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui
===================================================================
--- pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui	2010-10-27 19:56:45 UTC (rev 7918)
+++ pcbsd/current/src-qt4/pc-sysmanager/pbsystemtab.ui	2010-10-27 20:04:43 UTC (rev 7919)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>478</width>
-    <height>452</height>
+    <width>489</width>
+    <height>505</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -1019,7 +1019,7 @@
          </layout>
         </widget>
        </item>
-       <item row="4" column="1">
+       <item row="5" column="1">
         <spacer name="spacer37">
          <property name="orientation">
           <enum>Qt::Vertical</enum>
@@ -1035,6 +1035,22 @@
          </property>
         </spacer>
        </item>
+       <item row="4" column="0" colspan="2">
+        <widget class="QGroupBox" name="groupBox_6">
+         <property name="title">
+          <string>Other Options</string>
+         </property>
+         <layout class="QGridLayout" name="gridLayout_12">
+          <item row="0" column="0">
+           <widget class="QCheckBox" name="checkForceIbus">
+            <property name="text">
+             <string>Force IBUS keyboard input</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
+        </widget>
+       </item>
       </layout>
      </widget>
     </widget>



More information about the Commits mailing list