* moved palette initialization into lmmsStyle class

* added a hack for making titlebar text colors in QMdiSubWindows common on all platforms



git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1550 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-05 20:52:27 +00:00
parent ee662759f0
commit 1dfddf50be
4 changed files with 69 additions and 26 deletions

View File

@@ -1,3 +1,12 @@
2008-09-05 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* 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 <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/vst_base/vst_plugin.cpp:

View File

@@ -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,

View File

@@ -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

View File

@@ -28,7 +28,6 @@
#include <QtGui/QApplication>
#include <QtGui/QFrame>
#include <QtGui/QPainter>
#include <QtGui/QPlastiqueStyle>
#include <QtGui/QStyleOption>
#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<const QStyleOptionTitleBar *>(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 );
}