Commit 0725ddb4 authored by Hugo Pereira Da Costa's avatar Hugo Pereira Da Costa
Browse files

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 5183226d
......@@ -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>
......
......@@ -7773,6 +7773,9 @@ namespace Oxygen
// reset helper configuration
helper().reloadConfig();
// background gradient
helper().setUseBackgroundGradient( StyleConfigData::useBackgroundGradient() );
// background pixmap
helper().setBackgroundPixmap( StyleConfigData::backgroundPixmap() );
......
......@@ -37,7 +37,8 @@ namespace Oxygen
{
//______________________________________________________________________________
StyleHelper::StyleHelper( void )
StyleHelper::StyleHelper( void ):
_useBackgroundGradient( true )
{
#if HAVE_X11
......@@ -101,6 +102,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 )
{
......
......@@ -62,17 +62,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 )
......@@ -211,6 +214,9 @@ namespace Oxygen
private:
//! background grandient
bool _useBackgroundGradient;
Cache<QPixmap> _dialSlabCache;
Cache<QPixmap> _roundSlabCache;
Cache<QPixmap> _sliderSlabCache;
......
......@@ -71,7 +71,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()) );
......@@ -106,7 +105,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() );
......@@ -130,7 +128,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() );
......@@ -231,7 +228,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;
......
......@@ -42,7 +42,6 @@ namespace Oxygen
// store checkboxes from ui into list
_checkBoxes.insert( FrameBorder, frameBorderCheckBox );
_checkBoxes.insert( BlendColor, blendColorCheckBox );
_checkBoxes.insert( SizeGripMode, sizeGripCheckBox );
_checkBoxes.insert( TitleOutline, titleOutlineCheckBox );
_checkBoxes.insert( DrawSeparator, separatorCheckBox );
......@@ -54,7 +53,6 @@ namespace Oxygen
connect( exceptionType, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( exceptionEditor, SIGNAL(textChanged(QString)), SLOT(updateChanged()) );
connect( frameBorderComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( blendColorComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( sizeGripComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( titleOutlineComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
connect( separatorComboBox, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) );
......@@ -76,7 +74,6 @@ namespace Oxygen
exceptionType->setCurrentIndex(_exception->exceptionType() );
exceptionEditor->setText( _exception->exceptionPattern() );
frameBorderComboBox->setCurrentIndex( _exception->frameBorder() );
blendColorComboBox->setCurrentIndex( _exception->blendStyle() );
sizeGripComboBox->setCurrentIndex( _exception->drawSizeGrip() );
separatorComboBox->setCurrentIndex( _exception->separatorMode() );
titleOutlineComboBox->setCurrentIndex( _exception->drawTitleOutline() );
......@@ -96,7 +93,6 @@ namespace Oxygen
_exception->setExceptionType( exceptionType->currentIndex() );
_exception->setExceptionPattern( exceptionEditor->text() );
_exception->setFrameBorder( frameBorderComboBox->currentIndex() );
_exception->setBlendStyle( blendColorComboBox->currentIndex() );
_exception->setDrawSizeGrip( sizeGripComboBox->currentIndex() );
_exception->setSeparatorMode( separatorComboBox->currentIndex() );
_exception->setDrawTitleOutline( titleOutlineComboBox->currentIndex() );
......@@ -120,7 +116,6 @@ namespace Oxygen
if( _exception->exceptionType() != exceptionType->currentIndex() ) modified = true;
else if( _exception->exceptionPattern() != exceptionEditor->text() ) modified = true;
else if( _exception->frameBorder() != frameBorderComboBox->currentIndex() ) modified = true;
else if( _exception->blendStyle() != blendColorComboBox->currentIndex() ) modified = true;
else if( _exception->drawSizeGrip() != sizeGripComboBox->currentIndex() ) modified = true;
else if( _exception->separatorMode() != separatorComboBox->currentIndex() ) modified = true;
else if( _exception->drawTitleOutline() != titleOutlineComboBox->currentIndex() ) modified = true;
......
......@@ -17,16 +17,7 @@
</sizepolicy>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item>
......@@ -223,16 +214,7 @@
<string>Fine Tuning</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>4</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="rightMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>4</number>
</property>
<item row="6" column="0" colspan="3">
......@@ -274,51 +256,6 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Bac&amp;kground 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">
<widget class="QCheckBox" name="titleOutline">
<property name="text">
......@@ -360,6 +297,19 @@
</property>
</widget>
</item>
<item row="1" 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>
</layout>
</widget>
<widget class="QWidget" name="tab_3">
......@@ -469,7 +419,6 @@
<tabstop>buttonSize</tabstop>
<tabstop>animationsEnabled</tabstop>
<tabstop>_expertModeButton</tabstop>
<tabstop>blendColor</tabstop>
<tabstop>separatorMode</tabstop>
<tabstop>titleOutline</tabstop>
<tabstop>narrowButtonSpacing</tabstop>
......
......@@ -83,6 +83,45 @@
<string>Decoration Options</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="3" column="2">
<widget class="KComboBox" name="titleOutlineComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string comment="outline window title">Disabled</string>
</property>
</item>
<item>
<property name="text">
<string comment="outline window title">Enabled</string>
</property>
</item>
</widget>
</item>
<item row="4" column="2">
<widget class="KComboBox" name="separatorComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Never Draw Separator</string>
</property>
</item>
<item>
<property name="text">
<string>Draw Separator When Window is Active</string>
</property>
</item>
<item>
<property name="text">
<string>Always Draw Separator</string>
</property>
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QCheckBox" name="frameBorderCheckBox">
<property name="text">
......@@ -90,42 +129,35 @@
</property>
</widget>
</item>
<item row="3" column="0">
<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="4" column="0">
<item row="3" 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>
......@@ -188,28 +220,6 @@
</widget>
</item>
<item row="2" column="2">
<widget class="KComboBox" name="blendColorComboBox">
<property name="enabled">
<bool>false</bool>
</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">
<widget class="KComboBox" name="sizeGripComboBox">
<property name="enabled">
<bool>false</bool>
......@@ -226,45 +236,6 @@
</item>
</widget>
</item>
<item row="4" column="2">
<widget class="KComboBox" name="titleOutlineComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string comment="outline window title">Disabled</string>
</property>
</item>
<item>
<property name="text">
<string comment="outline window title">Enabled</string>
</property>
</item>
</widget>
</item>
<item row="5" column="2">
<widget class="KComboBox" name="separatorComboBox">
<property name="enabled">
<bool>false</bool>
</property>
<item>
<property name="text">
<string>Never Draw Separator</string>
</property>
</item>
<item>
<property name="text">
<string>Draw Separator When Window is Active</string>
</property>
</item>
<item>
<property name="text">
<string>Always Draw Separator</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
</item>
......@@ -342,22 +313,6 @@
</hint>
</hints>
</connection>
<connection>
<sender>blendColorCheckBox</sender>
<signal>toggled(bool)</signal>
<receiver>blendColorComboBox</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>136</x>
<y>188</y>
</hint>
<hint type="destinationlabel">
<x>333</x>
<y>189</y>
</hint>
</hints>
</connection>
<connection>
<sender>sizeGripCheckBox</sender>
<signal>toggled(bool)</signal>
......
......@@ -609,17 +609,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
......@@ -629,6 +621,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