[vlc-commits] Qt4: slightly improve the color set of the slider

Ludovic Fauvet git at videolan.org
Wed Dec 14 18:59:51 CET 2011


vlc | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Dec 14 18:32:07 2011 +0100| [f3158ac08740071390a3bb8ca718ea4ac1a6aa11] | committer: Jean-Baptiste Kempf

Qt4: slightly improve the color set of the slider

Thanks a lot to François Cartegnie, for the help to resolve the issue

Close #5604

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f3158ac08740071390a3bb8ca718ea4ac1a6aa11
---

 modules/gui/qt4/util/input_slider.cpp |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/util/input_slider.cpp b/modules/gui/qt4/util/input_slider.cpp
index 6ef722a..1798268 100644
--- a/modules/gui/qt4/util/input_slider.cpp
+++ b/modules/gui/qt4/util/input_slider.cpp
@@ -397,10 +397,10 @@ void SeekSlider::paintEvent( QPaintEvent *event )
     barRect.moveCenter( rect().center() );
 
     // set the background color and gradient
-    QColor backgroundBase( 135, 135, 135 );
+    QColor backgroundBase( palette().window().color() );
     QLinearGradient backgroundGradient( 0, 0, 0, height() );
-    backgroundGradient.setColorAt( 0.0, backgroundBase );
-    backgroundGradient.setColorAt( 1.0, backgroundBase.lighter( 150 ) );
+    backgroundGradient.setColorAt( 0.0, backgroundBase.darker( 140 ) );
+    backgroundGradient.setColorAt( 1.0, backgroundBase );
 
     // set the foreground color and gradient
     QColor foregroundBase( 50, 156, 255 );
@@ -501,12 +501,15 @@ void SeekSlider::paintEvent( QPaintEvent *event )
 
             // prepare the handle's gradient
             QLinearGradient handleGradient( 0, 0, 0, hSize.height() );
-            handleGradient.setColorAt( 0.0, p.midlight().color() );
-            handleGradient.setColorAt( 0.9, p.mid().color() );
+            handleGradient.setColorAt( 0.0, p.window().color().lighter( 120 ) );
+            handleGradient.setColorAt( 0.9, p.window().color().darker( 120 ) );
 
             // prepare the handle's shadow gradient
-            QColor shadowDark( p.shadow().color().darker( 150 ) );
-            QColor shadowLight( p.shadow().color().lighter( 180 ) );
+            QColor shadowBase = p.shadow().color();
+            if( shadowBase.lightness() > 100 )
+                shadowBase = QColor( 60, 60, 60 ); // Palette's shadow is too bright
+            QColor shadowDark( shadowBase.darker( 150 ) );
+            QColor shadowLight( shadowBase.lighter( 180 ) );
             shadowLight.setAlpha( 50 );
 
             QRadialGradient shadowGradient( shadowPos.x() + ( sSize.width() / 2 ),



More information about the vlc-commits mailing list