[Marble-commits] KDE/kdeedu/marble/src/plasmoid

Cristian Oneț onet.cristian at gmail.com
Sun Mar 20 22:17:56 CET 2011


SVN commit 1225421 by conet:

REVIEW: 6622

Fix sunlight and timezone display in the worldclock plasmoid.

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


--- trunk/KDE/kdeedu/marble/src/plasmoid/worldclock.cpp #1225420:1225421
@@ -86,6 +86,8 @@
     m_map->setShowPlaces     ( false );
     m_map->setShowCities     ( false );
     m_map->setShowOtherPlaces( false );
+    // set the date time of the marble model otherwise the sun will not show up correctly
+    m_map->model()->setClockDateTime(QDateTime::currentDateTimeUtc());
 
     if(cg.readEntry("projection", static_cast<int>(Equirectangular)) == Mercator)
         m_map->setProjection(Mercator);
@@ -138,6 +140,8 @@
 
     Plasma::DataEngine *m_timeEngine = dataEngine("time");
     m_timeEngine->connectSource( "Local", this, 6000, Plasma::AlignToMinute);
+
+    connect(m_map, SIGNAL(repaintNeeded(const QRegion&)), this, SLOT(slotRepaint()));
 }
 
 WorldClock::~WorldClock()
@@ -189,6 +193,11 @@
     }
 }
 
+void WorldClock::slotRepaint()
+{
+  update();
+}
+
 void WorldClock::dataUpdated(const QString &source,
                              const Plasma::DataEngine::Data &data)
 {
@@ -228,7 +237,9 @@
 QString WorldClock::getZone()
 {
     qreal lat, lon;
-    bool ok = m_map->viewport()->currentProjection()->geoCoordinates(
+    // get the hover zone only if the hove point exists
+    bool ok = !m_hover.isNull() && 
+              m_map->viewport()->currentProjection()->geoCoordinates(
                 m_hover.x(), m_hover.y(), m_map->viewport(), lon, lat );
 
     if( !ok ) {
--- trunk/KDE/kdeedu/marble/src/plasmoid/worldclock.h #1225420:1225421
@@ -62,6 +62,7 @@
     private slots:
         //connected to geometryChanged()
         void resizeMap(bool changeAspect = false);
+        void slotRepaint();
     private:
         void connectToEngine();
 


More information about the Marble-commits mailing list