[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/plasma/applets/systemtray/ui
From: Marco Martin <notmart () gmail ! com>
Date: 2009-01-09 11:55:27
Message-ID: 1231502127.616442.10663.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 908171 by mart:
add a tiny spacer that separes the normal systray items and the last
ones, making the background of last items to look more balanced
will backport to 4.2
M +28 -1 taskarea.cpp
--- trunk/KDE/kdebase/workspace/plasma/applets/systemtray/ui/taskarea.cpp \
#908170:908171 @@ -49,6 +49,7 @@
unhider(0),
topLayout(new QGraphicsLinearLayout(Qt::Horizontal)),
taskLayout(new CompactLayout()),
+ lastItemMargin(0),
lastItemCount(0),
showingHidden(false),
hasHiddenTasks(false),
@@ -60,6 +61,9 @@
Plasma::IconWidget *unhider;
QGraphicsLinearLayout *topLayout;
CompactLayout *taskLayout;
+ //This item gives a bit of extra margin that separes the last items and the \
"normal" ones + QGraphicsWidget *lastItemMargin;
+
QSet<QString> hiddenTypes;
int lastItemCount;
bool showingHidden : 1;
@@ -151,6 +155,19 @@
d->taskLayout->insertItem(d->taskLayout->count() - \
d->lastItemCount, widget); break;
case SystemTray::Task::Last:
+ /*on the first added "last" task add also a little separator: \
the size depends from the applet margins, + in order to make the \
background of the last items look "balanced"*/ + if \
(d->lastItemCount == 0) { + QGraphicsWidget *applet = \
dynamic_cast<QGraphicsWidget *>(parentItem()); +
+ if (applet) {
+ qreal left, top, right, bottom;
+ applet->getContentsMargins(&left, &top, &right, &bottom);
+ d->lastItemMargin = new QGraphicsWidget();
+
+ d->lastItemMargin->setMinimumSize(right, bottom);
+ }
+ }
++d->lastItemCount;
d->taskLayout->addItem(widget);
break;
@@ -183,6 +200,12 @@
if (d->taskLayout->containsItem(widget)) {
if (task->order() == Task::Last) {
--d->lastItemCount;
+ //we have removed the last item, remove also the spacer
+ if (d->lastItemCount == 0 && d->lastItemMargin) {
+ d->taskLayout->removeItem(d->lastItemMargin);
+ d->lastItemMargin->deleteLater();
+ d->lastItemMargin = 0;
+ }
}
d->taskLayout->removeItem(widget);
@@ -210,7 +233,11 @@
int TaskArea::rightEasement() const
{
- return d->lastItemCount * 24;
+ int extraMargin = 0;
+ if (d->lastItemMargin) {
+ extraMargin = qMin(d->lastItemMargin->size().width(), \
d->lastItemMargin->size().height()); + }
+ return d->lastItemCount * 24 + int(qreal(extraMargin)/2.0);
}
bool TaskArea::hasHiddenTasks() const
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic