redesign active window glow following Nuno's SVG; Changed default shadow parameters accordingly; and Changed scale of shadowSize in config dialog to physical scale.
svn path=/trunk/KDE/kdebase/workspace/; revision=1033963
This commit is contained in:
parent
c23a330748
commit
3d531bf4b2
4 changed files with 61 additions and 50 deletions
|
@ -151,7 +151,7 @@ namespace Oxygen
|
|||
|
||||
// save shadow configuration
|
||||
KConfigGroup configurationGroup( configuration_, ( (colorGroup == QPalette::Active) ? "ActiveShadow":"InactiveShadow" ) );
|
||||
configurationGroup.writeEntry( OxygenConfig::SHADOW_SIZE, 0.1*ui.shadowSize->value() );
|
||||
configurationGroup.writeEntry( OxygenConfig::SHADOW_SIZE, ui.shadowSize->value() );
|
||||
configurationGroup.writeEntry( OxygenConfig::SHADOW_HOFFSET, 0.1*ui.horizontalOffset->value() );
|
||||
configurationGroup.writeEntry( OxygenConfig::SHADOW_VOFFSET, 0.1*ui.verticalOffset->value() );
|
||||
configurationGroup.writeEntry( OxygenConfig::SHADOW_INNER_COLOR, ui.innerColor->color() );
|
||||
|
@ -200,7 +200,7 @@ namespace Oxygen
|
|||
{
|
||||
assert( colorGroup == QPalette::Active || colorGroup == QPalette::Inactive );
|
||||
OxygenShadowConfigurationUI* ui = userInterface_->shadowConfigurations[ (colorGroup == QPalette::Active) ? 0:1 ];
|
||||
ui->shadowSize->setValue( 10*configuration.shadowSize() );
|
||||
ui->shadowSize->setValue( configuration.shadowSize() );
|
||||
ui->horizontalOffset->setValue( 10*configuration.horizontalOffset() );
|
||||
ui->verticalOffset->setValue( 10*configuration.verticalOffset() );
|
||||
ui->innerColor->setColor( configuration.innerColor() );
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace Oxygen
|
|||
// 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 );
|
||||
mainLayout->addWidget( shadowSize = new KIntSpinBox( 0, 50, 1, 1, this ), 0, 1, 1, 1 );
|
||||
shadowSize->setObjectName(QString::fromUtf8("shadowSize"));
|
||||
label->setAlignment( Qt::AlignRight|Qt::AlignVCenter );
|
||||
label->setBuddy( shadowSize );
|
||||
|
|
|
@ -208,32 +208,30 @@ namespace Oxygen
|
|||
|
||||
{
|
||||
|
||||
int nPoints = 5;
|
||||
int values[5] = {255, 220, 180, 25, 0};
|
||||
qreal x[5] = {4.4, 4.5, 5, 5.5, 6.5};
|
||||
|
||||
// the first point of this gradient does not scaled
|
||||
QRadialGradient rg( size, size, shadowSize );
|
||||
QColor c = color;
|
||||
// inner (shark) gradient
|
||||
int nPoints = 7;
|
||||
qreal x[7] = {0, 0.05, 0.1, 0.15, 0.2, 0.3, 0.4 };
|
||||
int values[7] = {203, 200, 175, 105, 45, 2, 0 };
|
||||
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( x[0]/shadowSize+(x[i]-x[0])/fixedSize, c ); }
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
renderGradient( p, shadow.rect(), rg, noBorder );
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
if( true ) {
|
||||
|
||||
// this gradient scales with shadow size
|
||||
int nPoints = 8;
|
||||
qreal values[8] = {1, 0.58, 0.43, 0.30, 0.22, 0.15, 0.08, 0 };
|
||||
qreal x[8] = {0, 4.5, 5.5, 6.5, 7.5, 8.5, 11.5, 14.4};
|
||||
|
||||
// this gradient scales with shadow size
|
||||
QRadialGradient rg( size+hoffset, size+voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
// outer (spread) gradient
|
||||
int nPoints = 7;
|
||||
qreal x[7] = {0, 0.15, 0.3, 0.45, 0.65, 0.75, 1 };
|
||||
int values[7] = {120, 95, 50, 20, 10, 5, 0 };
|
||||
QRadialGradient rg = QRadialGradient( size+12.0*hoffset, size+12.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
{ c.setAlpha( values[i] ); rg.setColorAt( x[i], c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
@ -243,22 +241,22 @@ namespace Oxygen
|
|||
} else {
|
||||
|
||||
{
|
||||
|
||||
int nPoints = 9;
|
||||
qreal values[9] = { 0.17, 0.12, 0.11, 0.075, 0.06, 0.035, 0.025, 0.01, 0 };
|
||||
qreal x[9] = {0, 4.5, 6.6, 8.5, 11.5, 14.5, 17.5, 21.5, 25.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+20.0*hoffset, size+20.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
// inner (sharp gradient)
|
||||
int nPoints = 5;
|
||||
qreal values[5] = { 1, 0.32, 0.22, 0.03, 0 };
|
||||
qreal x[5] = { 0, 4.5, 5.0, 5.5, 6.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+hoffset, size+voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
renderGradient( p, shadow.rect(), rg, noBorder );
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
// mid gradient
|
||||
int nPoints = 7;
|
||||
qreal values[7] = {0.55, 0.25, 0.20, 0.1, 0.06, 0.015, 0 };
|
||||
qreal x[7] = {0, 4.5, 5.5, 7.5, 8.5, 11.5, 14.5 };
|
||||
|
@ -273,15 +271,18 @@ namespace Oxygen
|
|||
}
|
||||
|
||||
{
|
||||
int nPoints = 5;
|
||||
qreal values[5] = { 1, 0.32, 0.22, 0.03, 0 };
|
||||
qreal x[5] = { 0, 4.5, 5.0, 5.5, 6.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+hoffset, size+voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.innerColor();
|
||||
|
||||
// outer (spread) gradient
|
||||
int nPoints = 9;
|
||||
qreal values[9] = { 0.17, 0.12, 0.11, 0.075, 0.06, 0.035, 0.025, 0.01, 0 };
|
||||
qreal x[9] = {0, 4.5, 6.6, 8.5, 11.5, 14.5, 17.5, 21.5, 25.5 };
|
||||
QRadialGradient rg = QRadialGradient( size+20.0*hoffset, size+20.0*voffset, shadowSize );
|
||||
QColor c = shadowConfiguration.outerColor();
|
||||
for( int i = 0; i<nPoints; i++ )
|
||||
{ c.setAlphaF( values[i] ); rg.setColorAt( x[i]/fixedSize, c ); }
|
||||
|
||||
renderGradient( p, shadow.rect(), rg, noBorder );
|
||||
p.setBrush( rg );
|
||||
p.drawRect( shadow.rect() );
|
||||
|
||||
}
|
||||
|
||||
|
@ -295,10 +296,8 @@ namespace Oxygen
|
|||
lg.setColorAt(1.0, oxygenHelper()->backgroundBottomColor(color) );
|
||||
|
||||
// draw ellipse.
|
||||
// note: special tricks are needed to cope with some rounding issues when size is not an integer.
|
||||
p.setBrush( lg );
|
||||
int sizeInt( size );
|
||||
p.drawEllipse( QRectF( sizeInt-4, sizeInt-4, 8+2*(size-sizeInt), 8+2*(size-sizeInt) ) );
|
||||
p.drawEllipse( QRectF( size-4, size-4, 8, 8 ) );
|
||||
|
||||
p.end();
|
||||
return shadow;
|
||||
|
|
|
@ -33,25 +33,37 @@ namespace Oxygen
|
|||
|
||||
//_________________________________________________________
|
||||
OxygenShadowConfiguration::OxygenShadowConfiguration( QPalette::ColorGroup colorGroup ):
|
||||
colorGroup_( colorGroup ),
|
||||
shadowSize_( 25.5 ),
|
||||
horizontalOffset_( 0 ),
|
||||
useOuterColor_( false )
|
||||
colorGroup_( colorGroup )
|
||||
{
|
||||
|
||||
// check colorgroup
|
||||
assert( colorGroup == QPalette::Active || colorGroup == QPalette::Inactive );
|
||||
|
||||
// vertical offset
|
||||
verticalOffset_ = ( OxygenShadowConfiguration::colorGroup() == QPalette::Active ) ? 0:0.2;
|
||||
if( colorGroup == QPalette::Active )
|
||||
{
|
||||
|
||||
// colors
|
||||
innerColor_ = ( OxygenShadowConfiguration::colorGroup() == QPalette::Active ) ?
|
||||
KDecoration::options()->color( KDecorationDefines::ColorTitleBar, true ):
|
||||
QColor( Qt::black );
|
||||
shadowSize_ = 25;
|
||||
horizontalOffset_ = 0;
|
||||
verticalOffset_ = 0.1;
|
||||
|
||||
outerColor_ = outerColor2_ = calcOuterColor();
|
||||
midColor_ = calcMidColor();
|
||||
innerColor_ = QColor( "#0070D2" );
|
||||
outerColor_ = QColor( "#6ABAFF" );
|
||||
outerColor2_ = calcOuterColor();
|
||||
midColor_ = calcMidColor();
|
||||
useOuterColor_ = true;
|
||||
|
||||
} else {
|
||||
|
||||
shadowSize_ = 25;
|
||||
horizontalOffset_ = 0;
|
||||
verticalOffset_ = 0.2;
|
||||
|
||||
innerColor_ = QColor( Qt::black );
|
||||
outerColor_ = outerColor2_ = calcOuterColor();
|
||||
midColor_ = calcMidColor();
|
||||
useOuterColor_ = false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue