Sync r937562 from Oxygen.

svn path=/trunk/KDE/kdebase/workspace/; revision=980081
icc-effect-5.14.5
Lucas Murray 2009-06-11 05:44:39 +00:00
parent 2c0b61630f
commit dd913d6657
5 changed files with 72 additions and 31 deletions

View File

@ -50,7 +50,6 @@ OxygenConfig::OxygenConfig( KConfig*, QWidget* parent )
KConfigGroup cg(c, "Windeco");
ui = new OxygenConfigUI( parent );
connect( ui->showStripes, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui->thinBorders, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui->blendTitlebarColors, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui->titleAlignmentLeft, SIGNAL(clicked()), SIGNAL(changed()) );
connect( ui->titleAlignmentCenter, SIGNAL(clicked()), SIGNAL(changed()) );
@ -74,7 +73,6 @@ void OxygenConfig::load( const KConfigGroup& )
{
KConfigGroup cg(c, "Windeco");
ui->showStripes->setChecked( cg.readEntry("ShowStripes", true) );
ui->thinBorders->setChecked( cg.readEntry("ThinBorders", true) );
ui->blendTitlebarColors->setChecked( cg.readEntry("BlendTitlebarColors", true) );
QString titleAlignment = cg.readEntry("TitleAlignment", "Left");
@ -89,7 +87,6 @@ void OxygenConfig::save( KConfigGroup& )
{
KConfigGroup cg(c, "Windeco");
cg.writeEntry( "ShowStripes", ui->showStripes->isChecked() );
cg.writeEntry( "ThinBorders", ui->thinBorders->isChecked() );
cg.writeEntry( "BlendTitlebarColors", ui->blendTitlebarColors->isChecked() );
QString titleAlignment = "Left";
@ -110,7 +107,6 @@ void OxygenConfig::save( KConfigGroup& )
void OxygenConfig::defaults()
{
ui->showStripes->setChecked( true );
ui->thinBorders->setChecked( true );
ui->titleAlignmentLeft->setChecked( true );
ui->blendTitlebarColors->setChecked( true );

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>364</width>
<height>234</height>
<height>92</height>
</rect>
</property>
<property name="windowTitle">
@ -70,13 +70,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="thinBorders">
<property name="text">
<string>Use thin borders</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -53,8 +53,8 @@ OxygenHelper *oxygenHelper(); // referenced from definition in oxygendclient.cpp
bool OxygenFactory::initialized_ = false;
Qt::Alignment OxygenFactory::titleAlignment_ = Qt::AlignLeft;
bool OxygenFactory::showStripes_ = true;
int OxygenFactory::borderSize_ = 4; // BorderSize::BorderNormal
bool OxygenFactory::blendTitlebarColors_ = true;
bool OxygenFactory::thinBorders_ = true;
//////////////////////////////////////////////////////////////////////////////
// OxygenFactory()
@ -104,6 +104,31 @@ bool OxygenFactory::reset(unsigned long changed)
resetDecorations(changed);
return false;
}
// taken from plastik
switch(KDecoration::options()->preferredBorderSize( this )) {
case BorderTiny:
borderSize_ = 2;
break;
case BorderLarge:
borderSize_ = 8;
break;
case BorderVeryLarge:
borderSize_ = 12;
break;
case BorderHuge:
borderSize_ = 18;
break;
case BorderVeryHuge:
borderSize_ = 27;
break;
case BorderOversized:
borderSize_ = 40;
break;
case BorderNormal:
default:
borderSize_ = 4;
}
}
//////////////////////////////////////////////////////////////////////////////
@ -127,8 +152,30 @@ bool OxygenFactory::readConfig()
else if (value == "Right")
titleAlignment_ = Qt::AlignRight;
bool oldborders = thinBorders_;
thinBorders_ = group.readEntry( "ThinBorders", true );
int oldBorderSize = borderSize_;
switch(KDecoration::options()->preferredBorderSize( this )) {
case BorderTiny:
borderSize_ = 2;
break;
case BorderLarge:
borderSize_ = 8;
break;
case BorderVeryLarge:
borderSize_ = 12;
break;
case BorderHuge:
borderSize_ = 18;
break;
case BorderVeryHuge:
borderSize_ = 27;
break;
case BorderOversized:
borderSize_ = 40;
break;
case BorderNormal:
default:
borderSize_ = 4;
}
bool oldstripes = showStripes_;
showStripes_ = group.readEntry( "ShowStripes", true );
@ -137,7 +184,7 @@ bool OxygenFactory::readConfig()
blendTitlebarColors_ = group.readEntry( "BlendTitlebarColors", true );
if (oldalign == titleAlignment_ && oldstripes == showStripes_
&& oldborders == thinBorders_)
&& oldBorderSize == borderSize_)
return false;
else
return true;
@ -169,6 +216,15 @@ bool OxygenFactory::supports( Ability ability ) const
};
}
QList< OxygenFactory::BorderSize >
OxygenFactory::borderSizes() const
{
// the list must be sorted
return QList< BorderSize >() << BorderTiny << BorderNormal <<
BorderLarge << BorderVeryLarge << BorderHuge <<
BorderVeryHuge << BorderOversized;
}
//////////////////////////////////////////////////////////////////////////////
// Shadows

View File

@ -37,9 +37,6 @@ namespace Oxygen
static const int OXYGEN_BUTTONSIZE = 22;
#define TFRAMESIZE 3
#define BFRAMESIZE 5
#define LFRAMESIZE 5
#define RFRAMESIZE 5
enum ButtonType {
ButtonHelp=0,
@ -63,6 +60,7 @@ public:
virtual KDecoration *createDecoration(KDecorationBridge *b);
virtual bool reset(unsigned long changed);
virtual bool supports( Ability ability ) const;
QList< BorderSize > borderSizes() const;
virtual QList< QList<QImage> > shadowTextures();
virtual int shadowTextureList( ShadowType type ) const;
@ -72,7 +70,7 @@ public:
static bool initialized();
static Qt::Alignment titleAlignment();
static bool showStripes();
static bool thinBorders();
static int borderSize();
static bool blendTitlebarColors();
private:
@ -82,7 +80,7 @@ private:
static bool initialized_;
static Qt::Alignment titleAlignment_;
static bool showStripes_;
static bool thinBorders_;
static int borderSize_;
static bool blendTitlebarColors_;
};
@ -98,8 +96,8 @@ inline bool OxygenFactory::blendTitlebarColors()
inline bool OxygenFactory::showStripes()
{ return showStripes_; }
inline bool OxygenFactory::thinBorders()
{ return thinBorders_; }
inline int OxygenFactory::borderSize()
{ return borderSize_; }
} //namespace Oxygen
} //namespace Ozone

View File

@ -124,6 +124,7 @@ bool OxygenClient::decorationBehaviour(DecorationBehaviour behaviour) const
int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const KCommonDecorationButton *btn) const
{
bool maximized = maximizeMode()==MaximizeFull && !options()->moveResizeMaximizedWindows();
int frameWidth = OxygenFactory::borderSize();
switch (lm) {
case LM_BorderLeft:
@ -133,15 +134,12 @@ int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const K
if (respectWindowState && maximized) {
return 0;
} else {
if (OxygenFactory::thinBorders())
{
if (lm == LM_BorderBottom) {
return BFRAMESIZE + 2;
} else {
return 2;
}
// Even for thin borders (2px wide) we want to preserve
// the rounded corners having a minimum height of 7px
if (lm == LM_BorderBottom) {
return qMax(frameWidth, 7);
} else {
return BFRAMESIZE;
return frameWidth;
}
}
}