From e22588e97dc93fd9b38362fede37fb23b3eb4af6 Mon Sep 17 00:00:00 2001 From: Mavridis Philippe Date: Wed, 7 Jul 2021 13:01:30 +0300 Subject: 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 --- kicker/applets/naughty/NaughtyApplet.cpp | 21 +++++---------------- kicker/applets/naughty/NaughtyApplet.h | 2 -- kicker/applets/naughty/naughty-happy.png | Bin 391 -> 2094 bytes kicker/applets/naughty/naughty-sad.png | Bin 374 -> 2104 bytes 4 files changed, 5 insertions(+), 18 deletions(-) (limited to 'kicker/applets') diff --git a/kicker/applets/naughty/NaughtyApplet.cpp b/kicker/applets/naughty/NaughtyApplet.cpp index 1da45a350..8eb26afbc 100644 --- a/kicker/applets/naughty/NaughtyApplet.cpp +++ b/kicker/applets/naughty/NaughtyApplet.cpp @@ -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 diff --git a/kicker/applets/naughty/NaughtyApplet.h b/kicker/applets/naughty/NaughtyApplet.h index eb9850851..a907ca9bb 100644 --- a/kicker/applets/naughty/NaughtyApplet.h +++ b/kicker/applets/naughty/NaughtyApplet.h @@ -46,8 +46,6 @@ class NaughtyApplet : public KPanelApplet ~NaughtyApplet(); - virtual int widthForHeight(int h) const; - virtual int heightForWidth(int w) const; signals: diff --git a/kicker/applets/naughty/naughty-happy.png b/kicker/applets/naughty/naughty-happy.png index 4c3505dfc..cbd451365 100644 Binary files a/kicker/applets/naughty/naughty-happy.png and b/kicker/applets/naughty/naughty-happy.png differ diff --git a/kicker/applets/naughty/naughty-sad.png b/kicker/applets/naughty/naughty-sad.png index ae6d727f2..82a8279f5 100644 Binary files a/kicker/applets/naughty/naughty-sad.png and b/kicker/applets/naughty/naughty-sad.png differ -- cgit v1.2.1