[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/applets/clock
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2007-06-20 22:06:12
Message-ID: 1182377172.553878.28413.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 678218 by aseigo:

* it occurred to me just now how to avoid half of the repaints in the clock when \
                showing the seconds hand. *duh*
* set the report seconds property in the ctor as well

(yes, i know that the direct qproperty method only works for
 idempotent methods)


 M  +12 -1     clock.cpp  
 M  +1 -0      clock.h  


--- trunk/KDE/kdebase/workspace/plasma/applets/clock/clock.cpp #678217:678218
@@ -60,7 +60,9 @@
     m_theme->setContentType(Plasma::Svg::SingleImage);
     m_theme->resize(m_pixelSize, m_pixelSize);
 
-    dataEngine("time")->connectSource(m_timezone, this);
+    Plasma::DataEngine* timeEngine = dataEngine("time");
+    timeEngine->connectSource(m_timezone, this);
+    timeEngine->setProperty("reportSeconds", m_showSecondHand);
     constraintsUpdated();
 }
 
@@ -86,6 +88,15 @@
 {
     Q_UNUSED(source);
     m_time = data[i18n("Time")].toTime();
+
+    if (m_time.minute() == m_lastTimeSeen.minute() &&
+        m_time.second() == m_lastTimeSeen.second()) {
+        // avoid unnecessary repaints
+        kDebug() << "avoided unecessary update!" << endl;
+        return;
+    }
+
+    m_lastTimeSeen = m_time;
     update();
 }
 
--- trunk/KDE/kdebase/workspace/plasma/applets/clock/clock.h #678217:678218
@@ -78,6 +78,7 @@
         Plasma::Svg* m_theme;
         QTime m_time;
         KDialog *m_dialog; //should we move this into another class?
+        QTime m_lastTimeSeen;
 	/// Designer Config file
 	Ui::clockConfig ui;
 };


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic