From cf2fb230a23332a608d248fb0987eb331bc89021 Mon Sep 17 00:00:00 2001 From: Vesa Date: Wed, 15 Jan 2014 20:08:33 +0200 Subject: [PATCH] Stylesheet changes, added palette customizability, fx mixer obeys palette, etc... --- data/themes/default/style.css | 56 ++++++++++++++++++----------- data/themes/default/toolbar_bg.png | Bin 130 -> 160 bytes src/gui/FxMixerView.cpp | 42 ++++++++++++++++------ src/gui/lmms_style.cpp | 45 +++++++++++++++-------- src/gui/widgets/EffectView.cpp | 10 +++--- src/gui/widgets/group_box.cpp | 2 +- 6 files changed, 103 insertions(+), 52 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 46c0991482..8a811f09fa 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -78,11 +78,11 @@ pianoRoll { background-color: rgb(0, 0, 0); } -trackContainerView QWidget{ +/*TrackContainerView QWidget{ background-color: #5b6571; -} +}*/ -trackContainerView QFrame{ +TrackContainerView QFrame{ background-color: #49515b; } @@ -142,43 +142,44 @@ nameLabel, effectLabel, sf2InstrumentView > QLabel { QWidget#mainToolbar { - background-image: url(resources:main_toolbar_bg.png); + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #98a2a7, stop:1 #5b646f); } QToolBar { - background: url(resources:toolbar_bg.png); + background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #98a2a7, stop:1 #5b646f); } QToolButton, toolButton { padding: 2px 1px 1px 2px; border-radius: 2px; border: 1px solid rgba(0,0,0,64); - background: #c9c9c9; + background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #c9c9c9, stop:0.5 #c0c0c0, stop:1 #747474 ); font-size:10px; color: black; } -QToolButton:hover { - background: qlineargradient(spread:reflect, x1:0.5, y1:0.5, x2:0.5, y2:0, stop:0 rgba(224, 224, 224, 255), stop:1 rgba(201, 201, 201, 255)); +QToolButton:hover, toolButton:hover { + background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.5 #c9c9c9, stop:1 #747474 ); border: 1px solid rgba(0,0,0,255); - color: black; + color: white; } -QToolButton:pressed { - background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #747474, stop:0.5 #c9c9c9, stop:1 #c0c0c0 ); +QToolButton:pressed, ToolButton:pressed { + background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #c9c9c9, stop:0.5 #c0c0c0, stop:1 #747474 ); padding: 3px 1px 0px 2px; border: 1px solid rgba(0,0,0,255); color: white; } -QToolButton:checked { - background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #747474, stop:0.5 #c9c9c9, stop:1 #c0c0c0 ); +QToolButton:checked, ToolButton:checked { + background: qradialgradient(cx:0.3, cy:0.3, radius:0.8, fx:0.3, fy:0.3, stop:0 #e0e0e0, stop:0.8 #c9c9c9, stop:1 #c0c0c0 ); + border-radius: 3px; padding: 3px 1px 0px 2px; - border: 1px solid rgba(0,0,0,64); + border: 1px solid rgba(0,0,0,255); color: black; } -trackContainerView QToolButton { +trackLabelButton { background-color: #5b6571; color: #c9c9c9; font-size: 10px; @@ -187,34 +188,34 @@ trackContainerView QToolButton { border: 1px solid rgba(0,0,0,64); } -trackContainerView QToolButton:hover { +trackLabelButton:hover { background-color: #7b838d; color: white; border: 1px solid black; } -trackContainerView QToolButton:pressed { +trackLabelButton:pressed { background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 ); color: white; border: 1px solid black; font-weight: bold; } -trackContainerView QToolButton:checked { +trackLabelButton:checked { background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 ); color: #c9c9c9; border: 1px solid rgba(0,0,0,64); font-weight: bold; } -trackContainerView QToolButton:checked:hover { +trackLabelButton:checked:hover { background-color: #7b838d; color: white; border: 1px solid black; font-weight: bold; } -trackContainerView QToolButton:checked:pressed { +trackLabelButton:checked:pressed { background: qlineargradient(spread:reflect, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 #49515b, stop:0.5 #5b6571, stop:1 #6b7581 ); color: white; border: 1px solid black; @@ -316,6 +317,21 @@ opl2instrumentView knob { qproperty-outerRadius: 9; qproperty-lineWidth: 2; } + +/* palette information - each colour definition must be on a single line, and the line must begin with "palette:", with no leading whitespace + * colour codes MUST be of the form #RRGGBB */ + +palette:background {color: #5b6571} +palette:windowtext {color: #f0f0f0} +palette:base {color: #808080} +palette:text {color: #e0e0e0} +palette:button {color: #c9c9c9} +palette:shadow {color: #000000} +palette:buttontext {color: #000000} +palette:brighttext {color: #4afd85} +palette:highlight {color: #303030} +palette:highlightedtext {color: #ffffff} + /* Notes: lcd-spinbox colors: (12, 250, 150), (37, 57, 42) diff --git a/data/themes/default/toolbar_bg.png b/data/themes/default/toolbar_bg.png index 78ebb5e0f939db9278db94c09a3726340b7f2393..bbe26abf35b2b2d5a59ca1f8c403f32942179e94 100644 GIT binary patch delta 131 zcmZo-T);R%rG~S>BeIx*fm;}a85w5Hkzin8U@!6Xb!ETD$S=ey+hD*r8z^M&>Eal| zaozWfA=d#10jG;ce}7+j`N_1;J{!3`6&KaSUjOS7p5+v5v}BfHrt}dLzQsv0_jjiF ig`0iEYOgK;HE&u=kH%UZ6R0vyLi_r-HAP_>sVH==1 zS~*QRIH3P>to@(aqvGYer?g!M`%f*g00000NkvXX Hu0mjfjcurrentFxLine() == 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(); } } diff --git a/src/gui/lmms_style.cpp b/src/gui/lmms_style.cpp index 31944ebc13..c3fab2153e 100644 --- a/src/gui/lmms_style.cpp +++ b/src/gui/lmms_style.cpp @@ -3,7 +3,7 @@ * interface * * Copyright (c) 2007-2008 Tobias Doerffel - * + * * 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( 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 ); diff --git a/src/gui/widgets/EffectView.cpp b/src/gui/widgets/EffectView.cpp index 0eb94b20f9..0e42d1194e 100644 --- a/src/gui/widgets/EffectView.cpp +++ b/src/gui/widgets/EffectView.cpp @@ -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() ); diff --git a/src/gui/widgets/group_box.cpp b/src/gui/widgets/group_box.cpp index 8f074bdb36..afb86a630a 100644 --- a/src/gui/widgets/group_box.cpp +++ b/src/gui/widgets/group_box.cpp @@ -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 );