[PC-BSD Commits] r1939 - pcbsd/trunk/PCInstall

svn at pcbsd.org svn at pcbsd.org
Wed May 21 09:34:24 PDT 2008


Author: kris
Date: 2008-05-21 09:34:23 -0700 (Wed, 21 May 2008)
New Revision: 1939

Added:
   pcbsd/trunk/PCInstall/dialogkeyboard.ui
   pcbsd/trunk/PCInstall/dialogkeyboard.ui.h
Modified:
   pcbsd/trunk/PCInstall/PCInstall.pro
   pcbsd/trunk/PCInstall/pcinstall.ui
   pcbsd/trunk/PCInstall/pcinstall.ui.h
Log:

Updated the system installer, changed the GUI to use different keyboard setup,
now user can specify a keyboard model, layout and variant all within the GUI



Modified: pcbsd/trunk/PCInstall/PCInstall.pro
===================================================================
--- pcbsd/trunk/PCInstall/PCInstall.pro	2008-05-21 16:02:25 UTC (rev 1938)
+++ pcbsd/trunk/PCInstall/PCInstall.pro	2008-05-21 16:34:23 UTC (rev 1939)
@@ -7,7 +7,8 @@
 
 FORMS	= pcinstall.ui \
 	addpartitiondialog.ui \
-	background.ui
+	background.ui \
+        dialogkeyboard.ui
 
 LIBS	+= -lkdecore -Ikdelibs
 

Added: pcbsd/trunk/PCInstall/dialogkeyboard.ui

Added: pcbsd/trunk/PCInstall/dialogkeyboard.ui.h

Modified: pcbsd/trunk/PCInstall/pcinstall.ui
===================================================================
--- pcbsd/trunk/PCInstall/pcinstall.ui	2008-05-21 16:02:25 UTC (rev 1938)
+++ pcbsd/trunk/PCInstall/pcinstall.ui	2008-05-21 16:34:23 UTC (rev 1939)
@@ -637,104 +637,6 @@
         </widget>
         <widget class="QGroupBox">
             <property name="name">
-                <cstring>groupBox31</cstring>
-            </property>
-            <property name="geometry">
-                <rect>
-                    <x>310</x>
-                    <y>220</y>
-                    <width>670</width>
-                    <height>150</height>
-                </rect>
-            </property>
-            <property name="font">
-                <font>
-                </font>
-            </property>
-            <property name="title">
-                <string>Keyboard Settings</string>
-            </property>
-            <widget class="QLabel">
-                <property name="name">
-                    <cstring>textLabel1_4</cstring>
-                </property>
-                <property name="geometry">
-                    <rect>
-                        <x>14</x>
-                        <y>25</y>
-                        <width>310</width>
-                        <height>20</height>
-                    </rect>
-                </property>
-                <property name="text">
-                    <string>Keyboard Layout</string>
-                </property>
-            </widget>
-            <widget class="QLabel">
-                <property name="name">
-                    <cstring>textLabel1_4_2</cstring>
-                </property>
-                <property name="geometry">
-                    <rect>
-                        <x>340</x>
-                        <y>25</y>
-                        <width>310</width>
-                        <height>20</height>
-                    </rect>
-                </property>
-                <property name="text">
-                    <string>Keyboard Model</string>
-                </property>
-            </widget>
-            <widget class="QListBox">
-                <property name="name">
-                    <cstring>listBoxKeyLayout</cstring>
-                </property>
-                <property name="geometry">
-                    <rect>
-                        <x>10</x>
-                        <y>46</y>
-                        <width>310</width>
-                        <height>90</height>
-                    </rect>
-                </property>
-                <property name="font">
-                    <font>
-                    </font>
-                </property>
-                <property name="frameShape">
-                    <enum>StyledPanel</enum>
-                </property>
-                <property name="frameShadow">
-                    <enum>Sunken</enum>
-                </property>
-            </widget>
-            <widget class="QListBox">
-                <property name="name">
-                    <cstring>listBoxKeyModel</cstring>
-                </property>
-                <property name="geometry">
-                    <rect>
-                        <x>340</x>
-                        <y>46</y>
-                        <width>310</width>
-                        <height>90</height>
-                    </rect>
-                </property>
-                <property name="font">
-                    <font>
-                    </font>
-                </property>
-                <property name="frameShape">
-                    <enum>StyledPanel</enum>
-                </property>
-                <property name="frameShadow">
-                    <enum>Sunken</enum>
-                </property>
-            </widget>
-        </widget>
-        <widget class="QGroupBox">
-            <property name="name">
                 <cstring>groupBox30</cstring>
             </property>
             <property name="geometry">
@@ -808,6 +710,159 @@
                 <bool>true</bool>
             </property>
         </widget>
+        <widget class="QGroupBox">
+            <property name="name">
+                <cstring>groupBox31</cstring>
+            </property>
+            <property name="geometry">
+                <rect>
+                    <x>310</x>
+                    <y>220</y>
+                    <width>670</width>
+                    <height>150</height>
+                </rect>
+            </property>
+            <property name="font">
+                <font>
+                </font>
+            </property>
+            <property name="title">
+                <string>Keyboard Settings</string>
+            </property>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textLabel1_4</cstring>
+                </property>
+                <property name="geometry">
+                    <rect>
+                        <x>10</x>
+                        <y>20</y>
+                        <width>120</width>
+                        <height>20</height>
+                    </rect>
+                </property>
+                <property name="text">
+                    <string>Layout:</string>
+                </property>
+                <property name="alignment">
+                    <set>AlignVCenter|AlignRight</set>
+                </property>
+            </widget>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textLabel1_4_2_2</cstring>
+                </property>
+                <property name="geometry">
+                    <rect>
+                        <x>10</x>
+                        <y>80</y>
+                        <width>120</width>
+                        <height>20</height>
+                    </rect>
+                </property>
+                <property name="text">
+                    <string>Variant:</string>
+                </property>
+                <property name="alignment">
+                    <set>AlignVCenter|AlignRight</set>
+                </property>
+            </widget>
+            <widget class="QPushButton">
+                <property name="name">
+                    <cstring>pushChangeKeyboard</cstring>
+                </property>
+                <property name="geometry">
+                    <rect>
+                        <x>60</x>
+                        <y>110</y>
+                        <width>160</width>
+                        <height>26</height>
+                    </rect>
+                </property>
+                <property name="text">
+                    <string>&amp;Change Keyboard</string>
+                </property>
+                <property name="accel">
+                    <string>Alt+C</string>
+                </property>
+            </widget>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textKBLayout</cstring>
+                </property>
+                <property name="geometry">
+                    <rect>
+                        <x>140</x>
+                        <y>20</y>
+                        <width>520</width>
+                        <height>20</height>
+                    </rect>
+                </property>
+                <property name="text">
+                    <string>us - USA</string>
+                </property>
+                <property name="alignment">
+                    <set>AlignVCenter|AlignLeft</set>
+                </property>
+            </widget>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textLabel1_4_2</cstring>
+                </property>
+                <property name="geometry">
+                    <rect>
+                        <x>10</x>
+                        <y>50</y>
+                        <width>120</width>
+                        <height>20</height>
+                    </rect>
+                </property>
+                <property name="text">
+                    <string>Model:</string>
+                </property>
+                <property name="alignment">
+                    <set>AlignVCenter|AlignRight</set>
+                </property>
+            </widget>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textKBModel</cstring>
+                </property>
+                <property name="geometry">
+                    <rect>
+                        <x>140</x>
+                        <y>50</y>
+                        <width>520</width>
+                        <height>20</height>
+                    </rect>
+                </property>
+                <property name="text">
+                    <string>pc105 - Generic 105-key PC</string>
+                </property>
+                <property name="alignment">
+                    <set>AlignVCenter|AlignLeft</set>
+                </property>
+            </widget>
+            <widget class="QLabel">
+                <property name="name">
+                    <cstring>textKBVariant</cstring>
+                </property>
+                <property name="geometry">
+                    <rect>
+                        <x>140</x>
+                        <y>80</y>
+                        <width>520</width>
+                        <height>20</height>
+                    </rect>
+                </property>
+                <property name="text">
+                    <string>off - Using default layout</string>
+                </property>
+                <property name="alignment">
+                    <set>AlignVCenter|AlignLeft</set>
+                </property>
+            </widget>
+        </widget>
     </widget>
     <widget class="QWidget">
         <property name="name">
@@ -7743,10 +7798,15 @@
         <receiver>PCInstall</receiver>
         <slot>removeComponentSlot()</slot>
     </connection>
+    <connection>
+        <sender>pushChangeKeyboard</sender>
+        <signal>clicked()</signal>
+        <receiver>PCInstall</receiver>
+        <slot>slotChangeKeyboard()</slot>
+    </connection>
 </connections>
 <tabstops>
     <tabstop>listBoxLang</tabstop>
-    <tabstop>listBoxKeyLayout</tabstop>
     <tabstop>comboTZone</tabstop>
     <tabstop>checkTimeSync</tabstop>
     <tabstop>radioFreshInstall</tabstop>
@@ -7784,6 +7844,7 @@
     <include location="local" impldecl="in declaration">qtimer.h</include>
     <include location="local" impldecl="in declaration">qtranslator.h</include>
     <include location="local" impldecl="in declaration">qstylefactory.h</include>
+    <include location="local" impldecl="in declaration">dialogkeyboard.h</include>
     <include location="local" impldecl="in implementation">pcinstall.ui.h</include>
 </includes>
 <variables>
@@ -7844,6 +7905,7 @@
     <variable access="private">QProcess *InstallComponentsProc;</variable>
     <variable access="private">int installComponents;</variable>
     <variable access="private">int regenCustomSlices;</variable>
+    <variable access="private">dialogKeyboard *keyboardDialog;</variable>
 </variables>
 <slots>
     <slot>ProgramInit()</slot>
@@ -7909,11 +7971,12 @@
     <slot access="private">readInstallComponentSlot()</slot>
     <slot>rootPasswordLineEditLostFocus()</slot>
     <slot access="private">userPasswordLineEditLostFocus()</slot>
+    <slot access="private">slotChangeKeyboard()</slot>
+    <slot access="private">changeKeyboardSlot( QString &amp; layout, QString &amp; model, QString &amp; variant )</slot>
 </slots>
 <functions>
     <function access="private">loadLangs()</function>
     <function access="private">loadTZone()</function>
-    <function access="private">loadKBModels()</function>
     <function access="private">runFindDisk()</function>
     <function access="private">startFreshInstall()</function>
     <function access="private" returnType="QString">Sanitize_Bios_Geom( QString cyl, QString head, QString sec, QString block )</function>

Modified: pcbsd/trunk/PCInstall/pcinstall.ui.h
===================================================================
--- pcbsd/trunk/PCInstall/pcinstall.ui.h	2008-05-21 16:02:25 UTC (rev 1938)
+++ pcbsd/trunk/PCInstall/pcinstall.ui.h	2008-05-21 16:34:23 UTC (rev 1939)
@@ -77,17 +77,21 @@
     customDiskSliceSlot( FALSE);
    
    // Connect the keyboard layoyt box
-    connect( listBoxKeyLayout, SIGNAL( selectionChanged () ), this, SLOT(listBoxLayoutChanged() ) );
-    
+   // connect( listBoxKeyLayout, SIGNAL( selectionChanged () ), this, SLOT(listBoxLayoutChanged() ) );
+   // Load keyboard layouts
+   //loadKBModels();
+   // listBoxKeyLayout->setSelected(0, TRUE); 
+    textKBLayout->setText("us - USA");
+    textKBModel->setText("pc105 - Generic 105-key PC");
+    textKBVariant->setText("off - Using default layout");
+	    
     // Load the Lang List
     loadLangs();
     
     // Load the TimeZone Info
     loadTZone();
     
-    // Load keyboard layouts
-    loadKBModels();
-    listBoxKeyLayout->setSelected(0, TRUE); 
+
     
     // Load the HD info
     runFindDisk();
@@ -423,34 +427,7 @@
 }
 
 
-void PCInstall::loadKBModels()
-{
-    QString tmp;
-    QString Langcode;
-    QString Langdescr;
-    
-   listBoxKeyLayout->clear();
-    
-    QFile file( "/root/kblayout" );
-    if ( file.open( IO_ReadOnly ) ) {
-	QTextStream stream( &file );
-	QString line;
-	while ( !stream.atEnd() ) {
-	    line = stream.readLine(); // line of text excluding '\n'
-	    tmp = line;
-	    tmp.truncate(tmp.find(" ") );
-	    Langcode = tmp;
-	    
-	    
-	    Langdescr = line.remove(0, line.find(" ") + 1 );     
-	    
-	    listBoxKeyLayout->insertItem(Langcode + " (" + Langdescr + ")" );   
-	}
-	file.close();
-    }
-}
 
-
 void PCInstall::CheckAccountInfo()
 {
     int ok = 0;
@@ -1500,14 +1477,14 @@
     tmp.remove(0, tmp.find("(") + 1 );
     tmp.truncate(tmp.find(")") );
     
-    tmp2 = listBoxKeyLayout->currentText();
-    tmp2.truncate(tmp.find(" ") );
+   // tmp2 = listBoxKeyLayout->currentText();
+   // tmp2.truncate(tmp.find(" ") );
 
     // Start with the update system config script
    SystemConfig= new QProcess( this );
    SystemConfig->addArgument( "/usr/local/pcbsd/scripts/PCBSD.SysConfig.sh" );
    SystemConfig->addArgument( tmp );
-   SystemConfig->addArgument( tmp2 );
+   //SystemConfig->addArgument( tmp2 );
    SystemConfig->addArgument(tr("Start"));
 
    if ( checkAllowBSDSTATS->isChecked() )
@@ -2597,6 +2574,7 @@
 
 void PCInstall::listBoxLayoutChanged()
 {
+    /*
     QString tmp;
     
     tmp = listBoxKeyLayout->currentText();
@@ -2610,6 +2588,8 @@
     if ( !SetKeyboard->start() ) {
 	QMessageBox::warning( this, tr("PCBSD Installer"),  tr("Failed Starting SetKeyboard.sh"), tr("Retry"), tr("Quit"), 0, 0, 1 );
     }
+    
+    */
 }
 
 void PCInstall::accept()
@@ -3139,3 +3119,61 @@
     }
     
 }
+
+
+void PCInstall::slotChangeKeyboard()
+{
+    
+               QString layout, model, variant;
+	       
+	layout = textKBLayout->text();
+	model = textKBModel->text();
+	variant = textKBVariant->text();
+    
+	layout.truncate(layout.find(" "));
+	model.truncate(model.find(" "));
+	variant.truncate(variant.find(" "));
+	
+    	// Launch our AddPartitionDialog to add a new device
+	keyboardDialog = new dialogKeyboard();
+	connect(keyboardDialog, SIGNAL(saved(QString &, QString &, QString &)), this, SLOT(changeKeyboardSlot(QString &, QString &, QString &)) );
+	keyboardDialog->programInit();
+	keyboardDialog->setKeyboard( layout, model, variant);
+	keyboardDialog->exec();
+
+}
+
+
+void PCInstall::changeKeyboardSlot( QString &layout, QString &model, QString &variant )
+{
+    QString tmp, tmp2, tmp3;
+    
+    // Save the new settings to the GUI
+    textKBLayout->setText(layout);
+    textKBModel->setText(model);
+    textKBVariant->setText(variant);
+    
+    // Now run the SetKeyboard.sh
+    tmp = textKBLayout->text();
+    tmp.truncate(tmp.find(" ") );
+    
+    tmp2 = textKBModel->text();
+    tmp2.truncate(tmp2.find(" ") );
+    
+    tmp3 = textKBVariant->text();
+    tmp3.truncate(tmp3.find(" ") );
+    
+
+    // Start with the update system config script
+   SetKeyboard= new QProcess( this );
+   SetKeyboard->addArgument( "/usr/local/pcbsd/scripts/PCBSD.SetKeyboard.sh" );
+   SetKeyboard->addArgument( tmp );
+   SetKeyboard->addArgument( tmp2 );
+   SetKeyboard->addArgument( tmp3 );
+   
+    if ( !SetKeyboard->start() ) {
+        QMessageBox::warning( this, tr("PCBSD Installer"),  tr("Failed Starting SetKeyboard.sh"), tr("Retry"), tr("Quit"), 0, 0, 1 );
+    }
+
+    
+}



More information about the Commits mailing list