aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-10-13 13:49:17 -0400
committerKen Moore <moorekou@gmail.com>2015-10-13 13:49:17 -0400
commit5d24324a6ba0ccb5f45a206857511f451684a52f (patch)
tree92723d2f309808c8ecf684141e85da8a14039bf0
parentRemove the box outline for the applauncher plugin: the new font outlines take... (diff)
downloadlumina-5d24324a6ba0ccb5f45a206857511f451684a52f.tar.gz
lumina-5d24324a6ba0ccb5f45a206857511f451684a52f.tar.bz2
lumina-5d24324a6ba0ccb5f45a206857511f451684a52f.zip
Add Inheritance to the Lumian theme files.
Now you can specify: "INHERITS=<name of theme>" within the theme file and it will replace that line with the contents of the other theme (if it exists). This allows all the lumina-interface-specific settings to be put within the "None" theme, and the Lumina-Default theme just inherits those settings at the outset (a lot easier to maintain/adjust going forward).
-rw-r--r--libLumina/LuminaThemes.cpp18
-rw-r--r--libLumina/themes/Lumina-default.qss.template122
2 files changed, 19 insertions, 121 deletions
diff --git a/libLumina/LuminaThemes.cpp b/libLumina/LuminaThemes.cpp
index 7a4ce9ad..351189eb 100644
--- a/libLumina/LuminaThemes.cpp
+++ b/libLumina/LuminaThemes.cpp
@@ -213,6 +213,24 @@ QString LTHEME::assembleStyleSheet(QString themepath, QString colorpath, QString
QStringList colors = LUtils::readFile(colorpath);
//qDebug() << "Found Theme:" << themepath << stylesheet;
//qDebug() << "Found Colors:" << colorpath << colors;
+ QStringList systhemes = availableSystemThemes();
+ QStringList locthemes = availableLocalThemes();
+ //Now do any inheritance between themes
+ int start = stylesheet.indexOf("INHERITS=");
+ while(start>=0){
+ QString line = stylesheet.mid(start, stylesheet.indexOf("\n",start)-start); //only get this line
+ QString inherit = line.section("=",1,1);
+ QString rStyle; //replacement stylesheet
+ if(!locthemes.filter(inherit+"::::").isEmpty()){
+ rStyle = LUtils::readFile(locthemes.filter(inherit+"::::").first().section("::::",1,1)).join("\n");
+ }else if(!systhemes.filter(inherit+"::::").isEmpty()){
+ rStyle = LUtils::readFile(systhemes.filter(inherit+"::::").first().section("::::",1,1)).join("\n");
+ }
+ stylesheet.replace(line, rStyle);
+ //Now look for the next one
+ start = stylesheet.indexOf("INHERITS=");
+ }
+ //Now perform the color replacements
for(int i=0; i<colors.length(); i++){
if(colors[i].isEmpty() || colors[i].startsWith("#")){ continue; }
else if(colors[i].startsWith("PRIMARYCOLOR=")){ stylesheet = stylesheet.replace("%%PRIMARYCOLOR%%", colors[i].section("=",1,1).simplified()); }
diff --git a/libLumina/themes/Lumina-default.qss.template b/libLumina/themes/Lumina-default.qss.template
index 7a15d963..9133ccf8 100644
--- a/libLumina/themes/Lumina-default.qss.template
+++ b/libLumina/themes/Lumina-default.qss.template
@@ -1,98 +1,5 @@
/* ALL THE TEMPLATE WIDGETS */
-
-/* Set all the fonts (unless manually changed below) */
-QWidget{
- font-family: %%FONT%%;
- font-size: %%FONTSIZE%%;
-}
-/* Set the panel appearance for this theme (unless manually customized) */
-QWidget#LuminaPanelColor{
- background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1, stop: 0 %%PRIMARYCOLOR%%, stop: 1 %%PRIMARYDISABLECOLOR%%);
- border-radius: 5px;
-}
-QWidget#LuminaBootSplash{
- background: %%BASECOLOR%%;
- border-radius: 5px;
-}
-
-/* Set the default canvas appearance for Lumina desktop plugins*/
-/* Default to a non-transparent background for all desktop plugins*/
-LDPlugin{
- background: %%BASECOLOR%%;
- border-radius: 5px;
-}
-/* Now specify which plugins should have a transparent background */
-LDPlugin#applauncher, LDPlugin#desktopview{
- background: transparent;
- border-radius: 5px;
-}
-
-LDPlugin#applauncher QToolButton{
-background: transparent;
- border: none;
- border-radius: 5px;
- color: %%TEXTCOLOR%%;
-}
-LDPlugin#applauncher QToolButton:hover{
- background: %%PRIMARYDISABLECOLOR%%;
- border: none;
- border-radius: 5px;
- color: %%TEXTHIGHLIGHTCOLOR%%;
-}
-
-LDPlugin#desktopview QListWidget{
- background: transparent;
- border: 1px solid transparent;
-}
-LDPlugin#desktopview QListWidget::item{
- background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
- stop: 0 transparent,
- stop: 0.7 transparent,
- stop: 1.0 %%PRIMARYDISABLECOLOR%%);
- border-radius: 5px;
- color: %%TEXTCOLOR%%;
-}
-
-LDPlugin#desktopview QListWidget::item:hover{
- background: %%PRIMARYDISABLECOLOR%%;
- border-radius: 5px;
- color: %%TEXTHIGHLIGHTCOLOR%%;
-}
-
-/*For the special widgets on the user button*/
-UserItemWidget, ItemWidget{
- background: transparent;
- border-radius: 3px;
-}
-UserItemWidget:hover, ItemWidget:hover{
- background: %%HIGHLIGHTCOLOR%%;
- color: %%TEXTHIGHLIGHTCOLOR%%;
-}
-
-/*Special taskmanager window buttons: based on window state*/
-LTBWidget{
- border: 1px solid transparent;
- border-radius: 3px;
-}
-LTBWidget::menu-indicator{ image: none; } /*disable the menu arrow*/
-LTBWidget#WindowVisible{
- background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.3 %%SECONDARYCOLOR%%, stop: 1 transparent);
-}
-LTBWidget#WindowInvisible{
- /* Primary color is used for the panel appearance, so use that to make it disappear*/
- background: transparent;
-}
-LTBWidget#WindowActive{
- background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.3 %%HIGHLIGHTDISABLECOLOR%%, stop: 1 transparent);
-}
-LTBWidget#WindowAttention{
- background: QLinearGradient(x1: 0, y1: 0, x2: 1, y2: 1.1, stop: 0.3 %%HIGHLIGHTCOLOR%%, stop: 1 transparent);
-}
-LTBWidget:hover, LTBWidget#WindowVisible:hover, LTBWidget#WindowInvisible:hover, LTBWidget#WindowActive:hover, LTBWidget#WindowAttention:hover{
- background: %%HIGHLIGHTCOLOR%%;
- color: %%TEXTHIGHLIGHTCOLOR%%;
- border: 1px solid %%ACCENTCOLOR%%;
-}
+INHERITS=None
/* ALL THE WIDGETS WITH THE BASE COLOR */
QMainWindow, QMenu, QDialog, QMessageBox{
@@ -564,30 +471,3 @@ QAbstractSpinBox::up-arrow{
width: 16px;
height: 16px;
}*/
- /* CALENDER WIDGET */
- /* (This is a special hack since there is no official support for stylesheets for this widget) */
- QCalendarWidget QWidget#qt_calendar_navigationbar{
- background-color: %%ALTBASECOLOR%%; /*QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %%PRIMARYDISABLECOLOR%%, stop: 1 %%PRIMARYCOLOR%%);*/
- }
-QCalendarWidget QWidget{
- background-color: %%BASECOLOR%%;
- alternate-background-color: %%HIGHLIGHTDISABLECOLOR%%;
- color: %%TEXTCOLOR%%;
-}
-QCalendarWidget QAbstractButton{
- background-color: transparent;
-}
-QCalendarWidget QAbstractButton::menu-indicator{
- image: none;
-}
-QCalendarWidget QAbstractItemView{
- background-color: %%SECONDARYCOLOR%%;
- selection-background-color: QLinearGradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 %%HIGHLIGHTDISABLECOLOR%%, stop: 1 %%HIGHLIGHTCOLOR%%);;
- selection-color: %%TEXTHIGHLIGHTCOLOR%%;
-}
-QCalendarWidget QWidget#qt_calendar_calendarview{
- background-color: %%ALTBASECOLOR%%;
- border: none;
-}
-
-
bgstack15