diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 4ac5e1cde..069700904 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -128,10 +128,8 @@ nameLabel, effectLabel, sf2InstrumentView > QLabel, QComboBox { } -QWidget#mainToolbar { - background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #66728c, stop: 1.0 #38404e); -} - +QWidget#mainToolbar, +QWidget#toolbar, QToolBar { background: qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #66728c, stop: 1.0 #38404e); } @@ -145,21 +143,21 @@ QToolButton, toolButton { color: white; } -QToolButton:hover { +QToolButton:hover, toolButton:hover { background: rgba(255,255,255,96); border-radius: 3px; border: 1px solid rgba(0,0,0,255); color: black; } -QToolButton:pressed { +QToolButton:pressed, toolButton:pressed { background: rgba(192,192,192,96); padding: 3px 0px 0px 3px; border-radius: 3px; border: 1px solid rgba(255,255,255,64); } -QToolButton:checked { +QToolButton:checked, toolButton:checked { background: rgba(233,239,255,96); border-radius: 3px; border: 1px solid black; diff --git a/include/classic_style.h b/include/classic_style.h index 80105fd56..4c0da6159 100644 --- a/include/classic_style.h +++ b/include/classic_style.h @@ -26,16 +26,14 @@ #ifndef _CLASSIC_STYLE_H #define _CLASSIC_STYLE_H -#include +#include #include "lmms_style.h" - -template -class ClassicStyle : public BaseStyle, public LmmsStyle +class ClassicStyle : public QProxyStyle, public LmmsStyle { public: - ClassicStyle(); + ClassicStyle( QStyle *style = 0 ); virtual ~ClassicStyle() { } @@ -81,6 +79,4 @@ private: }; -QPair classicStyleSpecializationForBaseStyle( QStyle * baseStyle ); - #endif diff --git a/src/core/main.cpp b/src/core/main.cpp index e267bedf9..77a456ded 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -411,11 +411,9 @@ int main( int argc, char * * argv ) engine::setLmmsStyle( style ); } else { - QPair style = - classicStyleSpecializationForBaseStyle( - QApplication::style() ); - QApplication::setStyle( style.first ); - engine::setLmmsStyle( style.second ); + ClassicStyle * style = new ClassicStyle(); + QApplication::setStyle( style ); + engine::setLmmsStyle( style ); } // END TODO diff --git a/src/gui/automation_editor.cpp b/src/gui/automation_editor.cpp index 5f1f448de..5ffdd9a63 100644 --- a/src/gui/automation_editor.cpp +++ b/src/gui/automation_editor.cpp @@ -133,13 +133,10 @@ automationEditor::automationEditor() : m_toolBar = new QWidget( this ); + m_toolBar->setObjectName( "toolbar" ); m_toolBar->setFixedHeight( 32 ); m_toolBar->move( 0, 0 ); m_toolBar->setAutoFillBackground( true ); - QPalette pal; - pal.setBrush( m_toolBar->backgroundRole(), - embed::getIconPixmap( "toolbar_bg" ) ); - m_toolBar->setPalette( pal ); QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar ); tb_layout->setMargin( 0 ); diff --git a/src/gui/bb_editor.cpp b/src/gui/bb_editor.cpp index 5e6c56db5..397727a05 100644 --- a/src/gui/bb_editor.cpp +++ b/src/gui/bb_editor.cpp @@ -43,13 +43,10 @@ bbEditor::bbEditor( bbTrackContainer * _tc ) : { // create toolbar m_toolBar = new QWidget; + m_toolBar->setObjectName( "toolbar" ); m_toolBar->setFixedHeight( 32 ); m_toolBar->move( 0, 0 ); m_toolBar->setAutoFillBackground( true ); - QPalette pal; - pal.setBrush( m_toolBar->backgroundRole(), - embed::getIconPixmap( "toolbar_bg" ) ); - m_toolBar->setPalette( pal ); static_cast( layout() )->insertWidget( 0, m_toolBar ); QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar ); diff --git a/src/gui/classic_style.cpp b/src/gui/classic_style.cpp index f878cb705..4b946b081 100644 --- a/src/gui/classic_style.cpp +++ b/src/gui/classic_style.cpp @@ -41,9 +41,8 @@ -template -ClassicStyle::ClassicStyle() : - BaseStyle(), +ClassicStyle::ClassicStyle(QStyle *style) : + QProxyStyle(style), LmmsStyle() { QFile file( "resources:style.css" ); @@ -83,18 +82,16 @@ ClassicStyle::ClassicStyle() : -template -QColor ClassicStyle::color( LmmsStyle::ColorRole _role ) const +QColor ClassicStyle::color( LmmsStyle::ColorRole _role ) const { return colors[_role]; } -template -QPalette ClassicStyle::standardPalette() const +QPalette ClassicStyle::standardPalette() const { - QPalette pal = BaseStyle::standardPalette(); + QPalette pal = QProxyStyle::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 ) ); @@ -111,8 +108,7 @@ QPalette ClassicStyle::standardPalette() const -template -void ClassicStyle::drawComplexControl( +void ClassicStyle::drawComplexControl( QStyle::ComplexControl control, const QStyleOptionComplex * option, QPainter *painter, @@ -133,19 +129,17 @@ void ClassicStyle::drawComplexControl( QColor( 192, 192, 192 ) ); so.palette.setColor( QPalette::Text, QColor( 64, 64, 64 ) ); - BaseStyle::drawComplexControl( control, &so, + QProxyStyle::drawComplexControl( control, &so, painter, widget ); return; } } - BaseStyle::drawComplexControl( control, option, painter, widget ); + QProxyStyle::drawComplexControl( control, option, painter, widget ); } - -template -void ClassicStyle::drawPrimitive( +void ClassicStyle::drawPrimitive( QStyle::PrimitiveElement element, const QStyleOption *option, QPainter *painter, @@ -252,14 +246,14 @@ void ClassicStyle::drawPrimitive( } else { - BaseStyle::drawPrimitive( element, option, painter, widget ); + QProxyStyle::drawPrimitive( element, option, painter, widget ); } } -template -int ClassicStyle::pixelMetric( + +int ClassicStyle::pixelMetric( QStyle::PixelMetric _metric, const QStyleOption * _option, const QWidget * _widget ) const @@ -282,14 +276,13 @@ int ClassicStyle::pixelMetric( return 24; default: - return BaseStyle::pixelMetric( + return QProxyStyle::pixelMetric( _metric, _option, _widget ); } } -template -void ClassicStyle::drawFxLine( QPainter * _painter, const QWidget *_fxLine, +void ClassicStyle::drawFxLine( QPainter * _painter, const QWidget *_fxLine, const QString & _name, bool _active, bool _sendToThis ) { int width = _fxLine->rect().width(); @@ -320,8 +313,7 @@ void ClassicStyle::drawFxLine( QPainter * _painter, const QWidget *_f -template -void ClassicStyle::drawTrackContentBackground(QPainter * _painter, +void ClassicStyle::drawTrackContentBackground(QPainter * _painter, const QSize & _size, const int _pixelsPerTact) { const int w = _size.width(); @@ -362,8 +354,7 @@ void ClassicStyle::drawTrackContentBackground(QPainter * _painter, -template -void ClassicStyle::drawTrackContentObject( QPainter * _painter, +void ClassicStyle::drawTrackContentObject( QPainter * _painter, const trackContentObject * _model, const LmmsStyleOptionTCO * _option ) { QRectF rc = _option->rect.adjusted( 0, 2, 0, -2 ); @@ -626,47 +617,3 @@ void ClassicStyle::drawTrackContentObject( QPainter * _painter, _painter->setRenderHint( QPainter::Antialiasing, true ); } - - - -#include -#ifdef LMMS_BUILD_LINUX -#include -#include -#endif -#ifdef LMMS_BUILD_APPLE -#include -#endif -#ifdef LMMS_BUILD_WIN32 -#include -#include -#endif - - -QPair classicStyleSpecializationForBaseStyle( QStyle * baseStyle ) -{ -#define CHECK_AND_INSTANTIATE_STYLE(s) \ - if( qobject_cast( baseStyle ) ) \ - { \ - ClassicStyle * style = new ClassicStyle; \ - return qMakePair( style, style );\ - } - -#ifdef LMMS_BUILD_LINUX - CHECK_AND_INSTANTIATE_STYLE(QCleanlooksStyle); - CHECK_AND_INSTANTIATE_STYLE(QGtkStyle); -#endif -#ifdef LMMS_BUILD_APPLE - CHECK_AND_INSTANTIATE_STYLE(QMacStyle); -#endif -#ifdef LMMS_BUILD_WIN32 - CHECK_AND_INSTANTIATE_STYLE(QWindowsXPStyle); - CHECK_AND_INSTANTIATE_STYLE(QWindowsVistaStyle); -#endif - - typedef QPlastiqueStyle DefaultBaseStyle; - ClassicStyle * style = new ClassicStyle; - return qMakePair( style, style ); -} - - diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 11d3b9ef3..44c602fd2 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -254,13 +254,10 @@ pianoRoll::pianoRoll() : m_toolBar = new QWidget( this ); + m_toolBar->setObjectName( "toolbar" ); m_toolBar->setFixedHeight( 32 ); m_toolBar->move( 0, 0 ); m_toolBar->setAutoFillBackground( true ); - QPalette pal; - pal.setBrush( m_toolBar->backgroundRole(), - embed::getIconPixmap( "toolbar_bg" ) ); - m_toolBar->setPalette( pal ); QHBoxLayout * tb_layout = new QHBoxLayout( m_toolBar ); tb_layout->setMargin( 0 ); diff --git a/src/gui/song_editor.cpp b/src/gui/song_editor.cpp index 697b2b8af..3ef02eed8 100644 --- a/src/gui/song_editor.cpp +++ b/src/gui/song_editor.cpp @@ -98,12 +98,9 @@ songEditor::songEditor( song * _song, songEditor * & _engine_ptr ) : // create own toolbar m_toolBar = new QWidget( this ); + m_toolBar->setObjectName( "toolbar" ); m_toolBar->setFixedHeight( 32 ); m_toolBar->setAutoFillBackground( true ); - QPalette pal; - pal.setBrush( m_toolBar->backgroundRole(), - embed::getIconPixmap( "toolbar_bg" ) ); - m_toolBar->setPalette( pal ); static_cast( layout() )->insertWidget( 0, m_toolBar ); static_cast( layout() )->insertWidget( 1, m_timeLine );