Add option "Use thin borders"

svn path=/trunk/KDE/kdebase/workspace/; revision=926623
This commit is contained in:
Huynh Huu Long 2009-02-15 21:16:10 +00:00
parent 37f938b841
commit b49c213e59
5 changed files with 55 additions and 27 deletions

View file

@ -48,7 +48,8 @@ OxygenConfig::OxygenConfig( KConfig*, QWidget* parent )
c = new KConfig( "oxygenrc" );
KConfigGroup cg(c, "Windeco");
ui = new OxygenConfigUI( parent );
connect( ui->showStripes, SIGNAL(clicked()), SIGNAL(changed()) );
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()) );
@ -71,6 +72,7 @@ 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" );
@ -84,6 +86,7 @@ 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())
@ -103,6 +106,7 @@ void OxygenConfig::save( KConfigGroup& )
void OxygenConfig::defaults()
{
ui->showStripes->setChecked( true );
ui->thinBorders->setChecked( true );
ui->titleAlignmentLeft->setChecked( true );
emit changed();

View file

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>OxygenConfigUI</class>
<widget class="QWidget" name="OxygenConfigUI" >
<property name="geometry" >
<widget class="QWidget" name="OxygenConfigUI">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,39 +10,39 @@
<height>234</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Oxygen</string>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<layout class="QVBoxLayout">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Title &amp;Alignment</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" >
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="titleAlignmentLeft" >
<property name="enabled" >
<widget class="QRadioButton" name="titleAlignmentLeft">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text" >
<property name="text">
<string>&amp;Left</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="titleAlignmentCenter" >
<property name="text" >
<widget class="QRadioButton" name="titleAlignmentCenter">
<property name="text">
<string>Center</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="titleAlignmentRight" >
<property name="text" >
<widget class="QRadioButton" name="titleAlignmentRight">
<property name="text">
<string>&amp;Right</string>
</property>
</widget>
@ -50,18 +51,25 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="showStripes" >
<property name="whatsThis" >
<widget class="QCheckBox" name="showStripes">
<property name="whatsThis">
<string>When enabled, this option increases the visibility of the window titlebar by showing stripes</string>
</property>
<property name="text" >
<property name="text">
<string>Show stripes next to the title</string>
</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" />
<layoutdefault spacing="6" margin="11"/>
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<resources/>
<connections/>

View file

@ -51,6 +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;
//////////////////////////////////////////////////////////////////////////////
// OxygenFactory()
@ -123,10 +124,14 @@ bool OxygenFactory::readConfig()
else if (value == "Right")
titleAlignment_ = Qt::AlignRight;
bool oldstripes = showStripes;
bool oldborders = thinBorders_;
thinBorders_ = group.readEntry( "ThinBorders", true );
bool oldstripes = showStripes_;
showStripes_ = group.readEntry( "ShowStripes", true );
if (oldalign == titleAlignment_ && oldstripes == showStripes_)
if (oldalign == titleAlignment_ && oldstripes == showStripes_
&& oldborders == thinBorders_)
return false;
else
return true;

View file

@ -70,6 +70,7 @@ public:
static bool initialized();
static Qt::Alignment titleAlignment();
static bool showStripes();
static bool thinBorders();
private:
bool readConfig();
@ -78,6 +79,7 @@ private:
static bool initialized_;
static Qt::Alignment titleAlignment_;
static bool showStripes_;
static bool thinBorders_;
};
inline bool OxygenFactory::initialized()
@ -89,6 +91,9 @@ inline Qt::Alignment OxygenFactory::titleAlignment()
inline bool OxygenFactory::showStripes()
{ return showStripes_; }
inline bool OxygenFactory::thinBorders()
{ return thinBorders_; }
} //namespace Oxygen
#endif

View file

@ -131,10 +131,16 @@ int OxygenClient::layoutMetric(LayoutMetric lm, bool respectWindowState, const K
if (respectWindowState && maximized) {
return 0;
} else {
if (lm == LM_BorderBottom)
return BFRAMESIZE + 2;
else
return 2;
if (OxygenFactory::thinBorders())
{
if (lm == LM_BorderBottom) {
return BFRAMESIZE + 2;
} else {
return 2;
}
} else {
return BFRAMESIZE;
}
}
}