Naughty applet: dynamic applet size

This commit also replaces old 20x20 pixmap with new ones if higher quality.

This solves issue #213.

Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
pull/214/head
Mavridis Philippe 1 year ago
parent baf43828a3
commit e22588e97d
No known key found for this signature in database
GPG Key ID: F8D2D7E2F989A494
  1. 21
      kicker/applets/naughty/NaughtyApplet.cpp
  2. 2
      kicker/applets/naughty/NaughtyApplet.h
  3. BIN
      kicker/applets/naughty/naughty-happy.png
  4. BIN
      kicker/applets/naughty/naughty-sad.png

@ -67,7 +67,6 @@ NaughtyApplet::NaughtyApplet
setBackgroundOrigin( AncestorOrigin );
button_ = new SimpleButton(this);
button_->setFixedSize(20, 20);
TQVBoxLayout * layout = new TQVBoxLayout(this);
layout->addWidget(button_);
@ -132,25 +131,15 @@ NaughtyApplet::slotWarn(ulong pid, const TQString & name)
}
}
int
NaughtyApplet::widthForHeight(int) const
{
return 20;
}
int
NaughtyApplet::heightForWidth(int) const
{
return 20;
}
void
NaughtyApplet::slotLoad(uint l)
{
if (l > monitor_->triggerLevel())
button_->setPixmap(BarIcon("naughty-sad"));
else
button_->setPixmap(BarIcon("naughty-happy"));
button_->setPixmap(TDEGlobal::iconLoader()->loadIcon(
(l > monitor_->triggerLevel() ? "naughty-sad" : "naughty-happy"),
TDEIcon::Panel,
TQMIN(size().width(),size().height())-2
));
}
void

@ -46,8 +46,6 @@ class NaughtyApplet : public KPanelApplet
~NaughtyApplet();
virtual int widthForHeight(int h) const;
virtual int heightForWidth(int w) const;
signals:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 391 B

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 374 B

After

Width:  |  Height:  |  Size: 2.1 KiB

Loading…
Cancel
Save