From b49c213e59e67e3e6173f5c0450320c544a1c335 Mon Sep 17 00:00:00 2001 From: Huynh Huu Long Date: Sun, 15 Feb 2009 21:16:10 +0000 Subject: [PATCH] Add option "Use thin borders" svn path=/trunk/KDE/kdebase/workspace/; revision=926623 --- clients/oxygen/config/config.cpp | 6 +++- clients/oxygen/config/oxygenconfig.ui | 48 ++++++++++++++++----------- clients/oxygen/oxygen.cpp | 9 +++-- clients/oxygen/oxygen.h | 5 +++ clients/oxygen/oxygenclient.cpp | 14 +++++--- 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/clients/oxygen/config/config.cpp b/clients/oxygen/config/config.cpp index 7c2b8c2b69..5986287d73 100644 --- a/clients/oxygen/config/config.cpp +++ b/clients/oxygen/config/config.cpp @@ -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(); diff --git a/clients/oxygen/config/oxygenconfig.ui b/clients/oxygen/config/oxygenconfig.ui index 1bd28689af..f77f335d7a 100644 --- a/clients/oxygen/config/oxygenconfig.ui +++ b/clients/oxygen/config/oxygenconfig.ui @@ -1,7 +1,8 @@ - + + OxygenConfigUI - - + + 0 0 @@ -9,39 +10,39 @@ 234 - + Oxygen - - + + 0 - - + + Title &Alignment - + - - + + true - + &Left - - + + Center - - + + &Right @@ -50,18 +51,25 @@ - - + + When enabled, this option increases the visibility of the window titlebar by showing stripes - + Show stripes next to the title + + + + Use thin borders + + + - + qPixmapFromMimeSource diff --git a/clients/oxygen/oxygen.cpp b/clients/oxygen/oxygen.cpp index c6b9e756bd..9bb9923307 100644 --- a/clients/oxygen/oxygen.cpp +++ b/clients/oxygen/oxygen.cpp @@ -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; diff --git a/clients/oxygen/oxygen.h b/clients/oxygen/oxygen.h index 4376c179c6..0c95dcb397 100644 --- a/clients/oxygen/oxygen.h +++ b/clients/oxygen/oxygen.h @@ -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 diff --git a/clients/oxygen/oxygenclient.cpp b/clients/oxygen/oxygenclient.cpp index ee9a3ba56b..466fdfea1d 100644 --- a/clients/oxygen/oxygenclient.cpp +++ b/clients/oxygen/oxygenclient.cpp @@ -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; + } } }