From a497253048f3fcd77450eba6db7e3732860c75f5 Mon Sep 17 00:00:00 2001 From: Emanoil Kotsev Date: Wed, 29 Jul 2020 22:43:44 +0200 Subject: [PATCH] Remove unnecessary header includes Fix rendering and tooltips Signed-off-by: Emanoil Kotsev --- kmoon/kmoonapplet.cpp | 19 ------------------- kmoon/kmoonapplet.h | 7 +------ kmoon/kmoonwidget.cpp | 28 +++++++++++----------------- kmoon/kmoonwidget.h | 3 +-- 4 files changed, 13 insertions(+), 44 deletions(-) diff --git a/kmoon/kmoonapplet.cpp b/kmoon/kmoonapplet.cpp index 1a653f9..706a550 100644 --- a/kmoon/kmoonapplet.cpp +++ b/kmoon/kmoonapplet.cpp @@ -19,30 +19,12 @@ * */ -#include -#include -#include - -#include -#include -#include #include #include -#include -#include -#include -#include -#include #include -#include #include -#include -#include #include -#include -#include -#include #include "version.h" #include "kmoondlg.h" @@ -145,7 +127,6 @@ void MoonPAWidget::timerEvent( TQTimerEvent * ) time(&clock); struct tm *t = localtime(&clock); moon->calcStatus(mktime(t)); - moon->repaint(); } void MoonPAWidget::mousePressEvent( TQMouseEvent *e) diff --git a/kmoon/kmoonapplet.h b/kmoon/kmoonapplet.h index 5018b3d..b9d5607 100644 --- a/kmoon/kmoonapplet.h +++ b/kmoon/kmoonapplet.h @@ -21,14 +21,9 @@ #ifndef KMOONAPPLET #define KMOONAPPLET -#include -#include -#include -#include -#include #include -// #include "kmoonwidget.h" +#include "kmoonwidget.h" class TQPopupMenu; diff --git a/kmoon/kmoonwidget.cpp b/kmoon/kmoonwidget.cpp index 8ef85a3..e25860e 100644 --- a/kmoon/kmoonwidget.cpp +++ b/kmoon/kmoonwidget.cpp @@ -19,27 +19,14 @@ * */ -#include #include -#include #include #include #include -#include -#include - -#include #include -#include -#include -#include -#include -#include #include #include -#include -#include #include #include @@ -125,6 +112,8 @@ void MoonWidget::calcStatus( time_t time ) if ( fm.daysTo( now ) == 0 ) { counter = 14; tooltip = i18n( "Full Moon" ); + renderGraphic(); + repaint(); return; } else if ( counter <= 15 && counter >= 13 ) { counter = 14 + fm.daysTo( now ); @@ -168,6 +157,8 @@ void MoonWidget::calcStatus( time_t time ) switch (counter) { case 0: tooltip = i18n("New Moon"); + renderGraphic(); + repaint(); return; case 1: case 2: @@ -215,7 +206,7 @@ void MoonWidget::calcStatus( time_t time ) default: kdFatal() << "coolo can't count\n"; } - + renderGraphic(); repaint(); } @@ -359,10 +350,13 @@ void MoonWidget::renderGraphic() if (!pixmap.convertFromImage(dest, 0)) { return; } - - TQToolTip::remove(this); - TQToolTip::add(this, tooltip); + TQString oldText = TQToolTip::textFor(this); + if (oldText != tooltip) + { + TQToolTip::remove(this); + TQToolTip::add(this, tooltip); + } } diff --git a/kmoon/kmoonwidget.h b/kmoon/kmoonwidget.h index 19f21d0..6c66948 100644 --- a/kmoon/kmoonwidget.h +++ b/kmoon/kmoonwidget.h @@ -21,11 +21,10 @@ #ifndef KMOON #define KMOON -#include #include -#include #include #include + class TQPopupMenu; class MoonWidget : public TQWidget