traverso-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-commit] traverso/src/core Themer.cpp


From: Remon Sijrier
Subject: [Traverso-commit] traverso/src/core Themer.cpp
Date: Sat, 24 Nov 2007 10:27:15 +0000

CVSROOT:        /sources/traverso
Module name:    traverso
Changes by:     Remon Sijrier <r_sijrier>       07/11/24 10:27:15

Modified files:
        src/core       : Themer.cpp 

Log message:
        * Added 3 new themes from Nicola as build-in themes, thanks Nic!
        * Detect and set theme that fits the current style best (KDE -> 
TraversoLight, Gnome - > ubuntu theme), unless a theme was specified by the 
user.
        * updated default-color for Marker End 

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Themer.cpp?cvsroot=traverso&r1=1.7&r2=1.8

Patches:
Index: Themer.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Themer.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Themer.cpp  5 Nov 2007 15:49:30 -0000       1.7
+++ Themer.cpp  24 Nov 2007 10:27:15 -0000      1.8
@@ -17,7 +17,7 @@
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA.
 
-$Id: Themer.cpp,v 1.7 2007/11/05 15:49:30 r_sijrier Exp $
+$Id: Themer.cpp,v 1.8 2007/11/24 10:27:15 r_sijrier Exp $
 */
 
 #include "Themer.h"
@@ -56,26 +56,52 @@
 {
        m_watcher = new QFileSystemWatcher(this);
        QString themepath = config().get_property("Themer", "themepath", 
"").toString();
-       if (themepath.isEmpty()) {
-               themepath = ":/themes";
-       }
-       m_currentTheme = config().get_property("Themer", "currenttheme", 
"TraversoLight").toString();
        
-       if (get_builtin_themes().contains(m_currentTheme)) {
+       // No theme path specified, fall back on built in themes only
+       if (themepath.isEmpty()) {
                themepath = ":/themes";
        }
 
-       m_themefile =  themepath + "/" + m_currentTheme + "/traversotheme.xml";
-       m_coloradjust = -1;
+       // Detect and set theme based on current style
+       // but only when no theme was specified by the user!
        
+       m_currentTheme = config().get_property("Themer", "currenttheme", 
"").toString();
        m_systempallete = QApplication::palette();
        
        QString style = config().get_property("Themer", "style", "").toString();
        QString currentStyle = 
QString(QApplication::style()->metaObject()->className()).remove("Q").remove("Style");
+       
+       if (style.isEmpty()) {
+               style = currentStyle;
+               config().set_property("Themer", "style", currentStyle);
+       }
+       
        if (style != currentStyle) {
                QApplication::setStyle(style);
+               currentStyle = style;
+               config().set_property("Themer", "style", currentStyle);
        }
+       
+       if (m_currentTheme.isEmpty()) {
+               if (currentStyle  == "Cleanlooks") {
+                       m_currentTheme = "ubuntu";
+               } else if (currentStyle == "Plastique") {
+                       m_currentTheme = "TraversoLight";
+               } else {
+                       m_currentTheme = "TraversoLight";
+               }
+               config().set_property("Themer", "currenttheme", m_currentTheme);
+       }
+       
+       if (get_builtin_themes().contains(m_currentTheme)) {
+               themepath = ":/themes";
+       }
+       
+       m_themefile =  themepath + "/" + m_currentTheme + "/traversotheme.xml";
+       m_coloradjust = -1;
+       
        bool usestylepallete = config().get_property("Themer", 
"usestylepallet", "").toBool();
+       
        if (usestylepallete) {
                
QApplication::setPalette(QApplication::style()->standardPalette());
        }
@@ -282,7 +308,7 @@
 QStringList Themer::get_builtin_themes()
 {
        QStringList list;
-       list << "TraversoLight";
+       list << "system-palette" << "medium-contrast" << "ubuntu" << 
"TraversoLight";
        return list;
 }
 
@@ -429,8 +455,10 @@
 
                if (name == "Workcursor:default") c = 
p.color(QPalette::WindowText);
                
-               if (name == "Marker:default") c = p.color(QPalette::Highlight);
-               if (name == "Marker:blink") c = Qt::red;
+               if (name == "Marker:default") c = Qt::red;
+               if (name == "Marker:blink") c = p.color(QPalette::Highlight);
+               if (name == "Marker:end") c = Qt::blue;
+               if (name == "Marker:blinkend") c = p.color(QPalette::Highlight);
 
        return c;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]