summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMavridis Philippe <mavridisf@gmail.com>2022-04-15 19:26:19 +0300
committerMichele Calgaro <michele.calgaro@yahoo.it>2022-09-05 12:48:59 +0900
commit74466041a674faaaf22f586968f275e2606e08fe (patch)
treea76f24d46dea0847ccad7146be17053ca0f43d81
parent80592938130c5f3eb0406c98a6a0942a495c54d5 (diff)
downloadtdebase-74466041a674faaaf22f586968f275e2606e08fe.tar.gz
tdebase-74466041a674faaaf22f586968f275e2606e08fe.zip
Taskbar: small/panel icon size selection.
By default the 16x16 value was hardcoded into the taskbar, which is not correct. With this commit the default value is TDEIcon::Small (can be defined in TCC->LookNFeel->Icons) to retain the "classic" style. This commit adds a "Small icons" checkbox which can be unchecked to set the icon size to TDEIcon::Panel (for consistency with other panel icons). Combined with "Icons only", this produces a Plasma/Windows-like big icon taskbar. This commit also ensures that in "Icons only" mode the icons are centered in their button, for better looking result. Finally, this commit fixes a typo in some macros (TABSKAR -> TASKBAR). Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
-rw-r--r--kcontrol/taskbar/kcmtaskbar.cpp20
-rw-r--r--kcontrol/taskbar/kcmtaskbarui.ui78
-rw-r--r--kicker/taskbar/taskbar.cpp89
-rw-r--r--kicker/taskbar/taskbar.h3
-rw-r--r--kicker/taskbar/taskbar.kcfg3
-rw-r--r--kicker/taskbar/taskcontainer.cpp123
-rw-r--r--kicker/taskbar/taskcontainer.h1
7 files changed, 176 insertions, 141 deletions
diff --git a/kcontrol/taskbar/kcmtaskbar.cpp b/kcontrol/taskbar/kcmtaskbar.cpp
index f2997a331..bb7a7a8b9 100644
--- a/kcontrol/taskbar/kcmtaskbar.cpp
+++ b/kcontrol/taskbar/kcmtaskbar.cpp
@@ -36,6 +36,7 @@
#include <twin.h>
#include <kcolorbutton.h>
#include <kstandarddirs.h>
+#include <kiconloader.h>
#define protected public
#include "kcmtaskbarui.h"
@@ -262,6 +263,7 @@ TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringL
m_widget->showAllScreens->show();
}
connect( m_widget->showAllScreens, TQT_SIGNAL( stateChanged( int )), TQT_SLOT( changed()));
+ connect( m_widget->smallIcons, TQT_SIGNAL(toggled(bool)), TQT_SLOT(changed()) );
TDEAboutData *about = new TDEAboutData(I18N_NOOP("kcmtaskbar"),
I18N_NOOP("TDE Taskbar Control Module"),
@@ -423,20 +425,36 @@ void TaskbarConfig::load()
slotUpdateComboBox();
updateAppearanceCombo();
m_widget->showAllScreens->setChecked(!m_settingsObject->showCurrentScreenOnly());
+
+ int iconSize = m_settingsObject->iconSize();
+ if(kapp->iconLoader()->currentSize(TDEIcon::Small) != iconSize)
+ {
+ m_widget->smallIcons->setChecked(false);
+ }
}
void TaskbarConfig::save()
{
TDECModule::save();
+ if(m_widget->smallIcons->isChecked())
+ {
+ m_settingsObject->setIconSize(kapp->iconLoader()->currentSize(TDEIcon::Small));
+ }
+ else
+ {
+ m_settingsObject->setIconSize(kapp->iconLoader()->currentSize(TDEIcon::Panel));
+ }
+
m_settingsObject->setShowCurrentScreenOnly(!m_widget->showAllScreens->isChecked());
int selectedAppearance = m_widget->appearance->currentItem();
if (selectedAppearance < (int)m_appearances.count())
{
m_appearances[selectedAppearance].alterSettings();
- m_settingsObject->writeConfig();
}
+ m_settingsObject->writeConfig();
+
TQByteArray data;
kapp->dcopClient()->emitDCOPSignal("kdeTaskBarConfigChanged()", data);
}
diff --git a/kcontrol/taskbar/kcmtaskbarui.ui b/kcontrol/taskbar/kcmtaskbarui.ui
index 5723c76d7..ae4f4531d 100644
--- a/kcontrol/taskbar/kcmtaskbarui.ui
+++ b/kcontrol/taskbar/kcmtaskbarui.ui
@@ -667,48 +667,6 @@ By default the taskbar groups windows when it is full.</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="4">
- <property name="name">
- <cstring>kcfg_ShowThumbnails</cstring>
- </property>
- <property name="text">
- <string>Show thumbnails on hover</string>
- </property>
- </widget>
- <spacer row="3" column="0">
- <property name="name">
- <cstring>spacer2_2_2_3</cstring>
- </property>
- <property name="orientation">
- <enum>Horizontal</enum>
- </property>
- <property name="sizeType">
- <enum>Fixed</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- <spacer row="1" column="1">
- <property name="name">
- <cstring>spacer2_2_2_3_2</cstring>
- </property>
- <property name="orientation">
- <enum>Vertical</enum>
- </property>
- <property name="sizeType">
- <enum>Fixed</enum>
- </property>
- <property name="sizeHint">
- <size>
- <width>20</width>
- <height>16</height>
- </size>
- </property>
- </spacer>
<widget class="TQLabel" row="0" column="0" rowspan="1" colspan="2">
<property name="name">
<cstring>displayIconsNTextLabel</cstring>
@@ -734,6 +692,14 @@ By default the taskbar groups windows when it is full.</string>
<cstring>kcfg_DisplayIconsNText</cstring>
</property>
</widget>
+ <widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="4">
+ <property name="name">
+ <cstring>kcfg_ShowThumbnails</cstring>
+ </property>
+ <property name="text">
+ <string>Show thumbnails on hover</string>
+ </property>
+ </widget>
<widget class="TQSpinBox" row="3" column="3">
<property name="name">
<cstring>kcfg_ThumbnailMaxDimension</cstring>
@@ -754,6 +720,23 @@ By default the taskbar groups windows when it is full.</string>
<number>100</number>
</property>
</widget>
+ <spacer row="3" column="0">
+ <property name="name">
+ <cstring>spacer2_2_2_3</cstring>
+ </property>
+ <property name="orientation">
+ <enum>Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>Fixed</enum>
+ </property>
+ <property name="sizeHint">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
<widget class="TQLabel" row="3" column="1" rowspan="1" colspan="2">
<property name="name">
<cstring>thumbMaxDimensionLabel</cstring>
@@ -765,6 +748,17 @@ By default the taskbar groups windows when it is full.</string>
<string>Maximum dimension:</string>
</property>
</widget>
+ <widget class="TQCheckBox" row="1" column="2">
+ <property name="name">
+ <cstring>smallIcons</cstring>
+ </property>
+ <property name="text">
+ <string>Small icons</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
</grid>
</widget>
<widget class="TQButtonGroup" row="0" column="0">
diff --git a/kicker/taskbar/taskbar.cpp b/kicker/taskbar/taskbar.cpp
index 29c06da89..ed6c985be 100644
--- a/kicker/taskbar/taskbar.cpp
+++ b/kicker/taskbar/taskbar.cpp
@@ -49,7 +49,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskbar.h"
#include "taskbar.moc"
-#define READ_MERGED_TASBKAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
+#define READ_MERGED_TASKBAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettingsObject, TQWidget *parent, const char *name )
: Panner( parent, name ),
@@ -81,7 +81,7 @@ TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettin
// init
setSizePolicy( TQSizePolicy( TQSizePolicy::Expanding, TQSizePolicy::Expanding ) );
- m_sortByAppPrev = READ_MERGED_TASBKAR_SETTING(sortByApp);
+ m_sortByAppPrev = READ_MERGED_TASKBAR_SETTING(sortByApp);
// setup animation frames
for (int i = 1; i < 11; i++)
@@ -174,31 +174,40 @@ KTextShadowEngine *TaskBar::textShadowEngine()
return m_textShadowEngine;
}
-
-TQSize TaskBar::sizeHint() const
+int TaskBar::buttonHeight() const
{
- // get our minimum height based on the minimum button height or the
- // height of the font in use, which is largest
TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ int bh = TQMAX(fm.height(), READ_MERGED_TASKBAR_SETTING(minimumButtonHeight));
+
+ if(showIcons())
+ {
+ bh = TQMAX(bh, READ_MERGED_TASKBAR_SETTING(iconSize));
+ }
+
+ return bh + 2;
+}
+
+int TaskBar::buttonWidth() const
+{
+ return TQMAX(BUTTON_MIN_WIDTH, READ_MERGED_TASKBAR_SETTING(iconSize)) + 2;
+}
- return TQSize(BUTTON_MIN_WIDTH, minButtonHeight);
+
+TQSize TaskBar::sizeHint() const
+{
+ return TQSize(buttonWidth(), buttonHeight());
}
TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
{
- // get our minimum height based on the minimum button height or the
- // height of the font in use, which is largest
- TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ // get our minimum height based on the minimum button height, the icon size or the
+ // height of the font in use, whichever is largest
if ( p == KPanelExtension::Left || p == KPanelExtension::Right )
{
// Vertical layout
// Minimum space allows for one icon, the window list button and the up/down scrollers
- int minHeight = minButtonHeight*3;
+ int minHeight = buttonHeight()*3;
if (minHeight > maxSize.height())
return maxSize;
return TQSize(maxSize.width(), minHeight);
@@ -207,7 +216,7 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
{
// 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;
+ int min_width=buttonWidth()*3;
if (min_width > maxSize.width())
return maxSize;
return TQSize(min_width, maxSize.height());
@@ -234,15 +243,15 @@ void TaskBar::configure()
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_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);
+ m_showAllWindows = READ_MERGED_TASKBAR_SETTING(showAllWindows);
+ m_sortByDesktop = m_showAllWindows && READ_MERGED_TASKBAR_SETTING(sortByDesktop);
+ m_displayIconsNText = READ_MERGED_TASKBAR_SETTING(displayIconsNText);
+ m_showOnlyIconified = READ_MERGED_TASKBAR_SETTING(showOnlyIconified);
+ m_cycleWheel = READ_MERGED_TASKBAR_SETTING(cycleWheel);
+ m_showTaskStates = READ_MERGED_TASKBAR_SETTING(showTaskStates);
m_currentScreen = -1; // Show all screens or re-get our screen
- m_showOnlyCurrentScreen = (READ_MERGED_TASBKAR_SETTING(showCurrentScreenOnly) &&
+ m_showOnlyCurrentScreen = (READ_MERGED_TASKBAR_SETTING(showCurrentScreenOnly) &&
TQApplication::desktop()->isVirtualDesktop() &&
TQApplication::desktop()->numScreens() > 1);
@@ -275,12 +284,12 @@ void TaskBar::configure()
}
}
- if (m_sortByAppPrev != READ_MERGED_TASBKAR_SETTING(sortByApp)) {
- m_sortByAppPrev = READ_MERGED_TASBKAR_SETTING(sortByApp);
+ if (m_sortByAppPrev != READ_MERGED_TASKBAR_SETTING(sortByApp)) {
+ m_sortByAppPrev = READ_MERGED_TASKBAR_SETTING(sortByApp);
reSort();
}
- TaskManager::the()->setXCompositeEnabled(READ_MERGED_TASBKAR_SETTING(showThumbnails));
+ TaskManager::the()->setXCompositeEnabled(READ_MERGED_TASKBAR_SETTING(showThumbnails));
reLayoutEventually();
}
@@ -409,7 +418,7 @@ void TaskBar::showTaskContainer(TaskContainer* container)
}
// try to place the container after one of the same app
- if (READ_MERGED_TASBKAR_SETTING(sortByApp))
+ if (READ_MERGED_TASKBAR_SETTING(sortByApp))
{
TaskContainer::Iterator it = containers.begin();
for (; it != containers.end(); ++it)
@@ -731,14 +740,12 @@ void TaskBar::reLayout()
// number of rows simply depends on our height which is either the
// minimum button height or the height of the font in use, whichever is
// largest
- TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ int minButtonHeight = buttonHeight();
// horizontal layout
if (orientation() == Qt::Horizontal)
{
- int bwidth=BUTTON_MIN_WIDTH;
+ int bwidth=buttonWidth();
int rows = contentsRect().height() / minButtonHeight;
if (rows<1)
rows=1;
@@ -752,20 +759,20 @@ void TaskBar::reLayout()
int bpr = static_cast<int>(ceil(static_cast<double>(list.count()) / rows));
// adjust content size
- if ( contentsRect().width() < bpr * BUTTON_MIN_WIDTH )
+ if ( contentsRect().width() < bpr * bwidth )
{
- resizeContents( bpr * BUTTON_MIN_WIDTH, contentsRect().height() );
+ resizeContents( bpr * bwidth, contentsRect().height() );
}
// maximum number of buttons per row
- int mbpr = contentsRect().width() / BUTTON_MIN_WIDTH;
+ int mbpr = contentsRect().width() / bwidth;
// expand button width if space permits and the taskbar is not in 'icons only' mode
if (mbpr > bpr)
{
if (!showIcons() || showText())
bwidth = contentsRect().width() / bpr;
- int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
+ int maxWidth = READ_MERGED_TASKBAR_SETTING(maximumButtonWidth);
if (maxWidth > 0 && bwidth > maxWidth)
{
bwidth = maxWidth;
@@ -987,9 +994,7 @@ int TaskBar::taskCount() const
int TaskBar::maximumButtonsWithoutShrinking() const
{
- TQFontMetrics fm(TDEGlobalSettings::taskbarFont());
- int minButtonHeight = fm.height() > READ_MERGED_TASBKAR_SETTING(minimumButtonHeight) ?
- fm.height() : READ_MERGED_TASBKAR_SETTING(minimumButtonHeight);
+ int minButtonHeight = buttonHeight();
int rows = contentsRect().height() / minButtonHeight;
if (rows < 1)
@@ -999,7 +1004,7 @@ int TaskBar::maximumButtonsWithoutShrinking() const
if ( orientation() == Qt::Horizontal ) {
// maxWidth of 0 means no max width, drop back to default
- int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
+ int maxWidth = READ_MERGED_TASKBAR_SETTING(maximumButtonWidth);
if (maxWidth == 0)
{
maxWidth = BUTTON_MAX_WIDTH;
@@ -1017,8 +1022,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 &&
+ return READ_MERGED_TASKBAR_SETTING(groupTasks) == m_settingsObject->GroupAlways ||
+ ((READ_MERGED_TASKBAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull &&
taskCount() > maximumButtonsWithoutShrinking()));
}
@@ -1166,7 +1171,7 @@ void TaskBar::activateNextTask(bool forward)
void TaskBar::wheelEvent(TQWheelEvent* e)
{
- if(READ_MERGED_TASBKAR_SETTING(cycleWheel)) {
+ if(READ_MERGED_TASKBAR_SETTING(cycleWheel)) {
if (e->delta() > 0)
{
diff --git a/kicker/taskbar/taskbar.h b/kicker/taskbar/taskbar.h
index 0ab614a61..1b2895789 100644
--- a/kicker/taskbar/taskbar.h
+++ b/kicker/taskbar/taskbar.h
@@ -137,6 +137,8 @@ protected:
void moveEvent( TQMoveEvent* );
bool idMatch( const TQString& id1, const TQString& id2 );
TaskContainer::List filteredContainers();
+ int buttonHeight() const;
+ int buttonWidth() const;
private:
void sortContainersByDesktop(TaskContainer::List& list);
@@ -168,6 +170,7 @@ private:
TQImage m_blendGradient;
TaskBarSettings* m_settingsObject;
TaskBarSettings* m_globalSettingsObject;
+
};
#endif
diff --git a/kicker/taskbar/taskbar.kcfg b/kicker/taskbar/taskbar.kcfg
index 676834aac..6d2b5ea59 100644
--- a/kicker/taskbar/taskbar.kcfg
+++ b/kicker/taskbar/taskbar.kcfg
@@ -212,5 +212,8 @@
<default code="true">QColor()</default>
<whatsthis>This color is used for displaying background of taskbar buttons.</whatsthis>
</entry>
+ <entry name="IconSize" type="UInt" >
+ <default>16</default>
+ </entry>
</group>
</kcfg>
diff --git a/kicker/taskbar/taskcontainer.cpp b/kicker/taskbar/taskcontainer.cpp
index cc533f0b9..cd154df3a 100644
--- a/kicker/taskbar/taskcontainer.cpp
+++ b/kicker/taskbar/taskcontainer.cpp
@@ -62,8 +62,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "taskcontainer.h"
#include "taskcontainer.moc"
-#define READ_MERGED_TASBKAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
-#define READ_MERGED_TASBKAR_ACTION(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->action(x):m_settingsObject->action(x))
+#define READ_MERGED_TASKBAR_SETTING(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->x():m_settingsObject->x())
+#define READ_MERGED_TASKBAR_ACTION(x) ((m_settingsObject->useGlobalSettings())?m_globalSettingsObject->action(x):m_settingsObject->action(x))
static Bool netwm_atoms_created = False;
static Atom net_wm_pid = 0;
@@ -192,9 +192,11 @@ void TaskContainer::init()
if (!netwm_atoms_created) create_atoms(TQPaintDevice::x11AppDisplay());
+ int iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
+
setWFlags(TQt::WNoAutoErase);
setBackgroundMode(NoBackground);
- animBg = TQPixmap(16, 16);
+ animBg = TQPixmap(iconSize, iconSize);
installEventFilter(KickerTip::the());
@@ -366,11 +368,11 @@ void TaskContainer::checkAttention(const Task::Ptr t)
void TaskContainer::attentionTimerFired()
{
assert( attentionState != -1 );
- if (attentionState < READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations)*2)
+ if (attentionState < READ_MERGED_TASKBAR_SETTING(attentionBlinkIterations)*2)
{
++attentionState;
}
- else if (READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations) < 1000)
+ else if (READ_MERGED_TASKBAR_SETTING(attentionBlinkIterations) < 1000)
{
attentionTimer.stop();
}
@@ -390,9 +392,18 @@ TQSizePolicy TaskContainer::sizePolicy() const
void TaskContainer::resizeEvent( TQResizeEvent * )
{
+ int iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
+
// calculate the icon rect
- TQRect br( style().subRect( TQStyle::SR_PushButtonContents, this ) );
- iconRect = TQStyle::visualRect( TQRect(br.x() + 2, (height() - 16) / 2, 16, 16), this );
+ if(taskBar->showText())
+ {
+ TQRect br( style().subRect( TQStyle::SR_PushButtonContents, this ) );
+ iconRect = TQStyle::visualRect( TQRect(br.x() + 2, (height() - iconSize) / 2, iconSize, iconSize), this );
+ }
+ else
+ {
+ iconRect = TQStyle::visualRect( TQRect((width() - iconSize) / 2, (height() - iconSize) / 2, iconSize, iconSize), this );
+ }
}
void TaskContainer::add(Task::Ptr task)
@@ -581,13 +592,14 @@ void TaskContainer::drawButton(TQPainter *p)
TQPixmap *pm((TQPixmap*)p->device());
TQPixmap pixmap; // icon
Task::Ptr task = 0;
- bool iconified = !READ_MERGED_TASBKAR_SETTING(showOnlyIconified);
- bool halo = READ_MERGED_TASBKAR_SETTING(haloText);
- bool alwaysDrawButtons = READ_MERGED_TASBKAR_SETTING(drawButtons);
+ bool iconified = !READ_MERGED_TASKBAR_SETTING(showOnlyIconified);
+ bool halo = READ_MERGED_TASKBAR_SETTING(haloText);
+ bool alwaysDrawButtons = READ_MERGED_TASKBAR_SETTING(drawButtons);
bool drawButton = alwaysDrawButtons ||
(m_mouseOver && !halo && isEnabled() &&
- READ_MERGED_TASBKAR_SETTING(showButtonOnHover));
+ READ_MERGED_TASKBAR_SETTING(showButtonOnHover));
TQFont font(TDEGlobalSettings::taskbarFont());
+ int iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
// draw sunken if we contain the active task
bool active = false;
@@ -608,7 +620,7 @@ void TaskContainer::drawButton(TQPainter *p)
if (task->demandsAttention())
{
- demandsAttention = attentionState == READ_MERGED_TASBKAR_SETTING(attentionBlinkIterations) ||
+ demandsAttention = attentionState == READ_MERGED_TASKBAR_SETTING(attentionBlinkIterations) ||
attentionState % 2 == 0;
}
}
@@ -617,12 +629,12 @@ void TaskContainer::drawButton(TQPainter *p)
TQColorGroup colors = palette().active();
- if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
+ if (READ_MERGED_TASKBAR_SETTING(useCustomColors))
{
- colors.setColor( TQColorGroup::Button, READ_MERGED_TASBKAR_SETTING(taskBackgroundColor));
- colors.setColor( TQColorGroup::Background, READ_MERGED_TASBKAR_SETTING(taskBackgroundColor) );
- colors.setColor( TQColorGroup::ButtonText, READ_MERGED_TASBKAR_SETTING(inactiveTaskTextColor) );
- colors.setColor( TQColorGroup::Text, READ_MERGED_TASBKAR_SETTING(inactiveTaskTextColor) );
+ colors.setColor( TQColorGroup::Button, READ_MERGED_TASKBAR_SETTING(taskBackgroundColor));
+ colors.setColor( TQColorGroup::Background, READ_MERGED_TASKBAR_SETTING(taskBackgroundColor) );
+ colors.setColor( TQColorGroup::ButtonText, READ_MERGED_TASKBAR_SETTING(inactiveTaskTextColor) );
+ colors.setColor( TQColorGroup::Text, READ_MERGED_TASKBAR_SETTING(inactiveTaskTextColor) );
}
if (demandsAttention)
@@ -659,7 +671,7 @@ void TaskContainer::drawButton(TQPainter *p)
// get the task icon
if (task)
{
- pixmap = task->pixmap();
+ pixmap = task->icon(iconSize, iconSize, true);
}
bool sunken = isDown() || (alwaysDrawButtons && (active || aboutToActivate));
@@ -671,7 +683,7 @@ void TaskContainer::drawButton(TQPainter *p)
// draw button background
if (drawButton)
{
- if (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons()) {
+ if (READ_MERGED_TASKBAR_SETTING(drawButtons) && KickerSettings::showDeepButtons()) {
style().tqdrawPrimitive(TQStyle::PE_ButtonBevel, p,
TQRect(1, 1, width()-3, height()-2),
colors, sunken ? TQStyle::Style_On : TQStyle::Style_Raised);
@@ -690,21 +702,21 @@ void TaskContainer::drawButton(TQPainter *p)
}
TQString text = name(); // find text
- int textPos = ( taskBar->showIcons() && (!pixmap.isNull() || m_startup)) ? 2 + 16 + 2 : 0;
+ int textPos = ( taskBar->showIcons() && (!pixmap.isNull() || m_startup)) ? 2 + iconSize + 2 : 0;
// show icons
if (taskBar->showIcons())
{
if (pixmap.isNull() && m_startup)
- pixmap = SmallIcon(m_startup->icon());
+ pixmap = kapp->iconLoader()->loadIcon(m_startup->icon(), TDEIcon::Panel, iconSize);
if ( !pixmap.isNull() )
{
- // make sure it is no larger than 16x16
- if ( pixmap.width() > 16 || pixmap.height() > 16 )
+ // make sure it is no larger than icon size
+ if ( pixmap.width() > iconSize || pixmap.height() > iconSize )
{
TQImage tmp = pixmap.convertToImage();
- pixmap.convertFromImage( tmp.smoothScale( 16, 16 ) );
+ pixmap.convertFromImage( tmp.smoothScale( iconSize, iconSize ) );
}
// fade out the icon when minimized
@@ -731,13 +743,13 @@ void TaskContainer::drawButton(TQPainter *p)
// draw modified overlay
if (!modPixmap.isNull())
{
- TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos,(height() - 16) / 2, 16, 16), this);
+ TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos,(height() - iconSize) / 2, iconSize, iconSize), this);
if (iconified)
{
TDEIconEffect::semiTransparent(modPixmap);
}
p->drawPixmap(r, modPixmap);
- textPos += 16 + 2;
+ textPos += iconSize + 2;
}
}
}
@@ -765,9 +777,9 @@ void TaskContainer::drawButton(TQPainter *p)
}
else // hack for the dotNET style and others
{
- if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
+ if (READ_MERGED_TASKBAR_SETTING(useCustomColors))
{
- textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor));
+ textPen = TQPen(READ_MERGED_TASKBAR_SETTING(activeTaskTextColor));
}
else
{
@@ -775,7 +787,7 @@ void TaskContainer::drawButton(TQPainter *p)
}
}
- int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
+ int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASKBAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
if (m_filteredTasks.count() > 1)
{
availableWidth -= 8;
@@ -852,7 +864,7 @@ void TaskContainer::drawButton(TQPainter *p)
}
// draw popup arrow
- if ((m_filteredTasks.count() > 1) && (!(READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())))
+ if ((m_filteredTasks.count() > 1) && (!(READ_MERGED_TASKBAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())))
{
TQStyle::PrimitiveElement e = TQStyle::PE_ArrowLeft;
@@ -995,14 +1007,14 @@ void TaskContainer::mousePressEvent( TQMouseEvent* e )
switch (e->button())
{
case Qt::LeftButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->LeftButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->LeftButton);
break;
case Qt::MidButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->MiddleButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->MiddleButton);
break;
case Qt::RightButton:
default:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->RightButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->RightButton);
break;
}
@@ -1018,7 +1030,7 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
{
m_dragStartPos = TQPoint();
- if (!READ_MERGED_TASBKAR_SETTING(drawButtons))
+ if (!READ_MERGED_TASKBAR_SETTING(drawButtons))
{
setDown(false);
}
@@ -1036,14 +1048,14 @@ void TaskContainer::mouseReleaseEvent(TQMouseEvent *e)
switch (e->button())
{
case Qt::LeftButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->LeftButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->LeftButton);
break;
case Qt::MidButton:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->MiddleButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->MiddleButton);
break;
case Qt::RightButton:
default:
- buttonAction = READ_MERGED_TASBKAR_ACTION(m_settingsObject->RightButton);
+ buttonAction = READ_MERGED_TASKBAR_ACTION(m_settingsObject->RightButton);
break;
}
@@ -1223,7 +1235,7 @@ void TaskContainer::popupMenu(int action)
return;
}
- m_menu = new TaskRMBMenu(m_filteredTasks, taskBar->showAllWindows(), (READ_MERGED_TASBKAR_SETTING(allowDragAndDropReArrange))?makeTaskMoveMenu():NULL);
+ m_menu = new TaskRMBMenu(m_filteredTasks, taskBar->showAllWindows(), (READ_MERGED_TASKBAR_SETTING(allowDragAndDropReArrange))?makeTaskMoveMenu():NULL);
}
else
{
@@ -1452,7 +1464,7 @@ void TaskContainer::dragEnterEvent( TQDragEnterEvent* e )
return;
}
- if (e->source() && (e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASBKAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASBKAR_SETTING(sortByApp)))
+ if (e->source() && (e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASKBAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASKBAR_SETTING(sortByApp)))
{
e->accept();
}
@@ -1480,7 +1492,7 @@ void TaskContainer::dropEvent( TQDropEvent* e )
return;
}
- if ((e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASBKAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASBKAR_SETTING(sortByApp)))
+ if ((e->source()->parent() == this->parent()) && TaskDrag::canDecode(e) && READ_MERGED_TASKBAR_SETTING(allowDragAndDropReArrange) && (!READ_MERGED_TASKBAR_SETTING(sortByApp)))
{
if (taskBar->taskMoveHandler(TaskMoveDestination::Position, TaskDrag::decode(e), TQWidget::mapTo(taskBar, e->pos()))) {
e->accept();
@@ -1631,7 +1643,7 @@ void TaskContainer::updateFilteredTaskList()
{
Task::Ptr t = *it;
if ((taskBar->showAllWindows() || t->isOnCurrentDesktop()) &&
- (!READ_MERGED_TASBKAR_SETTING(showOnlyIconified) || t->isIconified()))
+ (!READ_MERGED_TASKBAR_SETTING(showOnlyIconified) || t->isIconified()))
{
pid_t pid = 0;
#ifdef Q_WS_X11
@@ -1652,15 +1664,15 @@ void TaskContainer::updateFilteredTaskList()
if (pid < 0) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) != m_settingsObject->ShowAll) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) != m_settingsObject->ShowAll) {
if (is_process_resumable(pid)) {
- if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
+ if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
t->publishIconGeometry( TQRect());
}
else {
@@ -1668,13 +1680,13 @@ void TaskContainer::updateFilteredTaskList()
}
}
else {
- if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
+ if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowAll) {
m_filteredTasks.append(t);
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowStopped) {
t->publishIconGeometry( TQRect());
}
- else if (READ_MERGED_TASBKAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
+ else if (READ_MERGED_TASKBAR_SETTING(showTaskStates) == m_settingsObject->ShowRunning) {
m_filteredTasks.append(t);
}
else {
@@ -1742,6 +1754,8 @@ void TaskContainer::settingsChanged()
void TaskContainer::updateKickerTip(KickerTip::Data& data)
{
+ int iconSize = READ_MERGED_TASKBAR_SETTING(iconSize);
+
if (m_startup)
{
data.message = m_startup->text();
@@ -1749,7 +1763,7 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
data.subtext = i18n("Loading application ...");
data.icon = TDEGlobal::iconLoader()->loadIcon(m_startup->icon(),
TDEIcon::Small,
- TDEIcon::SizeMedium,
+ iconSize,
TDEIcon::DefaultState,
0, true);
return;
@@ -1761,21 +1775,18 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
if (m_filteredTasks.count() > 0)
{
- if (READ_MERGED_TASBKAR_SETTING(showThumbnails) &&
+ if (READ_MERGED_TASKBAR_SETTING(showThumbnails) &&
m_filteredTasks.count() == 1)
{
Task::Ptr t = m_filteredTasks.first();
- pixmap = t->thumbnail(READ_MERGED_TASBKAR_SETTING(thumbnailMaxDimension));
+ pixmap = t->thumbnail(READ_MERGED_TASKBAR_SETTING(thumbnailMaxDimension));
}
if (pixmap.isNull() && tasks.count())
{
// try to load icon via net_wm
- pixmap = KWin::icon(tasks.last()->window(),
- TDEIcon::SizeMedium,
- TDEIcon::SizeMedium,
- true);
+ pixmap = KWin::icon(tasks.last()->window(), iconSize, iconSize, true);
}
// Collect all desktops the tasks are on. Sort naturally.
@@ -1809,7 +1820,7 @@ void TaskContainer::updateKickerTip(KickerTip::Data& data)
}
}
- if (READ_MERGED_TASBKAR_SETTING(showAllWindows) && KWin::numberOfDesktops() > 1)
+ if (READ_MERGED_TASKBAR_SETTING(showAllWindows) && KWin::numberOfDesktops() > 1)
{
if (desktopMap.isEmpty())
{
diff --git a/kicker/taskbar/taskcontainer.h b/kicker/taskbar/taskcontainer.h
index edaf337b4..f40566e9c 100644
--- a/kicker/taskbar/taskcontainer.h
+++ b/kicker/taskbar/taskcontainer.h
@@ -117,6 +117,7 @@ protected:
void popupMenu(int);
void updateFilteredTaskList();
+ void updateIconSize();
protected slots:
void animationTimerFired();