[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Tue Jul 5 07:15:33 CEST 2005


SVN commit 431745 by harris:

The DCOP functions writeConfig()/readConfig() now store and restore the 
user's original date and geographic location settings.

TODO: add readConfig(), writeConfig(), and getOption() to the 
ScriptBuilder.  Also, the clock's time step should also be restored 
(and changing the timestep in a script should modify the timestep 
widget in the toolbar).

CCMAIL: kstars-devel at kde.org


 M  +3 -0      kstars.cpp  
 M  +3 -0      kstarsdata.cpp  
 M  +1 -0      kstarsdata.h  
 M  +11 -2     kstarsdcop.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/kstars.cpp #431744:431745
@@ -210,6 +210,9 @@
 //	if ( !Options::showMainToolBar() ) ks->toolBar( "mainToolBar" )->hide();
 //	if ( !Options::showViewToolBar() ) ks->toolBar( "viewToolBar" )->hide();
 
+	//Geographic location
+	setGeoLocation( Options::cityName(), Options::provinceName(), Options::countryName() );
+
 	//Focus
 	SkyObject *fo = data()->objectNamed( Options::focusObject() );
 	if ( fo && fo != map()->focusObject() ) {
--- trunk/KDE/kdeedu/kstars/kstars/kstarsdata.cpp #431744:431745
@@ -140,6 +140,9 @@
 	// at startup times run forward
 	setTimeDirection( 0.0 );
 
+	//The StoredDate is used when saving user settings in a script; initialize to invalid date
+	StoredDate.setDJD( (long double)INVALID_DAY );
+
 	temporaryTrail = false;
 }
 
--- trunk/KDE/kdeedu/kstars/kstars/kstarsdata.h #431744:431745
@@ -749,6 +749,7 @@
 	double Obliquity, dObliq, dEcLong;
 	KStarsDateTime LastNumUpdate, LastSkyUpdate, LastPlanetUpdate, LastMoonUpdate;
 	KStarsDateTime NextDSTChange;
+	KStarsDateTime StoredDate;
 
 	QTimer *initTimer;
 	int initCounter;
--- trunk/KDE/kdeedu/kstars/kstars/kstarsdcop.cpp #431744:431745
@@ -101,7 +101,7 @@
 }
 
 void KStars::setLocalTime(int yr, int mth, int day, int hr, int min, int sec) {
-	data()->changeDateTime( KStarsDateTime( ExtDate(yr, mth, day), QTime(hr,min,sec) ) );
+	data()->changeDateTime( geo()->LTtoUT( KStarsDateTime( ExtDate(yr, mth, day), QTime(hr,min,sec) ) ) );
 }
 
 void KStars::waitFor( double t ) {
@@ -187,12 +187,21 @@
 	Options::self()->readConfig();
 
 	applyConfig();
+
+	//Reset date, if one was stored
+	if ( data()->StoredDate.isValid() ) {
+		data()->changeDateTime( geo()->LTtoUT( data()->StoredDate ) );
+		data()->StoredDate.setDJD( (long double)INVALID_DAY ); //invalidate StoredDate
+	}
+
 	map()->forceUpdate();
 }
 
 void KStars::writeConfig() {
-//	KGlobal::config()->sync();
 	Options::writeConfig();
+
+	//Store current simulation time
+	data()->StoredDate.setDJD( data()->lt().djd() );
 }
 
 QString KStars::getOption( const QString &name ) {


More information about the Kstars-devel mailing list