[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/extragear/kde3/graphics/digikam/digikam
From:       Gilles Caulier <caulier.gilles () gmail ! com>
Date:       2008-03-05 20:10:02
Message-ID: 1204747802.658649.23453.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 782704 by cgilles:

handle properly color scheme themes


 M  +37 -7     timelinewidget.cpp  
 M  +4 -0      timelinewidget.h  


--- branches/extragear/kde3/graphics/digikam/digikam/timelinewidget.cpp #782703:782704
@@ -42,6 +42,7 @@
 // Local includes.
 
 #include "ddebug.h"
+#include "themeengine.h"
 #include "timelinewidget.h"
 #include "timelinewidget.moc"
 
@@ -122,6 +123,9 @@
     QDateTime ref = QDateTime::currentDateTime();   
     setCursorDateTime(ref);   
     setRefDateTime(ref);
+
+    connect(ThemeEngine::instance(), SIGNAL(signalThemeChanged()),
+            this, SLOT(slotThemeChanged()));
 }
 
 TimeLineWidget::~TimeLineWidget()
@@ -622,7 +626,7 @@
     SelectionMode sel;
     QRect         focusRect, selRect, barRect;
     QBrush        selBrush;
-    QColor        dateColor;
+    QColor        dateColor, subDateColor;
 
     // Date histogram drawing is divided in 2 parts. The current date-time 
     // is placed on the center of the view and all dates on right are computed,
@@ -671,6 +675,16 @@
         p.drawLine(barRect.right(), barRect.bottom(), barRect.right(), barRect.bottom()+3);
         p.drawLine(barRect.left(),  barRect.bottom(), barRect.left(),  barRect.bottom()+3);
 
+        if (val) 
+        {
+            if (sel)
+                subDateColor = palette().active().highlightedText();
+            else
+                subDateColor = palette().active().foreground();
+        }        
+        else 
+            subDateColor = palette().active().mid();
+
         if (sel == Selected || sel == FuzzySelection)
         {
             selBrush.setColor(palette().active().highlight());
@@ -721,7 +735,7 @@
                     QFont fnt = p.font();
                     fnt.setPointSize(fnt.pointSize()-4);
                     p.setFont(fnt);
-                    p.setPen(val ? palette().active().foreground() : palette().active().mid()) ;
+                    p.setPen(subDateColor) ;
                     QString txt = QString::number(week);
                     QRect br    = p.fontMetrics().boundingRect(0, 0, width(), height(), 0, txt); 
                     p.drawText(barRect.left() + ((barRect.width()-br.width())/2),
@@ -753,7 +767,7 @@
                     QFont fnt = p.font();
                     fnt.setPointSize(fnt.pointSize()-4);
                     p.setFont(fnt);
-                    p.setPen(val ? palette().active().foreground() : palette().active().mid()) ;
+                    p.setPen(subDateColor) ;
                     QString txt = QString(d->calendar->monthName(ref.date(), true)[0]);
                     QRect br    = p.fontMetrics().boundingRect(0, 0, width(), height(), 0, txt); 
                     p.drawText(barRect.left() + ((barRect.width()-br.width())/2),
@@ -845,6 +859,16 @@
         p.drawLine(barRect.right(), barRect.bottom(), barRect.right(), barRect.bottom()+3);
         p.drawLine(barRect.left(),  barRect.bottom(), barRect.left(),  barRect.bottom()+3);
 
+        if (val) 
+        {
+            if (sel)
+                subDateColor = palette().active().highlightedText();
+            else
+                subDateColor = palette().active().foreground();
+        }        
+        else 
+            subDateColor = palette().active().mid();
+
         if (sel == Selected || sel == FuzzySelection)
         {
             selBrush.setColor(palette().active().highlight());
@@ -868,7 +892,7 @@
                     QFont fnt = p.font();
                     fnt.setPointSize(fnt.pointSize()-4);
                     p.setFont(fnt);
-                    p.setPen(val ? palette().active().foreground() : palette().active().mid()) ;
+                    p.setPen(subDateColor) ;
                     QString txt = QString(d->calendar->weekDayName(ref.date(), true)[0]);
                     QRect br    = p.fontMetrics().boundingRect(0, 0, width(), height(), 0, txt); 
                     p.drawText(barRect.left() + ((barRect.width()-br.width())/2),
@@ -895,7 +919,7 @@
                     QFont fnt = p.font();
                     fnt.setPointSize(fnt.pointSize()-4);
                     p.setFont(fnt);
-                    p.setPen(val ? palette().active().foreground() : palette().active().mid()) ;
+                    p.setPen(subDateColor) ;
                     QString txt = QString::number(week);
                     QRect br    = p.fontMetrics().boundingRect(0, 0, width(), height(), 0, txt); 
                     p.drawText(barRect.left() + ((barRect.width()-br.width())/2),
@@ -927,7 +951,7 @@
                     QFont fnt = p.font();
                     fnt.setPointSize(fnt.pointSize()-4);
                     p.setFont(fnt);
-                    p.setPen(val ? palette().active().foreground() : palette().active().mid()) ;
+                    p.setPen(subDateColor) ;
                     QString txt = QString(d->calendar->monthName(ref.date(), true)[0]);
                     QRect br    = p.fontMetrics().boundingRect(0, 0, width(), height(), 0, txt); 
                     p.drawText(barRect.left() + ((barRect.width()-br.width())/2),
@@ -985,7 +1009,7 @@
         p.drawRect(focusRect);
 
         focusRect.addCoords(-1,-1, 1, 1);
-        p.setPen(palette().active().background());
+        p.setPen(ThemeEngine::instance()->thumbSelColor());
         p.drawRect(focusRect);
         p.drawLine(p1.x()-1, p1.y(), p2.x()+1, p2.y());
 
@@ -1685,4 +1709,10 @@
     return dt;
 }
 
+void TimeLineWidget::slotThemeChanged()
+{
+    updatePixmap();
+    update();
+}
+
 }  // NameSpace Digikam
--- branches/extragear/kde3/graphics/digikam/digikam/timelinewidget.h #782703:782704
@@ -109,6 +109,10 @@
     void slotForward();
     void slotResetSelection();
 
+private slots:
+
+    void slotThemeChanged();
+
 private:
 
     QDateTime     prevDateTime(const QDateTime& dt);
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic