diff --git a/ChangeLog b/ChangeLog index 4a8090ee9..bb712efec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-09-05 Tobias Doerffel + + * include/lmms_style.h: + * src/gui/lmms_style.cpp: + * src/core/main.cpp: + - moved palette initialization into lmmsStyle class + - added a hack for making titlebar text colors in QMdiSubWindows + common on all platforms + 2008-09-04 Tobias Doerffel * plugins/vst_base/vst_plugin.cpp: diff --git a/include/lmms_style.h b/include/lmms_style.h index 736422d8f..3cf0fe7e0 100644 --- a/include/lmms_style.h +++ b/include/lmms_style.h @@ -38,6 +38,13 @@ public: { } + virtual QPalette standardPalette( void ) const; + + virtual void drawComplexControl( + ComplexControl control, + const QStyleOptionComplex * option, + QPainter *painter, + const QWidget *widget ) const; virtual void drawPrimitive( PrimitiveElement element, const QStyleOption *option, QPainter *painter, diff --git a/src/core/main.cpp b/src/core/main.cpp index e6cbcc0de..6aecbc216 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -343,33 +343,9 @@ int main( int argc, char * * argv ) if( render_out.isEmpty() && file_to_save.isEmpty() ) { + // init style and palette QApplication::setStyle( new lmmsStyle() ); - // set palette - QPalette pal = qApp->palette(); - //pal.setColor( QPalette::Background, QColor( 72, 76 ,88 ) ); - pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) ); - //pal.setColor( QPalette::Background, QColor( 127, 134 ,154 ) ); - //pal.setColor( QPalette::Background, QColor( 105, 110, 120 ) ); - //pal.setColor( QPalette::Background, QColor( 89, 99, 128 ) ); - - pal.setColor( QPalette::Foreground, QColor( 240, 240, 240 ) ); - - pal.setColor( QPalette::Base, QColor( 128, 128, 128 ) ); - //pal.setColor( QPalette::Base, QColor( 115, 110 , 94 ) ); - //pal.setColor( QPalette::Base, QColor( 128, 112 , 94 ) ); - - pal.setColor( QPalette::Text, QColor( 224, 224, 224 ) ); - - pal.setColor( QPalette::Button, QColor( 172, 176, 188 ) ); - //pal.setColor( QPalette::Button, QColor( 172, 177, 191 ) ); - - pal.setColor( QPalette::ButtonText, QColor( 255, 255, 255 ) ); - pal.setColor( QPalette::Highlight, QColor( 224, 224, 224 ) ); - pal.setColor( QPalette::HighlightedText, QColor( 0, 0, 0 ) ); - qApp->setPalette( pal ); - - // init splash screen - this is a bit difficult as we have a // semi-transparent splash-image therefore we first need to grab // the screen, paint the splash onto it and then set a mask diff --git a/src/gui/lmms_style.cpp b/src/gui/lmms_style.cpp index 9b86c7893..c73c33a79 100644 --- a/src/gui/lmms_style.cpp +++ b/src/gui/lmms_style.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include "lmms_style.h" @@ -41,6 +40,58 @@ lmmsStyle::lmmsStyle() : QFile file( "resources:style.css" ); file.open( QIODevice::ReadOnly ); qApp->setStyleSheet( file.readAll() ); + + qApp->setPalette( standardPalette() ); +} + + + + +QPalette lmmsStyle::standardPalette( void ) const +{ + QPalette pal = QPlastiqueStyle::standardPalette(); + pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) ); + pal.setColor( QPalette::WindowText, QColor( 240, 240, 240 ) ); + pal.setColor( QPalette::Base, QColor( 128, 128, 128 ) ); + pal.setColor( QPalette::Text, QColor( 224, 224, 224 ) ); + pal.setColor( QPalette::Button, QColor( 172, 176, 188 ) ); + pal.setColor( QPalette::Shadow, QColor( 0, 0, 0 ) ); + pal.setColor( QPalette::ButtonText, QColor( 255, 255, 255 ) ); + pal.setColor( QPalette::BrightText, QColor( 0, 255, 0 ) ); + pal.setColor( QPalette::Highlight, QColor( 224, 224, 224 ) ); + pal.setColor( QPalette::HighlightedText, QColor( 0, 0, 0 ) ); + return( pal ); +} + + + + +void lmmsStyle::drawComplexControl( ComplexControl control, + const QStyleOptionComplex * option, + QPainter *painter, + const QWidget *widget ) const +{ + // fix broken titlebar styling on win32 + if( control == CC_TitleBar ) + { + const QStyleOptionTitleBar * titleBar = + qstyleoption_cast(option ); + if( titleBar ) + { + QStyleOptionTitleBar so( *titleBar ); + so.palette = standardPalette(); + so.palette.setColor( QPalette::HighlightedText, + ( titleBar->titleBarState & State_Active ) ? + QColor( 255, 255, 255 ) : + QColor( 192, 192, 192 ) ); + so.palette.setColor( QPalette::Text, + QColor( 64, 64, 64 ) ); + QPlastiqueStyle::drawComplexControl( control, &so, + painter, widget ); + return; + } + } + QPlastiqueStyle::drawComplexControl( control, option, painter, widget ); }