From 838eb5bbfe16a2c4ef0ea166c0582b5e86cbe1fd Mon Sep 17 00:00:00 2001 From: Salva Ardid Date: Sat, 1 Dec 2018 01:43:43 -0500 Subject: [PATCH] V0.3.1: fixed borders opacity and better description of shadows setting on inactive windows --- CMakeLists.txt | 2 +- ChangeLog | 14 ++++++--- breezebutton.cpp | 7 ++++- breezedecoration.cpp | 41 +++++++++++++------------ breezedecoration.h | 1 - breezesettingsdata.kcfg | 16 +++++----- config/breezeconfigwidget.cpp | 15 ++++++---- config/ui/breezeconfigurationui.ui | 48 +++++++++++++++++++++++++++--- 8 files changed, 99 insertions(+), 45 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index af2c170..5503c9a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ project(sierrabreezeenhanced) -set(PROJECT_VERSION "0.3") +set(PROJECT_VERSION "0.3.1") set(PROJECT_VERSION_MAJOR 0) cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) diff --git a/ChangeLog b/ChangeLog index 45d370e..5cea6a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,16 @@ +V0.3.1 +--------- + +* Fixed borders opacity. +* Better description of shadows setting on inactive windows: "Small shadows on inactive windows". + V0.3 --------- -* added option to display small shadows for inactive windows as a way to make the active window more salient wrt others (issue #4). -* ported Match Title Bar Color from Sierra Breeze. It matches the "BackgroundNormal" color under "Windows" section of the color scheme. Title Bar Text Color is manipulated to guarantee visibility (issue #5). -* ported Font Weight Combobox from Breeze Enhanced. -* other minor fixes and code clean-up. +* Added option to display small shadows for inactive windows as a way to make the active window more salient wrt others (issue #4). +* Ported Match Title Bar Color from Sierra Breeze. It matches the "BackgroundNormal" color under "Windows" section of the color scheme. Title Bar Text Color is manipulated to guarantee visibility (issue #5). +* Ported Font Weight Combobox from Breeze Enhanced. +* Other minor fixes and code clean-up. V0.2 --------- diff --git a/breezebutton.cpp b/breezebutton.cpp index 81b9f31..5b61ecd 100644 --- a/breezebutton.cpp +++ b/breezebutton.cpp @@ -158,6 +158,11 @@ namespace Breeze painter->setRenderHints( QPainter::Antialiasing ); + /* + scale painter so that its window matches QRect( -1, -1, 20, 20 ) + this makes all further rendering and scaling simpler + all further rendering is preformed inside QRect( 0, 0, 18, 18 ) + */ painter->translate( geometry().topLeft() ); const qreal width( m_iconSize.width() ); @@ -345,7 +350,7 @@ namespace Breeze painter->setPen( Qt::NoPen ); } qreal r = static_cast(7) - + static_cast(2) * m_animation->currentValue().toReal(); + + static_cast(2) * m_animation->currentValue().toReal(); QPointF c(static_cast(9), static_cast(9)); painter->drawEllipse( c, r, r ); if ( isHovered() || isChecked() || ( inactiveWindow && !useActiveButtonStyle ) || useInactiveButtonStyle ) diff --git a/breezedecoration.cpp b/breezedecoration.cpp index 8823e84..c66c6df 100644 --- a/breezedecoration.cpp +++ b/breezedecoration.cpp @@ -154,7 +154,7 @@ namespace Breeze static int g_shadowStrength = 255; static QColor g_shadowColor = Qt::black; static QSharedPointer g_sShadow; - static bool g_shadowInactiveEnabled = true; + static bool g_smallShadowsInactiveWindows = false; //________________________________________________________________ Decoration::Decoration(QObject *parent, const QVariantList &args) @@ -340,7 +340,7 @@ namespace Breeze CompositeShadowParams params = lookupShadowParams(Breeze::InternalSettings::ShadowSmall); auto c = client().data(); - if ( g_shadowInactiveEnabled || c->isActive() ) + if ( !g_smallShadowsInactiveWindows || c->isActive() ) params = lookupShadowParams(g_shadowSizeEnum); if ( params.isNone() ) { @@ -484,8 +484,6 @@ namespace Breeze // size grip if( hasNoBorders() && m_internalSettings->drawSizeGrip() ) createSizeGrip(); else deleteSizeGrip(); - - m_opacityValue = m_internalSettings->backgroundOpacity() * 2.55; } //________________________________________________________________ @@ -633,13 +631,21 @@ namespace Breeze painter->save(); painter->setRenderHint(QPainter::Antialiasing); painter->setPen(Qt::NoPen); + painter->setBrush( c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::Frame ) ); - if (m_windowColor.rgb() != titleBarColor.rgb() ) { - m_windowColor = titleBarColor; - m_windowColor.setAlpha( m_opacityValue ); - } + if ( matchColorForTitleBar() || !opaqueTitleBar() ) { + + if ( m_windowColor.rgb() != titleBarColor.rgb() ) + m_windowColor = titleBarColor; - painter->setBrush( m_windowColor ); + if ( !opaqueTitleBar() ) { + int a = m_internalSettings->opacityOverride() > -1 ? m_internalSettings->opacityOverride() : m_internalSettings->backgroundOpacity(); + a = qBound(0, a, 100); + m_windowColor.setAlpha( qRound(static_cast(a) * (qreal)2.55) ); + } + + painter->setBrush( m_windowColor ); + } // clip away the top part if( !hideTitleBar() ) painter->setClipRect(0, borderTop(), size().width(), size().height() - borderTop(), Qt::IntersectClip); @@ -683,7 +689,7 @@ namespace Breeze // render a linear gradient on title area and draw a light border at the top if( m_internalSettings->drawBackgroundGradient() ) { - if( !opaqueTitleBar() ) { + if ( !opaqueTitleBar() ) { int a = m_internalSettings->opacityOverride() > -1 ? m_internalSettings->opacityOverride() : m_internalSettings->backgroundOpacity(); a = qBound(0, a, 100); titleBarColor.setAlpha( qRound(static_cast(a) * (qreal)2.55) ); @@ -700,20 +706,13 @@ namespace Breeze } else { - if( !opaqueTitleBar() ) { + if ( !opaqueTitleBar() ) { int a = m_internalSettings->opacityOverride() > -1 ? m_internalSettings->opacityOverride() : m_internalSettings->backgroundOpacity(); a = qBound(0, a, 100); titleBarColor.setAlpha( qRound(static_cast(a) * (qreal)2.55) ); } - QLinearGradient gradient( 0, 0, 0, titleRect.height() ); - QColor lightCol( titleBarColor.lighter( 130 ) ); - gradient.setColorAt(0.0, lightCol ); - gradient.setColorAt(0.99 / static_cast(titleRect.height()), lightCol ); - gradient.setColorAt(1.0 / static_cast(titleRect.height()), titleBarColor ); - gradient.setColorAt(1.0, titleBarColor); - - painter->setBrush( gradient ); + painter->setBrush( titleBarColor ); } @@ -852,12 +851,12 @@ namespace Breeze || g_shadowSizeEnum != m_internalSettings->shadowSize() || g_shadowStrength != m_internalSettings->shadowStrength() || g_shadowColor != m_internalSettings->shadowColor() - || g_shadowInactiveEnabled != m_internalSettings->shadowInactive() ) + || g_smallShadowsInactiveWindows != m_internalSettings->smallShadowsInactiveWindows() ) { g_shadowSizeEnum = m_internalSettings->shadowSize(); g_shadowStrength = m_internalSettings->shadowStrength(); g_shadowColor = m_internalSettings->shadowColor(); - g_shadowInactiveEnabled = m_internalSettings->shadowInactive(); + g_smallShadowsInactiveWindows = m_internalSettings->smallShadowsInactiveWindows(); } updateShadow(); diff --git a/breezedecoration.h b/breezedecoration.h index dd45230..721e122 100644 --- a/breezedecoration.h +++ b/breezedecoration.h @@ -153,7 +153,6 @@ namespace Breeze //* active state change opacity qreal m_opacity = 0; - int m_opacityValue = 0; QColor m_windowColor; }; diff --git a/breezesettingsdata.kcfg b/breezesettingsdata.kcfg index facab48..7bbed26 100644 --- a/breezesettingsdata.kcfg +++ b/breezesettingsdata.kcfg @@ -28,8 +28,8 @@ 35, 38, 41 - - true + + false @@ -107,10 +107,6 @@ ActiveVsInactiveStyle - - 100 - - false @@ -128,7 +124,7 @@ - + false @@ -148,7 +144,11 @@ - false + true + + + + 100 diff --git a/config/breezeconfigwidget.cpp b/config/breezeconfigwidget.cpp index 3634a03..73e29f7 100644 --- a/config/breezeconfigwidget.cpp +++ b/config/breezeconfigwidget.cpp @@ -51,6 +51,7 @@ namespace Breeze connect( m_ui.btnSpacingSpinBox, QOverload::of(&QSpinBox::valueChanged), [=](int /*i*/){updateChanged();} ); connect( m_ui.drawBorderOnMaximizedWindows, SIGNAL(clicked()), SLOT(updateChanged()) ); connect( m_ui.drawSizeGrip, SIGNAL(clicked()), SLOT(updateChanged()) ); + connect( m_ui.opaqueTitleBar, SIGNAL(clicked()), SLOT(updateChanged()) ); connect( m_ui.drawBackgroundGradient, SIGNAL(clicked()), SLOT(updateChanged()) ); connect( m_ui.buttonStyle, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); connect( m_ui.opacitySpinBox, QOverload::of(&QSpinBox::valueChanged), [=](int /*i*/){updateChanged();} ); @@ -71,7 +72,7 @@ namespace Breeze connect( m_ui.shadowSize, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); connect( m_ui.shadowStrength, SIGNAL(valueChanged(int)), SLOT(updateChanged()) ); connect( m_ui.shadowColor, SIGNAL(changed(QColor)), SLOT(updateChanged()) ); - connect( m_ui.shadowInactive, SIGNAL(clicked()), SLOT(updateChanged()) ); + connect( m_ui.smallShadowsInactiveWindows, SIGNAL(clicked()), SLOT(updateChanged()) ); // track exception changes connect( m_ui.exceptions, SIGNAL(changed(bool)), SLOT(updateChanged()) ); @@ -92,6 +93,7 @@ namespace Breeze m_ui.btnSpacingSpinBox->setValue( m_internalSettings->buttonSpacing() ); m_ui.drawBorderOnMaximizedWindows->setChecked( m_internalSettings->drawBorderOnMaximizedWindows() ); m_ui.drawSizeGrip->setChecked( m_internalSettings->drawSizeGrip() ); + m_ui.opaqueTitleBar->setChecked( m_internalSettings->opaqueTitleBar() ); m_ui.drawBackgroundGradient->setChecked( m_internalSettings->drawBackgroundGradient() ); m_ui.animationsEnabled->setChecked( m_internalSettings->animationsEnabled() ); m_ui.animationsDuration->setValue( m_internalSettings->animationsDuration() ); @@ -136,7 +138,7 @@ namespace Breeze m_ui.shadowStrength->setValue( qRound(qreal(m_internalSettings->shadowStrength()*100)/255 ) ); m_ui.shadowColor->setColor( m_internalSettings->shadowColor() ); - m_ui.shadowInactive->setChecked( m_internalSettings->shadowInactive() ); + m_ui.smallShadowsInactiveWindows->setChecked( m_internalSettings->smallShadowsInactiveWindows() ); // load exceptions ExceptionList exceptions; @@ -160,6 +162,7 @@ namespace Breeze m_internalSettings->setButtonSpacing( m_ui.btnSpacingSpinBox->value() ); m_internalSettings->setDrawBorderOnMaximizedWindows( m_ui.drawBorderOnMaximizedWindows->isChecked() ); m_internalSettings->setDrawSizeGrip( m_ui.drawSizeGrip->isChecked() ); + m_internalSettings->setOpaqueTitleBar( m_ui.opaqueTitleBar->isChecked() ); m_internalSettings->setDrawBackgroundGradient( m_ui.drawBackgroundGradient->isChecked() ); m_internalSettings->setAnimationsEnabled( m_ui.animationsEnabled->isChecked() ); m_internalSettings->setAnimationsDuration( m_ui.animationsDuration->value() ); @@ -198,7 +201,7 @@ namespace Breeze m_internalSettings->setShadowSize( m_ui.shadowSize->currentIndex() ); m_internalSettings->setShadowStrength( qRound( qreal(m_ui.shadowStrength->value()*255)/100 ) ); m_internalSettings->setShadowColor( m_ui.shadowColor->color() ); - m_internalSettings->setShadowInactive( m_ui.shadowInactive->isChecked() ); + m_internalSettings->setSmallShadowsInactiveWindows( m_ui.smallShadowsInactiveWindows->isChecked() ); // save configuration m_internalSettings->save(); @@ -239,6 +242,7 @@ namespace Breeze m_ui.btnSpacingSpinBox->setValue( m_internalSettings->buttonSpacing() ); m_ui.drawBorderOnMaximizedWindows->setChecked( m_internalSettings->drawBorderOnMaximizedWindows() ); m_ui.drawSizeGrip->setChecked( m_internalSettings->drawSizeGrip() ); + m_ui.opaqueTitleBar->setChecked( m_internalSettings->opaqueTitleBar() ); m_ui.drawBackgroundGradient->setChecked( m_internalSettings->drawBackgroundGradient() ); m_ui.drawTitleBarSeparator->setChecked( m_internalSettings->drawTitleBarSeparator() ); m_ui.matchColorForTitleBar->setChecked( m_internalSettings->matchColorForTitleBar() ); @@ -278,7 +282,7 @@ namespace Breeze m_ui.shadowSize->setCurrentIndex( m_internalSettings->shadowSize() ); m_ui.shadowStrength->setValue( qRound(qreal(m_internalSettings->shadowStrength()*100)/255 ) ); m_ui.shadowColor->setColor( m_internalSettings->shadowColor() ); - m_ui.shadowInactive->setChecked( m_internalSettings->shadowInactive() ); + m_ui.smallShadowsInactiveWindows->setChecked( m_internalSettings->smallShadowsInactiveWindows() ); } @@ -298,6 +302,7 @@ namespace Breeze else if( m_ui.btnSpacingSpinBox->value() != m_internalSettings->buttonSpacing() ) modified = true; else if( m_ui.drawBorderOnMaximizedWindows->isChecked() != m_internalSettings->drawBorderOnMaximizedWindows() ) modified = true; else if( m_ui.drawSizeGrip->isChecked() != m_internalSettings->drawSizeGrip() ) modified = true; + else if( m_ui.opaqueTitleBar->isChecked() != m_internalSettings->opaqueTitleBar() ) modified = true; else if( m_ui.drawBackgroundGradient->isChecked() != m_internalSettings->drawBackgroundGradient() ) modified = true; else if( m_ui.buttonStyle->currentIndex() != m_internalSettings->buttonStyle() ) modified = true; else if( m_ui.opacitySpinBox->value() != m_internalSettings->backgroundOpacity() ) modified = true; @@ -318,7 +323,7 @@ namespace Breeze else if( m_ui.shadowSize->currentIndex() != 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; - else if( m_ui.shadowInactive->isChecked() != m_internalSettings->shadowInactive() ) modified = true; + else if( m_ui.smallShadowsInactiveWindows->isChecked() != m_internalSettings->smallShadowsInactiveWindows() ) modified = true; // exceptions else if( m_ui.exceptions->isChanged() ) modified = true; diff --git a/config/ui/breezeconfigurationui.ui b/config/ui/breezeconfigurationui.ui index 73a55a6..898a5e2 100644 --- a/config/ui/breezeconfigurationui.ui +++ b/config/ui/breezeconfigurationui.ui @@ -257,11 +257,18 @@ + + + Opaque title bar + + + + - Opacity: + Background opacity: @@ -396,7 +403,7 @@ - + Qt::Vertical @@ -580,9 +587,9 @@ - + - Enable shadows on inactive windows + Small shadows on inactive windows @@ -645,6 +652,7 @@ drawBackgroundGradient drawSizeGrip drawTitleBarSeparator + opaqueTitleBar animationsEnabled animationsDuration shadowSize @@ -717,5 +725,37 @@ + + opaqueTitleBar + toggled(bool) + opacitySpinBox + setDisabled(bool) + + + 222 + 160 + + + 166 + 188 + + + + + opaqueTitleBar + toggled(bool) + label_6 + setDisabled(bool) + + + 222 + 160 + + + 64 + 57 + + +