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

svn at pcbsd.org svn at pcbsd.org
Wed Nov 25 11:03:21 PST 2009


Author: kris
Date: 2009-11-25 11:03:21 -0800 (Wed, 25 Nov 2009)
New Revision: 5146

Modified:
   pcbsd/trunk/SysInstaller/backend.cpp
   pcbsd/trunk/SysInstaller/backend.h
   pcbsd/trunk/SysInstaller/sys-keyboardwidget.cpp
   pcbsd/trunk/SysInstaller/sysinstaller.h
Log:

Finished up the keyboard settings / model / layout section, now you can change keyboard options and test
them on the fly




Modified: pcbsd/trunk/SysInstaller/backend.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/backend.cpp	2009-11-25 18:19:06 UTC (rev 5145)
+++ pcbsd/trunk/SysInstaller/backend.cpp	2009-11-25 19:03:21 UTC (rev 5146)
@@ -158,6 +158,19 @@
     return nics;
 }
 
+// Function which lets us run setxkbmap
+void Backend::changeKbMap(QString model, QString layout, QString variant)
+{
+   QProcess kbp;
+   QStringList args;
+   QString prog;
+   prog = "setxkbmap"; 
+   args << "-model" << model << "-layout" << layout << "-variant" << variant;
+   qDebug() << "setxkbmap:" << args;
+   kbp.start(prog, args);
+   kbp.waitForFinished();
+}
+
 QList<QStringList> Backend::hardDrives()
 {
     QList<QStringList> drives;

Modified: pcbsd/trunk/SysInstaller/backend.h
===================================================================
--- pcbsd/trunk/SysInstaller/backend.h	2009-11-25 18:19:06 UTC (rev 5145)
+++ pcbsd/trunk/SysInstaller/backend.h	2009-11-25 19:03:21 UTC (rev 5146)
@@ -44,6 +44,7 @@
     static QStringList bootableMedia();
     static QStringList networkDevices();
     static QStringList timezones();
+    static void changeKbMap(QString model, QString layout, QString variant);
     static QList<QStringList> hardDrives();
     static int systemMemory();
     //static QList<QStringList> slices();

Modified: pcbsd/trunk/SysInstaller/sys-keyboardwidget.cpp
===================================================================
--- pcbsd/trunk/SysInstaller/sys-keyboardwidget.cpp	2009-11-25 18:19:06 UTC (rev 5145)
+++ pcbsd/trunk/SysInstaller/sys-keyboardwidget.cpp	2009-11-25 19:03:21 UTC (rev 5146)
@@ -8,14 +8,20 @@
   listKbLayouts->addItems(Scripts::Backend::keyLayouts());
   comboBoxKeyboardModel->addItems(Scripts::Backend::keyModels());
 
+  // Set the default keyboard stuff
+  setKbDefaults();
+  checkKbDefault->setChecked(true);
+  slotCurrentKbLayoutChanged(0);
+  groupKeyboard->setEnabled(false);
+
+  // Connect all our slots
   connect(listKbLayouts, SIGNAL(currentRowChanged(int)), this, SLOT(slotCurrentKbLayoutChanged(int)));
   connect(listKbVariants,SIGNAL(currentRowChanged(int)), this, SLOT(slotCurrentKbVariantChanged(int)));
   connect(listKbLayouts, SIGNAL(itemSelectionChanged()), this, SLOT(slotSelectedKbItemChanged()));
   connect(listKbVariants,SIGNAL(itemSelectionChanged()), this, SLOT(slotSelectedKbItemChanged()));
+  connect(comboBoxKeyboardModel,SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateKbOnSys()));
   connect(checkKbDefault,SIGNAL(stateChanged(int)), this, SLOT(slotDefaultKbChecked(int)));
 
-  // Set the default keyboard stuff
-  setKbDefaults();
 }
 
 void SysInstaller::slotCurrentKbLayoutChanged(int row)
@@ -24,12 +30,42 @@
         QString kbLayout = listKbLayouts->currentItem()->text();
         setKbVariants(kbLayout);
     }
+
+   slotUpdateKbOnSys();
 }
 
+void SysInstaller::slotUpdateKbOnSys()
+{
+  QString model, layout, variant;
+
+  if ( ! comboBoxKeyboardModel->currentIndex() == -1 )
+     return;
+  if ( ! listKbLayouts->currentItem() )
+     return;
+  if ( ! listKbVariants->currentItem() )
+     return;
+
+  model = comboBoxKeyboardModel->currentText();
+  model = model.remove(0, model.indexOf("- (") + 3 );
+  model.truncate(model.size() -1 );
+
+  layout = listKbLayouts->currentItem()->text();
+  layout = layout.remove(0, layout.indexOf("- (") + 3 );
+  layout.truncate(layout.size() -1 );
+
+  variant = listKbVariants->currentItem()->text();
+  variant = variant.remove(0, variant.indexOf("- (") + 3 );
+  variant.truncate(variant.size() -1 );
+  
+  Scripts::Backend::changeKbMap(model, layout, variant);
+}
+
 void SysInstaller::slotCurrentKbVariantChanged(int row)
 {
-    if (row != -1)
-        listKbVariants->currentItem()->text();
+   if (row != -1)
+      listKbVariants->currentItem()->text();
+
+   slotUpdateKbOnSys();
 }
 
 void SysInstaller::setKbVariants(const QString &kbLayout)
@@ -59,6 +95,11 @@
 {
    if (state == Qt::Checked) {
      groupKeyboard->setEnabled(false);
+     QString model, layout, variant;
+     model = "pc104";
+     layout = "us";
+     variant = "";
+     Scripts::Backend::changeKbMap(model, layout, variant);
    } else {
      groupKeyboard->setEnabled(true);
      setKbDefaults();

Modified: pcbsd/trunk/SysInstaller/sysinstaller.h
===================================================================
--- pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-25 18:19:06 UTC (rev 5145)
+++ pcbsd/trunk/SysInstaller/sysinstaller.h	2009-11-25 19:03:21 UTC (rev 5146)
@@ -69,6 +69,7 @@
     void slotCurrentKbVariantChanged(int);
     void slotSelectedKbItemChanged();
     void slotDefaultKbChecked(int);
+    void slotUpdateKbOnSys();
 
     // Source slots
     void slotChangedInstallType();



More information about the Commits mailing list