[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Tue Jan 11 07:52:22 CET 2005


CVS commit by harris: 

Command line changes.

(1) The "--date" argument is now applied when starting in normal GUI 
mode (it used to only be read when using image-dump mode).

(2) There is now a "--paused" argument which will make KStars start with 
the clock paused.  This fixes BR #78068, and should help people on 
slower machines.

So, to start KStars at 12:30 on October 3rd, 2002 with the clock paused, 
start it like:

% kstars --paused --date "3 Oct 2002 12:30:00"

BUG: 78068
CCMAIL: kstars-devel at kde.org
 


  M +6 -3      kstars.cpp   1.89
  M +5 -2      kstars.h   1.81
  M +10 -4     kstarsinit.cpp   1.104
  M +10 -5     main.cpp   1.39


--- kdeedu/kstars/kstars/kstars.cpp  #1.88:1.89
@@ -43,5 +43,5 @@
 #include "indidriver.h"
 
-KStars::KStars( bool doSplash ) :
+KStars::KStars( bool doSplash, bool clockrun, const QString &startdate ) :
         DCOPObject("KStarsInterface"), KMainWindow(),
         skymap(0), centralWidget(0), topLayout(0), viewToolBar(0), TimeStep(0),
@@ -49,5 +49,5 @@ KStars::KStars( bool doSplash ) :
         AAVSODialog(0), findDialog(0), kns(0), 
         indimenu(0), indidriver(0), indiseq(0),
-        DialogIsObsolete(false)
+        DialogIsObsolete(false), StartClockRunning( clockrun ), StartDateString( startdate )
 {
         pd = new privatedata(this);
@@ -73,4 +73,7 @@ KStars::KStars( bool doSplash ) :
         pd->kstarsData->setLocationFromOptions();
 
+        //Pause the clock if the user gave the "--paused" arg
+        if ( ! StartClockRunning ) pd->kstarsData->clock()->stop();
+        
         //set up Dark color scheme for application windows
         DarkPalette = QPalette(QColor("red4"), QColor("DarkRed"));

--- kdeedu/kstars/kstars/kstars.h  #1.80:1.81
@@ -80,6 +80,7 @@ class KStars : public KMainWindow, virtu
                 *@param doSplash should the splash panel be displayed during
                 *initialization.
+                *@param startClockRunning should the clock be running on startup?
                 */
-                KStars( bool doSplash );
+                KStars( bool doSplash, bool startClockRunning = true, const QString &startDateString = "" );
 
         /**Destructor.  Synchs config file.  Deletes objects.
@@ -479,4 +480,6 @@ class KStars : public KMainWindow, virtu
                 int idSpinBox;
                 bool DialogIsObsolete;
+                bool StartClockRunning;
+                QString StartDateString;
                 
                 QPalette OriginalPalette, DarkPalette;

--- kdeedu/kstars/kstars/kstarsinit.cpp  #1.103:1.104
@@ -512,4 +512,6 @@ void KStars::datainitFinished(bool worke
         updateTime();
 
+        //Do not start the clock if the user specified "--paused" on the cmd line
+        if ( StartClockRunning )
         data()->clock()->start();
 
@@ -622,5 +624,9 @@ void KStars::privatedata::buildGUI() {
         ks->resize( Options::windowWidth(), Options::windowHeight() );
 
-        // initialize clock with current time/date
+        // initialize clock with current time/date or the date/time specified on the command line
+        KStarsDateTime startDate = KStarsDateTime::fromString( ks->StartDateString );
+        if ( startDate.isValid() )
+                ks->data()->changeDateTime( ks->geo()->LTtoUT( startDate ) );
+        else 
         ks->slotSetTimeToNow();
 

--- kdeedu/kstars/kstars/main.cpp  #1.38:1.39
@@ -44,6 +44,7 @@ static KCmdLineOptions options[] =
         { "width ", I18N_NOOP( "width of sky image" ), "640" },
         { "height ", I18N_NOOP( "height of sky image" ), "480" },
-        { "date ", I18N_NOOP( "date and time" ), "" },
         { "filename ", I18N_NOOP( "filename for sky image" ), "kstars.png" },
+        { "date ", I18N_NOOP( "date and time" ), "" },
+        { "!paused", I18N_NOOP( "start with clock paused" ), 0 },
         KCmdLineLastOption
 };
@@ -172,8 +173,12 @@ int main(int argc, char *argv[])
         }
 
-        //start up normally
-        //DEBUG
-        kdDebug() << "creating KStars object..." << endl;
-        /*KStars *kstars = */new KStars( true );
+        //start up normally in GUI mode
+        
+        //warn about invalid dates
+        QString datestring = args->getOption( "date" );
+        if ( ! datestring.isEmpty() && ! KStarsDateTime::fromString( datestring ).isValid() )
+                kdWarning() << i18n("Specified date (%1) is invalid.  Will use current CPU date instead." ) << endl;
+        
+        new KStars( true, ! args->isSet( "paused" ), datestring );
         QObject::connect(kapp, SIGNAL(lastWindowClosed()), kapp, SLOT(quit()));
         return a.exec();




More information about the Kstars-devel mailing list