added support for fully configurable shadows, on agreement with Nuno.
svn path=/trunk/KDE/kdebase/workspace/; revision=1023467icc-effect-5.14.5
parent
400ee1a6c8
commit
f6973ae9dd
|
@ -12,6 +12,7 @@ set(kwin_nitrogen_SRCS
|
|||
nitrogenconfiguration.cpp
|
||||
nitrogenexception.cpp
|
||||
nitrogenexceptionlist.cpp
|
||||
nitrogenshadowconfiguration.cpp
|
||||
nitrogensizegrip.cpp
|
||||
x11util.cpp
|
||||
)
|
||||
|
|
|
@ -5,6 +5,7 @@ set(kwin_nitrogen_config_PART_SRCS
|
|||
config.cpp
|
||||
itemmodel.cpp
|
||||
../nitrogenconfiguration.cpp
|
||||
../nitrogenshadowconfiguration.cpp
|
||||
../nitrogenexception.cpp
|
||||
../nitrogenexceptionlist.cpp
|
||||
nitrogenconfigurationui.cpp
|
||||
|
@ -12,6 +13,7 @@ set(kwin_nitrogen_config_PART_SRCS
|
|||
nitrogenexceptiondialog.cpp
|
||||
nitrogenexceptionlistwidget.cpp
|
||||
nitrogenexceptionmodel.cpp
|
||||
nitrogenshadowconfigurationui.cpp
|
||||
)
|
||||
|
||||
kde4_add_plugin(kwin_nitrogen_config ${kwin_nitrogen_config_PART_SRCS})
|
||||
|
@ -21,7 +23,7 @@ target_link_libraries(
|
|||
${KDE4_KDEUI_LIBS}
|
||||
${QT_QTGUI_LIBRARY}
|
||||
${X11_X11_LIB}
|
||||
kdecorations
|
||||
)
|
||||
|
||||
install(TARGETS kwin_nitrogen_config DESTINATION ${PLUGIN_INSTALL_DIR} )
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "config.moc"
|
||||
|
||||
#include "../nitrogenconfiguration.h"
|
||||
#include "../nitrogenshadowconfiguration.h"
|
||||
|
||||
//_______________________________________________________________________
|
||||
extern "C"
|
||||
|
@ -58,20 +59,11 @@ namespace Nitrogen
|
|||
configuration_ = new KConfig( "nitrogenrc" );
|
||||
KConfigGroup configurationGroup( configuration_, "Windeco");
|
||||
|
||||
user_interface_ = new NitrogenConfigurationUI( parent );
|
||||
connect( user_interface_->titleAlignment, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
connect( user_interface_->buttonSize, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
connect( user_interface_->frameBorder, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
connect( user_interface_->blendColor, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
connect( user_interface_->sizeGripMode, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
|
||||
connect( user_interface_->drawSeparator, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( user_interface_->titleOutline, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( user_interface_->useOxygenShadows, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( user_interface_->exceptions, SIGNAL(changed()), SIGNAL(changed()) );
|
||||
userInterface_ = new NitrogenConfigurationUI( parent );
|
||||
connect( userInterface_, SIGNAL(changed()), SIGNAL( changed() ) );
|
||||
|
||||
load( configurationGroup );
|
||||
user_interface_->show();
|
||||
userInterface_->show();
|
||||
|
||||
}
|
||||
|
||||
|
@ -79,7 +71,7 @@ namespace Nitrogen
|
|||
//_______________________________________________________________________
|
||||
Config::~Config()
|
||||
{
|
||||
delete user_interface_;
|
||||
delete userInterface_;
|
||||
delete configuration_;
|
||||
}
|
||||
|
||||
|
@ -89,8 +81,9 @@ namespace Nitrogen
|
|||
{
|
||||
|
||||
// load standard configuration
|
||||
KConfigGroup configurationGroup( configuration_, "Windeco");
|
||||
loadConfiguration( NitrogenConfiguration( configurationGroup ) );
|
||||
loadConfiguration( NitrogenConfiguration( KConfigGroup( configuration_, "Windeco") ) );
|
||||
loadShadowConfiguration( QPalette::Active, NitrogenShadowConfiguration( QPalette::Active, KConfigGroup( configuration_, "ActiveShadow") ) );
|
||||
loadShadowConfiguration( QPalette::Inactive, NitrogenShadowConfiguration( QPalette::Inactive, KConfigGroup( configuration_, "InactiveShadow") ) );
|
||||
|
||||
// load exceptions
|
||||
NitrogenExceptionList exceptions;
|
||||
|
@ -99,7 +92,7 @@ namespace Nitrogen
|
|||
{ exceptions = NitrogenExceptionList::defaultList(); }
|
||||
|
||||
// install in ui
|
||||
user_interface_->exceptions->setExceptions( exceptions );
|
||||
userInterface_->exceptions->setExceptions( exceptions );
|
||||
|
||||
|
||||
}
|
||||
|
@ -116,30 +109,34 @@ namespace Nitrogen
|
|||
// to the configuration file are *not* translated using current locale
|
||||
configurationGroup.writeEntry(
|
||||
NitrogenConfig::TITLE_ALIGNMENT,
|
||||
NitrogenConfiguration::titleAlignmentName( NitrogenConfiguration::titleAlignment( user_interface_->titleAlignment->currentText(), true ), false ) );
|
||||
NitrogenConfiguration::titleAlignmentName( NitrogenConfiguration::titleAlignment( userInterface_->titleAlignment->currentText(), true ), false ) );
|
||||
|
||||
configurationGroup.writeEntry(
|
||||
NitrogenConfig::BUTTON_SIZE,
|
||||
NitrogenConfiguration::buttonSizeName( NitrogenConfiguration::buttonSize( user_interface_->buttonSize->currentText(), true ), false ) );
|
||||
NitrogenConfiguration::buttonSizeName( NitrogenConfiguration::buttonSize( userInterface_->buttonSize->currentText(), true ), false ) );
|
||||
|
||||
configurationGroup.writeEntry(
|
||||
NitrogenConfig::BLEND_COLOR,
|
||||
NitrogenConfiguration::blendColorName( NitrogenConfiguration::blendColor( user_interface_->blendColor->currentText(), true ), false ) );
|
||||
NitrogenConfiguration::blendColorName( NitrogenConfiguration::blendColor( userInterface_->blendColor->currentText(), true ), false ) );
|
||||
|
||||
configurationGroup.writeEntry(
|
||||
NitrogenConfig::FRAME_BORDER,
|
||||
NitrogenConfiguration::frameBorderName( NitrogenConfiguration::frameBorder( user_interface_->frameBorder->currentText(), true ), false ) );
|
||||
NitrogenConfiguration::frameBorderName( NitrogenConfiguration::frameBorder( userInterface_->frameBorder->currentText(), true ), false ) );
|
||||
|
||||
configurationGroup.writeEntry(
|
||||
NitrogenConfig::SIZE_GRIP_MODE,
|
||||
NitrogenConfiguration::sizeGripModeName( NitrogenConfiguration::sizeGripMode( user_interface_->sizeGripMode->currentText(), true ), false ) );
|
||||
NitrogenConfiguration::sizeGripModeName( NitrogenConfiguration::sizeGripMode( userInterface_->sizeGripMode->currentText(), true ), false ) );
|
||||
|
||||
configurationGroup.writeEntry( NitrogenConfig::DRAW_SEPARATOR, user_interface_->drawSeparator->isChecked() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::DRAW_TITLE_OUTLINE, user_interface_->titleOutline->isChecked() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::USE_OXYGEN_SHADOWS, user_interface_->useOxygenShadows->isChecked() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::DRAW_SEPARATOR, userInterface_->drawSeparator->isChecked() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::DRAW_TITLE_OUTLINE, userInterface_->titleOutline->isChecked() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::USE_OXYGEN_SHADOWS, userInterface_->useOxygenShadows->isChecked() );
|
||||
|
||||
// write exceptions
|
||||
user_interface_->exceptions->exceptions().write( *configuration_ );
|
||||
userInterface_->exceptions->exceptions().write( *configuration_ );
|
||||
|
||||
// write shadow configuration
|
||||
saveShadowConfiguration( QPalette::Active, *userInterface_->shadowConfigurations[0] );
|
||||
saveShadowConfiguration( QPalette::Inactive, *userInterface_->shadowConfigurations[1] );
|
||||
|
||||
// sync configuration
|
||||
configuration_->sync();
|
||||
|
@ -147,6 +144,23 @@ namespace Nitrogen
|
|||
}
|
||||
|
||||
|
||||
//_______________________________________________________________________
|
||||
void Config::saveShadowConfiguration( QPalette::ColorGroup colorGroup, const NitrogenShadowConfigurationUI& ui ) const
|
||||
{
|
||||
|
||||
assert( colorGroup == QPalette::Active || colorGroup == QPalette::Inactive );
|
||||
|
||||
// save shadow configuration
|
||||
KConfigGroup configurationGroup( configuration_, ( (colorGroup == QPalette::Active) ? "ActiveShadow":"InactiveShadow" ) );
|
||||
configurationGroup.writeEntry( NitrogenConfig::SHADOW_SIZE, 0.1*ui.shadowSize->value() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::SHADOW_HOFFSET, 0.1*ui.horizontalOffset->value() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::SHADOW_VOFFSET, 0.1*ui.verticalOffset->value() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::SHADOW_INNER_COLOR, ui.innerColor->color() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::SHADOW_OUTER_COLOR, ui.outerColor->color() );
|
||||
configurationGroup.writeEntry( NitrogenConfig::SHADOW_USE_OUTER_COLOR, ui.useOuterColor->isChecked() );
|
||||
|
||||
}
|
||||
|
||||
//_______________________________________________________________________
|
||||
void Config::defaults()
|
||||
{
|
||||
|
@ -154,8 +168,12 @@ namespace Nitrogen
|
|||
// install default configuration
|
||||
loadConfiguration( NitrogenConfiguration() );
|
||||
|
||||
// load shadows
|
||||
loadShadowConfiguration( QPalette::Active, NitrogenShadowConfiguration( QPalette::Active ) );
|
||||
loadShadowConfiguration( QPalette::Inactive, NitrogenShadowConfiguration( QPalette::Inactive ) );
|
||||
|
||||
// install default exceptions
|
||||
user_interface_->exceptions->setExceptions( NitrogenExceptionList::defaultList() );
|
||||
userInterface_->exceptions->setExceptions( NitrogenExceptionList::defaultList() );
|
||||
|
||||
// emit changed signal
|
||||
emit changed();
|
||||
|
@ -166,18 +184,30 @@ namespace Nitrogen
|
|||
void Config::loadConfiguration( const NitrogenConfiguration& configuration )
|
||||
{
|
||||
|
||||
user_interface_->titleAlignment->setCurrentIndex( user_interface_->titleAlignment->findText( configuration.titleAlignmentName( true ) ) );
|
||||
user_interface_->buttonSize->setCurrentIndex( user_interface_->buttonSize->findText( configuration.buttonSizeName( true ) ) );
|
||||
user_interface_->blendColor->setCurrentIndex( user_interface_->blendColor->findText( configuration.blendColorName( true ) ) );
|
||||
user_interface_->frameBorder->setCurrentIndex( user_interface_->frameBorder->findText( configuration.frameBorderName( true ) ) );
|
||||
user_interface_->sizeGripMode->setCurrentIndex( user_interface_->sizeGripMode->findText( configuration.sizeGripModeName( true ) ) );
|
||||
userInterface_->titleAlignment->setCurrentIndex( userInterface_->titleAlignment->findText( configuration.titleAlignmentName( true ) ) );
|
||||
userInterface_->buttonSize->setCurrentIndex( userInterface_->buttonSize->findText( configuration.buttonSizeName( true ) ) );
|
||||
userInterface_->blendColor->setCurrentIndex( userInterface_->blendColor->findText( configuration.blendColorName( true ) ) );
|
||||
userInterface_->frameBorder->setCurrentIndex( userInterface_->frameBorder->findText( configuration.frameBorderName( true ) ) );
|
||||
userInterface_->sizeGripMode->setCurrentIndex( userInterface_->sizeGripMode->findText( configuration.sizeGripModeName( true ) ) );
|
||||
|
||||
user_interface_->drawSeparator->setChecked( configuration.drawSeparator() );
|
||||
user_interface_->titleOutline->setChecked( configuration.drawTitleOutline() );
|
||||
user_interface_->useOxygenShadows->setChecked( configuration.useOxygenShadows() );
|
||||
userInterface_->drawSeparator->setChecked( configuration.drawSeparator() );
|
||||
userInterface_->titleOutline->setChecked( configuration.drawTitleOutline() );
|
||||
userInterface_->useOxygenShadows->setChecked( configuration.useOxygenShadows() );
|
||||
}
|
||||
|
||||
|
||||
//_______________________________________________________________________
|
||||
void Config::loadShadowConfiguration( QPalette::ColorGroup colorGroup, const NitrogenShadowConfiguration& configuration )
|
||||
{
|
||||
assert( colorGroup == QPalette::Active || colorGroup == QPalette::Inactive );
|
||||
NitrogenShadowConfigurationUI* ui = userInterface_->shadowConfigurations[ (colorGroup == QPalette::Active) ? 0:1 ];
|
||||
ui->shadowSize->setValue( 10*configuration.shadowSize() );
|
||||
ui->horizontalOffset->setValue( 10*configuration.horizontalOffset() );
|
||||
ui->verticalOffset->setValue( 10*configuration.verticalOffset() );
|
||||
ui->innerColor->setColor( configuration.innerColor() );
|
||||
ui->outerColor->setColor( configuration.outerColor() );
|
||||
ui->useOuterColor->setChecked( configuration.useOuterColor() );
|
||||
}
|
||||
//_______________________________________________________________________
|
||||
void Config::aboutNitrogen( void )
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <KConfig>
|
||||
#include <QPalette>
|
||||
|
||||
#include "nitrogenconfigurationui.h"
|
||||
#include "../nitrogenexceptionlist.h"
|
||||
|
@ -38,6 +39,7 @@
|
|||
namespace Nitrogen {
|
||||
|
||||
class NitrogenConfiguration;
|
||||
class NitrogenShadowConfiguration;
|
||||
|
||||
// nitrogen configuration object
|
||||
class Config: public QObject
|
||||
|
@ -79,8 +81,14 @@ namespace Nitrogen {
|
|||
//! load configuration
|
||||
void loadConfiguration( const NitrogenConfiguration& );
|
||||
|
||||
//! load configuration
|
||||
void loadShadowConfiguration( QPalette::ColorGroup, const NitrogenShadowConfiguration& );
|
||||
|
||||
//! load configuration
|
||||
void saveShadowConfiguration( QPalette::ColorGroup, const NitrogenShadowConfigurationUI& ) const;
|
||||
|
||||
//! user interface
|
||||
NitrogenConfigurationUI *user_interface_;
|
||||
NitrogenConfigurationUI *userInterface_;
|
||||
|
||||
//! kconfiguration object
|
||||
KConfig *configuration_;
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
|
||||
#include "../nitrogenconfiguration.h"
|
||||
#include "nitrogenconfigurationui.h"
|
||||
#include "nitrogenconfigurationui.moc"
|
||||
|
||||
namespace Nitrogen
|
||||
{
|
||||
|
@ -121,7 +120,6 @@ namespace Nitrogen
|
|||
|
||||
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
||||
label->setBuddy( buttonSize );
|
||||
|
||||
vboxLayout->addStretch(1);
|
||||
|
||||
}
|
||||
|
@ -183,13 +181,34 @@ namespace Nitrogen
|
|||
drawSeparator->setWhatsThis(i18n(
|
||||
"When enabled, this option makes an horizontal separator appear between the window title bar and the window contents."));
|
||||
|
||||
vboxLayout->addStretch(1);
|
||||
|
||||
}
|
||||
|
||||
// shadow configurations
|
||||
{
|
||||
shadowConfigurations = QVector<NitrogenShadowConfigurationUI*>( 2, 0 );
|
||||
QWidget* widget = new QWidget();
|
||||
int index = tab->addTab( widget, i18n( "&Shadows" ) );
|
||||
tab->setTabToolTip( index, i18n( "Configure shadow colors for active and inactive windows" ) );
|
||||
|
||||
QGridLayout* gridLayout( new QGridLayout() );
|
||||
widget->setLayout( gridLayout );
|
||||
|
||||
// oxygen shadow
|
||||
vboxLayout->addWidget( useOxygenShadows = new QCheckBox( i18n("Glow active window" ), advancedWidget ) );
|
||||
gridLayout->addWidget( useOxygenShadows = new QCheckBox( i18n("Glow active window" ), this ), 0, 0, 1, 1 );
|
||||
useOxygenShadows->setObjectName(QString::fromUtf8("useOxygenShadows"));
|
||||
useOxygenShadows->setWhatsThis(i18n(
|
||||
"When this option is enabled, oxygen signature blue glow is used for the active window shadow."));
|
||||
|
||||
connect( titleOutline, SIGNAL(toggled( bool )), drawSeparator, SLOT( setDisabled( bool ) ) );
|
||||
// regular shadow configuration
|
||||
gridLayout->addWidget( shadowConfigurations[1] = new NitrogenShadowConfigurationUI( i18n( "Window Dropdown Shadow" ), widget ), 1, 0, 1, 1 );
|
||||
shadowConfigurations[1]->setObjectName( "inactiveShadowConfiguration" );
|
||||
|
||||
// active window glow
|
||||
gridLayout->addWidget( shadowConfigurations[0] = new NitrogenShadowConfigurationUI( i18n( "Active Window Glow" ), widget ), 1, 1, 1, 1 );
|
||||
shadowConfigurations[0]->setObjectName( "activeShadowConfiguration" );
|
||||
shadowConfigurations[0]->setEnabled( false );
|
||||
|
||||
}
|
||||
|
||||
|
@ -201,8 +220,25 @@ namespace Nitrogen
|
|||
tab->setTabToolTip( index, i18n( "Configure window decoraction option overrides for specific windows" ) );
|
||||
}
|
||||
|
||||
// connections
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
|
||||
connect( titleOutline, SIGNAL(toggled( bool )), drawSeparator, SLOT( setDisabled( bool ) ) );
|
||||
connect( useOxygenShadows, SIGNAL(toggled( bool )), shadowConfigurations[0], SLOT( setEnabled( bool ) ) );
|
||||
|
||||
connect( shadowConfigurations[0], SIGNAL( changed() ), SIGNAL( changed() ) );
|
||||
connect( shadowConfigurations[1], SIGNAL( changed() ), SIGNAL( changed() ) );
|
||||
connect( titleAlignment, SIGNAL(currentIndexChanged(int)), SIGNAL( changed() ) );
|
||||
connect( buttonSize, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
connect( frameBorder, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
connect( blendColor, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
connect( sizeGripMode, SIGNAL(currentIndexChanged(int)), SIGNAL(changed()) );
|
||||
|
||||
connect( drawSeparator, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( titleOutline, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( useOxygenShadows, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( exceptions, SIGNAL(changed()), SIGNAL(changed()) );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,9 @@
|
|||
#include <QComboBox>
|
||||
#include <QCheckBox>
|
||||
#include <QPushButton>
|
||||
#include <QVector>
|
||||
|
||||
#include "nitrogenshadowconfigurationui.h"
|
||||
#include "nitrogenexceptionlistwidget.h"
|
||||
|
||||
namespace Nitrogen
|
||||
|
@ -77,7 +79,17 @@ namespace Nitrogen
|
|||
//! about nitrogen
|
||||
QPushButton *aboutNitrogen;
|
||||
|
||||
// shadow configuration
|
||||
QVector<NitrogenShadowConfigurationUI*> shadowConfigurations;
|
||||
|
||||
//! exceptions
|
||||
NitrogenExceptionListWidget *exceptions;
|
||||
|
||||
signals:
|
||||
|
||||
//! emmited when changed
|
||||
bool changed( void );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,107 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// NitrogenShadowConfigurationUI.cpp
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <KLocale>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
|
||||
#include "nitrogenshadowconfigurationui.h"
|
||||
|
||||
namespace Nitrogen
|
||||
{
|
||||
|
||||
//_________________________________________________________
|
||||
NitrogenShadowConfigurationUI::NitrogenShadowConfigurationUI( const QString& name, QWidget* parent ):
|
||||
QGroupBox( name, parent ),
|
||||
shadowSize(0),
|
||||
horizontalOffset(0),
|
||||
verticalOffset(0),
|
||||
innerColor(0),
|
||||
outerColor(0)
|
||||
{ setupUI(); }
|
||||
|
||||
//_________________________________________________________
|
||||
void NitrogenShadowConfigurationUI::setupUI( void )
|
||||
{
|
||||
|
||||
QGridLayout* mainLayout = new QGridLayout();
|
||||
setLayout( mainLayout );
|
||||
|
||||
// shadow size
|
||||
QLabel* label;
|
||||
mainLayout->addWidget( label = new QLabel( i18n( "Size:" ), this ), 0, 0, 1, 1 );
|
||||
mainLayout->addWidget( shadowSize = new KIntSpinBox( 0, 500, 1, 1, this ), 0, 1, 1, 1 );
|
||||
shadowSize->setObjectName(QString::fromUtf8("shadowSize"));
|
||||
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
||||
label->setBuddy( shadowSize );
|
||||
|
||||
// horizontal offset
|
||||
// horizontal offset is foreseen in the configuration but is hidden for now
|
||||
// it might be removed in future releases
|
||||
//mainLayout->addWidget( label = new QLabel( i18n( "Horizontal Offset:" ), this ), 1, 0, 1, 1 );
|
||||
mainLayout->addWidget( horizontalOffset = new KIntSpinBox( -50, 50, 1, 1, this ), 1, 1, 1, 1 );
|
||||
horizontalOffset->setObjectName(QString::fromUtf8("horizontalOffset"));
|
||||
//label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
||||
//label->setBuddy( horizontalOffset );
|
||||
horizontalOffset->hide();
|
||||
|
||||
// vertical offset
|
||||
mainLayout->addWidget( label = new QLabel( i18n( "Vertical Offset:" ), this ), 2, 0, 1, 1 );
|
||||
mainLayout->addWidget( verticalOffset = new KIntSpinBox( -50, 50, 1, 1, this ), 2, 1, 1, 1 );
|
||||
verticalOffset->setObjectName(QString::fromUtf8("verticalOffset"));
|
||||
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
||||
label->setBuddy( verticalOffset );
|
||||
|
||||
// first color
|
||||
mainLayout->addWidget( label = new QLabel( i18n( "Inner Color:" ), this ), 3, 0, 1, 1 );
|
||||
mainLayout->addWidget( innerColor = new KColorButton( Qt::white, this ), 3, 1, 1, 1 );
|
||||
innerColor->setObjectName(QString::fromUtf8( "innerColor"));
|
||||
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
||||
label->setBuddy( innerColor );
|
||||
|
||||
// second color
|
||||
mainLayout->addWidget( label = new QLabel( i18n( "Outer Color:" ), this ), 4, 0, 1, 1 );
|
||||
mainLayout->addWidget( outerColor = new KColorButton( Qt::black, this ), 4, 1, 1, 1 );
|
||||
outerColor->setObjectName(QString::fromUtf8("outerColor"));
|
||||
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
||||
label->setBuddy( outerColor );
|
||||
|
||||
// second color selection
|
||||
mainLayout->addWidget( useOuterColor = new QCheckBox( this ), 4, 2, 1, 1 );
|
||||
useOuterColor->setObjectName(QString::fromUtf8("useOuterColor"));
|
||||
connect( useOuterColor, SIGNAL( toggled( bool ) ), outerColor, SLOT( setEnabled( bool ) ) );
|
||||
outerColor->setEnabled( false );
|
||||
|
||||
QMetaObject::connectSlotsByName(this);
|
||||
connect( shadowSize, SIGNAL( valueChanged( int ) ), SIGNAL( changed() ) );
|
||||
connect( horizontalOffset, SIGNAL( valueChanged( int ) ), SIGNAL( changed() ) );
|
||||
connect( verticalOffset, SIGNAL( valueChanged( int ) ), SIGNAL( changed() ) );
|
||||
connect( innerColor, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) );
|
||||
connect( outerColor, SIGNAL( changed( const QColor& ) ), SIGNAL( changed() ) );
|
||||
connect( useOuterColor, SIGNAL( toggled( bool ) ), SIGNAL( changed() ) );
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
#ifndef NitrogenShadowConfigurationUI_h
|
||||
#define NitrogenShadowConfigurationUI_h
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// NitrogenShadowConfigurationUI.h
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGroupBox>
|
||||
#include <KIntSpinBox>
|
||||
#include <kcolorbutton.h>
|
||||
|
||||
namespace Nitrogen
|
||||
{
|
||||
|
||||
//_____________________________________________
|
||||
class NitrogenShadowConfigurationUI: public QGroupBox
|
||||
{
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
//! constructor
|
||||
NitrogenShadowConfigurationUI( const QString&, QWidget* );
|
||||
|
||||
//! ui
|
||||
void setupUI( void );
|
||||
|
||||
//! size spinbox
|
||||
KIntSpinBox *shadowSize;
|
||||
|
||||
//! horizontal offset
|
||||
KIntSpinBox *horizontalOffset;
|
||||
|
||||
//! vertical offset
|
||||
KIntSpinBox *verticalOffset;
|
||||
|
||||
//! first color
|
||||
KColorButton *innerColor;
|
||||
|
||||
//! second color
|
||||
KColorButton *outerColor;
|
||||
|
||||
//! second color checkbox
|
||||
QCheckBox *useOuterColor;
|
||||
|
||||
signals:
|
||||
|
||||
//! emmitted when configuration is changed
|
||||
void changed( void );
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -52,6 +52,8 @@ namespace Nitrogen
|
|||
// initialize static members
|
||||
bool NitrogenFactory::initialized_ = false;
|
||||
NitrogenConfiguration NitrogenFactory::defaultConfiguration_;
|
||||
NitrogenShadowConfiguration NitrogenFactory::activeShadowConfiguration_ = NitrogenShadowConfiguration( QPalette::Active );
|
||||
NitrogenShadowConfiguration NitrogenFactory::inactiveShadowConfiguration_ = NitrogenShadowConfiguration( QPalette::Inactive );
|
||||
NitrogenExceptionList NitrogenFactory::exceptions_;
|
||||
|
||||
//___________________________________________________
|
||||
|
@ -106,11 +108,17 @@ namespace Nitrogen
|
|||
|
||||
kDebug( 1212 ) << endl;
|
||||
|
||||
bool changed( false );
|
||||
|
||||
// create a config object
|
||||
KConfig config("nitrogenrc");
|
||||
KConfigGroup group( config.group("Windeco") );
|
||||
NitrogenConfiguration configuration( group );
|
||||
bool changed = !( configuration == defaultConfiguration() );
|
||||
if( !( configuration == defaultConfiguration() ) )
|
||||
{
|
||||
setDefaultConfiguration( configuration );
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// read exceptionsreadConfig
|
||||
NitrogenExceptionList exceptions( config );
|
||||
|
@ -120,12 +128,26 @@ namespace Nitrogen
|
|||
changed = true;
|
||||
}
|
||||
|
||||
// read shadow configurations
|
||||
NitrogenShadowConfiguration activeShadowConfiguration( QPalette::Active, config.group( "ActiveShadow" ) );
|
||||
if( !( activeShadowConfiguration == activeShadowConfiguration_ ) )
|
||||
{
|
||||
activeShadowConfiguration_ = activeShadowConfiguration;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
// read shadow configurations
|
||||
NitrogenShadowConfiguration inactiveShadowConfiguration( QPalette::Inactive, config.group( "InactiveShadow" ) );
|
||||
if( !( inactiveShadowConfiguration == inactiveShadowConfiguration_ ) )
|
||||
{
|
||||
inactiveShadowConfiguration_ = inactiveShadowConfiguration;
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if( changed )
|
||||
{
|
||||
|
||||
nitrogenHelper()->invalidateCaches();
|
||||
setDefaultConfiguration( configuration );
|
||||
return true;
|
||||
|
||||
} else return false;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <kdeversion.h>
|
||||
|
||||
#include "nitrogenconfiguration.h"
|
||||
#include "nitrogenshadowconfiguration.h"
|
||||
#include "nitrogenexceptionlist.h"
|
||||
|
||||
// TODO:
|
||||
|
@ -60,8 +61,6 @@ namespace Nitrogen
|
|||
ButtonTypeCount
|
||||
};
|
||||
|
||||
static const qreal SHADOW_WIDTH = 25.5;
|
||||
|
||||
/*
|
||||
If non zero, this possibly allow one to have an additional space
|
||||
around window that is clickable although it is part of the shadow
|
||||
|
@ -107,6 +106,22 @@ namespace Nitrogen
|
|||
//! get configuration for a give client
|
||||
static NitrogenConfiguration configuration( const NitrogenClient& );
|
||||
|
||||
//! shadow configuration
|
||||
static NitrogenShadowConfiguration activeShadowConfiguration( void )
|
||||
{ return activeShadowConfiguration_; }
|
||||
|
||||
//! shadow configuration
|
||||
static NitrogenShadowConfiguration inactiveShadowConfiguration( void )
|
||||
{ return inactiveShadowConfiguration_; }
|
||||
|
||||
//! shadow configuration
|
||||
static NitrogenShadowConfiguration shadowConfiguration( bool active )
|
||||
{ return active ? activeShadowConfiguration():inactiveShadowConfiguration(); }
|
||||
|
||||
//! shadow size
|
||||
static qreal shadowSize( void )
|
||||
{ return qMax( activeShadowConfiguration().shadowSize(), inactiveShadowConfiguration().shadowSize() ); }
|
||||
|
||||
signals:
|
||||
|
||||
//! configuration has changed
|
||||
|
@ -135,6 +150,12 @@ namespace Nitrogen
|
|||
//! default configuration
|
||||
static NitrogenConfiguration defaultConfiguration_;
|
||||
|
||||
//! shadow configuration
|
||||
static NitrogenShadowConfiguration activeShadowConfiguration_;
|
||||
|
||||
//! shadow configuration
|
||||
static NitrogenShadowConfiguration inactiveShadowConfiguration_;
|
||||
|
||||
//! exceptions
|
||||
static NitrogenExceptionList exceptions_;
|
||||
|
||||
|
|
|
@ -74,8 +74,8 @@ namespace Nitrogen
|
|||
KCommonDecorationUnstable(b, f),
|
||||
colorCacheInvalid_(true),
|
||||
size_grip_( 0 ),
|
||||
shadowTiles_( 0 ),
|
||||
glowTiles_( 0 ),
|
||||
inactiveShadowTiles_( 0 ),
|
||||
activeShadowTiles_( 0 ),
|
||||
helper_(*globalHelper),
|
||||
initialized_( false )
|
||||
{ qAddPostRoutine(oxkwincleanupBefore); }
|
||||
|
@ -88,8 +88,8 @@ namespace Nitrogen
|
|||
if( hasSizeGrip() ) deleteSizeGrip();
|
||||
|
||||
// delete tilesets
|
||||
if( shadowTiles_ ) delete shadowTiles_;
|
||||
if( glowTiles_ ) delete glowTiles_;
|
||||
if( inactiveShadowTiles_ ) delete inactiveShadowTiles_;
|
||||
if( activeShadowTiles_ ) delete activeShadowTiles_;
|
||||
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace Nitrogen
|
|||
updateWindowShape();
|
||||
widget()->update();
|
||||
}
|
||||
|
||||
|
||||
KCommonDecorationUnstable::reset( changed );
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ namespace Nitrogen
|
|||
case LM_OuterPaddingRight:
|
||||
case LM_OuterPaddingTop:
|
||||
case LM_OuterPaddingBottom:
|
||||
return SHADOW_WIDTH - extraBorder;
|
||||
return NitrogenFactory::shadowSize() - extraBorder;
|
||||
|
||||
default:
|
||||
return KCommonDecoration::layoutMetric(lm, respectWindowState, btn);
|
||||
|
@ -447,7 +447,7 @@ namespace Nitrogen
|
|||
}
|
||||
|
||||
QRect r = (isPreview()) ? NitrogenClient::widget()->rect():window->rect();
|
||||
r.adjust( SHADOW_WIDTH, SHADOW_WIDTH, -SHADOW_WIDTH, -SHADOW_WIDTH );
|
||||
r.adjust( NitrogenFactory::shadowSize(), NitrogenFactory::shadowSize(), -NitrogenFactory::shadowSize(), -NitrogenFactory::shadowSize() );
|
||||
r.adjust(0,0, 1, 1);
|
||||
|
||||
// mask and painting frame
|
||||
|
@ -604,7 +604,6 @@ namespace Nitrogen
|
|||
void NitrogenClient::paintEvent( QPaintEvent* event )
|
||||
{
|
||||
|
||||
|
||||
// factory
|
||||
if(!( initialized_ && NitrogenFactory::initialized() ) ) return;
|
||||
|
||||
|
@ -627,13 +626,12 @@ namespace Nitrogen
|
|||
{
|
||||
shadowTiles(
|
||||
backgroundPalette( widget(), palette ).color( widget()->backgroundRole() ),
|
||||
KDecoration::options()->color(ColorTitleBar),
|
||||
SHADOW_WIDTH, isActive() )->render( frame.adjusted( 4, 4, -4, -4),
|
||||
isActive() )->render( frame.adjusted( 4, 4, -4, -4),
|
||||
&painter, TileSet::Ring);
|
||||
}
|
||||
|
||||
// adjust frame
|
||||
frame.adjust( SHADOW_WIDTH, SHADOW_WIDTH, -SHADOW_WIDTH, -SHADOW_WIDTH );
|
||||
frame.adjust( NitrogenFactory::shadowSize(), NitrogenFactory::shadowSize(), -NitrogenFactory::shadowSize(), -NitrogenFactory::shadowSize() );
|
||||
|
||||
// adjust mask
|
||||
if( compositingActive() || isPreview() )
|
||||
|
@ -662,6 +660,8 @@ namespace Nitrogen
|
|||
mask += QRegion(x+3*left, y+1*top, w-3*(left+right), h-1*(top+bottom));
|
||||
mask += QRegion(x+1*left, y+3*top, w-1*(left+right), h-3*(top+bottom));
|
||||
|
||||
// in no-border configuration, an extra pixel is added to the mask
|
||||
// in order to get the corners color right in case of title highlighting.
|
||||
if( configuration().frameBorder() == NitrogenConfiguration::BorderNone )
|
||||
{ mask += QRegion(x+0*left, y+4*top, w-0*(left+right), h-4*(top+bottom)); }
|
||||
|
||||
|
@ -824,51 +824,58 @@ namespace Nitrogen
|
|||
}
|
||||
|
||||
//_________________________________________________________________
|
||||
TileSet *NitrogenClient::shadowTiles(const QColor& color, const QColor& glow, qreal size, bool active)
|
||||
TileSet *NitrogenClient::shadowTiles(const QColor& color, bool active)
|
||||
{
|
||||
|
||||
NitrogenShadowConfiguration shadowConfiguration( NitrogenFactory::shadowConfiguration( active && useOxygenShadows() ) );
|
||||
|
||||
ShadowTilesOption opt;
|
||||
opt.active = active;
|
||||
opt.width = size;
|
||||
opt.width = shadowConfiguration.shadowSize();
|
||||
opt.windowColor = color;
|
||||
opt.glowColor = glow;
|
||||
opt.innerColor = shadowConfiguration.innerColor();
|
||||
|
||||
ShadowTilesOption currentOpt = active ? glowTilesOption_:shadowTilesOption_;
|
||||
ShadowTilesOption currentOpt = active ? activeShadowTilesOption_:inactiveShadowTilesOption_;
|
||||
|
||||
bool optionChanged = !(currentOpt == opt );
|
||||
if (active && glowTiles_ )
|
||||
if (active && activeShadowTiles_ )
|
||||
{
|
||||
|
||||
if( optionChanged) delete glowTiles_;
|
||||
else return glowTiles_;
|
||||
if( optionChanged) delete activeShadowTiles_;
|
||||
else return activeShadowTiles_;
|
||||
|
||||
} else if (!active && shadowTiles_ ) {
|
||||
} else if (!active && inactiveShadowTiles_ ) {
|
||||
|
||||
if( optionChanged ) delete shadowTiles_;
|
||||
else return shadowTiles_;
|
||||
if( optionChanged ) delete inactiveShadowTiles_;
|
||||
else return inactiveShadowTiles_;
|
||||
|
||||
}
|
||||
|
||||
kDebug( 1212 ) << " creating tiles - active: " << active << endl;
|
||||
TileSet *tileSet = 0;
|
||||
|
||||
//
|
||||
qreal size( NitrogenFactory::shadowSize() );
|
||||
if( active && configuration().drawTitleOutline() && configuration().frameBorder() == NitrogenConfiguration::BorderNone )
|
||||
{
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Create new glow/shadow tiles
|
||||
// a more complex tile set is needed for the configuration above:
|
||||
// top corners must be beveled with the "active titlebar color" while
|
||||
// bottom corners must be beveled with the "window background color".
|
||||
// this requires generating two shadow pixmaps and tiling them in the tileSet.
|
||||
QPixmap shadow = QPixmap( size*2, size*2 );
|
||||
shadow.fill( Qt::transparent );
|
||||
|
||||
QPainter p( &shadow );
|
||||
p.setRenderHint( QPainter::Antialiasing );
|
||||
|
||||
QPixmap shadowTop = shadowPixmap( color, glow, size );
|
||||
QPixmap shadowTop = shadowPixmap( color, active );
|
||||
QRect topRect( shadow.rect() );
|
||||
topRect.setBottom( int( size )-1 );
|
||||
p.setClipRect( topRect );
|
||||
p.drawPixmap( QPointF( 0, 0 ), shadowTop );
|
||||
|
||||
QPixmap shadowBottom = shadowPixmap( widget()->palette().color( widget()->backgroundRole() ), glow, size );
|
||||
QPixmap shadowBottom = shadowPixmap( widget()->palette().color( widget()->backgroundRole() ), active );
|
||||
QRect bottomRect( shadow.rect() );
|
||||
bottomRect.setTop( int( size ) );
|
||||
p.setClipRect( bottomRect );
|
||||
|
@ -880,7 +887,7 @@ namespace Nitrogen
|
|||
} else {
|
||||
|
||||
tileSet = new TileSet(
|
||||
shadowPixmap( color, glow, size ),
|
||||
shadowPixmap( color, active ),
|
||||
size, size, 1, 1);
|
||||
|
||||
}
|
||||
|
@ -889,24 +896,29 @@ namespace Nitrogen
|
|||
if( active )
|
||||
{
|
||||
|
||||
glowTilesOption_ = opt;
|
||||
glowTiles_ = tileSet;
|
||||
activeShadowTilesOption_ = opt;
|
||||
activeShadowTiles_ = tileSet;
|
||||
|
||||
} else {
|
||||
|
||||
shadowTilesOption_ = opt;
|
||||
shadowTiles_ = tileSet;
|
||||
inactiveShadowTilesOption_ = opt;
|
||||
inactiveShadowTiles_ = tileSet;
|
||||
|
||||
}
|
||||
|
||||
return tileSet;
|
||||
}
|
||||
|
||||
QPixmap NitrogenClient::shadowPixmap(const QColor& color, const QColor& glow, qreal size) const
|
||||
//_________________________________________________________________
|
||||
QPixmap NitrogenClient::shadowPixmap(const QColor& color, bool active ) const
|
||||
{
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Create new glow/shadow tiles
|
||||
NitrogenShadowConfiguration shadowConfiguration( NitrogenFactory::shadowConfiguration( active && useOxygenShadows() ) );
|
||||
|
||||
static const qreal fixedSize = 25.5;
|
||||
qreal size( NitrogenFactory::shadowSize() );
|
||||
qreal shadowSize( shadowConfiguration.shadowSize() );
|
||||
|
||||
QPixmap shadow = QPixmap( size*2, size*2 );
|
||||
shadow.fill( Qt::transparent );
|
||||
|
||||
|
@ -914,101 +926,181 @@ namespace Nitrogen
|
|||
p.setRenderHint( QPainter::Antialiasing );
|
||||
p.setPen( Qt::NoPen );
|
||||
|
||||
if( useOxygenShadows() )
|
||||
qreal hoffset = shadowConfiguration.horizontalOffset();
|
||||
qreal voffset = shadowConfiguration.verticalOffset();
|
||||
|
||||
// this is the size of the shadow for which
|
||||
// the following gradients have been originally calculated
|
||||
if( active && useOxygenShadows() )
|
||||
{
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Active shadow texture
|
||||
{
|
||||
|
||||
QRadialGradient rg( size, size, size );
|
||||
QColor c = color;
|
||||
c.setAlpha( 255 ); rg.setColorAt( 4.4/size, c );
|
||||
c.setAlpha( 220 ); rg.setColorAt( 4.5/size, c );
|
||||
c.setAlpha( 180 ); rg.setColorAt( 5/size, c );
|
||||
c.setAlpha( 25 ); rg.setColorAt( 5.5/size, c );
|
||||
c.setAlpha( 0 ); rg.setColorAt( 6.5/size, c );
|
||||
// all gradients are constructed in the same way
|
||||
// values are alpha channels for all gradients "pin-points"
|
||||
// positions are gradient pin-points, originally calculated
|
||||
// for a total gradient size of 25.5 (fixedSize)
|
||||
//
|
||||
// To scale these with the actual shadow size, one must:
|
||||
// 1- keep the first pin-point unscaled (because it matches the window corner)
|
||||
// 2- make the last pin-point full-scaled (i.e grow 1:1 with shadow size)
|
||||
// intermediate pin-points are a linear interpolation between the two
|
||||
//
|
||||
// Note: this strategy does not work if first pin-point end up being larger than last.
|
||||
// when this is the case the gradient is simpy disabled
|
||||
int values[5] = {255, 220, 180, 25, 0};
|
||||
qreal x[5] = {4.4, 4.5, 5, 5.5, 6.5};
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
qreal a = (x[4]/fixedSize - x[0]/shadowSize)/(x[4]-x[0]);
|
||||
|
||||
rg = QRadialGradient( size, size, size );
|
||||
c = color;
|
||||
c.setAlpha( 255 ); rg.setColorAt( 4.4/size, c );
|
||||
c = glow;
|
||||
c.setAlpha( 0.58*255 ); rg.setColorAt( 4.5/size, c );
|
||||
c.setAlpha( 0.43*255 ); rg.setColorAt( 5.5/size, c );
|
||||
c.setAlpha( 0.30*255 ); rg.setColorAt( 6.5/size, c );
|
||||
c.setAlpha( 0.22*255 ); rg.setColorAt( 7.5/size, c );
|
||||
c.setAlpha( 0.15*255 ); rg.setColorAt( 8.5/size, c );
|
||||
c.setAlpha( 0.08*255 ); rg.setColorAt( 11.5/size, c );
|
||||
c.setAlpha( 0); rg.setColorAt( 14.5/size, c );
|
||||
p.setRenderHint( QPainter::Antialiasing );
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
if( a > 0 )
|
||||
{
|
||||
qreal b = x[0]*x[4]*(1.0/shadowSize - 1.0/fixedSize)/(x[4]-x[0]);
|
||||
QRadialGradient rg( size, size, shadowSize );
|
||||
QColor c = color;
|
||||
for( int i = 0; i<5; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( a*x[i]+b, c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
int values[7] = { 0.58*255, 0.43*255, 0.30*255, 0.22*255, 0.15*255, 0.08*255, 0 };
|
||||
qreal x[7] = {4.5, 5.5, 6.5, 7.5, 8.5, 11.5, 14.4};
|
||||
qreal a = (x[6]/fixedSize - x[0]/shadowSize)/(x[6]-x[0]);
|
||||
|
||||
if( a > 0 )
|
||||
{
|
||||
qreal b = x[0]*x[6]*(1.0/shadowSize - 1.0/fixedSize)/(x[6]-x[0]);
|
||||
QRadialGradient rg( size, size, shadowSize );
|
||||
|
||||
// firt pin-point is assigned the windeco color
|
||||
// and does not scale with the shadow size
|
||||
QColor c = color;
|
||||
c.setAlpha( 255 ); rg.setColorAt( 4.4/shadowSize, c );
|
||||
|
||||
// othe pin-points follow the usual construct
|
||||
c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<7; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( a*x[i]+b, c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
QRadialGradient rg = QRadialGradient( size, size, size );
|
||||
QColor c = color;
|
||||
|
||||
c.setAlpha( 255 ); rg.setColorAt( 4.0/size, c );
|
||||
c.setAlpha( 0 ); rg.setColorAt( 4.01/size, c );
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Inactive shadow texture
|
||||
|
||||
QRadialGradient rg = QRadialGradient( size, size+4, size );
|
||||
QColor c = QColor( Qt::black );
|
||||
c.setAlpha( 0.12*255 ); rg.setColorAt( 4.5/size, c );
|
||||
c.setAlpha( 0.11*255 ); rg.setColorAt( 6.6/size, c );
|
||||
c.setAlpha( 0.075*255 ); rg.setColorAt( 8.5/size, c );
|
||||
c.setAlpha( 0.06*255 ); rg.setColorAt( 11.5/size, c );
|
||||
c.setAlpha( 0.035*255 ); rg.setColorAt( 14.5/size, c );
|
||||
c.setAlpha( 0.025*255 ); rg.setColorAt( 17.5/size, c );
|
||||
c.setAlpha( 0.01*255 ); rg.setColorAt( 21.5/size, c );
|
||||
c.setAlpha( 0.0*255 ); rg.setColorAt( 25.5/size, c );
|
||||
p.setRenderHint( QPainter::Antialiasing );
|
||||
p.setPen( Qt::NoPen );
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
{
|
||||
|
||||
rg = QRadialGradient( size, size+2, size );
|
||||
c = QColor( Qt::black );
|
||||
c.setAlpha( 0.25*255 ); rg.setColorAt( 4.5/size, c );
|
||||
c.setAlpha( 0.20*255 ); rg.setColorAt( 5.5/size, c );
|
||||
c.setAlpha( 0.13*255 ); rg.setColorAt( 7.5/size, c );
|
||||
c.setAlpha( 0.06*255 ); rg.setColorAt( 8.5/size, c );
|
||||
c.setAlpha( 0.015*255 ); rg.setColorAt( 11.5/size, c );
|
||||
c.setAlpha( 0.0*255 ); rg.setColorAt( 14.5/size, c );
|
||||
p.setRenderHint( QPainter::Antialiasing );
|
||||
p.setPen( Qt::NoPen );
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
int values[8] = { 0.12*255, 0.11*255, 0.075*255, 0.06*255, 0.035*255, 0.025*255, 0.01*255, 0 };
|
||||
qreal x[8] = {4.5, 6.6, 8.5, 11.5, 14.5, 17.5, 21.5, 25.5 };
|
||||
qreal a = (x[7]/fixedSize - x[0]/shadowSize)/(x[7]-x[0]);
|
||||
|
||||
rg = QRadialGradient( size, size+0.2, size );
|
||||
c = color;
|
||||
c = QColor( Qt::black );
|
||||
c.setAlpha( 0.35*255 ); rg.setColorAt( 0/size, c );
|
||||
c.setAlpha( 0.32*255 ); rg.setColorAt( 4.5/size, c );
|
||||
c.setAlpha( 0.22*255 ); rg.setColorAt( 5.0/size, c );
|
||||
c.setAlpha( 0.03*255 ); rg.setColorAt( 5.5/size, c );
|
||||
c.setAlpha( 0.0*255 ); rg.setColorAt( 6.5/size, c );
|
||||
p.setRenderHint( QPainter::Antialiasing );
|
||||
p.setPen( Qt::NoPen );
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
if( a > 0 )
|
||||
{
|
||||
qreal b = x[0]*x[7]*(1.0/shadowSize - 1.0/fixedSize)/(x[7]-x[0]);
|
||||
QRadialGradient rg = QRadialGradient(
|
||||
size+20.0*hoffset,
|
||||
size+20.0*voffset,
|
||||
shadowSize );
|
||||
|
||||
rg = QRadialGradient( size, size, size );
|
||||
c = color;
|
||||
c.setAlpha( 255 ); rg.setColorAt( 4.0/size, c );
|
||||
c.setAlpha( 0 ); rg.setColorAt( 4.01/size, c );
|
||||
p.setRenderHint( QPainter::Antialiasing );
|
||||
p.setPen( Qt::NoPen );
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
for( int i = 0; i<8; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( a*x[i]+b, c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
int values[6] = { 0.25*255, 0.20*255, 0.13*255, 0.06*255, 0.015*255, 0 };
|
||||
qreal x[6] = {4.5, 5.5, 7.5, 8.5, 11.5, 14.5 };
|
||||
qreal a = (x[5]/fixedSize - x[0]/shadowSize)/(x[5]-x[0]);
|
||||
|
||||
if( a > 0 )
|
||||
{
|
||||
qreal b = x[0]*x[5]*(1.0/shadowSize - 1.0/fixedSize)/(x[5]-x[0]);
|
||||
QRadialGradient rg = QRadialGradient(
|
||||
size+10.0*hoffset,
|
||||
size+10.0*voffset,
|
||||
shadowSize );
|
||||
|
||||
QColor c = shadowConfiguration.midColor();
|
||||
for( int i = 0; i<6; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( a*x[i]+b, c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
int values[4] = { 0.32*255, 0.22*255, 0.03*255, 0 };
|
||||
qreal x[4] = { 4.5, 5.0, 5.5, 6.5 };
|
||||
qreal a = (x[3]/fixedSize - x[0]/shadowSize)/(x[3]-x[0]);
|
||||
|
||||
if( a > 0 )
|
||||
{
|
||||
|
||||
qreal b = x[0]*x[3]*(1.0/shadowSize - 1.0/fixedSize)/(x[3]-x[0]);
|
||||
QRadialGradient rg = QRadialGradient(
|
||||
size+hoffset,
|
||||
size+voffset,
|
||||
shadowSize );
|
||||
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<5; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( a*x[i]+b, c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
QRadialGradient rg = QRadialGradient( size, size, size );
|
||||
QColor c = color;
|
||||
|
||||
c.setAlpha( 255 ); rg.setColorAt( 4.0/size, c );
|
||||
c.setAlpha( 0 ); rg.setColorAt( 4.01/size, c );
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// draw the corner of the window - actually all 4 corners as one circle
|
||||
QLinearGradient lg = QLinearGradient(0.0, size-4.5, 0.0, size+4.5);
|
||||
// this is all fixedSize. Does not scale with shadow size
|
||||
QLinearGradient lg = QLinearGradient(0.0, fixedSize-4.5, 0.0, fixedSize+4.5);
|
||||
if( configuration().frameBorder() < NitrogenConfiguration::BorderTiny )
|
||||
{
|
||||
|
||||
// for no
|
||||
lg.setColorAt(0.52, helper().backgroundTopColor(color));
|
||||
lg.setColorAt(1.0, helper().backgroundBottomColor(color) );
|
||||
|
||||
|
@ -1024,7 +1116,7 @@ namespace Nitrogen
|
|||
|
||||
p.setBrush( Qt::NoBrush );
|
||||
p.setPen(QPen(lg, 0.8));
|
||||
p.drawEllipse(QRectF(size-4, size-4, 8, 8));
|
||||
p.drawEllipse(QRectF(fixedSize-4, fixedSize-4, 8, 8));
|
||||
|
||||
p.end();
|
||||
return shadow;
|
||||
|
|
|
@ -121,10 +121,10 @@ namespace Nitrogen
|
|||
void paintEvent( QPaintEvent* );
|
||||
|
||||
//! shadows
|
||||
TileSet *shadowTiles(const QColor& color, const QColor& glow, qreal size, bool active);
|
||||
TileSet *shadowTiles(const QColor& color, bool active);
|
||||
|
||||
//! shadows
|
||||
QPixmap shadowPixmap( const QColor& color, const QColor& glow, qreal size) const;
|
||||
QPixmap shadowPixmap( const QColor& color, bool active ) const;
|
||||
|
||||
private:
|
||||
|
||||
|
@ -143,13 +143,13 @@ namespace Nitrogen
|
|||
{
|
||||
return
|
||||
windowColor == other.windowColor &&
|
||||
glowColor == other.glowColor &&
|
||||
innerColor == other.innerColor &&
|
||||
width == other.width &&
|
||||
active == other.active;
|
||||
}
|
||||
|
||||
QColor windowColor;
|
||||
QColor glowColor;
|
||||
QColor innerColor;
|
||||
qreal width;
|
||||
bool active;
|
||||
};
|
||||
|
@ -191,10 +191,10 @@ namespace Nitrogen
|
|||
//! size grip widget
|
||||
NitrogenSizeGrip* size_grip_;
|
||||
|
||||
ShadowTilesOption shadowTilesOption_;
|
||||
ShadowTilesOption glowTilesOption_;
|
||||
TileSet *shadowTiles_;
|
||||
TileSet *glowTiles_;
|
||||
ShadowTilesOption inactiveShadowTilesOption_;
|
||||
ShadowTilesOption activeShadowTilesOption_;
|
||||
TileSet *inactiveShadowTiles_;
|
||||
TileSet *activeShadowTiles_;
|
||||
|
||||
//! helper
|
||||
OxygenHelper& helper_;
|
||||
|
|
|
@ -24,11 +24,6 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <KLocale>
|
||||
|
||||
#include <QDBusMessage>
|
||||
#include <QDBusConnection>
|
||||
#include <QProcess>
|
||||
#include <kdeversion.h>
|
||||
|
||||
#include "nitrogenconfiguration.h"
|
||||
|
||||
namespace Nitrogen
|
||||
|
|
|
@ -0,0 +1,140 @@
|
|||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nitrogenshadowconfiguration.cpp
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cassert>
|
||||
#include <kdecoration.h>
|
||||
|
||||
#include "nitrogenshadowconfiguration.h"
|
||||
|
||||
namespace Nitrogen
|
||||
{
|
||||
|
||||
//_________________________________________________________
|
||||
NitrogenShadowConfiguration::NitrogenShadowConfiguration( QPalette::ColorGroup colorGroup ):
|
||||
colorGroup_( colorGroup ),
|
||||
shadowSize_( 25.5 ),
|
||||
horizontalOffset_( 0 ),
|
||||
useOuterColor_( false )
|
||||
{
|
||||
|
||||
// check colorgroup
|
||||
assert( colorGroup() == QPalette::Active || colorGroup() == QPalette::Inactive );
|
||||
|
||||
// vertical offset
|
||||
verticalOffset_ = ( NitrogenShadowConfiguration::colorGroup() == QPalette::Active ) ? 0:0.2;
|
||||
|
||||
// colors
|
||||
innerColor_ = ( NitrogenShadowConfiguration::colorGroup() == QPalette::Active ) ?
|
||||
KDecoration::options()->color( KDecorationDefines::ColorTitleBar, true ):
|
||||
QColor( Qt::black );
|
||||
|
||||
outerColor_ = outerColor2_ = calcOuterColor();
|
||||
midColor_ = calcMidColor();
|
||||
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
NitrogenShadowConfiguration::NitrogenShadowConfiguration( QPalette::ColorGroup colorGroup, KConfigGroup group ):
|
||||
colorGroup_( colorGroup )
|
||||
{
|
||||
|
||||
// get default configuration
|
||||
NitrogenShadowConfiguration defaultConfiguration( NitrogenShadowConfiguration::colorGroup() );
|
||||
|
||||
setShadowSize( group.readEntry( NitrogenConfig::SHADOW_SIZE, defaultConfiguration.shadowSize() ) );
|
||||
setHorizontalOffset( group.readEntry( NitrogenConfig::SHADOW_HOFFSET, defaultConfiguration.horizontalOffset() ) );
|
||||
setVerticalOffset( group.readEntry( NitrogenConfig::SHADOW_VOFFSET, defaultConfiguration.verticalOffset() ) );
|
||||
setInnerColor( group.readEntry( NitrogenConfig::SHADOW_INNER_COLOR, defaultConfiguration.innerColor() ) );
|
||||
setOuterColor( group.readEntry( NitrogenConfig::SHADOW_OUTER_COLOR, defaultConfiguration.outerColor() ) );
|
||||
setUseOuterColor( group.readEntry( NitrogenConfig::SHADOW_USE_OUTER_COLOR, defaultConfiguration.useOuterColor() ) );
|
||||
setOuterColor2( calcOuterColor() );
|
||||
setMidColor( calcMidColor() );
|
||||
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
bool NitrogenShadowConfiguration::operator == ( const NitrogenShadowConfiguration& other ) const
|
||||
{
|
||||
assert( colorGroup() == other.colorGroup() );
|
||||
return
|
||||
shadowSize() == other.shadowSize() &&
|
||||
horizontalOffset() == other.horizontalOffset() &&
|
||||
verticalOffset() == other.verticalOffset() &&
|
||||
innerColor() == other.innerColor() &&
|
||||
outerColor() == other.outerColor() &&
|
||||
useOuterColor() == other.useOuterColor();
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
void NitrogenShadowConfiguration::write( KConfigGroup& group ) const
|
||||
{
|
||||
group.writeEntry( NitrogenConfig::SHADOW_SIZE, shadowSize() );
|
||||
group.writeEntry( NitrogenConfig::SHADOW_HOFFSET, horizontalOffset() );
|
||||
group.writeEntry( NitrogenConfig::SHADOW_VOFFSET, verticalOffset() );
|
||||
group.writeEntry( NitrogenConfig::SHADOW_INNER_COLOR, innerColor().name() );
|
||||
group.writeEntry( NitrogenConfig::SHADOW_OUTER_COLOR, outerColor().name() );
|
||||
group.writeEntry( NitrogenConfig::SHADOW_USE_OUTER_COLOR, useOuterColor() );
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
void NitrogenShadowConfiguration::setInnerColor( QColor color )
|
||||
{ innerColor_ = color.isValid() ? color : NitrogenShadowConfiguration( colorGroup() ).innerColor(); }
|
||||
|
||||
//_________________________________________________________
|
||||
void NitrogenShadowConfiguration::setMidColor( QColor color )
|
||||
{ midColor_ = color.isValid() ? color : NitrogenShadowConfiguration( colorGroup() ).midColor(); }
|
||||
|
||||
//_________________________________________________________
|
||||
void NitrogenShadowConfiguration::setOuterColor( QColor color )
|
||||
{ outerColor_ = color.isValid() ? color : NitrogenShadowConfiguration( colorGroup() ).outerColor(); }
|
||||
|
||||
//_________________________________________________________
|
||||
void NitrogenShadowConfiguration::setOuterColor2( QColor color )
|
||||
{ outerColor2_ = color.isValid() ? color : NitrogenShadowConfiguration( colorGroup() ).outerColor2(); }
|
||||
|
||||
//_________________________________________________________
|
||||
QColor NitrogenShadowConfiguration::calcOuterColor( void ) const
|
||||
{
|
||||
QColor innerColor( NitrogenShadowConfiguration::innerColor() );
|
||||
assert( innerColor.isValid() );
|
||||
|
||||
// should contain a more ellaborate mathematical formula
|
||||
// to calculate outer color from inner color
|
||||
return innerColor;
|
||||
}
|
||||
|
||||
//_________________________________________________________
|
||||
QColor NitrogenShadowConfiguration::calcMidColor( void ) const
|
||||
{
|
||||
QColor innerColor( NitrogenShadowConfiguration::innerColor() );
|
||||
QColor outerColor( NitrogenShadowConfiguration::outerColor() );
|
||||
assert( innerColor.isValid() && outerColor.isValid() );
|
||||
|
||||
// should contain a more ellaborate mathematical formula
|
||||
// to calculate mid color from inner and outer colors
|
||||
return outerColor;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,173 @@
|
|||
#ifndef nitrogenshadowconfiguration_h
|
||||
#define nitrogenshadowconfiguration_h
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nitrogenshadowconfiguration.h
|
||||
// -------------------
|
||||
//
|
||||
// Copyright (c) 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the "Software"), to
|
||||
// deal in the Software without restriction, including without limitation the
|
||||
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
// sell copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
// IN THE SOFTWARE.
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <QPalette>
|
||||
|
||||
namespace NitrogenConfig
|
||||
{
|
||||
|
||||
static const QString SHADOW_SIZE = "Size";
|
||||
static const QString SHADOW_HOFFSET= "HorizontalOffset";
|
||||
static const QString SHADOW_VOFFSET= "VerticalOffset";
|
||||
static const QString SHADOW_INNER_COLOR = "InnerColor";
|
||||
static const QString SHADOW_OUTER_COLOR = "OuterColor";
|
||||
static const QString SHADOW_USE_OUTER_COLOR = "UseOuterColor";
|
||||
}
|
||||
|
||||
namespace Nitrogen
|
||||
{
|
||||
|
||||
class NitrogenShadowConfiguration
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! button size enumeration
|
||||
//! default constructor
|
||||
NitrogenShadowConfiguration( QPalette::ColorGroup );
|
||||
|
||||
//! constructor from KConfig
|
||||
NitrogenShadowConfiguration( QPalette::ColorGroup, KConfigGroup );
|
||||
|
||||
//! destructor
|
||||
virtual ~NitrogenShadowConfiguration( void )
|
||||
{}
|
||||
|
||||
//! equal to operator
|
||||
bool operator == ( const NitrogenShadowConfiguration& ) const;
|
||||
|
||||
//! write to kconfig group
|
||||
virtual void write( KConfigGroup& ) const;
|
||||
|
||||
//! color group
|
||||
QPalette::ColorGroup colorGroup( void ) const
|
||||
{ return colorGroup_; }
|
||||
|
||||
//! shadow size
|
||||
qreal shadowSize( void ) const
|
||||
{ return shadowSize_; }
|
||||
|
||||
//! shadow size
|
||||
void setShadowSize( qreal value )
|
||||
{ shadowSize_ = value; }
|
||||
|
||||
//! horizontal offset
|
||||
qreal horizontalOffset( void ) const
|
||||
{ return horizontalOffset_; }
|
||||
|
||||
//! horizontal offset
|
||||
void setHorizontalOffset( qreal value )
|
||||
{ horizontalOffset_ = value; }
|
||||
|
||||
//! vertical offset
|
||||
qreal verticalOffset( void ) const
|
||||
{ return verticalOffset_; }
|
||||
|
||||
//! vertical offset
|
||||
void setVerticalOffset( qreal value )
|
||||
{ verticalOffset_ = value; }
|
||||
|
||||
//! inner color
|
||||
QColor innerColor( void ) const
|
||||
{ return innerColor_; }
|
||||
|
||||
//! inner color
|
||||
void setInnerColor( QColor );
|
||||
|
||||
//! mid color
|
||||
QColor midColor( void ) const
|
||||
{ return midColor_; }
|
||||
|
||||
//! outer color
|
||||
QColor outerColor( void ) const
|
||||
{ return useOuterColor() ? outerColor_ : outerColor2_; }
|
||||
|
||||
//! outer color
|
||||
void setOuterColor( QColor );
|
||||
|
||||
//! use outer color
|
||||
bool useOuterColor( void ) const
|
||||
{ return useOuterColor_; }
|
||||
|
||||
//! use outer color
|
||||
void setUseOuterColor( bool value )
|
||||
{ useOuterColor_ = value; }
|
||||
|
||||
protected:
|
||||
|
||||
//! mid color
|
||||
void setMidColor( QColor );
|
||||
|
||||
//! calculated outer color
|
||||
QColor outerColor2( void ) const
|
||||
{ return outerColor2_; }
|
||||
|
||||
//! calculated outer color
|
||||
void setOuterColor2( QColor );
|
||||
|
||||
//! calculate mid color
|
||||
QColor calcMidColor( void ) const;
|
||||
|
||||
//! calculate outer color
|
||||
QColor calcOuterColor( void ) const;
|
||||
|
||||
private:
|
||||
|
||||
//! color group
|
||||
QPalette::ColorGroup colorGroup_;
|
||||
|
||||
//! shadow size
|
||||
qreal shadowSize_;
|
||||
|
||||
//! horizontal offset
|
||||
qreal horizontalOffset_;
|
||||
|
||||
//! vertical offset
|
||||
qreal verticalOffset_;
|
||||
|
||||
//! inner color
|
||||
QColor innerColor_;
|
||||
|
||||
//! mid color
|
||||
QColor midColor_;
|
||||
|
||||
//! outer color
|
||||
QColor outerColor_;
|
||||
|
||||
//! calculated outer color
|
||||
QColor outerColor2_;
|
||||
|
||||
//! use outer color
|
||||
bool useOuterColor_;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue