Stylesheet changes, added palette customizability, fx mixer obeys palette, etc...

This commit is contained in:
Vesa
2014-01-15 20:08:33 +02:00
parent 1b8e2b003b
commit cf2fb230a2
6 changed files with 103 additions and 52 deletions

View File

@@ -42,6 +42,7 @@
#include "gui_templates.h"
#include "tooltip.h"
#include "pixmap_button.h"
#include "lmms_style.h"
@@ -61,19 +62,36 @@ public:
virtual void paintEvent( QPaintEvent * )
{
QPainter p( this );
p.fillRect( rect(), QColor( 72, 76, 88 ) );
p.setPen( QColor( 40, 42, 48 ) );
QColor bg_color = QApplication::palette().color( QPalette::Active,
QPalette::Background );
QColor sh_color = QApplication::palette().color( QPalette::Active,
QPalette::Shadow );
QColor te_color = QApplication::palette().color( QPalette::Active,
QPalette::Text );
QColor bt_color = QApplication::palette().color( QPalette::Active,
QPalette::BrightText );
p.fillRect( rect(),
m_mv->currentFxLine() == this ? bg_color.lighter(130) : bg_color );
p.setPen( bg_color.darker(130) );
p.drawRect( 0, 0, width()-2, height()-2 );
p.setPen( QColor( 108, 114, 132 ) );
p.setPen( bg_color.lighter(150) );
p.drawRect( 1, 1, width()-2, height()-2 );
p.setPen( QColor( 20, 24, 32 ) );
p.setPen( m_mv->currentFxLine() == this ? sh_color : bg_color.darker(130) );
p.drawRect( 0, 0, width()-1, height()-1 );
p.rotate( -90 );
p.setPen( m_mv->currentFxLine() == this ?
QColor( 0, 255, 0 ) : Qt::white );
p.setFont( pointSizeF( font(), 7.5f ) );
p.setPen( sh_color );
p.drawText( -91, 21, m_name );
p.setPen( m_mv->currentFxLine() == this ? bt_color : te_color );
p.drawText( -90, 20, m_name );
}
virtual void mousePressEvent( QMouseEvent * )
@@ -114,9 +132,11 @@ FxMixerView::FxMixerView() :
FxMixer * m = engine::fxMixer();
m->setHook( this );
QPalette pal = palette();
/* QPalette pal = palette();
pal.setColor( QPalette::Background, QColor( 72, 76, 88 ) );
setPalette( pal );
setPalette( pal );*/
setAutoFillBackground( true );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Minimum );
@@ -231,7 +251,7 @@ FxMixerView::FxMixerView() :
// add ourself to workspace
QMdiSubWindow * subWin =
QMdiSubWindow * subWin =
engine::mainWindow()->workspace()->addSubWindow( this );
Qt::WindowFlags flags = subWin->windowFlags();
flags |= Qt::MSWindowsFixedSizeDialogHint;
@@ -292,7 +312,7 @@ void FxMixerView::setCurrentFxLine( int _line )
if ( _line >= 0 && _line < NumFxChannels+1 )
{
setCurrentFxLine( m_fxChannelViews[_line].m_fxLine );
m_bankButtons->button( (_line-1) / 16 )->click();
}
}

View File

@@ -3,7 +3,7 @@
* interface
*
* Copyright (c) 2007-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
* This program is free software; you can redistribute it and/or
@@ -33,9 +33,8 @@
#include "lmms_style.h"
lmmsStyle::lmmsStyle() :
QPlastiqueStyle()
lmmsStyle::lmmsStyle() :
QPlastiqueStyle()
{
QFile file( "resources:style.css" );
file.open( QIODevice::ReadOnly );
@@ -50,7 +49,7 @@ lmmsStyle::lmmsStyle() :
QPalette lmmsStyle::standardPalette( void ) const
{
QPalette pal = QPlastiqueStyle::standardPalette();
pal.setColor( QPalette::Background, QColor( 91, 101, 113 ) );
/* pal.setColor( QPalette::Background, QColor( 91, 101, 113 ) );
pal.setColor( QPalette::WindowText, QColor( 240, 240, 240 ) );
pal.setColor( QPalette::Base, QColor( 128, 128, 128 ) );
pal.setColor( QPalette::Text, QColor( 224, 224, 224 ) );
@@ -59,7 +58,23 @@ QPalette lmmsStyle::standardPalette( void ) const
pal.setColor( QPalette::ButtonText, QColor( 0, 0, 0 ) );
pal.setColor( QPalette::BrightText, QColor( 74, 253, 133 ) );
pal.setColor( QPalette::Highlight, QColor( 100, 100, 100 ) );
pal.setColor( QPalette::HighlightedText, QColor( 255, 255, 255 ) );
pal.setColor( QPalette::HighlightedText, QColor( 255, 255, 255 ) );*/
QStringList paletteData = qApp->styleSheet().split( '\n' ).filter( QRegExp( "^palette:*" ) );
foreach( QString s, paletteData )
{
if (s.contains("background")) { pal.setColor( QPalette::Background, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("windowtext")) { pal.setColor( QPalette::WindowText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("base")) { pal.setColor( QPalette::Base, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("buttontext")) { pal.setColor( QPalette::ButtonText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("brighttext")) { pal.setColor( QPalette::BrightText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("text")) { pal.setColor( QPalette::Text, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("button")) { pal.setColor( QPalette::Button, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("shadow")) { pal.setColor( QPalette::Shadow, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("highlightedtext")) { pal.setColor( QPalette::HighlightedText, QColor( s.mid( s.indexOf("#"), 7 ) ) ); }
else if (s.contains("highlight")) { pal.setColor( QPalette::Highlight, QColor( s.mid( s.indexOf("#"), 7 ) ) ); };
}
return( pal );
}
@@ -97,8 +112,8 @@ void lmmsStyle::drawComplexControl( ComplexControl control,
void lmmsStyle::drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
void lmmsStyle::drawPrimitive( PrimitiveElement element,
const QStyleOption *option, QPainter *painter,
const QWidget *widget) const
{
if( element == QStyle::PE_Frame ||
@@ -109,7 +124,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
QColor black = QColor( 0, 0, 0 );
QColor shadow = option->palette.shadow().color();
QColor highlight = option->palette.highlight().color();
QColor highlight = option->palette.highligt().color();
int a100 = 165;
int a75 = static_cast<int>( a100 * .75 );
@@ -152,7 +167,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
lines[1] = QLine(rect.left(), rect.top() + 2,
rect.left(), rect.bottom() - 2);
painter->drawLines(lines, 2);
// outside corner dots - shadow
// 75%
shadow.setAlpha(a50);
@@ -160,7 +175,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[0] = QPoint(rect.left() + 1, rect.top() + 1);
points[1] = QPoint(rect.right() - 1, rect.top() + 1);
painter->drawPoints(points, 2);
// outside end dots - shadow
// 50%
shadow.setAlpha(a25);
@@ -170,7 +185,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[2] = QPoint(rect.right() - 1, rect.top());
points[3] = QPoint(rect.left(), rect.bottom() - 1);
painter->drawPoints(points, 4);
// outside lines - highlight
// 100%
@@ -181,7 +196,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
lines[1] = QLine(rect.right(), rect.top() + 2,
rect.right(), rect.bottom() - 2);
painter->drawLines(lines, 2);
// outside corner dots - highlight
// 75%
highlight.setAlpha(a50);
@@ -189,7 +204,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[0] = QPoint(rect.left() + 1, rect.bottom() - 1);
points[1] = QPoint(rect.right() - 1, rect.bottom() - 1);
painter->drawPoints(points, 2);
// outside end dots - highlight
// 50%
highlight.setAlpha(a25);
@@ -200,7 +215,7 @@ void lmmsStyle::drawPrimitive( PrimitiveElement element,
points[3] = QPoint(rect.right(), rect.top() + 1);
painter->drawPoints(points, 4);
}
else
else
{
QPlastiqueStyle::drawPrimitive( element, option, painter,
widget );

View File

@@ -70,7 +70,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_autoQuit->setLabel( tr( "DECAY" ) );
m_autoQuit->move( 60, 5 );
m_autoQuit->setHintText( tr( "Time:" ) + " ", "ms" );
m_autoQuit->setWhatsThis( tr(
m_autoQuit->setWhatsThis( tr(
"The Decay knob controls how many buffers of silence must pass before the "
"plugin stops processing. Smaller values will reduce the CPU overhead but "
"run the risk of clipping the tail on delay and reverb effects." ) );
@@ -80,7 +80,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
m_gate->setLabel( tr( "GATE" ) );
m_gate->move( 93, 5 );
m_gate->setHintText( tr( "Gate:" ) + " ", "" );
m_gate->setWhatsThis( tr(
m_gate->setWhatsThis( tr(
"The Gate knob controls the signal level that is considered to be 'silence' "
"while deciding when to stop processing signals." ) );
@@ -94,7 +94,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
QFont f = ctls_btn->font();
ctls_btn->setFont( pointSize<7>( f ) );
ctls_btn->setGeometry( 140, 14, 50, 20 );
connect( ctls_btn, SIGNAL( clicked() ),
connect( ctls_btn, SIGNAL( clicked() ),
this, SLOT( editControls() ) );
m_controlView = effect()->controls()->createView();
@@ -115,7 +115,7 @@ EffectView::EffectView( Effect * _model, QWidget * _parent ) :
}
setWhatsThis( tr(
setWhatsThis( tr(
"Effect plugins function as a chained series of effects where the signal will "
"be processed from top to bottom.\n\n"
@@ -264,7 +264,7 @@ void EffectView::paintEvent( QPaintEvent * )
f.setBold( true );
p.setFont( f );
p.setPen( QColor( 64, 64, 64 ) );
p.setPen( palette().shadow().color() );
p.drawText( 6, 55, model()->displayName() );
p.setPen( palette().text().color() );
p.drawText( 5, 54, model()->displayName() );

View File

@@ -127,7 +127,7 @@ void groupBox::updatePixmap()
//p.setPen( QColor( 255, 255, 255 ) );
p.setPen( palette().color( QPalette::Active, QPalette::ButtonText ) );
p.setPen( palette().color( QPalette::Active, QPalette::Text ) );
p.setFont( pointSize<7>( font() ) );
p.drawText( 22, 10, m_caption );