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

svn at pcbsd.org svn at pcbsd.org
Fri Mar 1 10:37:46 PST 2013


Author: kenmoore
Date: 2013-03-01 18:37:46 +0000 (Fri, 01 Mar 2013)
New Revision: 21684

Modified:
   pcbsd-projects/PCDM/loginWidget.cpp
   pcbsd-projects/PCDM/loginWidget.h
   pcbsd-projects/PCDM/pcdm-gui.cpp
   pcbsd-projects/PCDM/pcdm-gui.h
Log:
Finish polishing up the new login widget functionality



Modified: pcbsd-projects/PCDM/loginWidget.cpp
===================================================================
--- pcbsd-projects/PCDM/loginWidget.cpp	2013-03-01 18:17:31 UTC (rev 21683)
+++ pcbsd-projects/PCDM/loginWidget.cpp	2013-03-01 18:37:46 UTC (rev 21684)
@@ -66,7 +66,7 @@
   connect(pushViewPassword,SIGNAL(released()),this,SLOT(slotChangePWView()));
   connect(listUsers,SIGNAL(activated(int)),this,SLOT(slotChooseUser(int)));
   connect(listUserBig,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(slotUserClicked(QListWidgetItem*)) );
-  
+  connect(listUserBig,SIGNAL(currentRowChanged(int)),this,SLOT(slotUserHighlighted(int)) );
   //Set this layout for the loginWidget
   this->setLayout(vlayout);
   
@@ -137,6 +137,10 @@
   slotUserSelected();	
 }
 
+void LoginWidget::slotUserHighlighted(int row){
+  emit UserChanged(idL[row]);	
+}
+
 void LoginWidget::slotTryLogin(){
   QString user = listUsers->currentText();
   QString pw = linePassword->text();

Modified: pcbsd-projects/PCDM/loginWidget.h
===================================================================
--- pcbsd-projects/PCDM/loginWidget.h	2013-03-01 18:17:31 UTC (rev 21683)
+++ pcbsd-projects/PCDM/loginWidget.h	2013-03-01 18:37:46 UTC (rev 21684)
@@ -68,6 +68,7 @@
   private slots:
 	void slotUserActivated(QAction*);
 	void slotUserClicked(QListWidgetItem*);
+	void slotUserHighlighted(int);
 	void slotUserSelected();
 	void slotUserUnselected();
   	void slotTryLogin();
@@ -78,6 +79,7 @@
 	//Emits these signals whenever a login request is detected
 	void loginRequested(QString user, QString password);
 	void UserSelected(QString user);
+	void UserChanged(QString user);
 	void escapePressed();
 
 };

Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp	2013-03-01 18:17:31 UTC (rev 21683)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp	2013-03-01 18:37:46 UTC (rev 21684)
@@ -155,7 +155,6 @@
     }
     
     //Username/Password/Login widget
-    qDebug() << "Creating login widget";
     loginW = new LoginWidget;
     loginW->setUsernames(Backend::getSystemUsers()); //add in the detected users
     if(!lastUser.isEmpty()){ loginW->setCurrentUser(lastUser); } //set the previously used user
@@ -180,11 +179,11 @@
     //Connect the signals/slots
     connect(loginW,SIGNAL(loginRequested(QString,QString)),this,SLOT(slotStartLogin(QString,QString)));
     connect(loginW,SIGNAL(escapePressed()),this,SLOT(slotShutdownComputer()));
-    connect(loginW,SIGNAL(UserSelected(QString)), this, SLOT(slotUserChanged(QString)) );
-    	    
+    connect(loginW,SIGNAL(UserSelected(QString)), this, SLOT(slotUserSelected(QString)) );
+    connect(loginW,SIGNAL(UserChanged(QString)), this, SLOT(slotUserChanged(QString)) );
+    
     //----Desktop Environment Switcher
     //Create the switcher
-    qDebug() << "Creating desktop switcher";
     deSwitcher = new FancySwitcher(this, !currentTheme->itemIsVertical("desktop") );
     QSize deSize = currentTheme->itemIconSize("desktop");
     deSwitcher->setIconSize(deSize.height());
@@ -256,6 +255,16 @@
 }
 
 void PCDMgui::slotUserChanged(QString newuser){
+  if( !newuser.isEmpty() ){
+    //Try to load the custom user icon
+    QString tmpIcon = Backend::getUserHomeDir(newuser) + "/.loginIcon.png";
+    if(!QFile::exists(tmpIcon) ){ tmpIcon= currentTheme->itemIcon("user"); }
+    if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/user.png"; }
+    loginW->changeButtonIcon("display",tmpIcon, currentTheme->itemIconSize("user"));
+  }
+}
+
+void PCDMgui::slotUserSelected(QString newuser){
   if(newuser.isEmpty()){
     deSwitcher->setVisible(FALSE);
   }else{
@@ -263,10 +272,7 @@
     //Try to load the user's last DE
     loadLastDE(newuser);
     //Try to load the custom user icon
-    QString tmpIcon = Backend::getUserHomeDir(newuser) + "/.loginImage.png";
-    if(!QFile::exists(tmpIcon) ){ tmpIcon= currentTheme->itemIcon("user"); }
-    if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/user.png"; }
-    loginW->changeButtonIcon("display",tmpIcon, currentTheme->itemIconSize("user"));
+    slotUserChanged(newuser);
   }
   retranslateUi();
 }

Modified: pcbsd-projects/PCDM/pcdm-gui.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.h	2013-03-01 18:17:31 UTC (rev 21683)
+++ pcbsd-projects/PCDM/pcdm-gui.h	2013-03-01 18:37:46 UTC (rev 21684)
@@ -46,6 +46,7 @@
 private slots:
     void slotStartLogin(QString,QString);
     void slotUserChanged(QString);
+    void slotUserSelected(QString);
     void slotRestartComputer();
     void slotShutdownComputer();
     void slotClosePCDM();



More information about the Commits mailing list