[Kstars-devel] [kstars] kstars/tools: Update Sun's rise and set when the user change location in calendar tool

Jérome SONRIER jsid at emor3j.fr.eu.org
Sat Jul 16 20:40:28 CEST 2011


Git commit 4fa8621396bd9c4eaabe42e3c344f05909b6d8aa by Jérome SONRIER.
Committed on 16/07/2011 at 20:40.
Pushed by jsonrier into branch 'master'.

Update Sun's rise and set when the user change location in calendar tool

CCBUG: 267145
CCMAIL: kstars-devel at kde.org

M  +5    -3    kstars/tools/calendarwidget.cpp
M  +1    -0    kstars/tools/skycalendar.h
M  +5    -0    kstars/tools/skycalendar.cpp

http://commits.kde.org/kstars/4fa8621396bd9c4eaabe42e3c344f05909b6d8aa

diff --git a/kstars/tools/calendarwidget.cpp b/kstars/tools/calendarwidget.cpp
index 2d7e01e..9832b3f 100644
--- a/kstars/tools/calendarwidget.cpp
+++ b/kstars/tools/calendarwidget.cpp
@@ -67,7 +67,6 @@ void CalendarWidget::paintEvent( QPaintEvent *e ) {
 
 void CalendarWidget::drawHorizon( QPainter *p ) {
     KSSun thesun;
-    KStarsData *data = KStarsData::Instance();
     // FIXME: OMG!!!
     SkyCalendar *skycal = (SkyCalendar*)topLevelWidget();
     int y = skycal->year();
@@ -78,10 +77,13 @@ void CalendarWidget::drawHorizon( QPainter *p ) {
     //Add points along curved edge of horizon polygons
     int imonth = -1;
     float rTime, sTime;
+    
+    riseTimeList.clear();
+    setTimeList.clear();
 
     while ( y == kdt.date().year() ) {
-        rTime = thesun.riseSetTime( kdt.djd() + 1.0, data->geo(), true, true ).secsTo(QTime())*-24.0/86400.0;
-        sTime = thesun.riseSetTime( kdt.djd(),       data->geo(), false, true  ).secsTo(QTime())*-24.0/86400.0 - 24.0;
+        rTime = thesun.riseSetTime( kdt.djd() + 1.0, skycal->get_geo(), true, true ).secsTo(QTime())*-24.0/86400.0;
+        sTime = thesun.riseSetTime( kdt.djd(),       skycal->get_geo(), false, true  ).secsTo(QTime())*-24.0/86400.0 - 24.0;
 
         // FIXME why do the above two give different values ? ( Difference < 1 min though )
         if ( kdt.date().month() != imonth ) {
diff --git a/kstars/tools/skycalendar.cpp b/kstars/tools/skycalendar.cpp
index 8a43f70..9ece02d 100644
--- a/kstars/tools/skycalendar.cpp
+++ b/kstars/tools/skycalendar.cpp
@@ -294,4 +294,9 @@ void SkyCalendar::slotLocation() {
     delete ld;
 }
 
+GeoLocation* SkyCalendar::get_geo()
+{
+    return geo;
+}
+
 #include "skycalendar.moc"
diff --git a/kstars/tools/skycalendar.h b/kstars/tools/skycalendar.h
index 1b8e78c..78d2f93 100644
--- a/kstars/tools/skycalendar.h
+++ b/kstars/tools/skycalendar.h
@@ -43,6 +43,7 @@ class SkyCalendar : public KDialog
         ~SkyCalendar();
         
         int year();
+        GeoLocation* get_geo();
         
     public slots:
         void slotFillCalendar();


More information about the Kstars-devel mailing list