summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2013-10-28 11:02:52 +0100
committerSlávek Banko <slavek.banko@axis.cz>2013-10-28 11:04:56 +0100
commit7119c2b2688b9e7ece707a60f28028b36d1120f9 (patch)
treef2fd5d872dfe6d684ed31d5d2c24ac6ee39672aa
parentcbbc7ad02e978c5f2cb1e90338eab65996bc554e (diff)
downloadtdebase-7119c2b2688b9e7ece707a60f28028b36d1120f9.tar.gz
tdebase-7119c2b2688b9e7ece707a60f28028b36d1120f9.zip
Add option to display only icons on taskbar
This resolves Bug 360
-rw-r--r--kcontrol/taskbar/kcmtaskbar.cpp28
-rw-r--r--kcontrol/taskbar/kcmtaskbar.h8
-rw-r--r--kcontrol/taskbar/kcmtaskbarui.ui39
-rw-r--r--kicker/taskbar/taskbar.cpp120
-rw-r--r--kicker/taskbar/taskbar.h66
-rw-r--r--kicker/taskbar/taskbar.kcfg21
-rw-r--r--kicker/taskbar/taskcontainer.cpp316
7 files changed, 324 insertions, 274 deletions
diff --git a/kcontrol/taskbar/kcmtaskbar.cpp b/kcontrol/taskbar/kcmtaskbar.cpp
index bd98ee3f9..788187ca7 100644
--- a/kcontrol/taskbar/kcmtaskbar.cpp
+++ b/kcontrol/taskbar/kcmtaskbar.cpp
@@ -14,6 +14,12 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
+
+ --------------------------------------------------------------
+ Additional changes:
+ - 2013/10/22 Michele Calgaro
+ * added support for display mode (Icons and Text, Text only, Icons only)
+ and removed "Show application icons"
*/
#include <tqcheckbox.h>
@@ -151,6 +157,27 @@ TQStringList TaskbarConfig::i18nShowTaskStatesList()
return i18nList;
}
+// These are the strings that are actually stored in the config file.
+const TQStringList& TaskbarConfig::displayIconsNText()
+{
+ static TQStringList list(TQStringList()
+ << I18N_NOOP("Icons and Text")
+ << I18N_NOOP("Text only")
+ << I18N_NOOP("Icons only"));
+ return list;
+}
+
+// Get a translated version of the above string list.
+TQStringList TaskbarConfig::i18ndisplayIconsNText()
+{
+ TQStringList i18nList;
+ for (TQStringList::ConstIterator it = displayIconsNText().begin(); it != displayIconsNText().end(); ++it)
+ {
+ i18nList << i18n((*it).latin1());
+ }
+ return i18nList;
+}
+
TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringList& args)
: TDECModule(TaskBarFactory::instance(), parent, name),
m_settingsObject(NULL)
@@ -211,6 +238,7 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
m_widget->kcfg_LeftButtonAction->insertStringList(list);
m_widget->kcfg_MiddleButtonAction->insertStringList(list);
m_widget->kcfg_RightButtonAction->insertStringList(list);
+ m_widget->kcfg_DisplayIconsNText->insertStringList(i18ndisplayIconsNText());
m_widget->kcfg_GroupTasks->insertStringList(i18nGroupModeList());
m_widget->kcfg_ShowTaskStates->insertStringList(i18nShowTaskStatesList());
diff --git a/kcontrol/taskbar/kcmtaskbar.h b/kcontrol/taskbar/kcmtaskbar.h
index b0fe0c7ea..f14500a68 100644
--- a/kcontrol/taskbar/kcmtaskbar.h
+++ b/kcontrol/taskbar/kcmtaskbar.h
@@ -14,6 +14,12 @@
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
+
+ --------------------------------------------------------------
+ Additional changes:
+ - 2013/10/22 Michele Calgaro
+ * added support for display mode (Icons and Text, Text only, Icons only)
+ and removed "Show application icons"
*/
#ifndef __kcmtaskbar_h__
@@ -84,6 +90,8 @@ private:
static TQStringList i18nGroupModeList();
static const TQStringList& showTaskStatesList();
static TQStringList i18nShowTaskStatesList();
+ static const TQStringList& displayIconsNText();
+ static TQStringList i18ndisplayIconsNText();
TaskbarConfigUI *m_widget;
TQString m_configFileName;
TaskBarSettings* m_settingsObject;
diff --git a/kcontrol/taskbar/kcmtaskbarui.ui b/kcontrol/taskbar/kcmtaskbarui.ui
index 4d655b2a7..d136fe50e 100644
--- a/kcontrol/taskbar/kcmtaskbarui.ui
+++ b/kcontrol/taskbar/kcmtaskbarui.ui
@@ -144,7 +144,7 @@ By default, this option is selected and all windows are shown.</string>
<string>Turning this option on will allow tasks on the taskbar to be manually rearranged using drag and drop.</string>
</property>
</widget>
- <widget class="TQCheckBox" row="8" column="0" rowspan="1" colspan="3">
+ <widget class="TQCheckBox" row="7" column="0" rowspan="1" colspan="3">
<property name="name">
<cstring>kcfg_ShowWindowListBtn</cstring>
</property>
@@ -180,13 +180,13 @@ By default the taskbar groups windows when it is full.</string>
</widget>
<widget class="TQLabel" row="9" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>groupTasksLabel</cstring>
+ <cstring>groupTasksLabel</cstring>
</property>
<property name="text">
<string>&amp;Group similar tasks:</string>
</property>
<property name="buddy" stdset="0">
- <cstring>kcfg_ShowTaskStates</cstring>
+ <cstring>kcfg_GroupTasks</cstring>
</property>
</widget>
<widget class="TQComboBox" row="10" column="2">
@@ -202,7 +202,7 @@ By default the taskbar groups windows when it is full.</string>
</sizepolicy>
</property>
<property name="whatsThis" stdset="0">
- <string>The taskbar can show and/or hide tasks based on their current process state. Select &lt;em&gt;Any&lt;/em&gt; to show all tasks regardless of current state.</string>
+ <string>The taskbar can show and/or hide tasks based on their current process state. Select &lt;em&gt;Any&lt;/em&gt; to show all tasks regardless of current state.</string>
</property>
</widget>
<widget class="TQLabel" row="10" column="0" rowspan="1" colspan="2">
@@ -210,7 +210,7 @@ By default the taskbar groups windows when it is full.</string>
<cstring>showTaskStatesLabel</cstring>
</property>
<property name="text">
- <string>&amp;Show tasks with state:</string>
+ <string>&amp;Show tasks with state:</string>
</property>
<property name="buddy" stdset="0">
<cstring>kcfg_ShowTaskStates</cstring>
@@ -229,20 +229,31 @@ By default the taskbar groups windows when it is full.</string>
By default, this option is not selected and the taskbar will show all windows.</string>
</property>
</widget>
- <widget class="TQCheckBox" row="7" column="0" rowspan="1" colspan="3">
+ <widget class="TQLabel" row="8" column="0" rowspan="1" colspan="2">
<property name="name">
- <cstring>kcfg_ShowIcon</cstring>
+ <cstring>displayIconsNText</cstring>
</property>
<property name="text">
- <string>Sho&amp;w application icons</string>
+ <string>Dis&amp;play:</string>
</property>
- <property name="checked">
- <bool>true</bool>
+ <property name="buddy" stdset="0">
+ <cstring>kcfg_DisplayIconsNText</cstring>
+ </property>
+ </widget>
+ <widget class="TQComboBox" row="8" column="2">
+ <property name="name">
+ <cstring>kcfg_DisplayIconsNText</cstring>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy>
+ <hsizetype>7</hsizetype>
+ <vsizetype>0</vsizetype>
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
<property name="whatsThis" stdset="0">
- <string>Select this option if you want window icons to appear along with their titles in the taskbar.
-
-By default this option is selected.</string>
+ <string>Choose taskbar display mode among &lt;strong&gt;Icons and text&lt;/strong&gt;, &lt;strong&gt;Text only&lt;/strong&gt; and &lt;strong&gt;Icons only&lt;/strong&gt;.</string>
</property>
</widget>
<widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="3">
@@ -568,8 +579,8 @@ By default, this option is selected and all windows are shown.</string>
<tabstop>showAllScreens</tabstop>
<tabstop>kcfg_SortByApp</tabstop>
<tabstop>kcfg_ShowOnlyIconified</tabstop>
- <tabstop>kcfg_ShowIcon</tabstop>
<tabstop>kcfg_ShowWindowListBtn</tabstop>
+ <tabstop>kcfg_DisplayIconsNText</tabstop>
<tabstop>kcfg_GroupTasks</tabstop>
<tabstop>kcfg_ShowTaskStates</tabstop>
<tabstop>appearance</tabstop>
diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp
index ad68f1c8f..d89149b13 100644
--- a/kicker/taskbar/taskbar.cpp
+++ b/kicker/taskbar/taskbar.cpp
@@ -20,8 +20,13 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*****************************************************************
-******************************************************************/
+ Additional changes:
+ - 2013/10/22 Michele Calgaro
+ * added support for display mode (Icons and Text, Text only, Icons only)
+ and removed "Show application icons"
+*/
#include <math.h>
@@ -58,7 +63,7 @@ TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettin
m_currentScreen(-1),
m_showOnlyCurrentScreen(false),
m_sortByDesktop(false),
- m_showIcon(false),
+ m_displayIconsNText(settingsObject->DisplayIconsAndText),
m_showOnlyIconified(false),
m_showTaskStates(0),
m_textShadowEngine(0),
@@ -196,66 +201,47 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
if ( p == KPanelExtension::Left || p == KPanelExtension::Right )
{
- int actualMax = minButtonHeight * containerCount();
-
- if (containerCount() == 0)
- {
- actualMax = minButtonHeight;
- }
-
- if (actualMax > maxSize.height())
- {
+ // Vertical layout
+ // Minimum space allows for one icon, the window list button and the up/down scrollers
+ int minHeight = minButtonHeight*3;
+ if (minHeight > maxSize.height())
return maxSize;
- }
- return TQSize( maxSize.width(), actualMax );
+ return TQSize(maxSize.width(), minHeight);
}
else
{
- int rows = KickerSettings::conserveSpace() ?
- contentsRect().height() / minButtonHeight :
- 1;
- if ( rows < 1 )
- {
- rows = 1;
- }
-
- int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
- if (maxWidth == 0)
- {
- maxWidth = BUTTON_MAX_WIDTH;
- }
-
- int actualMax = maxWidth * (containerCount() / rows);
-
- if (containerCount() % rows > 0)
- {
- actualMax += maxWidth;
- }
- if (containerCount() == 0)
- {
- actualMax = maxWidth;
- }
-
- if (actualMax > maxSize.width())
- {
- return maxSize;
- }
- return TQSize( actualMax, maxSize.height() );
+ // Horizontal layout
+ // Minimum space allows for one column of icons, the window list button and the left/right scrollers
+ int min_width=BUTTON_MIN_WIDTH*3;
+ if (min_width > maxSize.width())
+ return maxSize;
+ return TQSize(min_width, maxSize.height());
}
}
+bool TaskBar::showIcons() const
+{
+ return (m_displayIconsNText==m_settingsObject->DisplayIconsAndText ||
+ m_displayIconsNText==m_settingsObject->DisplayIconsOnly);
+}
+bool TaskBar::showText() const
+{
+ return (m_displayIconsNText==m_settingsObject->DisplayIconsAndText ||
+ m_displayIconsNText==m_settingsObject->DisplayTextOnly);
+}
+
void TaskBar::configure()
{
bool wasShowWindows = m_showAllWindows;
bool wasSortByDesktop = m_sortByDesktop;
bool wasCycleWheel = m_cycleWheel;
- bool wasShowIcon = m_showIcon;
+ bool wasDisplayIconsNText = m_displayIconsNText;
bool wasShowOnlyIconified = m_showOnlyIconified;
int wasShowTaskStates = m_showTaskStates;
m_showAllWindows = READ_MERGED_TASBKAR_SETTING(showAllWindows);
m_sortByDesktop = m_showAllWindows && READ_MERGED_TASBKAR_SETTING(sortByDesktop);
- m_showIcon = READ_MERGED_TASBKAR_SETTING(showIcon);
+ m_displayIconsNText = READ_MERGED_TASBKAR_SETTING(displayIconsNText);
m_showOnlyIconified = READ_MERGED_TASBKAR_SETTING(showOnlyIconified);
m_cycleWheel = READ_MERGED_TASBKAR_SETTING(cycleWheel);
m_showTaskStates = READ_MERGED_TASBKAR_SETTING(showTaskStates);
@@ -280,7 +266,7 @@ void TaskBar::configure()
if (wasShowWindows != m_showAllWindows ||
wasSortByDesktop != m_sortByDesktop ||
- wasShowIcon != m_showIcon ||
+ wasDisplayIconsNText != m_displayIconsNText ||
wasCycleWheel != m_cycleWheel ||
wasShowOnlyIconified != m_showOnlyIconified ||
wasShowTaskStates != m_showTaskStates)
@@ -757,25 +743,18 @@ void TaskBar::reLayout()
// horizontal layout
if (orientation() == Qt::Horizontal)
{
- int bwidth = BUTTON_MIN_WIDTH;
+ int bwidth=BUTTON_MIN_WIDTH;
int rows = contentsRect().height() / minButtonHeight;
-
- if ( rows < 1 )
- {
- rows = 1;
- }
+ if (rows<1)
+ rows=1;
// actual button height
int bheight = contentsRect().height() / rows;
-
- // avoid zero devision later
- if (bheight < 1)
- {
- bheight = 1;
- }
+ if (bheight<1) // avoid zero devision later
+ bheight=1;
// buttons per row
- int bpr = (int)ceil( (double)list.count() / rows);
+ int bpr = static_cast<int>(ceil(static_cast<double>(list.count()) / rows));
// adjust content size
if ( contentsRect().width() < bpr * BUTTON_MIN_WIDTH )
@@ -786,10 +765,11 @@ void TaskBar::reLayout()
// maximum number of buttons per row
int mbpr = contentsRect().width() / BUTTON_MIN_WIDTH;
- // expand button width if space permits
+ // expand button width if space permits and the taskbar is not in 'icons only' mode
if (mbpr > bpr)
{
- bwidth = contentsRect().width() / bpr;
+ if (!showIcons() || showText())
+ bwidth = contentsRect().width() / bpr;
int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
if (maxWidth > 0 && bwidth > maxWidth)
{
@@ -840,10 +820,12 @@ void TaskBar::reLayout()
}
else // vertical layout
{
+ // Adjust min button height to keep gaps into account
+ int minButtonHeightAdjusted=minButtonHeight+4;
// adjust content size
- if (contentsRect().height() < (int)list.count() * minButtonHeight)
+ if (contentsRect().height() < (int)list.count() * minButtonHeightAdjusted)
{
- resizeContents(contentsRect().width(), list.count() * minButtonHeight);
+ resizeContents(contentsRect().width(), list.count() * minButtonHeightAdjusted);
}
// layout containers
@@ -856,11 +838,11 @@ void TaskBar::reLayout()
c->setArrowType(arrowType);
- if (c->width() != contentsRect().width() || c->height() != minButtonHeight)
- c->resize(contentsRect().width(), minButtonHeight);
+ if (c->width() != contentsRect().width() || c->height() != minButtonHeightAdjusted)
+ c->resize(contentsRect().width(), minButtonHeightAdjusted);
- if (childX(c) != 0 || childY(c) != (i * minButtonHeight))
- moveChild(c, 0, i * minButtonHeight);
+ if (childX(c) != 0 || childY(c) != (i * minButtonHeightAdjusted))
+ moveChild(c, 0, i * minButtonHeightAdjusted);
c->setBackground();
i++;
@@ -1041,8 +1023,8 @@ int TaskBar::maximumButtonsWithoutShrinking() const
bool TaskBar::shouldGroup() const
{
return READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupAlways ||
- (READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull &&
- taskCount() > maximumButtonsWithoutShrinking());
+ ((READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull &&
+ taskCount() > maximumButtonsWithoutShrinking()));
}
void TaskBar::reGroup()
diff --git a/kicker/taskbar/taskbar.h b/kicker/taskbar/taskbar.h
index 8c1c42e93..111554014 100644
--- a/kicker/taskbar/taskbar.h
+++ b/kicker/taskbar/taskbar.h
@@ -19,7 +19,13 @@ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-******************************************************************/
+*****************************************************************
+
+ Additional changes:
+ - 2013/10/22 Michele Calgaro
+ * added support for display mode (Icons and Text, Text only, Icons only)
+ and removed "Show application icons"
+*/
#ifndef __taskbar_h__
#define __taskbar_h__
@@ -31,9 +37,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "panner.h"
#include "kshadowengine.h"
-#define WINDOWLISTBUTTON_SIZE 15
-#define BUTTON_MAX_WIDTH 200
-#define BUTTON_MIN_WIDTH 20
+const int WINDOWLISTBUTTON_SIZE = 15;
+const int BUTTON_MAX_WIDTH = 200;
+const int BUTTON_MIN_WIDTH = 24; // 24 = 4+2+16+2 -> Space for borders, application icon and gaps
class Startup;
class Task;
@@ -85,7 +91,8 @@ public:
int taskCount() const;
int showScreen() const;
- bool showIcon() const { return m_showIcon; }
+ bool showIcons() const;
+ bool showText() const;
bool sortByDesktop() const { return m_sortByDesktop; }
bool showAllWindows() const { return m_showAllWindows; }
@@ -140,31 +147,30 @@ private:
void sortContainersByDesktop(TaskContainer::List& list);
void setViewportBackground();
- bool blocklayout;
- bool m_showAllWindows;
- bool m_cycleWheel;
- // The screen to show, -1 for all screens
- int m_currentScreen;
- bool m_showOnlyCurrentScreen;
- bool m_sortByDesktop;
- bool m_showIcon;
- bool m_showOnlyIconified;
- int m_showTaskStates;
- ArrowType arrowType;
- TaskContainer::List containers;
- TaskContainer::List m_hiddenContainers;
- TaskContainer::List m_deletableContainers;
- PixmapList frames;
- int maximumButtonsWithoutShrinking() const;
- bool shouldGroup() const;
- bool isGrouping;
- void reGroup();
- TDEGlobalAccel* keys;
- KTextShadowEngine* m_textShadowEngine;
- bool m_ignoreUpdates;
- bool m_sortByAppPrev;
- TQTimer m_relayoutTimer;
- TQImage m_blendGradient;
+ bool blocklayout;
+ bool m_showAllWindows;
+ bool m_cycleWheel;
+ int m_currentScreen; // The screen to show, -1 for all screens
+ bool m_showOnlyCurrentScreen;
+ bool m_sortByDesktop;
+ int m_displayIconsNText;
+ bool m_showOnlyIconified;
+ int m_showTaskStates;
+ ArrowType arrowType;
+ TaskContainer::List containers;
+ TaskContainer::List m_hiddenContainers;
+ TaskContainer::List m_deletableContainers;
+ PixmapList frames;
+ int maximumButtonsWithoutShrinking() const;
+ bool shouldGroup() const;
+ bool isGrouping;
+ void reGroup();
+ TDEGlobalAccel* keys;
+ KTextShadowEngine* m_textShadowEngine;
+ bool m_ignoreUpdates;
+ bool m_sortByAppPrev;
+ TQTimer m_relayoutTimer;
+ TQImage m_blendGradient;
TaskBarSettings* m_settingsObject;
TaskBarSettings* m_globalSettingsObject;
};
diff --git a/kicker/taskbar/taskbar.kcfg b/kicker/taskbar/taskbar.kcfg
index 320b8a2d6..95596ad34 100644
--- a/kicker/taskbar/taskbar.kcfg
+++ b/kicker/taskbar/taskbar.kcfg
@@ -31,6 +31,22 @@
<label>Show only minimized windows</label>
<whatsthis>Select this option if you want the taskbar to display <b>only</b> minimized windows. By default, this option is not selected and the taskbar will show all windows.</whatsthis>
</entry>
+ <entry key="DisplayIconsNText" type="Enum" >
+ <choices>
+ <choice name="DisplayIconsAndText">
+ <label>Never</label>
+ </choice>
+ <choice name="DisplayTextOnly">
+ <label>When Taskbar Full</label>
+ </choice>
+ <choice name="DisplayIconsOnly">
+ <label>Always</label>
+ </choice>
+ </choices>
+ <default>DisplayIconsAndText</default>
+ <label>Display:</label>
+ <whatsthis>Choose taskbar display mode among <strong>Icons and text</strong>, <strong>Text only</strong> and <strong>Icons only</strong></whatsthis>
+ </entry>
<entry key="GroupTasks" type="Enum" >
<choices>
<choice name="GroupNever">
@@ -73,11 +89,6 @@
<label>Sort windows by application</label>
<whatsthis>Selecting this option causes the taskbar to show windows ordered by application. By default this option is selected.</whatsthis>
</entry>
- <entry key="ShowIcon" type="Bool" >
- <default>true</default>
- <label>Show application icons</label>
- <whatsthis>Select this option if you want window icons to appear along with their titles in the taskbar. By default this option is selected.</whatsthis>
- </entry>
<entry key="MaximumButtonWidth" type="Int" >
<default>200</default>
<min>0</min>
diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp
index fa3b560a8..860c231bb 100644
--- a/kicker/taskbar/taskcontainer.cpp
+++ b/kicker/taskbar/taskcontainer.cpp
@@ -21,7 +21,13 @@ AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-******************************************************************/
+*****************************************************************
+
+ Additional changes:
+ - 2013/10/22 Michele Calgaro
+ * added support for display mode (Icons and Text, Text only, Icons only)
+ and removed "Show application icons"
+*/
#include <assert.h>
@@ -216,7 +222,7 @@ TaskContainer::~TaskContainer()
void TaskContainer::showMe()
{
- if(!frames.isEmpty() && taskBar->showIcon())
+ if(!frames.isEmpty() && taskBar->showIcons())
animationTimer.start(100);
emit showMe(this);
@@ -307,28 +313,30 @@ void TaskContainer::setLastActivated()
void TaskContainer::animationTimerFired()
{
- if (!frames.isEmpty() && taskBar->showIcon() && frames.at(currentFrame) != frames.end())
+ if (!frames.isEmpty() && taskBar->showIcons() && frames.at(currentFrame) != frames.end())
{
- TQPixmap *pm = *frames.at(currentFrame);
+ TQPixmap *pm = *frames.at(currentFrame);
- // draw pixmap
- if ( pm && !pm->isNull() ) {
+ // draw pixmap
+ if ( pm && !pm->isNull() )
+ {
// we only have to redraw the background for frames 0, 8 and 9
- if ( currentFrame == 0 || currentFrame > 7 ) {
- // double buffered painting
- TQPixmap composite( animBg );
- bitBlt( &composite, 0, 0, pm );
- bitBlt( this, iconRect.x(), iconRect.y(), &composite );
- }
- else
- bitBlt( this, iconRect.x(), iconRect.y(), pm );
- }
-
- // increment frame counter
- if ( currentFrame >= 9)
- currentFrame = 0;
- else
- currentFrame++;
+ if ( currentFrame == 0 || currentFrame > 7 )
+ {
+ // double buffered painting
+ TQPixmap composite( animBg );
+ bitBlt( &composite, 0, 0, pm );
+ bitBlt( this, iconRect.x(), iconRect.y(), &composite );
+ }
+ else
+ bitBlt( this, iconRect.x(), iconRect.y(), pm );
+ }
+
+ // increment frame counter
+ if ( currentFrame >= 9)
+ currentFrame = 0;
+ else
+ currentFrame++;
}
}
@@ -686,151 +694,147 @@ void TaskContainer::drawButton(TQPainter *p)
p->translate(shift.x(), shift.y());
}
- if (taskBar->showIcon())
- {
- if (pixmap.isNull() && m_startup)
- {
- pixmap = SmallIcon(m_startup->icon());
- }
-
- if ( !pixmap.isNull() )
+ TQString text = name(); // find text
+ int textPos = ( taskBar->showIcons() && (!pixmap.isNull() || m_startup)) ? 2 + 16 + 2 : 0;
+
+ // show icons
+ if (taskBar->showIcons())
+ {
+ if (pixmap.isNull() && m_startup)
+ pixmap = SmallIcon(m_startup->icon());
+
+ if ( !pixmap.isNull() )
+ {
+ // make sure it is no larger than 16x16
+ if ( pixmap.width() > 16 || pixmap.height() > 16 )
+ {
+ TQImage tmp = pixmap.convertToImage();
+ pixmap.convertFromImage( tmp.smoothScale( 16, 16 ) );
+ }
+
+ // fade out the icon when minimized
+ if (iconified)
+ TDEIconEffect::semiTransparent( pixmap );
+
+ // draw icon
+ TQRect pmr(0, 0, pixmap.width(), pixmap.height());
+ pmr.moveCenter(iconRect.center());
+ p->drawPixmap(pmr, pixmap);
+ }
+
+ // modified overlay icon
+ if (taskBar->showText())
+ {
+ static TQString modStr = "[" + i18n( "modified" ) + "]";
+ int modStrPos = text.find( modStr );
+ if (modStrPos >= 0)
{
- // make sure it is no larger than 16x16
- if ( pixmap.width() > 16 || pixmap.height() > 16 )
- {
- TQImage tmp = pixmap.convertToImage();
- pixmap.convertFromImage( tmp.smoothScale( 16, 16 ) );
- }
-
- // fade out the icon when minimized
+ // +1 because we include a space after the closing brace.
+ text.remove(modStrPos, modStr.length() + 1);
+ TQPixmap modPixmap = SmallIcon("modified");
+
+ // draw modified overlay
+ if (!modPixmap.isNull())
+ {
+ TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos,(height() - 16) / 2, 16, 16), this);
if (iconified)
{
- TDEIconEffect::semiTransparent( pixmap );
+ TDEIconEffect::semiTransparent(modPixmap);
}
-
- // draw icon
- TQRect pmr(0, 0, pixmap.width(), pixmap.height());
- pmr.moveCenter(iconRect.center());
- p->drawPixmap(pmr, pixmap);
- }
- }
-
- // find text
- TQString text = name();
-
- // modified overlay
- static TQString modStr = "[" + i18n( "modified" ) + "]";
- int modStrPos = text.find( modStr );
- int textPos = ( taskBar->showIcon() && (!pixmap.isNull() || m_startup)) ? 2 + 16 + 2 : 0;
-
- if (modStrPos >= 0)
- {
- // +1 because we include a space after the closing brace.
- text.remove(modStrPos, modStr.length() + 1);
- TQPixmap modPixmap = SmallIcon("modified");
-
- // draw modified overlay
- if (!modPixmap.isNull())
- {
- TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos,
- (height() - 16) / 2, 16, 16),
- this);
-
- if (iconified)
- {
- TDEIconEffect::semiTransparent(modPixmap);
- }
-
p->drawPixmap(r, modPixmap);
textPos += 16 + 2;
+ }
}
+ }
}
// draw text
- if (!text.isEmpty())
- {
- TQRect tr = TQStyle::visualRect(TQRect(br.x() + textPos + 1, 0,
- width() - textPos, height()),
- this);
- int textFlags = AlignVCenter | SingleLine;
- textFlags |= reverse ? AlignRight : AlignLeft;
- TQPen textPen;
-
- // get the color for the text label
- if (iconified)
- {
- textPen = TQPen(KickerLib::blendColors(colors.button(), colors.buttonText()));
- }
- else if (!active)
- {
- textPen = TQPen(colors.buttonText());
- }
- else // hack for the dotNET style and others
- {
- if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
- {
- textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor));
- }
- else
- {
- textPen = TQPen(colors.buttonText()); // textPen = p->pen();
- }
- }
-
- int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
- if (m_filteredTasks.count() > 1)
- {
- availableWidth -= 8;
- }
-
- if (TQFontMetrics(font).width(text) > availableWidth)
- {
- // draw text into overlay pixmap
- TQPixmap tpm(*pm);
- TQPainter tp(&tpm);
-
- if (sunken)
- {
- tp.translate(shift.x(), shift.y());
- }
-
- tp.setFont(font);
- tp.setPen(textPen);
-
- if (halo)
- {
- taskBar->textShadowEngine()->drawText(tp, tr, textFlags, text, size());
- }
- else
- {
- tp.drawText(tr, textFlags, text);
- }
-
- // blend text into background image
- TQImage img = pm->convertToImage();
- TQImage timg = tpm.convertToImage();
- KImageEffect::blend(img, timg, *taskBar->blendGradient(size()), KImageEffect::Red);
-
- // End painting before assigning the pixmap
- TQPaintDevice* opd = p->device();
- p->end();
- pm->convertFromImage(img);
- p->begin(opd ,this);
- }
- else
- {
- p->setFont(font);
- p->setPen(textPen);
-
- if (halo)
- {
- taskBar->textShadowEngine()->drawText(*p, tr, textFlags, text, size());
- }
- else
- {
- p->drawText(tr, textFlags, text);
- }
- }
+ if (taskBar->showText())
+ {
+ if (!text.isEmpty())
+ {
+ TQRect tr = TQStyle::visualRect(TQRect(br.x() + textPos + 1, 0,
+ width() - textPos, height()), this);
+ int textFlags = AlignVCenter | SingleLine;
+ textFlags |= reverse ? AlignRight : AlignLeft;
+ TQPen textPen;
+
+ // get the color for the text label
+ if (iconified)
+ {
+ textPen = TQPen(KickerLib::blendColors(colors.button(), colors.buttonText()));
+ }
+ else if (!active)
+ {
+ textPen = TQPen(colors.buttonText());
+ }
+ else // hack for the dotNET style and others
+ {
+ if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
+ {
+ textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor));
+ }
+ else
+ {
+ textPen = TQPen(colors.buttonText()); // textPen = p->pen();
+ }
+ }
+
+ int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
+ if (m_filteredTasks.count() > 1)
+ {
+ availableWidth -= 8;
+ }
+
+ if (TQFontMetrics(font).width(text) > availableWidth)
+ {
+ // draw text into overlay pixmap
+ TQPixmap tpm(*pm);
+ TQPainter tp(&tpm);
+
+ if (sunken)
+ {
+ tp.translate(shift.x(), shift.y());
+ }
+
+ tp.setFont(font);
+ tp.setPen(textPen);
+
+ if (halo)
+ {
+ taskBar->textShadowEngine()->drawText(tp, tr, textFlags, text, size());
+ }
+ else
+ {
+ tp.drawText(tr, textFlags, text);
+ }
+
+ // blend text into background image
+ TQImage img = pm->convertToImage();
+ TQImage timg = tpm.convertToImage();
+ KImageEffect::blend(img, timg, *taskBar->blendGradient(size()), KImageEffect::Red);
+
+ // End painting before assigning the pixmap
+ TQPaintDevice* opd = p->device();
+ p->end();
+ pm->convertFromImage(img);
+ p->begin(opd ,this);
+ }
+ else
+ {
+ p->setFont(font);
+ p->setPen(textPen);
+
+ if (halo)
+ {
+ taskBar->textShadowEngine()->drawText(*p, tr, textFlags, text, size());
+ }
+ else
+ {
+ p->drawText(tr, textFlags, text);
+ }
+ }
+ }
}
if (!frames.isEmpty() && m_startup && frames.at(currentFrame) != frames.end())