Commit 3df4f129 authored by Hugo Pereira Da Costa's avatar Hugo Pereira Da Costa
Browse files

Removed background blend style option.

Background gradient is now always decided based on window flag.
CCBUG: 273423

Added option in oxygenrc to disable window background:

[Common]
UseBackgroundGradient=true

Option is hidden (no UI element) because of string freeze
Also removed decoration blend style option.
Background gradient is now always decided based on window flag.
CCBUG: 273423
parent b333e1d1
......@@ -6,7 +6,12 @@
<kcfgfile name="oxygenrc"/>
<group name="Common">
<!-- background opacity -->
<!-- background gradient -->
<entry name="UseBackgroundGradient" type = "Bool" >
<default>true</default>
</entry>
<!-- background pixmap -->
<entry name="BackgroundPixmap" type = "String" >
<default></default>
</entry>
......
......@@ -7992,6 +7992,9 @@ namespace Oxygen
// reset helper configuration
helper().reloadConfig();
// background gradient
helper().setUseBackgroundGradient( StyleConfigData::useBackgroundGradient() );
// background pixmap
helper().setBackgroundPixmap( StyleConfigData::backgroundPixmap() );
......
......@@ -39,7 +39,8 @@ namespace Oxygen
//______________________________________________________________________________
StyleHelper::StyleHelper( const QByteArray &componentName ):
Helper( componentName ),
_debugArea( KDebug::registerArea( "Oxygen ( style )" ) )
_debugArea( KDebug::registerArea( "Oxygen ( style )" ) ),
_useBackgroundGradient( true )
{
#ifdef Q_WS_X11
......@@ -108,6 +109,37 @@ namespace Oxygen
}
//____________________________________________________________________
void StyleHelper::renderWindowBackground( QPainter* p, const QRect& clipRect, const QWidget* widget, const QColor& color, int y_shift, int gradientHeight)
{
if( _useBackgroundGradient )
{
// normal background gradient
Helper::renderWindowBackground( p, clipRect, widget, widget->window(), color, y_shift, gradientHeight );
} else {
// if background gradient is disabled, simply render flat background
if ( clipRect.isValid() )
{ p->setClipRegion( clipRect,Qt::IntersectClip ); }
p->fillRect( widget->rect(), color );
}
// background pixmap
Helper::renderBackgroundPixmap( p, clipRect, widget, widget->window(), y_shift, gradientHeight );
}
//____________________________________________________________________
void StyleHelper::setHasBackgroundGradient( WId id, bool value ) const
{
if( _useBackgroundGradient )
{ Helper::setHasBackgroundGradient( id, value ); }
}
//____________________________________________________________________
void StyleHelper::renderMenuBackground( QPainter* p, const QRect& clipRect, const QWidget* widget, const QColor& color )
{
......
......@@ -68,17 +68,20 @@ namespace Oxygen
//! update maximum cache size
virtual void setMaxCacheSize( int );
//! background gradient
virtual void setUseBackgroundGradient( bool value )
{ _useBackgroundGradient = value; }
//! render window background using a given color as a reference
/*!
For the widget style, both the gradient and the background pixmap are rendered in the same method.
All the actual rendering is performed by the base class
*/
using Helper::renderWindowBackground;
virtual void renderWindowBackground( QPainter* p, const QRect& clipRect, const QWidget* widget, const QColor& color, int y_shift=-23, int gradientHeight = 20 )
{
Helper::renderWindowBackground( p, clipRect, widget, widget->window(), color, y_shift, gradientHeight );
Helper::renderBackgroundPixmap( p, clipRect, widget, widget->window(), y_shift, gradientHeight );
}
virtual void renderWindowBackground( QPainter*, const QRect&, const QWidget*, const QColor&, int y_shift=-23, int gradientHeight = 20 );
//! set background gradient hint to widget
virtual void setHasBackgroundGradient( WId, bool ) const;
// render menu background
void renderMenuBackground( QPainter* p, const QRect& clipRect, const QWidget* widget, const QPalette& pal )
......@@ -220,6 +223,9 @@ namespace Oxygen
//! dynamically allocated debug area
int _debugArea;
//! background grandient
bool _useBackgroundGradient;
Cache<QPixmap> _dialSlabCache;
Cache<QPixmap> _roundSlabCache;
Cache<QPixmap> _sliderSlabCache;
......
......@@ -70,7 +70,6 @@ namespace Oxygen
connect( ui.titleAlignment, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.buttonSize, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.frameBorder, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.blendColor, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.titleOutline, SIGNAL(clicked()), SLOT(updateChanged()) );
connect( ui.drawSizeGrip, SIGNAL(clicked()), SLOT(updateChanged()) );
......@@ -104,7 +103,6 @@ namespace Oxygen
if( !_configuration ) return;
ui.titleAlignment->setCurrentIndex( _configuration->titleAlignment() );
ui.buttonSize->setCurrentIndex( _configuration->buttonSize() );
ui.blendColor->setCurrentIndex( _configuration->blendStyle() );
ui.frameBorder->setCurrentIndex( _configuration->frameBorder() );
ui.separatorMode->setCurrentIndex( _configuration->separatorMode() );
ui.drawSizeGrip->setChecked( _configuration->drawSizeGrip() );
......@@ -127,7 +125,6 @@ namespace Oxygen
// apply modifications from ui
_configuration->setTitleAlignment( ui.titleAlignment->currentIndex() );
_configuration->setButtonSize( ui.buttonSize->currentIndex() );
_configuration->setBlendStyle( ui.blendColor->currentIndex() );
_configuration->setFrameBorder( ui.frameBorder->currentIndex() );
_configuration->setSeparatorMode( ui.separatorMode->currentIndex() );
_configuration->setDrawSizeGrip( ui.drawSizeGrip->isChecked() );
......@@ -228,7 +225,6 @@ namespace Oxygen
if( ui.titleAlignment->currentIndex() != _configuration->titleAlignment() ) modified = true;
else if( ui.buttonSize->currentIndex() != _configuration->buttonSize() ) modified = true;
else if( ui.blendColor->currentIndex() != _configuration->blendStyle() ) modified = true;
else if( ui.frameBorder->currentIndex() != _configuration->frameBorder() ) modified = true;
else if( ui.separatorMode->currentIndex() != _configuration->separatorMode() ) modified = true;
else if( ui.drawSizeGrip->isChecked() != _configuration->drawSizeGrip() ) modified = true;
......
......@@ -45,7 +45,6 @@ namespace Oxygen
// store checkboxes from ui into list
_checkBoxes.insert( FrameBorder, ui.frameBorderCheckBox );
_checkBoxes.insert( BlendColor, ui.blendColorCheckBox );
_checkBoxes.insert( SizeGripMode, ui.sizeGripCheckBox );
_checkBoxes.insert( TitleOutline, ui.titleOutlineCheckBox );
_checkBoxes.insert( DrawSeparator, ui.separatorCheckBox );
......@@ -57,7 +56,6 @@ namespace Oxygen
connect( ui.exceptionType, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.exceptionEditor, SIGNAL(textChanged(QString)), SLOT(updateChanged()) );
connect( ui.frameBorderComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.blendColorComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.sizeGripComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.titleOutlineComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( ui.separatorComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
......@@ -79,7 +77,6 @@ namespace Oxygen
ui.exceptionType->setCurrentIndex(_exception->exceptionType() );
ui.exceptionEditor->setText( _exception->exceptionPattern() );
ui.frameBorderComboBox->setCurrentIndex( _exception->frameBorder() );
ui.blendColorComboBox->setCurrentIndex( _exception->blendStyle() );
ui.sizeGripComboBox->setCurrentIndex( _exception->drawSizeGrip() );
ui.separatorComboBox->setCurrentIndex( _exception->separatorMode() );
ui.titleOutlineComboBox->setCurrentIndex( _exception->drawTitleOutline() );
......@@ -99,7 +96,6 @@ namespace Oxygen
_exception->setExceptionType( ui.exceptionType->currentIndex() );
_exception->setExceptionPattern( ui.exceptionEditor->text() );
_exception->setFrameBorder( ui.frameBorderComboBox->currentIndex() );
_exception->setBlendStyle( ui.blendColorComboBox->currentIndex() );
_exception->setDrawSizeGrip( ui.sizeGripComboBox->currentIndex() );
_exception->setSeparatorMode( ui.separatorComboBox->currentIndex() );
_exception->setDrawTitleOutline( ui.titleOutlineComboBox->currentIndex() );
......@@ -123,7 +119,6 @@ namespace Oxygen
if( _exception->exceptionType() != ui.exceptionType->currentIndex() ) modified = true;
else if( _exception->exceptionPattern() != ui.exceptionEditor->text() ) modified = true;
else if( _exception->frameBorder() != ui.frameBorderComboBox->currentIndex() ) modified = true;
else if( _exception->blendStyle() != ui.blendColorComboBox->currentIndex() ) modified = true;
else if( _exception->drawSizeGrip() != ui.sizeGripComboBox->currentIndex() ) modified = true;
else if( _exception->separatorMode() != ui.separatorComboBox->currentIndex() ) modified = true;
else if( _exception->drawTitleOutline() != ui.titleOutlineComboBox->currentIndex() ) modified = true;
......
......@@ -132,19 +132,6 @@
</item>
</widget>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
......@@ -207,6 +194,19 @@
</property>
</widget>
</item>
<item row="0" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
......@@ -217,7 +217,20 @@
<property name="margin">
<number>4</number>
</property>
<item row="1" column="1">
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="separatorMode">
<item>
<property name="text">
......@@ -236,7 +249,7 @@
</item>
</widget>
</item>
<item row="1" column="0">
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Separator display:</string>
......@@ -249,80 +262,35 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Background style: </string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>blendColor</cstring>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="KComboBox" name="blendColor">
<item>
<property name="text">
<string>Solid Color</string>
</property>
</item>
<item>
<property name="text">
<string>Radial Gradient</string>
</property>
</item>
<item>
<property name="text">
<string>Follow Style Hint</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="3">
<item row="2" column="0" colspan="3">
<widget class="QCheckBox" name="titleOutline">
<property name="text">
<string>Outline active window title</string>
</property>
</widget>
</item>
<item row="8" column="0" colspan="3">
<item row="7" column="0" colspan="3">
<widget class="QCheckBox" name="narrowButtonSpacing">
<property name="text">
<string>Use narrow space between decoration buttons</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="drawSizeGrip">
<property name="text">
<string>Add handle to resize windows with no border</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<item row="5" column="0" colspan="3">
<widget class="QCheckBox" name="closeFromMenuButton">
<property name="text">
<string>Close windows by double clicking the menu button</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="3">
<item row="8" column="0" colspan="3">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
......@@ -450,7 +418,6 @@
<tabstop>buttonSize</tabstop>
<tabstop>animationsEnabled</tabstop>
<tabstop>_expertModeButton</tabstop>
<tabstop>blendColor</tabstop>
<tabstop>separatorMode</tabstop>
<tabstop>titleOutline</tabstop>
<tabstop>narrowButtonSpacing</tabstop>
......
......@@ -80,49 +80,28 @@
<string>Decoration Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="frameBorderCheckBox">
<property name="text">
<string>Border size:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="sizeGripCheckBox">
<property name="text">
<string>Add handle to resize windows with no border</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="titleOutlineCheckBox">
<property name="text">
<string>Outline active window title:</string>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="4" column="0">
<widget class="QCheckBox" name="separatorCheckBox">
<property name="text">
<string>Separator display:</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="blendColorCheckBox">
<property name="text">
<string>Background style:</string>
</property>
</widget>
</item>
<item row="7" column="0" colspan="3">
<item row="6" column="0" colspan="3">
<widget class="QCheckBox" name="hideTitleBar">
<property name="text">
<string>Hide window title bar</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="3">
<item row="5" column="0" colspan="3">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::HLine</enum>
......@@ -184,29 +163,21 @@
</item>
</widget>
</item>
<item row="2" column="2">
<widget class="KComboBox" name="blendColorComboBox">
<property name="enabled">
<bool>false</bool>
<item row="0" column="0">
<widget class="QCheckBox" name="frameBorderCheckBox">
<property name="text">
<string>Border size:</string>
</property>
<item>
<property name="text">
<string>Solid Color</string>
</property>
</item>
<item>
<property name="text">
<string>Radial Gradient</string>
</property>
</item>
<item>
<property name="text">
<string>Follow Style Hint</string>
</property>
</item>
</widget>
</item>
<item row="3" column="2">
<item row="2" column="0">
<widget class="QCheckBox" name="sizeGripCheckBox">
<property name="text">
<string>Add handle to resize windows with no border</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="KComboBox" name="sizeGripComboBox">
<property name="enabled">
<bool>false</bool>
......@@ -223,7 +194,7 @@
</item>
</widget>
</item>
<item row="4" column="2">
<item row="3" column="2">
<widget class="KComboBox" name="titleOutlineComboBox">
<property name="enabled">
<bool>false</bool>
......@@ -240,7 +211,7 @@
</item>
</widget>
</item>
<item row="5" column="2">
<item row="4" column="2">
<widget class="KComboBox" name="separatorComboBox">
<property name="enabled">
<bool>false</bool>
......@@ -285,8 +256,6 @@
<tabstop>detectDialogButton</tabstop>
<tabstop>frameBorderCheckBox</tabstop>
<tabstop>frameBorderComboBox</tabstop>
<tabstop>blendColorCheckBox</tabstop>
<tabstop>blendColorComboBox</tabstop>
<tabstop>sizeGripCheckBox</tabstop>
<tabstop>sizeGripComboBox</tabstop>
<tabstop>titleOutlineCheckBox</tabstop>
......@@ -313,22 +282,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>blendColorCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>blendColorComboBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>99</x>
<y>217</y>
</hint>
<hint type="destinationlabel">
<x>315</x>
<y>217</y>
</hint>
</hints>
</connection>
<connection>
<sender>sizeGripCheckBox</sender>
<signal>toggled(bool)</signal>
......
......@@ -607,17 +607,9 @@ namespace Oxygen
{
// window background
if(
_configuration->blendStyle() == Configuration::BlendNone ||
( _configuration->blendStyle() == Configuration::BlendFromStyle &&
!helper().hasBackgroundGradient( windowId() )
) )
if( helper().hasBackgroundGradient( windowId() ) )
{
painter->fillRect( rect, palette.color( QPalette::Window ) );
} else {
int offset = layoutMetric( LM_OuterPaddingTop );
// radial gradient positionning
......@@ -627,6 +619,10 @@ namespace Oxygen
const QWidget* window( isPreview() ? this->widget() : widget->window() );
helper().renderWindowBackground(painter, rect, widget, window, palette, offset, height );
} else {
painter->fillRect( rect, palette.color( QPalette::Window ) );
}
// background pixmap
......
......@@ -50,15 +50,6 @@
<default>BorderTiny</default>
</entry>
<entry name="BlendStyle" type = "Enum">
<choices>
<choice name="BlendNone" />
<choice name="BlendRadial" />
<choice name="BlendFromStyle" />
</choices>
<default>BlendFromStyle</default>
</entry>
<entry name="drawSizeGrip" type = "Bool">
<default>true</default>
</entry>
......
......@@ -75,7 +75,6 @@ namespace Oxygen
DrawSeparator = 1<<2,
TitleOutline = 1<<3,
FrameBorder = 1<<4,
BlendColor = 1<<5,
SizeGripMode = 1<<6
};
......
......@@ -60,7 +60,6 @@ namespace Oxygen
// propagate all features found in mask to the output configuration
if( exception.mask() & FrameBorder ) configuration->setFrameBorder( exception.frameBorder() );
if( exception.mask() & BlendColor ) configuration->setBlendStyle( exception.blendStyle() );
if( exception.mask() & DrawSeparator ) configuration->setSeparatorMode( exception.separatorMode() );
if( exception.mask() & TitleOutline ) configuration->setDrawTitleOutline( exception.drawTitleOutline() );
if( exception.mask() & SizeGripMode ) configuration->setDrawSizeGrip( exception.drawSizeGrip() );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment