[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    [Patch] Colors for taskbar fonts
From:       Krzysztof Lichota <krzysiek () lichota ! net>
Date:       2007-02-14 12:19:50
Message-ID: 45D2FE66.5030001 () lichota ! net
[Download RAW message or body]

[Attachment #2 (multipart/signed)]

[Attachment #4 (multipart/mixed)]


I have prepared a patch implementing often-requested wish (218 votes) -
changing color of fonts in taskbar (see
https://bugs.kde.org/show_bug.cgi?id=118460).

Any comments welcome, it is my first patch involving .kcfg and .ui, so I
might have messed something up :)

If it is OK, I would like to commit it during next feature unfreeze for
stable branch (it is for 3.5.x, not for KDE4).

If necessary, I can submit it to kde-usability for review.

Here are the screenshots (they are with Polish text as KControl does not
seem to respect KDE_LANG variable):
Config window with custom colors disabled:
http://lichota.net/~krzysiek/projects/kde/taskbar-colors/config-custom-colors-inactive.png

Config window with custom colors enabled:
http://lichota.net/~krzysiek/projects/kde/taskbar-colors/config-custom-colors-active.png

Taskbar with "Classic" appearance:
http://lichota.net/~krzysiek/projects/kde/taskbar-colors/custom-colors-classic.png

Taskbar with "Elegant" appearance:
http://lichota.net/~krzysiek/projects/kde/taskbar-colors/custom-colors-elegant.png

Taskbar with "For transparency" appearance and transparent Kicker:
http://lichota.net/~krzysiek/projects/kde/taskbar-colors/custom-colors-transparency.png

Colors on screenshots have been chosen for demonstration, not because of
their beauty :)

	Krzysztof Lichota



["taskbar-colors2.diff" (text/x-patch)]

Index: kcontrol/taskbar/kcmtaskbar.cpp
===================================================================
--- kcontrol/taskbar/kcmtaskbar.cpp	(wersja 569913)
+++ kcontrol/taskbar/kcmtaskbar.cpp	(kopia robocza)
@@ -30,6 +30,8 @@
 #include <kdialog.h>
 #include <kgenericfactory.h>
 #include <kwin.h>
+#include <kcolorbutton.h>
+#include <qlabel.h>
 
 #define protected public
 #include "kcmtaskbarui.h"
@@ -151,7 +153,9 @@
 
     connect(m_widget->kcfg_GroupTasks, SIGNAL(activated(int)),
             this, SLOT(slotUpdateComboBox()));
+    connect(m_widget->kcfg_UseCustomColors, SIGNAL(stateChanged(int)), this, \
SLOT(slotUpdateCustomColors()));  
+    slotUpdateCustomColors();
     updateAppearanceCombo();
 
     if (KWin::numberOfDesktops() < 2)
@@ -182,6 +186,18 @@
     QTimer::singleShot(0, this, SLOT(notChanged()));
 }
 
+void TaskbarConfig::slotUpdateCustomColors()
+{
+    m_widget->kcfg_ActiveTaskTextColor->setEnabled(m_widget->kcfg_UseCustomColors->isChecked());
 +    m_widget->activeTaskTextColorLabel->setEnabled(m_widget->kcfg_UseCustomColors->isChecked());
 +    
+    m_widget->kcfg_InactiveTaskTextColor->setEnabled(m_widget->kcfg_UseCustomColors->isChecked());
 +    m_widget->inactiveTaskTextColorLabel->setEnabled(m_widget->kcfg_UseCustomColors->isChecked());
 +    
+    m_widget->kcfg_TaskBackgroundColor->setEnabled(m_widget->kcfg_UseCustomColors->isChecked());
 +    m_widget->taskBackgroundColorLabel->setEnabled(m_widget->kcfg_UseCustomColors->isChecked());
 +}
+
 void TaskbarConfig::slotUpdateComboBox()
 {
     int pos = TaskBarSettings::ActivateRaiseOrMinimize;
Index: kcontrol/taskbar/kcmtaskbar.h
===================================================================
--- kcontrol/taskbar/kcmtaskbar.h	(wersja 569913)
+++ kcontrol/taskbar/kcmtaskbar.h	(kopia robocza)
@@ -64,6 +64,7 @@
     void slotUpdateComboBox();
     void appearanceChanged(int);
     void notChanged();
+    void slotUpdateCustomColors();
 
 private:
     TaskbarAppearance::List m_appearances;
Index: kcontrol/taskbar/kcmtaskbarui.ui
===================================================================
--- kcontrol/taskbar/kcmtaskbarui.ui	(wersja 569913)
+++ kcontrol/taskbar/kcmtaskbarui.ui	(kopia robocza)
@@ -177,6 +177,141 @@
                         <cstring>appearance</cstring>
                     </property>
                 </widget>
+                <widget class="QCheckBox" row="9" column="0" rowspan="1" \
colspan="2"> +                    <property name="name">
+                        <cstring>kcfg_UseCustomColors</cstring>
+                    </property>
+                    <property name="enabled">
+                        <bool>true</bool>
+                    </property>
+                    <property name="text">
+                        <string>Use &amp;custom colors</string>
+                    </property>
+                    <property name="accel">
+                        <string>Alt+C</string>
+                    </property>
+                    <property name="checked">
+                        <bool>true</bool>
+                    </property>
+                </widget>
+                <widget class="QLayoutWidget" row="10" column="0" rowspan="1" \
colspan="3"> +                    <property name="name">
+                        <cstring>layout9</cstring>
+                    </property>
+                    <grid>
+                        <property name="name">
+                            <cstring>unnamed</cstring>
+                        </property>
+                        <spacer row="1" column="2">
+                            <property name="name">
+                                <cstring>spacer11_2</cstring>
+                            </property>
+                            <property name="orientation">
+                                <enum>Horizontal</enum>
+                            </property>
+                            <property name="sizeType">
+                                <enum>Expanding</enum>
+                            </property>
+                            <property name="sizeHint">
+                                <size>
+                                    <width>191</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
+                        <widget class="KColorButton" row="0" column="1">
+                            <property name="name">
+                                <cstring>kcfg_InactiveTaskTextColor</cstring>
+                            </property>
+                            <property name="text">
+                                <string></string>
+                            </property>
+                        </widget>
+                        <spacer row="0" column="2">
+                            <property name="name">
+                                <cstring>spacer11</cstring>
+                            </property>
+                            <property name="orientation">
+                                <enum>Horizontal</enum>
+                            </property>
+                            <property name="sizeType">
+                                <enum>Expanding</enum>
+                            </property>
+                            <property name="sizeHint">
+                                <size>
+                                    <width>191</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
+                        <widget class="KColorButton" row="2" column="1">
+                            <property name="name">
+                                <cstring>kcfg_TaskBackgroundColor</cstring>
+                            </property>
+                            <property name="text">
+                                <string></string>
+                            </property>
+                        </widget>
+                        <widget class="QLabel" row="2" column="0">
+                            <property name="name">
+                                <cstring>taskBackgroundColorLabel</cstring>
+                            </property>
+                            <property name="text">
+                                <string>&amp;Background color:</string>
+                            </property>
+                            <property name="buddy" stdset="0">
+                                <cstring>kcfg_TaskBackgroundColor</cstring>
+                            </property>
+                        </widget>
+                        <widget class="KColorButton" row="1" column="1">
+                            <property name="name">
+                                <cstring>kcfg_ActiveTaskTextColor</cstring>
+                            </property>
+                            <property name="text">
+                                <string></string>
+                            </property>
+                        </widget>
+                        <widget class="QLabel" row="0" column="0">
+                            <property name="name">
+                                <cstring>inactiveTaskTextColorLabel</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Inacti&amp;ve task text color:</string>
+                            </property>
+                            <property name="buddy" stdset="0">
+                                <cstring>kcfg_InactiveTaskTextColor</cstring>
+                            </property>
+                        </widget>
+                        <widget class="QLabel" row="1" column="0">
+                            <property name="name">
+                                <cstring>activeTaskTextColorLabel</cstring>
+                            </property>
+                            <property name="text">
+                                <string>Active task te&amp;xt color:</string>
+                            </property>
+                            <property name="buddy" stdset="0">
+                                <cstring>kcfg_ActiveTaskTextColor</cstring>
+                            </property>
+                        </widget>
+                        <spacer row="2" column="2">
+                            <property name="name">
+                                <cstring>spacer12</cstring>
+                            </property>
+                            <property name="orientation">
+                                <enum>Horizontal</enum>
+                            </property>
+                            <property name="sizeType">
+                                <enum>Expanding</enum>
+                            </property>
+                            <property name="sizeHint">
+                                <size>
+                                    <width>191</width>
+                                    <height>20</height>
+                                </size>
+                            </property>
+                        </spacer>
+                    </grid>
+                </widget>
                 <spacer row="1" column="0">
                     <property name="name">
                         <cstring>spacer2</cstring>
@@ -323,10 +458,16 @@
     <tabstop>kcfg_ShowAllWindows</tabstop>
     <tabstop>kcfg_SortByDesktop</tabstop>
     <tabstop>showAllScreens</tabstop>
+    <tabstop>kcfg_SortByApp</tabstop>
     <tabstop>kcfg_ShowOnlyIconified</tabstop>
     <tabstop>kcfg_ShowIcon</tabstop>
     <tabstop>kcfg_ShowWindowListBtn</tabstop>
     <tabstop>kcfg_GroupTasks</tabstop>
+    <tabstop>appearance</tabstop>
+    <tabstop>kcfg_UseCustomColors</tabstop>
+    <tabstop>kcfg_InactiveTaskTextColor</tabstop>
+    <tabstop>kcfg_ActiveTaskTextColor</tabstop>
+    <tabstop>kcfg_TaskBackgroundColor</tabstop>
     <tabstop>kcfg_LeftButtonAction</tabstop>
     <tabstop>kcfg_MiddleButtonAction</tabstop>
     <tabstop>kcfg_RightButtonAction</tabstop>
@@ -336,4 +477,9 @@
 </includes>
 <layoutdefaults spacing="3" margin="6"/>
 <layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
+<includehints>
+    <includehint>kcolorbutton.h</includehint>
+    <includehint>kcolorbutton.h</includehint>
+    <includehint>kcolorbutton.h</includehint>
+</includehints>
 </UI>
Index: kicker/taskbar/taskbar.kcfg
===================================================================
--- kicker/taskbar/taskbar.kcfg	(wersja 633266)
+++ kicker/taskbar/taskbar.kcfg	(kopia robocza)
@@ -149,5 +149,25 @@
             <label>Maximum width/height of the thumbnail in pixels</label>
             <whatsthis>A thumbnail is created by resizing the window. The scaling \
factor is determined by its largest dimension and this value. In doing so, the \
thumbnail's size will not exceed this value in any dimension.</whatsthis>  </entry>
+        <entry key="UseCustomColors" type="Bool" >
+            <default>false</default>
+            <label>Use custom colors for taskbar buttons text and background</label>
+            <whatsthis>Turning this option on will allow choosing your own colors \
for taskbar buttons text and background.</whatsthis> +        </entry>
+        <entry name="ActiveTaskTextColor" type="Color" >
+            <label>Color to use for active task button text</label>
+            <default code="true">QColor()</default>
+            <whatsthis>This color is used for displaying text on taskbar button for \
task which is active at the moment.</whatsthis> +        </entry>
+        <entry name="InactiveTaskTextColor" type="Color" >
+            <label>Color to use for inactive tasks button text</label>
+            <default code="true">QColor()</default>
+            <whatsthis>This color is used for displaying text on taskbar button for \
tasks other than active.</whatsthis> +        </entry>
+        <entry name="TaskBackgroundColor" type="Color" >
+            <label>Color to use for taskbar buttons background</label>
+            <default code="true">QColor()</default>
+            <whatsthis>This color is used for displaying background of taskbar \
buttons.</whatsthis> +        </entry>
     </group>
 </kcfg>
Index: kicker/taskbar/taskcontainer.cpp
===================================================================
--- kicker/taskbar/taskcontainer.cpp	(wersja 633266)
+++ kicker/taskbar/taskcontainer.cpp	(kopia robocza)
@@ -544,6 +544,15 @@
     font.setBold(active);
 
     QColorGroup colors = palette().active();
+    
+    if (TaskBarSettings::useCustomColors())
+    {
+        colors.setColor( QColorGroup::Button, \
TaskBarSettings::taskBackgroundColor()); +        colors.setColor( \
QColorGroup::Background, TaskBarSettings::taskBackgroundColor() ); +        \
colors.setColor( QColorGroup::ButtonText, TaskBarSettings::inactiveTaskTextColor() ); \
+        colors.setColor( QColorGroup::Text, TaskBarSettings::inactiveTaskTextColor() \
); +    }
+    
     if (demandsAttention)
     {
         if (!drawButton)
@@ -682,7 +691,14 @@
         }
         else // hack for the dotNET style and others
         {
-            textPen = p->pen();
+            if (TaskBarSettings::useCustomColors())
+            {
+                textPen = QPen(TaskBarSettings::activeTaskTextColor());
+            }
+            else
+            {
+                textPen = p->pen();
+            }
         }
 
         int availableWidth = width() - (br.x() * 2) - textPos;


["signature.asc" (application/pgp-signature)]

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic