From e24384e7325175335c2ad26359583dc5dcf984cf Mon Sep 17 00:00:00 2001 From: Umcaruje Date: Sun, 7 Feb 2016 01:35:07 +0100 Subject: [PATCH] Make FxLine Stroke Themeable --- data/themes/default/style.css | 4 +++ include/FxLine.h | 21 ++++++++++++++ src/gui/widgets/FxLine.cpp | 53 +++++++++++++++++++++++++++++++---- 3 files changed, 73 insertions(+), 5 deletions(-) diff --git a/data/themes/default/style.css b/data/themes/default/style.css index 23ea03af9..77a990a5d 100644 --- a/data/themes/default/style.css +++ b/data/themes/default/style.css @@ -492,6 +492,10 @@ FxLine { color: #e0e0e0; qproperty-backgroundActive: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:0, stop:0 #7b838d, stop:1 #6b7581 ); + qproperty-strokeOuterActive: rgb( 0, 0, 0 ); + qproperty-strokeOuterInactive: rgba( 0, 0, 0, 50 ); + qproperty-strokeInnerActive: rgba( 255, 255, 255, 100 ); + qproperty-strokeInnerInactive: rgba( 255, 255, 255, 50 ); } /* persistent peak markers for fx peak meters */ diff --git a/include/FxLine.h b/include/FxLine.h index 69f6a9ed0..6081912d4 100644 --- a/include/FxLine.h +++ b/include/FxLine.h @@ -41,6 +41,10 @@ class FxLine : public QWidget Q_OBJECT public: Q_PROPERTY( QBrush backgroundActive READ backgroundActive WRITE setBackgroundActive ) + Q_PROPERTY( QColor strokeOuterActive READ strokeOuterActive WRITE setStrokeOuterActive ) + Q_PROPERTY( QColor strokeOuterInactive READ strokeOuterInactive WRITE setStrokeOuterInactive ) + Q_PROPERTY( QColor strokeInnerActive READ strokeInnerActive WRITE setStrokeInnerActive ) + Q_PROPERTY( QColor strokeInnerInactive READ strokeInnerInactive WRITE setStrokeInnerInactive ) FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex); ~FxLine(); @@ -57,6 +61,19 @@ public: QBrush backgroundActive() const; void setBackgroundActive( const QBrush & c ); + + QColor strokeOuterActive() const; + void setStrokeOuterActive( const QColor & c ); + + QColor strokeOuterInactive() const; + void setStrokeOuterInactive( const QColor & c ); + + QColor strokeInnerActive() const; + void setStrokeInnerActive( const QColor & c ); + + QColor strokeInnerInactive() const; + void setStrokeInnerInactive( const QColor & c ); + static const int FxLineHeight; @@ -67,6 +84,10 @@ private: LcdWidget* m_lcd; int m_channelIndex; QBrush m_backgroundActive; + QColor m_strokeOuterActive; + QColor m_strokeOuterInactive; + QColor m_strokeInnerActive; + QColor m_strokeInnerInactive; static QPixmap * s_sendBgArrow; static QPixmap * s_receiveBgArrow; diff --git a/src/gui/widgets/FxLine.cpp b/src/gui/widgets/FxLine.cpp index ea3282a01..620f6d626 100644 --- a/src/gui/widgets/FxLine.cpp +++ b/src/gui/widgets/FxLine.cpp @@ -48,7 +48,11 @@ FxLine::FxLine( QWidget * _parent, FxMixerView * _mv, int _channelIndex) : QWidget( _parent ), m_mv( _mv ), m_channelIndex( _channelIndex ), - m_backgroundActive( Qt::SolidPattern ) + m_backgroundActive( Qt::SolidPattern ), + m_strokeOuterActive( 0, 0, 0 ), + m_strokeOuterInactive( 0, 0, 0 ), + m_strokeInnerActive( 0, 0, 0 ), + m_strokeInnerInactive( 0, 0, 0 ) { if( ! s_sendBgArrow ) { @@ -126,11 +130,13 @@ void FxLine::drawFxLine( QPainter* p, const FxLine *fxLine, const QString& name, p->fillRect( fxLine->rect(), isActive ? fxLine->backgroundActive() : p->background() ); - - p->setPen( QColor( 255, 255, 255, isActive ? 100 : 50 ) ); + + // inner border + p->setPen( isActive ? fxLine->strokeInnerActive() : fxLine->strokeInnerInactive() ); p->drawRect( 1, 1, width-3, height-3 ); - - p->setPen( isActive ? sh_color : QColor( 0, 0, 0, 50 ) ); + + // outer border + p->setPen( isActive ? fxLine->strokeOuterActive() : fxLine->strokeOuterInactive() ); p->drawRect( 0, 0, width-1, height-1 ); // draw the mixer send background @@ -276,5 +282,42 @@ void FxLine::setBackgroundActive( const QBrush & c ) m_backgroundActive = c; } +QColor FxLine::strokeOuterActive() const +{ + return m_strokeOuterActive; +} +void FxLine::setStrokeOuterActive( const QColor & c ) +{ + m_strokeOuterActive = c; +} +QColor FxLine::strokeOuterInactive() const +{ + return m_strokeOuterInactive; +} + +void FxLine::setStrokeOuterInactive( const QColor & c ) +{ + m_strokeOuterInactive = c; +} + +QColor FxLine::strokeInnerActive() const +{ + return m_strokeInnerActive; +} + +void FxLine::setStrokeInnerActive( const QColor & c ) +{ + m_strokeInnerActive = c; +} + +QColor FxLine::strokeInnerInactive() const +{ + return m_strokeInnerInactive; +} + +void FxLine::setStrokeInnerInactive( const QColor & c ) +{ + m_strokeInnerInactive = c; +}