diff --git a/kdecoration/breezedecoration.cpp b/kdecoration/breezedecoration.cpp index 17e1479d..51b815fc 100644 --- a/kdecoration/breezedecoration.cpp +++ b/kdecoration/breezedecoration.cpp @@ -66,6 +66,7 @@ namespace Breeze static int g_sDecoCount = 0; static int g_shadowSize = 0; static int g_shadowStrength = 0; + static QColor g_shadowColor = Qt::black; static QSharedPointer g_sShadow; //________________________________________________________________ @@ -587,11 +588,17 @@ namespace Breeze { // assign global shadow if exists and parameters match - if( !( g_sShadow && g_shadowSize == m_internalSettings->shadowSize() && g_shadowStrength == m_internalSettings->shadowStrength() ) ) + if( + !g_sShadow || + g_shadowSize != m_internalSettings->shadowSize() || + g_shadowStrength != m_internalSettings->shadowStrength() || + g_shadowColor != m_internalSettings->shadowColor() + ) { // assign parameters g_shadowSize = m_internalSettings->shadowSize(); g_shadowStrength = m_internalSettings->shadowStrength(); + g_shadowColor = m_internalSettings->shadowColor(); const int shadowOffset = qMax( 6*g_shadowSize/16, Metrics::Shadow_Overlap*2 ); // create image @@ -609,17 +616,14 @@ namespace Breeze return color; }; - auto c = client().data(); - const QColor shadowColor( c->palette().color( QPalette::Shadow ) ); - - QRadialGradient radialGradient( g_shadowSize, g_shadowSize, g_shadowSize); + QRadialGradient radialGradient( g_shadowSize, g_shadowSize, g_shadowSize ); for( int i = 0; i < 10; ++i ) { const qreal x( qreal( i )/9 ); - radialGradient.setColorAt(x, gradientStopColor(shadowColor, alpha(x)*g_shadowStrength)); + radialGradient.setColorAt(x, gradientStopColor( g_shadowColor, alpha(x)*g_shadowStrength ) ); } - radialGradient.setColorAt(1, gradientStopColor( shadowColor, 0 ) ); + radialGradient.setColorAt(1, gradientStopColor( g_shadowColor, 0 ) ); // fill QPainter painter(&image); @@ -628,7 +632,7 @@ namespace Breeze // contrast pixel painter.setBrush( Qt::NoBrush ); - painter.setPen( gradientStopColor(shadowColor, g_shadowStrength) ); + painter.setPen( gradientStopColor( g_shadowColor, g_shadowStrength ) ); painter.setRenderHints(QPainter::Antialiasing ); painter.drawRoundedRect( QRect( g_shadowSize-shadowOffset, g_shadowSize-shadowOffset, shadowOffset, shadowOffset ), 3, 3 ); painter.end(); diff --git a/kdecoration/breezesettingsdata.kcfg b/kdecoration/breezesettingsdata.kcfg index 477a2804..a808ffdb 100644 --- a/kdecoration/breezesettingsdata.kcfg +++ b/kdecoration/breezesettingsdata.kcfg @@ -19,6 +19,10 @@ 64 + + 0, 0, 0 + + true diff --git a/kdecoration/config/breezeconfigwidget.cpp b/kdecoration/config/breezeconfigwidget.cpp index fbb57492..4b45151f 100644 --- a/kdecoration/config/breezeconfigwidget.cpp +++ b/kdecoration/config/breezeconfigwidget.cpp @@ -59,6 +59,7 @@ namespace Breeze // track shadows changes connect( m_ui.shadowSize, SIGNAL(valueChanged(int)), SLOT(updateChanged()) ); connect( m_ui.shadowStrength, SIGNAL(valueChanged(int)), SLOT(updateChanged()) ); + connect( m_ui.shadowColor, SIGNAL(changed(QColor)), SLOT(updateChanged()) ); // track exception changes connect( m_ui.exceptions, SIGNAL(changed(bool)), SLOT(updateChanged()) ); @@ -85,6 +86,7 @@ namespace Breeze // load shadows m_ui.shadowSize->setValue( m_internalSettings->shadowSize() ); m_ui.shadowStrength->setValue( qRound(qreal(m_internalSettings->shadowStrength()*100)/255 ) ); + m_ui.shadowColor->setColor( m_internalSettings->shadowColor() ); // load exceptions ExceptionList exceptions; @@ -113,6 +115,7 @@ namespace Breeze m_internalSettings->setShadowSize( m_ui.shadowSize->value() ); m_internalSettings->setShadowStrength( qRound( qreal(m_ui.shadowStrength->value()*255)/100 ) ); + m_internalSettings->setShadowColor( m_ui.shadowColor->color() ); // save configuration m_internalSettings->save(); @@ -160,6 +163,7 @@ namespace Breeze m_ui.shadowSize->setValue( m_internalSettings->shadowSize() ); m_ui.shadowStrength->setValue( qRound(qreal(m_internalSettings->shadowStrength()*100)/255 ) ); + m_ui.shadowColor->setColor( m_internalSettings->shadowColor() ); } @@ -186,6 +190,7 @@ namespace Breeze // shadows else if( m_ui.shadowSize->value() != m_internalSettings->shadowSize() ) modified = true; else if( qRound( qreal(m_ui.shadowStrength->value()*255)/100 ) != m_internalSettings->shadowStrength() ) modified = true; + else if( m_ui.shadowColor->color() != m_internalSettings->shadowColor() ) modified = true; // exceptions else if( m_ui.exceptions->isChanged() ) modified = true; diff --git a/kdecoration/config/ui/breezeconfigurationui.ui b/kdecoration/config/ui/breezeconfigurationui.ui index b2572b9b..cea60ea6 100644 --- a/kdecoration/config/ui/breezeconfigurationui.ui +++ b/kdecoration/config/ui/breezeconfigurationui.ui @@ -11,7 +11,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -225,33 +234,7 @@ Shadows - - - - - % - - - 10 - - - 100 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - + @@ -291,7 +274,46 @@ - + + + + % + + + 10 + + + 100 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Color: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Vertical @@ -328,6 +350,11 @@ + + KColorButton + QPushButton +
kcolorbutton.h
+
Breeze::ExceptionListWidget QWidget