Add option to display only icons on taskbar

This resolves Bug 360
pull/2/head
Michele Calgaro 11 years ago committed by Slávek Banko
parent cbbc7ad02e
commit 7119c2b268

@ -14,6 +14,12 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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> #include <tqcheckbox.h>
@ -151,6 +157,27 @@ TQStringList TaskbarConfig::i18nShowTaskStatesList()
return i18nList; 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) TaskbarConfig::TaskbarConfig(TQWidget *parent, const char* name, const TQStringList& args)
: TDECModule(TaskBarFactory::instance(), parent, name), : TDECModule(TaskBarFactory::instance(), parent, name),
m_settingsObject(NULL) 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_LeftButtonAction->insertStringList(list);
m_widget->kcfg_MiddleButtonAction->insertStringList(list); m_widget->kcfg_MiddleButtonAction->insertStringList(list);
m_widget->kcfg_RightButtonAction->insertStringList(list); m_widget->kcfg_RightButtonAction->insertStringList(list);
m_widget->kcfg_DisplayIconsNText->insertStringList(i18ndisplayIconsNText());
m_widget->kcfg_GroupTasks->insertStringList(i18nGroupModeList()); m_widget->kcfg_GroupTasks->insertStringList(i18nGroupModeList());
m_widget->kcfg_ShowTaskStates->insertStringList(i18nShowTaskStatesList()); m_widget->kcfg_ShowTaskStates->insertStringList(i18nShowTaskStatesList());

@ -14,6 +14,12 @@
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * 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__ #ifndef __kcmtaskbar_h__
@ -84,6 +90,8 @@ private:
static TQStringList i18nGroupModeList(); static TQStringList i18nGroupModeList();
static const TQStringList& showTaskStatesList(); static const TQStringList& showTaskStatesList();
static TQStringList i18nShowTaskStatesList(); static TQStringList i18nShowTaskStatesList();
static const TQStringList& displayIconsNText();
static TQStringList i18ndisplayIconsNText();
TaskbarConfigUI *m_widget; TaskbarConfigUI *m_widget;
TQString m_configFileName; TQString m_configFileName;
TaskBarSettings* m_settingsObject; TaskBarSettings* m_settingsObject;

@ -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> <string>Turning this option on will allow tasks on the taskbar to be manually rearranged using drag and drop.</string>
</property> </property>
</widget> </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"> <property name="name">
<cstring>kcfg_ShowWindowListBtn</cstring> <cstring>kcfg_ShowWindowListBtn</cstring>
</property> </property>
@ -180,13 +180,13 @@ By default the taskbar groups windows when it is full.</string>
</widget> </widget>
<widget class="TQLabel" row="9" column="0" rowspan="1" colspan="2"> <widget class="TQLabel" row="9" column="0" rowspan="1" colspan="2">
<property name="name"> <property name="name">
<cstring>groupTasksLabel</cstring> <cstring>groupTasksLabel</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Group similar tasks:</string> <string>&amp;Group similar tasks:</string>
</property> </property>
<property name="buddy" stdset="0"> <property name="buddy" stdset="0">
<cstring>kcfg_ShowTaskStates</cstring> <cstring>kcfg_GroupTasks</cstring>
</property> </property>
</widget> </widget>
<widget class="TQComboBox" row="10" column="2"> <widget class="TQComboBox" row="10" column="2">
@ -202,7 +202,7 @@ By default the taskbar groups windows when it is full.</string>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="whatsThis" stdset="0"> <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> </property>
</widget> </widget>
<widget class="TQLabel" row="10" column="0" rowspan="1" colspan="2"> <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> <cstring>showTaskStatesLabel</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>&amp;Show tasks with state:</string> <string>&amp;Show tasks with state:</string>
</property> </property>
<property name="buddy" stdset="0"> <property name="buddy" stdset="0">
<cstring>kcfg_ShowTaskStates</cstring> <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> By default, this option is not selected and the taskbar will show all windows.</string>
</property> </property>
</widget> </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"> <property name="name">
<cstring>kcfg_ShowIcon</cstring> <cstring>displayIconsNText</cstring>
</property> </property>
<property name="text"> <property name="text">
<string>Sho&amp;w application icons</string> <string>Dis&amp;play:</string>
</property> </property>
<property name="checked"> <property name="buddy" stdset="0">
<bool>true</bool> <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>
<property name="whatsThis" stdset="0"> <property name="whatsThis" stdset="0">
<string>Select this option if you want window icons to appear along with their titles in the taskbar. <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>
By default this option is selected.</string>
</property> </property>
</widget> </widget>
<widget class="TQCheckBox" row="2" column="0" rowspan="1" colspan="3"> <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>showAllScreens</tabstop>
<tabstop>kcfg_SortByApp</tabstop> <tabstop>kcfg_SortByApp</tabstop>
<tabstop>kcfg_ShowOnlyIconified</tabstop> <tabstop>kcfg_ShowOnlyIconified</tabstop>
<tabstop>kcfg_ShowIcon</tabstop>
<tabstop>kcfg_ShowWindowListBtn</tabstop> <tabstop>kcfg_ShowWindowListBtn</tabstop>
<tabstop>kcfg_DisplayIconsNText</tabstop>
<tabstop>kcfg_GroupTasks</tabstop> <tabstop>kcfg_GroupTasks</tabstop>
<tabstop>kcfg_ShowTaskStates</tabstop> <tabstop>kcfg_ShowTaskStates</tabstop>
<tabstop>appearance</tabstop> <tabstop>appearance</tabstop>

@ -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 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 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. 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> #include <math.h>
@ -58,7 +63,7 @@ TaskBar::TaskBar( TaskBarSettings* settingsObject, TaskBarSettings* globalSettin
m_currentScreen(-1), m_currentScreen(-1),
m_showOnlyCurrentScreen(false), m_showOnlyCurrentScreen(false),
m_sortByDesktop(false), m_sortByDesktop(false),
m_showIcon(false), m_displayIconsNText(settingsObject->DisplayIconsAndText),
m_showOnlyIconified(false), m_showOnlyIconified(false),
m_showTaskStates(0), m_showTaskStates(0),
m_textShadowEngine(0), m_textShadowEngine(0),
@ -196,66 +201,47 @@ TQSize TaskBar::sizeHint( KPanelExtension::Position p, TQSize maxSize) const
if ( p == KPanelExtension::Left || p == KPanelExtension::Right ) if ( p == KPanelExtension::Left || p == KPanelExtension::Right )
{ {
int actualMax = minButtonHeight * containerCount(); // Vertical layout
// Minimum space allows for one icon, the window list button and the up/down scrollers
if (containerCount() == 0) int minHeight = minButtonHeight*3;
{ if (minHeight > maxSize.height())
actualMax = minButtonHeight;
}
if (actualMax > maxSize.height())
{
return maxSize; return maxSize;
} return TQSize(maxSize.width(), minHeight);
return TQSize( maxSize.width(), actualMax );
} }
else else
{ {
int rows = KickerSettings::conserveSpace() ? // Horizontal layout
contentsRect().height() / minButtonHeight : // Minimum space allows for one column of icons, the window list button and the left/right scrollers
1; int min_width=BUTTON_MIN_WIDTH*3;
if ( rows < 1 ) if (min_width > maxSize.width())
{ return maxSize;
rows = 1; return TQSize(min_width, maxSize.height());
}
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() );
} }
} }
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() void TaskBar::configure()
{ {
bool wasShowWindows = m_showAllWindows; bool wasShowWindows = m_showAllWindows;
bool wasSortByDesktop = m_sortByDesktop; bool wasSortByDesktop = m_sortByDesktop;
bool wasCycleWheel = m_cycleWheel; bool wasCycleWheel = m_cycleWheel;
bool wasShowIcon = m_showIcon; bool wasDisplayIconsNText = m_displayIconsNText;
bool wasShowOnlyIconified = m_showOnlyIconified; bool wasShowOnlyIconified = m_showOnlyIconified;
int wasShowTaskStates = m_showTaskStates; int wasShowTaskStates = m_showTaskStates;
m_showAllWindows = READ_MERGED_TASBKAR_SETTING(showAllWindows); m_showAllWindows = READ_MERGED_TASBKAR_SETTING(showAllWindows);
m_sortByDesktop = m_showAllWindows && READ_MERGED_TASBKAR_SETTING(sortByDesktop); 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_showOnlyIconified = READ_MERGED_TASBKAR_SETTING(showOnlyIconified);
m_cycleWheel = READ_MERGED_TASBKAR_SETTING(cycleWheel); m_cycleWheel = READ_MERGED_TASBKAR_SETTING(cycleWheel);
m_showTaskStates = READ_MERGED_TASBKAR_SETTING(showTaskStates); m_showTaskStates = READ_MERGED_TASBKAR_SETTING(showTaskStates);
@ -280,7 +266,7 @@ void TaskBar::configure()
if (wasShowWindows != m_showAllWindows || if (wasShowWindows != m_showAllWindows ||
wasSortByDesktop != m_sortByDesktop || wasSortByDesktop != m_sortByDesktop ||
wasShowIcon != m_showIcon || wasDisplayIconsNText != m_displayIconsNText ||
wasCycleWheel != m_cycleWheel || wasCycleWheel != m_cycleWheel ||
wasShowOnlyIconified != m_showOnlyIconified || wasShowOnlyIconified != m_showOnlyIconified ||
wasShowTaskStates != m_showTaskStates) wasShowTaskStates != m_showTaskStates)
@ -757,25 +743,18 @@ void TaskBar::reLayout()
// horizontal layout // horizontal layout
if (orientation() == Qt::Horizontal) if (orientation() == Qt::Horizontal)
{ {
int bwidth = BUTTON_MIN_WIDTH; int bwidth=BUTTON_MIN_WIDTH;
int rows = contentsRect().height() / minButtonHeight; int rows = contentsRect().height() / minButtonHeight;
if (rows<1)
if ( rows < 1 ) rows=1;
{
rows = 1;
}
// actual button height // actual button height
int bheight = contentsRect().height() / rows; int bheight = contentsRect().height() / rows;
if (bheight<1) // avoid zero devision later
// avoid zero devision later bheight=1;
if (bheight < 1)
{
bheight = 1;
}
// buttons per row // 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 // adjust content size
if ( contentsRect().width() < bpr * BUTTON_MIN_WIDTH ) if ( contentsRect().width() < bpr * BUTTON_MIN_WIDTH )
@ -786,10 +765,11 @@ void TaskBar::reLayout()
// maximum number of buttons per row // maximum number of buttons per row
int mbpr = contentsRect().width() / BUTTON_MIN_WIDTH; 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) if (mbpr > bpr)
{ {
bwidth = contentsRect().width() / bpr; if (!showIcons() || showText())
bwidth = contentsRect().width() / bpr;
int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth); int maxWidth = READ_MERGED_TASBKAR_SETTING(maximumButtonWidth);
if (maxWidth > 0 && bwidth > maxWidth) if (maxWidth > 0 && bwidth > maxWidth)
{ {
@ -840,10 +820,12 @@ void TaskBar::reLayout()
} }
else // vertical layout else // vertical layout
{ {
// Adjust min button height to keep gaps into account
int minButtonHeightAdjusted=minButtonHeight+4;
// adjust content size // 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 // layout containers
@ -856,11 +838,11 @@ void TaskBar::reLayout()
c->setArrowType(arrowType); c->setArrowType(arrowType);
if (c->width() != contentsRect().width() || c->height() != minButtonHeight) if (c->width() != contentsRect().width() || c->height() != minButtonHeightAdjusted)
c->resize(contentsRect().width(), minButtonHeight); c->resize(contentsRect().width(), minButtonHeightAdjusted);
if (childX(c) != 0 || childY(c) != (i * minButtonHeight)) if (childX(c) != 0 || childY(c) != (i * minButtonHeightAdjusted))
moveChild(c, 0, i * minButtonHeight); moveChild(c, 0, i * minButtonHeightAdjusted);
c->setBackground(); c->setBackground();
i++; i++;
@ -1041,8 +1023,8 @@ int TaskBar::maximumButtonsWithoutShrinking() const
bool TaskBar::shouldGroup() const bool TaskBar::shouldGroup() const
{ {
return READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupAlways || return READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupAlways ||
(READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull && ((READ_MERGED_TASBKAR_SETTING(groupTasks) == m_settingsObject->GroupWhenFull &&
taskCount() > maximumButtonsWithoutShrinking()); taskCount() > maximumButtonsWithoutShrinking()));
} }
void TaskBar::reGroup() void TaskBar::reGroup()

@ -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 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. 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__ #ifndef __taskbar_h__
#define __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 "panner.h"
#include "kshadowengine.h" #include "kshadowengine.h"
#define WINDOWLISTBUTTON_SIZE 15 const int WINDOWLISTBUTTON_SIZE = 15;
#define BUTTON_MAX_WIDTH 200 const int BUTTON_MAX_WIDTH = 200;
#define BUTTON_MIN_WIDTH 20 const int BUTTON_MIN_WIDTH = 24; // 24 = 4+2+16+2 -> Space for borders, application icon and gaps
class Startup; class Startup;
class Task; class Task;
@ -85,7 +91,8 @@ public:
int taskCount() const; int taskCount() const;
int showScreen() const; int showScreen() const;
bool showIcon() const { return m_showIcon; } bool showIcons() const;
bool showText() const;
bool sortByDesktop() const { return m_sortByDesktop; } bool sortByDesktop() const { return m_sortByDesktop; }
bool showAllWindows() const { return m_showAllWindows; } bool showAllWindows() const { return m_showAllWindows; }
@ -140,31 +147,30 @@ private:
void sortContainersByDesktop(TaskContainer::List& list); void sortContainersByDesktop(TaskContainer::List& list);
void setViewportBackground(); void setViewportBackground();
bool blocklayout; bool blocklayout;
bool m_showAllWindows; bool m_showAllWindows;
bool m_cycleWheel; bool m_cycleWheel;
// The screen to show, -1 for all screens int m_currentScreen; // The screen to show, -1 for all screens
int m_currentScreen; bool m_showOnlyCurrentScreen;
bool m_showOnlyCurrentScreen; bool m_sortByDesktop;
bool m_sortByDesktop; int m_displayIconsNText;
bool m_showIcon; bool m_showOnlyIconified;
bool m_showOnlyIconified; int m_showTaskStates;
int m_showTaskStates; ArrowType arrowType;
ArrowType arrowType; TaskContainer::List containers;
TaskContainer::List containers; TaskContainer::List m_hiddenContainers;
TaskContainer::List m_hiddenContainers; TaskContainer::List m_deletableContainers;
TaskContainer::List m_deletableContainers; PixmapList frames;
PixmapList frames; int maximumButtonsWithoutShrinking() const;
int maximumButtonsWithoutShrinking() const; bool shouldGroup() const;
bool shouldGroup() const; bool isGrouping;
bool isGrouping; void reGroup();
void reGroup(); TDEGlobalAccel* keys;
TDEGlobalAccel* keys; KTextShadowEngine* m_textShadowEngine;
KTextShadowEngine* m_textShadowEngine; bool m_ignoreUpdates;
bool m_ignoreUpdates; bool m_sortByAppPrev;
bool m_sortByAppPrev; TQTimer m_relayoutTimer;
TQTimer m_relayoutTimer; TQImage m_blendGradient;
TQImage m_blendGradient;
TaskBarSettings* m_settingsObject; TaskBarSettings* m_settingsObject;
TaskBarSettings* m_globalSettingsObject; TaskBarSettings* m_globalSettingsObject;
}; };

@ -31,6 +31,22 @@
<label>Show only minimized windows</label> <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> <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>
<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" > <entry key="GroupTasks" type="Enum" >
<choices> <choices>
<choice name="GroupNever"> <choice name="GroupNever">
@ -73,11 +89,6 @@
<label>Sort windows by application</label> <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> <whatsthis>Selecting this option causes the taskbar to show windows ordered by application. By default this option is selected.</whatsthis>
</entry> </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" > <entry key="MaximumButtonWidth" type="Int" >
<default>200</default> <default>200</default>
<min>0</min> <min>0</min>

@ -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 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. 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> #include <assert.h>
@ -216,7 +222,7 @@ TaskContainer::~TaskContainer()
void TaskContainer::showMe() void TaskContainer::showMe()
{ {
if(!frames.isEmpty() && taskBar->showIcon()) if(!frames.isEmpty() && taskBar->showIcons())
animationTimer.start(100); animationTimer.start(100);
emit showMe(this); emit showMe(this);
@ -307,28 +313,30 @@ void TaskContainer::setLastActivated()
void TaskContainer::animationTimerFired() 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 // draw pixmap
if ( pm && !pm->isNull() ) { if ( pm && !pm->isNull() )
{
// we only have to redraw the background for frames 0, 8 and 9 // we only have to redraw the background for frames 0, 8 and 9
if ( currentFrame == 0 || currentFrame > 7 ) { if ( currentFrame == 0 || currentFrame > 7 )
// double buffered painting {
TQPixmap composite( animBg ); // double buffered painting
bitBlt( &composite, 0, 0, pm ); TQPixmap composite( animBg );
bitBlt( this, iconRect.x(), iconRect.y(), &composite ); bitBlt( &composite, 0, 0, pm );
} bitBlt( this, iconRect.x(), iconRect.y(), &composite );
else }
bitBlt( this, iconRect.x(), iconRect.y(), pm ); else
} bitBlt( this, iconRect.x(), iconRect.y(), pm );
}
// increment frame counter
if ( currentFrame >= 9) // increment frame counter
currentFrame = 0; if ( currentFrame >= 9)
else currentFrame = 0;
currentFrame++; else
currentFrame++;
} }
} }
@ -686,151 +694,147 @@ void TaskContainer::drawButton(TQPainter *p)
p->translate(shift.x(), shift.y()); p->translate(shift.x(), shift.y());
} }
if (taskBar->showIcon()) TQString text = name(); // find text
{ int textPos = ( taskBar->showIcons() && (!pixmap.isNull() || m_startup)) ? 2 + 16 + 2 : 0;
if (pixmap.isNull() && m_startup)
{ // show icons
pixmap = SmallIcon(m_startup->icon()); if (taskBar->showIcons())
} {
if (pixmap.isNull() && m_startup)
if ( !pixmap.isNull() ) 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 // +1 because we include a space after the closing brace.
if ( pixmap.width() > 16 || pixmap.height() > 16 ) text.remove(modStrPos, modStr.length() + 1);
{ TQPixmap modPixmap = SmallIcon("modified");
TQImage tmp = pixmap.convertToImage();
pixmap.convertFromImage( tmp.smoothScale( 16, 16 ) ); // draw modified overlay
} if (!modPixmap.isNull())
{
// fade out the icon when minimized TQRect r = TQStyle::visualRect(TQRect(br.x() + textPos,(height() - 16) / 2, 16, 16), this);
if (iconified) 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); p->drawPixmap(r, modPixmap);
textPos += 16 + 2; textPos += 16 + 2;
}
} }
}
} }
// draw text // draw text
if (!text.isEmpty()) if (taskBar->showText())
{ {
TQRect tr = TQStyle::visualRect(TQRect(br.x() + textPos + 1, 0, if (!text.isEmpty())
width() - textPos, height()), {
this); TQRect tr = TQStyle::visualRect(TQRect(br.x() + textPos + 1, 0,
int textFlags = AlignVCenter | SingleLine; width() - textPos, height()), this);
textFlags |= reverse ? AlignRight : AlignLeft; int textFlags = AlignVCenter | SingleLine;
TQPen textPen; textFlags |= reverse ? AlignRight : AlignLeft;
TQPen textPen;
// get the color for the text label
if (iconified) // get the color for the text label
{ if (iconified)
textPen = TQPen(KickerLib::blendColors(colors.button(), colors.buttonText())); {
} textPen = TQPen(KickerLib::blendColors(colors.button(), colors.buttonText()));
else if (!active) }
{ else if (!active)
textPen = TQPen(colors.buttonText()); {
} textPen = TQPen(colors.buttonText());
else // hack for the dotNET style and others }
{ else // hack for the dotNET style and others
if (READ_MERGED_TASBKAR_SETTING(useCustomColors)) {
{ if (READ_MERGED_TASBKAR_SETTING(useCustomColors))
textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor)); {
} textPen = TQPen(READ_MERGED_TASBKAR_SETTING(activeTaskTextColor));
else }
{ else
textPen = TQPen(colors.buttonText()); // textPen = p->pen(); {
} 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) int availableWidth = width() - (br.x() * 2) - textPos - 2 - (READ_MERGED_TASBKAR_SETTING(drawButtons) && KickerSettings::showDeepButtons())?2:0;
{ if (m_filteredTasks.count() > 1)
availableWidth -= 8; {
} availableWidth -= 8;
}
if (TQFontMetrics(font).width(text) > availableWidth)
{ if (TQFontMetrics(font).width(text) > availableWidth)
// draw text into overlay pixmap {
TQPixmap tpm(*pm); // draw text into overlay pixmap
TQPainter tp(&tpm); TQPixmap tpm(*pm);
TQPainter tp(&tpm);
if (sunken)
{ if (sunken)
tp.translate(shift.x(), shift.y()); {
} tp.translate(shift.x(), shift.y());
}
tp.setFont(font);
tp.setPen(textPen); tp.setFont(font);
tp.setPen(textPen);
if (halo)
{ if (halo)
taskBar->textShadowEngine()->drawText(tp, tr, textFlags, text, size()); {
} taskBar->textShadowEngine()->drawText(tp, tr, textFlags, text, size());
else }
{ else
tp.drawText(tr, textFlags, text); {
} tp.drawText(tr, textFlags, text);
}
// blend text into background image
TQImage img = pm->convertToImage(); // blend text into background image
TQImage timg = tpm.convertToImage(); TQImage img = pm->convertToImage();
KImageEffect::blend(img, timg, *taskBar->blendGradient(size()), KImageEffect::Red); TQImage timg = tpm.convertToImage();
KImageEffect::blend(img, timg, *taskBar->blendGradient(size()), KImageEffect::Red);
// End painting before assigning the pixmap
TQPaintDevice* opd = p->device(); // End painting before assigning the pixmap
p->end(); TQPaintDevice* opd = p->device();
pm->convertFromImage(img); p->end();
p->begin(opd ,this); pm->convertFromImage(img);
} p->begin(opd ,this);
else }
{ else
p->setFont(font); {
p->setPen(textPen); p->setFont(font);
p->setPen(textPen);
if (halo)
{ if (halo)
taskBar->textShadowEngine()->drawText(*p, tr, textFlags, text, size()); {
} taskBar->textShadowEngine()->drawText(*p, tr, textFlags, text, size());
else }
{ else
p->drawText(tr, textFlags, text); {
} p->drawText(tr, textFlags, text);
} }
}
}
} }
if (!frames.isEmpty() && m_startup && frames.at(currentFrame) != frames.end()) if (!frames.isEmpty() && m_startup && frames.at(currentFrame) != frames.end())

Loading…
Cancel
Save