[PC-BSD Commits] r21528 - pcbsd-projects/PCDM
svn at pcbsd.org
svn at pcbsd.org
Fri Feb 15 06:50:15 PST 2013
Author: kenmoore
Date: 2013-02-15 14:50:15 +0000 (Fri, 15 Feb 2013)
New Revision: 21528
Removed:
pcbsd-projects/PCDM/pcdm-themes.cpp
pcbsd-projects/PCDM/pcdm-themes.h
Modified:
pcbsd-projects/PCDM/pcdm-gui.cpp
Log:
Remove the old pcdm-themes class and add in using included resources for icons if none found
Modified: pcbsd-projects/PCDM/pcdm-gui.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-gui.cpp 2013-02-15 11:45:58 UTC (rev 21527)
+++ pcbsd-projects/PCDM/pcdm-gui.cpp 2013-02-15 14:50:15 UTC (rev 21528)
@@ -35,6 +35,7 @@
defaultTheme->loadThemeFile( ":samples/pcdm.theme" );
for( int i=0; i<invalid.length(); i++){
//Replace the invalid items with the defaults
+ qDebug() << "Invalid Theme Item, Using defaults:" << invalid[i];
currentTheme->importItem( invalid[i] , defaultTheme->exportItem(invalid[i]) );
}
}
@@ -88,19 +89,25 @@
toolbar->setIconSize( currentTheme->itemIconSize("toolbar") ); //use theme size
//Populate the Toolbar with items (starts at leftmost/topmost)
+ QString tmpIcon = currentTheme->itemIcon("vkeyboard");
//----Virtual Keyboard
- virtkeyboardButton = new QAction( QIcon(currentTheme->itemIcon("vkeyboard")),tr("Virtual Keyboard"),this );
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/keyboard.png"; }
+ virtkeyboardButton = new QAction( QIcon(tmpIcon),tr("Virtual Keyboard"),this );
toolbar->addAction(virtkeyboardButton);
connect( virtkeyboardButton, SIGNAL(triggered()), this, SLOT(slotPushVirtKeyboard()) );
//----Locale Switcher
- localeButton = new QAction( QIcon(currentTheme->itemIcon("locale")),tr("Locale"),this );
+ tmpIcon = currentTheme->itemIcon("locale");
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/language.png"; }
+ localeButton = new QAction( QIcon(tmpIcon),tr("Locale"),this );
toolbar->addAction(localeButton);
connect( localeButton, SIGNAL(triggered()), this, SLOT(slotChangeLocale()) );
//----Keyboard Layout Switcher
- keyboardButton = new QAction( QIcon(currentTheme->itemIcon("keyboard")),tr("Keyboard Layout"),this );
+ tmpIcon = currentTheme->itemIcon("keyboard");
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/input-keyboard.png"; }
+ keyboardButton = new QAction( QIcon(tmpIcon),tr("Keyboard Layout"),this );
toolbar->addAction(keyboardButton);
connect( keyboardButton, SIGNAL(triggered()), this, SLOT(slotChangeKeyboardLayout()) );
@@ -110,12 +117,13 @@
toolbar->addWidget(spacer);
//----System Shutdown/Restart
- QAction* act = new QAction( QIcon(currentTheme->itemIcon("system")),tr("System"),this );
+ tmpIcon = currentTheme->itemIcon("system");
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/system.png"; }
+ QAction* act = new QAction( QIcon(tmpIcon),tr("System"),this );
systemButton = new QToolButton();
systemButton->setDefaultAction(act);
systemMenu = new QMenu();
toolbar->addWidget(systemButton);
- //connect( systemButton, SIGNAL(triggered()), this, SLOT(slotShutdownComputer()) );
systemButton->setPopupMode( QToolButton::InstantPopup );
//Create the grid layout
@@ -124,7 +132,9 @@
//----Header Image
QLabel* header = new QLabel;
if( currentTheme->itemIsEnabled("header") ){
- QPixmap tmp( currentTheme->itemIcon("header") );
+ tmpIcon = currentTheme->itemIcon("header");
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/banner.png"; }
+ QPixmap tmp( tmpIcon );
header->setPixmap( tmp.scaled( currentTheme->itemIconSize("header") ) );
grid->addWidget( header, currentTheme->itemLocation("header","row"), \
currentTheme->itemLocation("header","col"), \
@@ -137,14 +147,15 @@
loginW->setUsernames(Backend::getSystemUsers()); //add in the detected users
//loginW->setCurrentUser(); //set the previously used user
//Set Icons from theme
- loginW->changeButtonIcon("login",currentTheme->itemIcon("login"), currentTheme->itemIconSize("login"));
- loginW->changeButtonIcon("display",currentTheme->itemIcon("user"), currentTheme->itemIconSize("user"));
- loginW->changeButtonIcon("pwview",currentTheme->itemIcon("password"), currentTheme->itemIconSize("password"));
- //Set style sheets
- //loginW->changeStyleSheet("login", Theme::objectStyleSheet("login"));
- //loginW->changeStyleSheet("password", Theme::objectStyleSheet("password"));
- //loginW->changeStyleSheet("pwview", Theme::objectStyleSheet("password"));
- //loginW->changeStyleSheet("user", Theme::objectStyleSheet("user"));
+ tmpIcon = currentTheme->itemIcon("login");
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/right.png"; }
+ loginW->changeButtonIcon("login",tmpIcon, currentTheme->itemIconSize("login"));
+ tmpIcon = currentTheme->itemIcon("user");
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/user.png"; }
+ loginW->changeButtonIcon("display",tmpIcon, currentTheme->itemIconSize("user"));
+ tmpIcon = currentTheme->itemIcon("password");
+ if(!QFile::exists(tmpIcon) || tmpIcon.isEmpty() ){ tmpIcon=":/images/password.png"; }
+ loginW->changeButtonIcon("pwview",tmpIcon, currentTheme->itemIconSize("password"));
//Add item to the grid
grid->addWidget( loginW, currentTheme->itemLocation("login","row"), \
currentTheme->itemLocation("login","col"), \
@@ -176,7 +187,6 @@
}
//Set the switcher to the last used desktop environment
//deSwitcher->setCurrentItem("kde3");
- //deSwitcher->changeButtonIcon("forward","/home/kenmoore/Downloads/kde.png");
grid->addWidget( deSwitcher, currentTheme->itemLocation("desktop","row"), \
currentTheme->itemLocation("desktop","col"), \
currentTheme->itemLocation("desktop","rowspan"), \
More information about the Commits
mailing list