[prev in list] [next in list] [prev in thread] [next in thread]
List: kwin
Subject: Re: [PATCH] tabstrip deco: make outline color configurable
From: Martin =?ISO-8859-1?Q?Gr=E4=DFlin?= <mgraesslin () kde ! org>
Date: 2011-08-25 19:20:19
Message-ID: 1699623.2P2kgTWv6s () martin-desktop
[Download RAW message or body]
[Attachment #2 (multipart/signed)]
Hi,
thanks for the patch, but could you please post it on http://reviewboard.kde.org so that we
can easilier track the state of it? Patches to the mailinglist get easily lost...
Cheers
Martin
On Thursday 25 August 2011 17:37:55 Melchior FRANZ wrote:
> From 43c2607cd7bbf91b5a920bf5708b42d5c5e5e007 Mon Sep 17 00:00:00 2001
> From: Melchior FRANZ <mfranz@aon.at>
> Date: Thu, 25 Aug 2011 16:30:45 +0200
> Subject: [PATCH 1/1] tabstrip: make outline color configurable
>
> In addition to the foreground and background color the tabstrip window
> decoration also has an outline color, which is currently hardcoded as
> white. This doesn't fit very well in certain color combinations, so it
> is desirable to make this color configurable.
>
> Signed-off-by: Melchior FRANZ <mfranz@aon.at>
> ---
> The config dialog (attached screenshot) isn't particularly pleasing,
> but I found it hard to align the three different widgets in a meaningful
> way. The first screenshot shows the deco with grouped windows and black
> as outline color. You see that the widget composition doesn't become
> unclear. The second screenshot shows windows with different combinations
> copied together as an illustration. The top row corresponds to the
> currently hardcoded outline color white.
>
>
> kwin/clients/tabstrip/config/tabstripconfig.cpp | 4 ++++
> kwin/clients/tabstrip/config/tabstripconfig.ui | 20 ++++++++++++++++++++
> kwin/clients/tabstrip/tabstripdecoration.cpp | 8 ++++----
> kwin/clients/tabstrip/tabstripfactory.cpp | 2 ++
> kwin/clients/tabstrip/tabstripfactory.h | 6 ++++++
> 5 files changed, 36 insertions(+), 4 deletions(-)
>
> diff --git a/kwin/clients/tabstrip/config/tabstripconfig.cpp
b/kwin/clients/tabstrip/config/tabstripconfig.cpp
> index 4174cba..4ddd8fd 100644
> --- a/kwin/clients/tabstrip/config/tabstripconfig.cpp
> +++ b/kwin/clients/tabstrip/config/tabstripconfig.cpp
> @@ -49,6 +49,7 @@ TabstripConfig::TabstripConfig( KConfig *c, QWidget *parent )
> connect( ui->center, SIGNAL(clicked()), SIGNAL(changed()) );
> connect( ui->right, SIGNAL(clicked()), SIGNAL(changed()) );
> connect( ui->showIcon, SIGNAL(clicked()), SIGNAL(changed()) );
> + connect( ui->outlineColor, SIGNAL(clicked()), SIGNAL(changed()) );
> load( cg );
> ui->show();
> }
> @@ -67,6 +68,7 @@ void TabstripConfig::load( KConfigGroup &c )
> ui->center->setChecked( align == "Center" );
> ui->right->setChecked( align == "Right" );
> ui->showIcon->setChecked( c.readEntry( "ShowIcon", true ) );
> + ui->outlineColor->setColor( c.readEntry( "OutlineColor", QColor( Qt::white ) ) );
> }
>
> void TabstripConfig::save( KConfigGroup &c )
> @@ -79,6 +81,7 @@ void TabstripConfig::save( KConfigGroup &c )
> else
> c.writeEntry( "TitleAlignment", "Right" );
> c.writeEntry( "ShowIcon", ui->showIcon->isChecked() );
> + c.writeEntry( "OutlineColor", ui->outlineColor->color() );
> config->sync();
> }
>
> @@ -88,5 +91,6 @@ void TabstripConfig::defaults()
> ui->center->setChecked( true );
> ui->right->setChecked( false );
> ui->showIcon->setChecked( true );
> + ui->outlineColor->setColor( Qt::white );
> emit changed();
> }
> diff --git a/kwin/clients/tabstrip/config/tabstripconfig.ui
b/kwin/clients/tabstrip/config/tabstripconfig.ui
> index 1a21e05..8927f9d 100644
> --- a/kwin/clients/tabstrip/config/tabstripconfig.ui
> +++ b/kwin/clients/tabstrip/config/tabstripconfig.ui
> @@ -51,6 +51,26 @@
> </property>
> </widget>
> </item>
> + <item>
> + <layout class="QHBoxLayout" name="outlineColorLayout">
> + <item>
> + <widget class="QLabel" name="outline">
> + <property name="text">
> + <string>O&utline Color:</string>
> + </property>
> + <property name="alignment">
> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
> + </property>
> + <property name="buddy">
> + <cstring>outlineColor</cstring>
> + </property>
> + </widget>
> + </item>
> + <item>
> + <widget class="KColorButton" name="outlineColor"/>
> + </item>
> + </layout>
> + </item>
> </layout>
> </widget>
> <resources/>
> diff --git a/kwin/clients/tabstrip/tabstripdecoration.cpp
b/kwin/clients/tabstrip/tabstripdecoration.cpp
> index ae46872..a159a96 100644
> --- a/kwin/clients/tabstrip/tabstripdecoration.cpp
> +++ b/kwin/clients/tabstrip/tabstripdecoration.cpp
> @@ -81,7 +81,7 @@ void TabstripDecoration::paintTab( QPainter &painter, const QRect
&geom, ClientG
> // Draw border around the tab
> painter.setPen( Qt::black );
> painter.drawRect( geom.adjusted( 0, 0, -1, -1 ));
> - painter.setPen( Qt::white );
> + painter.setPen( TabstripFactory::outlineColor() );
> painter.drawRect( geom.adjusted( 1, 1, -2, -2 ));
>
> // Background
> @@ -132,7 +132,7 @@ void TabstripDecoration::paintEvent( QPaintEvent * )
> // Draw black/white border around the main window
> painter.setPen( Qt::black );
> painter.drawRect( 0, titlebar.height() - 1, frame.width() - 1, frame.height() -
titlebar.height() );
> - painter.setPen( Qt::white );
> + painter.setPen( TabstripFactory::outlineColor() );
> painter.drawRect( 1, titlebar.height(), frame.width() - 3, frame.height() - titlebar.height() -
2 );
>
> QList< ClientGroupItem > tabList = clientGroupItems();
> @@ -176,7 +176,7 @@ void TabstripDecoration::paintEvent( QPaintEvent * )
> painter.setPen( Qt::black );
> painter.drawRect( 0, 0, allTabGeom.left(), allTabGeom.height() - 1 );
> painter.drawRect( allTabGeom.right() - 1, 0, frame.width() - allTabGeom.right(),
allTabGeom.height() - 1 );
> - painter.setPen( Qt::white );
> + painter.setPen( TabstripFactory::outlineColor() );
> painter.drawRect( 1, 1, allTabGeom.left() - 2, allTabGeom.height() - 3 );
> painter.drawRect( allTabGeom.right(), 1, frame.width() - allTabGeom.right() - 2,
allTabGeom.height() - 3 );
>
> @@ -189,7 +189,7 @@ void TabstripDecoration::paintEvent( QPaintEvent * )
> // Draw border around the titlebar
> painter.setPen( Qt::black );
> painter.drawRect( titlebar.adjusted( 0, 0, -1, -1 ));
> - painter.setPen( Qt::white );
> + painter.setPen( TabstripFactory::outlineColor() );
> painter.drawRect( titlebar.adjusted( 1, 1, -2, -2 ));
>
> // Background
> diff --git a/kwin/clients/tabstrip/tabstripfactory.cpp
b/kwin/clients/tabstrip/tabstripfactory.cpp
> index 591a148..6b34c01 100644
> --- a/kwin/clients/tabstrip/tabstripfactory.cpp
> +++ b/kwin/clients/tabstrip/tabstripfactory.cpp
> @@ -36,6 +36,7 @@ extern "C"
>
> Qt::AlignmentFlag TabstripFactory::titlealign = Qt::AlignCenter;
> bool TabstripFactory::show_icon = true;
> +QColor TabstripFactory::outline_color = Qt::white;
>
> TabstripFactory::TabstripFactory()
> {
> @@ -88,6 +89,7 @@ bool TabstripFactory::readConfig()
> else if( align == "Right" )
> titlealign = Qt::AlignRight;
> show_icon = cg.readEntry( "ShowIcon", true );
> + outline_color = cg.readEntry( "OutlineColor", QColor( Qt::white ) );
> return ( titlealign != oldalign );
> }
>
> diff --git a/kwin/clients/tabstrip/tabstripfactory.h b/kwin/clients/tabstrip/tabstripfactory.h
> index 2b667f0..0b610c2 100644
> --- a/kwin/clients/tabstrip/tabstripfactory.h
> +++ b/kwin/clients/tabstrip/tabstripfactory.h
> @@ -37,11 +37,13 @@ class TabstripFactory : public KDecorationFactoryUnstable
> QList< KDecorationDefines::BorderSize > borderSizes() const;
> static Qt::AlignmentFlag titleAlign();
> static bool showIcon();
> + static QColor &outlineColor();
> private:
> bool readConfig();
> bool initialized;
> static Qt::AlignmentFlag titlealign;
> static bool show_icon;
> + static QColor outline_color;
> };
>
> inline Qt::AlignmentFlag TabstripFactory::titleAlign()
> @@ -53,5 +55,9 @@ inline bool TabstripFactory::showIcon()
> {
> return show_icon;
> }
> +inline QColor &TabstripFactory::outlineColor()
> + {
> + return outline_color;
> + }
>
> #endif
> --
> 1.7.6.GIT
>
["signature.asc" (application/pgp-signature)]
_______________________________________________
kwin mailing list
kwin@kde.org
https://mail.kde.org/mailman/listinfo/kwin
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic