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

svn at pcbsd.org svn at pcbsd.org
Tue Feb 12 13:32:07 PST 2013


Author: kenmoore
Date: 2013-02-12 21:32:07 +0000 (Tue, 12 Feb 2013)
New Revision: 21478

Modified:
   pcbsd-projects/PCDM/pcdm.theme
   pcbsd-projects/PCDM/themeStruct.cpp
   pcbsd-projects/PCDM/themeStruct.h
Log:
Finish up the new theme structure format for PCDM, now to integrate it into the program



Modified: pcbsd-projects/PCDM/pcdm.theme
===================================================================
--- pcbsd-projects/PCDM/pcdm.theme	2013-02-12 18:17:28 UTC (rev 21477)
+++ pcbsd-projects/PCDM/pcdm.theme	2013-02-12 21:32:07 UTC (rev 21478)
@@ -72,7 +72,7 @@
 # ----------
 APP_STYLESHEET_START
 QComboBox{ font-size: 32px; }
-QGroupBox{ background-color: qlineargradient(x1: 0, x2: 0, y1: 0, y2: 1, stop: 0 lightblue, stop: 1 transparent); }
-QToolBar{ background-color: qlineargradient(x1: 0, x2: 0, y1: 0, y2: 1, stop: 0 lightblue, stop: 1 blue); }
+QGroupBox{ background-color: qlineargradient(x1: 0, x2: 0, y1: 0.5, y2: 0.5, stop: 0 lightred, stop: 1 transparent); }
+QToolBar{ background-color: qlineargradient(x1: 0, x2: 0, y1: 0.5, y2: 0.5, stop: 0 red, stop: 1 transparent); }
 QGraphicsView{ background: white; color: black; }
 APP_STYLESHEET_STOP

Modified: pcbsd-projects/PCDM/themeStruct.cpp
===================================================================
--- pcbsd-projects/PCDM/themeStruct.cpp	2013-02-12 18:17:28 UTC (rev 21477)
+++ pcbsd-projects/PCDM/themeStruct.cpp	2013-02-12 21:32:07 UTC (rev 21478)
@@ -1,5 +1,6 @@
 #include "pcdm-themes.h"
 
+
 void ThemeStruct::loadThemeFile(QString filePath){
   //Create the required Items:
   itemNames.clear();
@@ -73,14 +74,111 @@
 	    else{ items[index].x1 = x.section("-",0,0).toInt(); items[index].x2 = x.section("-",1,1).toInt(); }
 	    if(y.indexOf("-") == -1){ items[index].y1 = y.toInt(); items[index].y2 = -1;}
 	    else{ items[index].y1 = y.section("-",0,0).toInt(); items[index].y2 = y.section("-",1,1).toInt(); }
-	    
 	}
-	
-	      
-      
-
+      }
     } // end if line is not a comment or empty
   } // end reading lines from file
   file.close();
-  
+}
+
+ThemeItem ThemeStruct::exportItem(QString item){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid export item:"<<item;
+    ThemeItem TI = new ThemeItem();
+    return TI;
+  }else{
+    //Now format the output
+    ThemeItem TI = items[index];
+    return TI;
+  }
+}
+
+void ThemeStruct::importItem(QString item, ThemeItem TI){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid import item:"<<item;
+  }else{
+    items[index] = TI;
+  }
+}
+
+bool ThemeStruct::validItem(QString item){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid item:"<<item;
+    return FALSE;
+  }else{
+    bool ok = TRUE;
+    bool chk = items[index].enabled && items[index].value.isEmpty() && items[index].icon.isEmpty() && ( (items[index].x1==-1) || (items[index].y1==-1) );
+    if(chk){ ok=FALSE; }
+    return ok;
+  }
+}
+
+bool ThemeStruct::itemIsEnabled(QString item){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid item:"<<item;
+    return FALSE;
+  }else{
+    return items[index].enabled;
+  }
+}
+
+QString ThemeStruct::itemValue(QString item){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid item:"<<item;
+    return FALSE;
+  }else{
+    return items[index].value;
+  }
+}
+
+QString ThemeStruct::itemIcon(QString item){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid item:"<<item;
+    return FALSE;
+  }else{
+    return items[index].icon;
+  }  
+}
+
+QSize ThemeStruct::itemIconSize(QString item){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid item:"<<item;
+    return FALSE;
+  }else{
+    return items[index].iconSize;
+  }
+}
+
+int ThemeStruct::itemLocation(QString item, QString variable){
+  int index = itemNames.indexOf(item);
+  if( index == -1 ){ 
+    qDebug() << "ThemeStruct: Invalid item:"<<item;
+    return FALSE;
+  }else{
+    variable = variable.toLower();
+    if(variable == "row"){ return items[index].x1; }
+    else if(variable == "col"){ return items[index].y1; }
+    else if(variable == "rowspan"){ 
+      int span = items[index].x2 - items[index].x1;
+      if(span < 0){ span = 0 - span; } //Make sure it is always positive
+      span++; //add 1 for the end point
+      return span;
+    }else if(variable == "colspan"){
+      int span = items[index].y2 - items[index].y1;
+      if(span < 0){ span = 0 - span; } //Make sure it is always positive
+      span++; //add 1 for the end point
+      return span;
+    }
+  }
+}
+
+QString ThemeStruct::styleSheet(){
+  return applicationStyleSheet;
 }
\ No newline at end of file

Modified: pcbsd-projects/PCDM/themeStruct.h
===================================================================
--- pcbsd-projects/PCDM/themeStruct.h	2013-02-12 18:17:28 UTC (rev 21477)
+++ pcbsd-projects/PCDM/themeStruct.h	2013-02-12 21:32:07 UTC (rev 21478)
@@ -11,12 +11,11 @@
 class ThemeItem{
 
 public:
-  ThemeItem(){ enabled=FALSE; type="";}
+  ThemeItem(){ enabled=FALSE; x1=-1; x2=-1; y1=-1; y2=-1; }
   ~ThemeItem();
   //values
   bool enabled;
   bool isVertical;
-  QString type;
   QString value;
   int x1,x2,y1,y2;
   QString icon;
@@ -33,6 +32,8 @@
   QString applicationStyleSheet;
 
 public:
+  ThemeStruct(){}
+  ~ThemeStruct();
   //How to fill a structure with items
   void loadThemeFile(QString);
   //import/export functions for passing items between different theme structures
@@ -46,6 +47,7 @@
   QString itemIcon(QString);
   QSize itemIconSize(QString);
   int itemLocation(QString, QString variable);
+  QString styleSheet();
 
 };
 



More information about the Commits mailing list