[PC-BSD Commits] r18455 - pcbsd-projects/PCDM

svn at pcbsd.org svn at pcbsd.org
Wed Aug 15 16:11:21 PDT 2012


Author: kenmoore
Date: 2012-08-15 23:11:21 +0000 (Wed, 15 Aug 2012)
New Revision: 18455

Modified:
   pcbsd-projects/PCDM/PCDM.pro
   pcbsd-projects/PCDM/dialogKeyboard.cpp
   pcbsd-projects/PCDM/dialogKeyboard.h
   pcbsd-projects/PCDM/pcdm-gui.cpp
   pcbsd-projects/PCDM/pcdm-gui.h
Log:
Add a new widget to handle the whole username/password/login part of PCDM. This allows much better keyboard integration, as well as more dynamic prompting for the username/password



Modified: pcbsd-projects/PCDM/PCDM.pro
===================================================================
--- pcbsd-projects/PCDM/PCDM.pro	2012-08-15 19:48:38 UTC (rev 18454)
+++ pcbsd-projects/PCDM/PCDM.pro	2012-08-15 23:11:21 UTC (rev 18455)
@@ -10,7 +10,8 @@
            pcdm-config.cpp \
            fancySwitcher.cpp \
            dialogKeyboard.cpp \
-           dialogLocale.cpp
+           dialogLocale.cpp \
+           loginWidget.cpp
 
 HEADERS += pcdm-gui.h \
     	   pcdm-backend.h \
@@ -19,6 +20,7 @@
            fancySwitcher.h \
            dialogKeyboard.h \
            dialogLocale.h \
+           loginWidget.h
            
 FORMS += dialogKeyboard.ui dialogLocale.ui
 
@@ -87,7 +89,7 @@
 		i18n/PCDM_zh_TW.ts \
 		i18n/PCDM_zu.ts
 
-dotrans.path=/usr/local/share/pcbsd/i18n/
+dotrans.path=/usr/local/share/PCDM/i18n/
 dotrans.extra=cd i18n && lrelease-qt4 -nounfinished *.ts && cp *.qm /usr/local/share/pcbsd/i18n/
 
 INSTALLS += dotrans TARGET

Modified: pcbsd-projects/PCDM/dialogKeyboard.cpp
===================================================================
--- pcbsd-projects/PCDM/dialogKeyboard.cpp	2012-08-15 19:48:38 UTC (rev 18454)
+++ pcbsd-projects/PCDM/dialogKeyboard.cpp	2012-08-15 23:11:21 UTC (rev 18455)
@@ -13,6 +13,10 @@
 #include "dialogKeyboard.h"
 #include "ui_dialogKeyboard.h"
 
+widgetKeyboard::widgetKeyboard(QWidget* parent) : QWidget(parent){
+  setupUi(this);
+}
+
 void widgetKeyboard::programInit(QStringList kModel, QStringList kLayouts)
 {
   connect(pushClose, SIGNAL(clicked()), this, SLOT(slotClose()));

Modified: pcbsd-projects/PCDM/dialogKeyboard.h
===================================================================
--- pcbsd-projects/PCDM/dialogKeyboard.h	2012-08-15 19:48:38 UTC (rev 18454)
+++ pcbsd-projects/PCDM/dialogKeyboard.h	2012-08-15 23:11:21 UTC (rev 18455)
@@ -10,10 +10,7 @@
 	Q_OBJECT
 
 public:
-        widgetKeyboard() : QWidget()
-        {
-          setupUi(this);
-        }
+    widgetKeyboard(QWidget* parent = 0);
 
     void programInit(QStringList, QStringList);
 

Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp	2012-08-15 19:48:38 UTC (rev 18454)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp	2012-08-15 23:11:21 UTC (rev 18455)
@@ -101,6 +101,28 @@
                       Theme::objectLocationColumnSpan("header"), Qt::AlignCenter);
     }
 
+    //Username/Password/Login widget
+    loginW = new LoginWidget;
+    loginW->setUsernames(Backend::getSystemUsers()); //add in the detected users
+    //loginW->setCurrentUser(); //set the previously used user
+    //Set Icons from theme
+    loginW->changeButtonIcon("login",Theme::objectIconPath("login"));
+    loginW->changeButtonIcon("display",Theme::objectIconPath("user"));
+    loginW->changeButtonIcon("pwview",Theme::objectIconPath("password"));
+    //Set style sheets
+    loginW->setStyleSheet("login", Theme::objectStyleSheet("login"));
+    loginW->setStyleSheet("password", Theme::objectStyleSheet("password"));
+    loginW->setStyleSheet("pwview", Theme::objectStyleSheet("password"));
+    loginW->setStyleSheet("user", Theme::objectStyleSheet("user"));
+    //Add item to the grid
+    grid->addWidget( loginW, Theme::objectLocationRow("user"), \
+                      Theme::objectLocationColumn("user"), \
+                      Theme::objectLocationRowSpan("user"), \
+                      Theme::objectLocationColumnSpan("user"), Qt::AlignCenter);
+    //Connect the login button to the appripriate slot
+    connect(loginW,SIGNAL(loginRequested(QString,QString)),this,SLOT(slotStartLogin(QString,QString)));
+    
+    /*
     //----Username Input collection
     QString uLayout = Theme::objectIconStyle("user");
     unameline = new QComboBox;
@@ -171,7 +193,7 @@
                       Theme::objectLocationColumn("login"), \
                       Theme::objectLocationRowSpan("login"), \
                       Theme::objectLocationColumnSpan("login"), Qt::AlignCenter); 
-
+*/
     //----Desktop Environment Switcher
     //Create the switcher
     bool horizontalDE = TRUE;
@@ -219,15 +241,14 @@
 
 }
 
-void PCDMgui::slotStartLogin(){
+void PCDMgui::slotStartLogin(QString displayname, QString password){
   //Get user inputs
-  QString displayname = unameline->currentText();
   QString username = Backend::getUsernameFromDisplayname(displayname);
-  QString password = pwline->text();
   QString binary = Backend::getDesktopBinary(deSwitcher->currentItem());
   //Disable user input while confirming login
-  unameline->setEnabled(FALSE);
-  pwline->setEnabled(FALSE);
+  loginW->setEnabled(FALSE);
+  //unameline->setEnabled(FALSE);
+  //pwline->setEnabled(FALSE);
   deSwitcher->setEnabled(FALSE);
   toolbar->setEnabled(FALSE);
   //Try to login
@@ -247,8 +268,9 @@
     notice.exec();
   }
   //Re-Enable user input
-  unameline->setEnabled(TRUE);
-  pwline->setEnabled(TRUE);
+  loginW->setEnabled(TRUE);
+  //unameline->setEnabled(TRUE);
+  //pwline->setEnabled(TRUE);
   deSwitcher->setEnabled(TRUE);
   toolbar->setEnabled(TRUE);
 }
@@ -292,7 +314,7 @@
 
 void PCDMgui::slotChangeLocale(){
   //Open the selector
-  wLoc = new widgetLocale(this);
+  wLoc = new widgetLocale();
   QLocale currLocale = this->locale();
   qDebug() << "Current PCDM Locale:" << currLocale.name();
   wLoc->setCurrentLocale(currLocale.name());
@@ -305,18 +327,6 @@
 }
 
 void PCDMgui::slotLocaleChanged(QString langCode){
-  qDebug() << "Changing localization to" << langCode;
-  
-  // Now write out the lang code and close
-  /*
-  QFile lfile( TMPLANGFILE );
-  if ( lfile.open( QIODevice::WriteOnly ) ) {
-    QTextStream stream( &lfile );
-      stream <<  langCode;
-    lfile.close();
-  }
-  slotClosePCDM();
-  */
   //Get the valid Locale code
   QString translationFile;
   if(!QFile::exists(translationDir+"PCDM_"+langCode+".qm")){
@@ -333,7 +343,21 @@
     }
   }else{
     translationFile = translationDir+"PCDM_"+langCode+".qm";
+  }	
+	
+  qDebug() << "Changing localization to" << langCode;
+  
+  // Now write out the lang code and close
+  /*
+  QFile lfile( TMPLANGFILE );
+  if ( lfile.open( QIODevice::WriteOnly ) ) {
+    QTextStream stream( &lfile );
+      stream <<  langCode;
+    lfile.close();
   }
+  slotClosePCDM();
+  */
+
   //Alternate method for changing Locale
   QLocale locale(langCode);
   this->setLocale(locale);

Modified: pcbsd-projects/PCDM/pcdm-gui.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.h	2012-08-15 19:48:38 UTC (rev 18454)
+++ pcbsd-projects/PCDM/pcdm-gui.h	2012-08-15 23:11:21 UTC (rev 18455)
@@ -22,6 +22,7 @@
 #include "fancySwitcher.h"
 #include "dialogKeyboard.h"
 #include "dialogLocale.h"
+#include "loginWidget.h"
 
 #define TMPLANGFILE QString("/tmp/.PCDMLang")
 
@@ -36,7 +37,7 @@
     void progInit();
 
 private slots:
-    void slotStartLogin();
+    void slotStartLogin(QString,QString);
     void slotRestartComputer();
     void slotShutdownComputer();
     void slotClosePCDM();
@@ -47,6 +48,7 @@
 
 private:
     //Objects
+    LoginWidget* loginW;
     widgetKeyboard* wKey;
     widgetLocale* wLoc;
     QToolBar* toolbar;



More information about the Commits mailing list