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

svn at pcbsd.org svn at pcbsd.org
Thu Jul 26 12:38:15 PDT 2012


Author: kenmoore
Date: 2012-07-26 19:38:15 +0000 (Thu, 26 Jul 2012)
New Revision: 17961

Modified:
   pcbsd-projects/PCDM/fancySwitcher.cpp
   pcbsd-projects/PCDM/fancySwitcher.h
   pcbsd-projects/PCDM/pcdm-themes.cpp
   pcbsd-projects/PCDM/sample.pcdm-theme
Log:
Add a simple text label to the fancySwitcher that will display the name of the selected icon. Also fix an issue where the tooltips were unreadable if the widget background was set transparent



Modified: pcbsd-projects/PCDM/fancySwitcher.cpp
===================================================================
--- pcbsd-projects/PCDM/fancySwitcher.cpp	2012-07-26 18:24:09 UTC (rev 17960)
+++ pcbsd-projects/PCDM/fancySwitcher.cpp	2012-07-26 19:38:15 UTC (rev 17961)
@@ -18,6 +18,8 @@
   //Add the buttons to the grid (back is always left/up)
   pushForward = new QPushButton;
   pushBack = new QPushButton;
+  textLabel = new QLabel;
+  textLabel->setAlignment(Qt::AlignCenter);
 
   iconViewer = new QGraphicsView();
   iconViewer->setInteractive(FALSE);
@@ -33,13 +35,15 @@
     layout->addWidget(pushBack,1,1);
     layout->addWidget(iconViewer,1,2);
     layout->addWidget(pushForward,1,3);
+    layout->addWidget(textLabel,2,1,1,3);
   }else{ //vertical
     iconViewer->setFixedSize(iconSize+2,2*iconSize);
     pushBack->setIcon(QIcon(":images/up.png"));
     pushForward->setIcon(QIcon(":images/down.png"));
     layout->addWidget(pushBack,1,1);
     layout->addWidget(iconViewer,2,1);
-    layout->addWidget(pushForward,3,1);
+    layout->addWidget(textLabel,3,1);
+    layout->addWidget(pushForward,4,1);
   }
   //set this layout as the layout for the FancySwitcher
   this->setLayout(layout);
@@ -139,6 +143,7 @@
 
   //Save the (now) current item as the old item for animation purposes later
   oldItem = item;
+  textLabel->setText(idL[item]); //set the info text 
 }
 
 void FancySwitcher::checkButtons(){
@@ -290,6 +295,7 @@
   //Propagate the style sheet to both the buttons and the iconViewer
   pushForward->setStyleSheet(style);
   pushBack->setStyleSheet(style);
-  iconViewer->setStyleSheet(style);
+  iconViewer->setStyleSheet("QGraphicsView { "+style+" } "); //make sure the tooltips are not affected
+  textLabel->setStyleSheet(style);
 }
 

Modified: pcbsd-projects/PCDM/fancySwitcher.h
===================================================================
--- pcbsd-projects/PCDM/fancySwitcher.h	2012-07-26 18:24:09 UTC (rev 17960)
+++ pcbsd-projects/PCDM/fancySwitcher.h	2012-07-26 19:38:15 UTC (rev 17961)
@@ -16,6 +16,7 @@
 #include <QGridLayout>
 #include <QPixmap>
 #include <QDebug>
+#include <QLabel>
 
 class FancySwitcher : public QWidget
 {
@@ -49,6 +50,7 @@
 	QGraphicsScene* scene;
 	QStringList idL;
 	QList<QGraphicsPixmapItem*> icL;
+	QLabel* textLabel;
 	int item, oldItem;
 	bool isHorizontal;
 	int iconSize;

Modified: pcbsd-projects/PCDM/pcdm-themes.cpp
===================================================================
--- pcbsd-projects/PCDM/pcdm-themes.cpp	2012-07-26 18:24:09 UTC (rev 17960)
+++ pcbsd-projects/PCDM/pcdm-themes.cpp	2012-07-26 19:38:15 UTC (rev 17961)
@@ -9,7 +9,7 @@
 void Theme::loadDefaults(QString vars){
   if( vars=="all" ){
     validLayouts.clear(); needText.clear(); objStruct.clear();
-    validLayouts << "above" << "below" << "left" << "right" << "disabled" << "icononly";
+    validLayouts << "above" << "below" << "left" << "right" << "disabled" << "icononly" << "vertical" << "horizontal";
     needText << "user" << "password" << "login";
     objStruct << "header" << "background" << "splashscreen" << "user" << "password" << "login" << "keyboard" << "locale" << "system" << "desktop" << "virt-keyboard";
   }

Modified: pcbsd-projects/PCDM/sample.pcdm-theme
===================================================================
--- pcbsd-projects/PCDM/sample.pcdm-theme	2012-07-26 18:24:09 UTC (rev 17960)
+++ pcbsd-projects/PCDM/sample.pcdm-theme	2012-07-26 19:38:15 UTC (rev 17961)
@@ -67,3 +67,4 @@
 #SET_ITEM_STYLE=toolbar::selection-color::red		#red text when selected
 SET_ITEM_STYLE=user::font-size::32px			#set the font to size 32
 SET_ITEM_STYLE=desktop::background::transparent
+SET_ITEM_STYLE=desktop::color::white



More information about the Commits mailing list