Use the stardard method to adjust the border width
svn path=/trunk/KDE/kdebase/workspace/; revision=937562
This commit is contained in:
parent
cf222c6da0
commit
62f7201f41
5 changed files with 72 additions and 31 deletions
|
@ -49,7 +49,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->titleAlignmentLeft, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( ui->titleAlignmentCenter, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
connect( ui->titleAlignmentRight, SIGNAL(clicked()), SIGNAL(changed()) );
|
||||
|
@ -72,7 +71,6 @@ void OxygenConfig::load( const KConfigGroup& )
|
|||
{
|
||||
KConfigGroup cg(c, "Windeco");
|
||||
ui->showStripes->setChecked( cg.readEntry("ShowStripes", true) );
|
||||
ui->thinBorders->setChecked( cg.readEntry("ThinBorders", true) );
|
||||
|
||||
QString titleAlignment = cg.readEntry("TitleAlignment", "Left");
|
||||
ui->titleAlignmentLeft->setChecked( titleAlignment == "Left" );
|
||||
|
@ -86,7 +84,6 @@ void OxygenConfig::save( KConfigGroup& )
|
|||
{
|
||||
KConfigGroup cg(c, "Windeco");
|
||||
cg.writeEntry( "ShowStripes", ui->showStripes->isChecked() );
|
||||
cg.writeEntry( "ThinBorders", ui->thinBorders->isChecked() );
|
||||
|
||||
QString titleAlignment = "Left";
|
||||
if (ui->titleAlignmentCenter->isChecked())
|
||||
|
@ -106,7 +103,6 @@ void OxygenConfig::save( KConfigGroup& )
|
|||
void OxygenConfig::defaults()
|
||||
{
|
||||
ui->showStripes->setChecked( true );
|
||||
ui->thinBorders->setChecked( true );
|
||||
ui->titleAlignmentLeft->setChecked( true );
|
||||
|
||||
emit changed();
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>364</width>
|
||||
<height>234</height>
|
||||
<height>92</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -60,13 +60,6 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="thinBorders">
|
||||
<property name="text">
|
||||
<string>Use thin borders</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
|
|
|
@ -51,7 +51,7 @@ OxygenHelper *oxygenHelper(); // referenced from definition in oxygendclient.cpp
|
|||
bool OxygenFactory::initialized_ = false;
|
||||
Qt::Alignment OxygenFactory::titleAlignment_ = Qt::AlignLeft;
|
||||
bool OxygenFactory::showStripes_ = true;
|
||||
bool OxygenFactory::thinBorders_ = true;
|
||||
int OxygenFactory::borderSize_ = 4; // BorderSize::BorderNormal
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// OxygenFactory()
|
||||
|
@ -101,6 +101,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;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -124,14 +149,36 @@ 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 );
|
||||
|
||||
if (oldalign == titleAlignment_ && oldstripes == showStripes_
|
||||
&& oldborders == thinBorders_)
|
||||
&& oldBorderSize == borderSize_)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
@ -163,6 +210,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
|
||||
|
||||
|
|
|
@ -35,9 +35,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,
|
||||
|
@ -61,6 +58,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;
|
||||
|
@ -70,7 +68,7 @@ public:
|
|||
static bool initialized();
|
||||
static Qt::Alignment titleAlignment();
|
||||
static bool showStripes();
|
||||
static bool thinBorders();
|
||||
static int borderSize();
|
||||
|
||||
private:
|
||||
bool readConfig();
|
||||
|
@ -79,7 +77,7 @@ private:
|
|||
static bool initialized_;
|
||||
static Qt::Alignment titleAlignment_;
|
||||
static bool showStripes_;
|
||||
static bool thinBorders_;
|
||||
static int borderSize_;
|
||||
};
|
||||
|
||||
inline bool OxygenFactory::initialized()
|
||||
|
@ -91,8 +89,8 @@ inline Qt::Alignment OxygenFactory::titleAlignment()
|
|||
inline bool OxygenFactory::showStripes()
|
||||
{ return showStripes_; }
|
||||
|
||||
inline bool OxygenFactory::thinBorders()
|
||||
{ return thinBorders_; }
|
||||
inline int OxygenFactory::borderSize()
|
||||
{ return borderSize_; }
|
||||
|
||||
} //namespace Oxygen
|
||||
|
||||
|
|
|
@ -122,6 +122,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:
|
||||
|
@ -131,15 +132,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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue