18 #include <kcmdlineargs.h> 
   19 #include <kaboutdata.h> 
   22 #include <kapplication.h> 
   38     I18N_NOOP(
"Desktop Planetarium");
 
   40     I18N_NOOP(
"Some images in KStars are for non-commercial use only.  See README.images.");
 
   43 int main(
int argc, 
char *argv[])
 
   45     KAboutData aboutData( 
"kstars", 0, ki18n(
"KStars"),
 
   46                           KSTARS_VERSION, ki18n(
description), KAboutData::License_GPL,
 
   47                           ki18n(
"(c) 2001-2013, The KStars Team"), ki18n(
notice), 
"http://edu.kde.org/kstars");
 
   48     aboutData.addAuthor(ki18n(
"Jason Harris"),KLocalizedString(), 
"jharris@30doradus.org", 
"http://www.30doradus.org");
 
   49     aboutData.addAuthor(ki18n(
"Jasem Mutlaq"), KLocalizedString(), 
"mutlaqja@ikarustech.com");
 
   50     aboutData.addAuthor(ki18n(
"James Bowlin"), KLocalizedString(), 
"bowlin@mindspring.com");
 
   51     aboutData.addAuthor(ki18n(
"Pablo de Vicente"), KLocalizedString(), 
"pvicentea@wanadoo.es");
 
   52     aboutData.addAuthor(ki18n(
"Thomas Kabelmann"), KLocalizedString(), 
"tk78@gmx.de");
 
   53     aboutData.addAuthor(ki18n(
"Heiko Evermann"),KLocalizedString(), 
"heiko@evermann.de", 
"http://www.evermann.de");
 
   54     aboutData.addAuthor(ki18n(
"Carsten Niehaus"), KLocalizedString(), 
"cniehaus@gmx.de");
 
   55     aboutData.addAuthor(ki18n(
"Mark Hollomon"), KLocalizedString(), 
"mhh@mindspring.com");
 
   56     aboutData.addAuthor(ki18n(
"Alexey Khudyakov"), KLocalizedString(), 
"alexey.skladnoy@gmail.com");
 
   57     aboutData.addAuthor(ki18n(
"Médéric Boquien"), KLocalizedString(), 
"mboquien@free.fr");
 
   58     aboutData.addAuthor(ki18n(
"Akarsh Simha"), KLocalizedString(), 
"akarsh.simha@kdemail.net", 
"http://www.ph.utexas.edu/~asimha");
 
   59     aboutData.addAuthor(ki18n(
"Jérôme Sonrier"), KLocalizedString(), 
"jsid@emor3j.fr.eu.org");
 
   60     aboutData.addAuthor(ki18n(
"Prakash Mohan"), KLocalizedString(), 
"prakash.mohan@kdemail.net");
 
   61     aboutData.addAuthor(ki18n(
"Victor Cărbune"), KLocalizedString(), 
"victor.carbune@kdemail.net");
 
   62     aboutData.addAuthor(ki18n(
"Henry de Valence"), KLocalizedString(), 
"hdevalence@gmail.com");
 
   63     aboutData.addAuthor(ki18n(
"Samikshan Bairagya"), KLocalizedString(), 
"samikshan.bairagya@kdemail.net");
 
   64     aboutData.addAuthor(ki18n(
"Rafał Kułaga"), KLocalizedString(), 
"rl.kulaga@gmail.com");
 
   65     aboutData.addAuthor(ki18n(
"Rishab Arora"), KLocalizedString(), 
"ra.rishab@gmail.com");
 
   67     aboutData.addCredit(ki18n(
"Valery Kharitonov"), ki18n(
"Converted labels containing technical terms to links to documentation") );
 
   68     aboutData.addCredit(ki18n(
"Ana-Maria Constantin"), ki18n(
"Technical documentation on Astronomy and KStars") );
 
   69     aboutData.addCredit(ki18n(
"Andrew Stepanenko"), ki18n(
"Guiding code based on lin_guider") );
 
   70     aboutData.addCredit(ki18n(
"Nuno Pinheiro"), ki18n(
"Artwork") );
 
   72     KCmdLineArgs::init( argc, argv, &aboutData );
 
   74     KCmdLineOptions options;
 
   75     options.add(
"!dump", ki18n( 
"Dump sky image to file" ));
 
   76     options.add(
"script ", ki18n( 
"Script to execute" ));
 
   77     options.add(
"width ", ki18n( 
"Width of sky image" ), 
"640");
 
   78     options.add(
"height ", ki18n( 
"Height of sky image" ), 
"480");
 
   79     options.add(
"filename ", ki18n( 
"Filename for sky image" ), 
"kstars.png");
 
   80     options.add(
"date ", ki18n( 
"Date and time" ));
 
   81     options.add(
"!paused", ki18n( 
"Start with clock paused" ));
 
   82     KCmdLineArgs::addCmdLineOptions( options ); 
 
   83     KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
 
   87     if ( args->isSet( 
"dump" ) ) {
 
   88         kDebug() << i18n( 
"Dumping sky image" );
 
   91         const char* format = 
"PNG";
 
   92         QString fname = args->getOption( 
"filename" );
 
   93         QString ext = fname.mid( fname.lastIndexOf(
".")+1 );
 
   94         if ( ext.toLower() == 
"png" ) { format = 
"PNG"; }
 
   95         else if ( ext.toLower() == 
"jpg" || ext.toLower() == 
"jpeg" ) { format = 
"JPG"; }
 
   96         else if ( ext.toLower() == 
"gif" ) { format = 
"GIF"; }
 
   97         else if ( ext.toLower() == 
"pnm" ) { format = 
"PNM"; }
 
   98         else if ( ext.toLower() == 
"bmp" ) { format = 
"BMP"; }
 
   99         else { kWarning() << i18n( 
"Could not parse image format of %1; assuming PNG.", fname ) ; }
 
  104         w = args->getOption( 
"width" ).toInt( &ok );
 
  105         if ( ok ) h =  args->getOption( 
"height" ).toInt( &ok );
 
  107             kWarning() << 
"Unable to parse arguments: " ;
 
  108             kWarning() << 
"Width: " << args->getOption( 
"width" )
 
  109             << 
"  Height: " << args->getOption( 
"height" ) << endl;
 
  114         QObject::connect( dat, SIGNAL( progressText(QString) ), dat, SLOT( slotConsoleMessage(QString) ) );
 
  125         QString datestring = args->getOption( 
"date" );
 
  127         if ( ! datestring.isEmpty() ) {
 
  128             if ( datestring.contains( 
"-" ) ) { 
 
  129                 if ( datestring.contains( 
":" ) ) { 
 
  130                     kdt = KDateTime::fromString( datestring, KDateTime::ISODate );
 
  132                     kdt.
setDate( QDate::fromString( datestring, Qt::ISODate ) );
 
  133                     kdt.
setTime( QTime( 0, 0, 0 ) );
 
  136                 kdt = dat->
geo()->
LTtoUT( KDateTime::fromString( datestring, KDateTime::QtTextDate ) );
 
  139             if ( ! kdt.isValid() ) {
 
  140                 kWarning() << i18n( 
"Using CPU date/time instead." ) ;
 
  142                 kdt = KStarsDateTime::currentUtcDateTime();
 
  145             kdt = KStarsDateTime::currentUtcDateTime();
 
  160         map->setDestination( dest );
 
  161         map->destination()->EquatorialToHorizontal( dat->
lst(), dat->
geo()->
lat() );
 
  162         map->setFocus( map->destination() );
 
  163         map->focus()->EquatorialToHorizontal( dat->
lst(), dat->
geo()->
lat() );
 
  166         QString scriptfile = args->getOption( 
"script" );
 
  167         if ( ! scriptfile.isEmpty() ) {
 
  169                 std::cout << i18n( 
"Script executed." ).toUtf8().data() << std::endl;
 
  171                 kWarning() << i18n( 
"Could not execute script." ) ;
 
  175         qApp->processEvents();
 
  176         map->setupProjector();
 
  177         map->exportSkyImage( &sky );
 
  178         qApp->processEvents();
 
  180         if ( ! sky.save( fname, format ) ) kWarning() << i18n( 
"Unable to save image: %1 ", fname ) ;
 
  181         else kDebug() << i18n( 
"Saved to file: %1", fname );
 
  191     QString datestring = args->getOption( 
"date" );
 
  193     kDebug() << 
"Date string: " << datestring;
 
  196         kWarning() << i18n( 
"Using CPU date/time instead." ) ;
 
  202     QObject::connect(kapp, SIGNAL(lastWindowClosed()), kapp, SLOT(quit()));
 
static double focusRA()
Get Right Ascension of focus position. 
 
static const char notice[]
 
static double focusDec()
Get Declination of focus position. 
 
static KStarsDateTime fromString(const QString &s)
 
KStarsData is the backbone of KStars. 
 
ColorScheme * colorScheme()
 
void setLocationFromOptions()
Set the GeoLocation according to the values stored in the configuration file. 
 
bool initialize()
Initialize KStarsData while running splash screen. 
 
KStarsDateTime LTtoUT(const KStarsDateTime <) const 
 
bool executeScript(const QString &name, SkyMap *map)
Execute a script. 
 
void setDate(const QDate &d)
Assign the Date according to a QDate object. 
 
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets...
 
void setTime(const QTime &t)
Assign the Time according to a QTime object. 
 
static KStarsData * Create()
 
The sky coordinates of a point in the sky. 
 
void loadFromConfig()
Read color-scheme data from the Config object. 
 
Extension of KDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day...
 
There are several time-dependent values used in position calculations, that are not specific to an ob...
 
This is the canvas on which the sky is painted. 
 
static const char description[]
 
void updateTime(GeoLocation *geo, SkyMap *skymap, const bool automaticDSTchange=true)
Update the Simulation Clock. 
 
const KStarsDateTime & ut() const 
 
static KStars * createInstance(bool doSplash, bool clockrunning=true, const QString &startDateString=QString())
Create an instance of this class. 
 
int main(int argc, char *argv[])
 
Q_SCRIPTABLE Q_NOREPLY void setUTC(const KStarsDateTime &newtime)
DBUS function to set the time of the SimClock.