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

svn at pcbsd.org svn at pcbsd.org
Thu Jan 24 08:36:08 PST 2013


Author: kenmoore
Date: 2013-01-24 16:36:07 +0000 (Thu, 24 Jan 2013)
New Revision: 21124

Modified:
   pcbsd-projects/PCDM/fancySwitcher.cpp
   pcbsd-projects/PCDM/fancySwitcher.h
   pcbsd-projects/PCDM/loginWidget.cpp
   pcbsd-projects/PCDM/loginWidget.h
   pcbsd-projects/PCDM/pcdm-gui.cpp
   pcbsd-projects/PCDM/pcdm-gui.h
Log:
Fix up the PCDM build so that it should now properly perform the translations



Modified: pcbsd-projects/PCDM/fancySwitcher.cpp
===================================================================
--- pcbsd-projects/PCDM/fancySwitcher.cpp	2013-01-24 15:01:27 UTC (rev 21123)
+++ pcbsd-projects/PCDM/fancySwitcher.cpp	2013-01-24 16:36:07 UTC (rev 21124)
@@ -261,6 +261,17 @@
   checkButtons();
 }
 
+void FancySwitcher::removeAllItems(){
+  if( idL.isEmpty() ){ return; } //do nothing if nothing to change
+  //clear the internal lists
+  idL.clear();
+  icL.clear();
+  item = -1;
+  //now refresh the display
+  updateIconViewer();
+  checkButtons();
+}
+
 QString FancySwitcher::currentItem(){
   QString id = idL[item];
   return id;

Modified: pcbsd-projects/PCDM/fancySwitcher.h
===================================================================
--- pcbsd-projects/PCDM/fancySwitcher.h	2013-01-24 15:01:27 UTC (rev 21123)
+++ pcbsd-projects/PCDM/fancySwitcher.h	2013-01-24 16:36:07 UTC (rev 21124)
@@ -32,6 +32,7 @@
 	//Remove item(s) from the widget (given the item(s) identifier(s))
 	void removeItem(QString id);
 	void removeItems(QStringList idList);
+        void removeAllItems();
 	//Get the currently selected item (returns the item identifier)
 	QString currentItem();
 	//Set the currently selected item (by identifier)

Modified: pcbsd-projects/PCDM/loginWidget.cpp
===================================================================
--- pcbsd-projects/PCDM/loginWidget.cpp	2013-01-24 15:01:27 UTC (rev 21123)
+++ pcbsd-projects/PCDM/loginWidget.cpp	2013-01-24 16:36:07 UTC (rev 21124)
@@ -31,7 +31,9 @@
   layout->addWidget(pushLogin,0,2);
   //Setup the Signals/Slots
   connect(pushLogin,SIGNAL(clicked()),this,SLOT(slotTryLogin()));
-  connect(pushViewPassword,SIGNAL(clicked()),this,SLOT(slotChangePWView()));
+  //connect(pushViewPassword,SIGNAL(clicked()),this,SLOT(slotChangePWView()));
+  connect(pushViewPassword,SIGNAL(pressed()),this,SLOT(slotChangePWView()));
+  connect(pushViewPassword,SIGNAL(released()),this,SLOT(slotChangePWView()));
   connect(listUsers,SIGNAL(activated(int)),this,SLOT(slotChooseUser(int)));
   
   //Set this layout for the loginWidget
@@ -164,4 +166,3 @@
     qDebug() << "LoginWidget: Invalid item to change style" << item << " - valid items are \"login\", \"pwview\", \"user\", and \"password\"";	
   }
 }
-

Modified: pcbsd-projects/PCDM/loginWidget.h
===================================================================
--- pcbsd-projects/PCDM/loginWidget.h	2013-01-24 15:01:27 UTC (rev 21123)
+++ pcbsd-projects/PCDM/loginWidget.h	2013-01-24 16:36:07 UTC (rev 21124)
@@ -37,6 +37,7 @@
 	void setStyleSheet(QString item, QString style);
         
         void keyPressEvent(QKeyEvent *e);
+  
   private:
   	QComboBox* listUsers;
   	QLineEdit* linePassword;

Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp	2013-01-24 15:01:27 UTC (rev 21123)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp	2013-01-24 16:36:07 UTC (rev 21124)
@@ -10,7 +10,7 @@
 
 bool DEBUG_MODE=TRUE;
 
-PCDMgui::PCDMgui()
+PCDMgui::PCDMgui() : QMainWindow()
 {
     //Create the GUI based upon the current Theme
     createGUIfromTheme();
@@ -53,22 +53,20 @@
     
   //Populate the Toolbar with items (starts at leftmost/topmost)
     //----Virtual Keyboard
-    QAction* virtkeyboardButton = new QAction( QIcon(Theme::objectIconPath("virt-keyboard")),tr("Virtual Keyboard"),this );
+    virtkeyboardButton = new QAction( QIcon(Theme::objectIconPath("virt-keyboard")),tr("Virtual Keyboard"),this );
     toolbar->addAction(virtkeyboardButton);
     connect( virtkeyboardButton, SIGNAL(triggered()), this, SLOT(slotPushVirtKeyboard()) );
-    virtkeyboardButton->setToolTip(tr("Virtual Keyboard"));
 
+
     //----Locale Switcher
-    QAction* localeButton = new QAction( QIcon(Theme::objectIconPath("locale")),tr("Locale"),this );
+    localeButton = new QAction( QIcon(Theme::objectIconPath("locale")),tr("Locale"),this );
     toolbar->addAction(localeButton);
     connect( localeButton, SIGNAL(triggered()), this, SLOT(slotChangeLocale()) );
-    localeButton->setToolTip(tr("Change locale"));
 
     //----Keyboard Layout Switcher
-    QAction* keyboardButton = new QAction( QIcon(Theme::objectIconPath("keyboard")),tr("Keyboard Layout"),this );
+    keyboardButton = new QAction( QIcon(Theme::objectIconPath("keyboard")),tr("Keyboard Layout"),this );
     toolbar->addAction(keyboardButton);
     connect( keyboardButton, SIGNAL(triggered()), this, SLOT(slotChangeKeyboardLayout()) );
-    keyboardButton->setToolTip(tr("Change Keyboard Layout"));
 
     //----Add a spacer
     QWidget* spacer = new QWidget();
@@ -76,12 +74,8 @@
     toolbar->addWidget(spacer);
 
     //----System Shutdown/Restart
-    QAction* systemButton = new QAction( QIcon(Theme::objectIconPath("system")),tr("System"),this );
+    systemButton = new QAction( QIcon(Theme::objectIconPath("system")),tr("System"),this );
     systemMenu = new QMenu();
-    systemMenu->addAction( tr("Restart"),this, SLOT(slotRestartComputer()) );
-    systemMenu->addAction( tr("Shut Down"), this, SLOT(slotShutdownComputer()) );
-    if(DEBUG_MODE){systemMenu->addAction( tr("Close PCDM"), this, SLOT(slotClosePCDM()) ); }
-    systemButton->setMenu(systemMenu);
     toolbar->addAction(systemButton);
     connect( systemButton, SIGNAL(triggered()), this, SLOT(slotShutdownComputer()) );
     systemButton->setToolTip(tr("Shutdown the computer"));
@@ -295,7 +289,7 @@
     QCoreApplication::installTranslator(m_translator);	  
   }
   //Re-draw the interface
-  this->retranslateUi(this);
+  retranslateUi();
   
   Backend::log("Current Locale after change: " + this->locale().name() );
 }
@@ -313,4 +307,36 @@
    system("killall -9 xvkbd; xvkbd -compact &");
 }
 
+void PCDMgui::retranslateUi(){
+  //All the text-setting for the main interface needs to be done here
+  //virtual keyboard button
+  virtkeyboardButton->setToolTip(tr("Virtual Keyboard"));
+  virtkeyboardButton->setText(tr("Virtual Keyboard"));
+  //locale switcher button
+  localeButton->setToolTip(tr("Change locale"));
+  localeButton->setText(tr("Locale"));
+  //keyboard layout button
+  keyboardButton->setToolTip(tr("Change Keyboard Layout"));
+  keyboardButton->setText(tr("Keyboard Layout"));
+  //system button
+  systemButton->setToolTip(tr("Shutdown the computer"));
+  systemButton->setText(tr("System"));
+  //Menu entries for system button
+    systemMenu->clear();	
+    systemMenu->addAction( tr("Restart"),this, SLOT(slotRestartComputer()) );
+    systemMenu->addAction( tr("Shut Down"), this, SLOT(slotShutdownComputer()) );
+    if(DEBUG_MODE){systemMenu->addAction( tr("Close PCDM"), this, SLOT(slotClosePCDM()) ); }
+    systemButton->setMenu(systemMenu);
+  //The main login widget
+    
+  //The desktop switcher
+  deSwitcher->removeAllItems();
+  QStringList deList = Backend::getAvailableDesktops();
+  for(int i=0; i<deList.length(); i++){
+    deSwitcher->addItem( deList[i], Backend::getDesktopIcon(deList[i]), Backend::getDesktopComment(deList[i]) );
+  }
+    //Set the switcher to the last used desktop environment
+    //deSwitcher->setCurrentItem("kde3"); 
 
+}
+

Modified: pcbsd-projects/PCDM/pcdm-gui.h
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.h	2013-01-24 15:01:27 UTC (rev 21123)
+++ pcbsd-projects/PCDM/pcdm-gui.h	2013-01-24 16:36:07 UTC (rev 21124)
@@ -52,6 +52,7 @@
     widgetKeyboard* wKey;
     widgetLocale* wLoc;
     QToolBar* toolbar;
+    QAction *virtkeyboardButton, *localeButton, *keyboardButton, *systemButton;
     QMenu* systemMenu;
     QComboBox* unameline;
     FancySwitcher* deSwitcher;
@@ -64,6 +65,7 @@
     QString translationDir;
     //Functions
     void createGUIfromTheme();
+    void retranslateUi();
 
 signals:
     void xUserFound(QString);



More information about the Commits mailing list