kstars
simclock.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 simclock.h - description 00003 ------------------- 00004 begin : Mon Feb 18 2002 00005 copyright : (C) 2002 by Mark Hollomon 00006 email : mhh@mindspring.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef KSTARS_SIMCLOCK_H_ 00019 #define KSTARS_SIMCLOCK_H_ 00020 00021 #include <time.h> 00022 #include <qtimer.h> 00023 00024 #include "simclockinterface.h" 00025 #include "kstarsdatetime.h" 00026 00033 class SimClock : public QObject, public SimClockInterface { 00034 Q_OBJECT 00035 00036 public: 00042 SimClock(QObject *parent = 0, const KStarsDateTime &when = KStarsDateTime::currentDateTime() ); 00047 SimClock(const SimClock &old); 00048 00050 const KStarsDateTime& utc() const { return UTC; } 00051 00060 bool isActive(); 00061 00063 double scale() const { return Scale; } 00064 00075 bool isManualMode() const { return ManualMode; } 00076 00078 void setManualMode( bool on=true ); 00079 00081 virtual ASYNC stop(); 00082 00084 virtual ASYNC start(); 00085 00087 virtual ASYNC setUTC(const KStarsDateTime &newtime); 00088 00091 virtual ASYNC setClockScale(float s); 00092 00093 public slots: 00094 00096 void setScale(float s); 00097 00099 void tick(); 00100 00106 void manualTick( bool force=false ); 00107 00108 signals: 00109 00111 void timeChanged(); 00112 00114 void timeAdvanced(); 00115 00117 void scaleChanged(float); 00118 00119 00121 void clockStarted(); 00122 00124 void clockStopped(); 00125 00126 private: 00127 long double julianmark; 00128 KStarsDateTime UTC; 00129 QTimer tmr; 00130 double Scale; 00131 QTime sysmark; 00132 int lastelapsed; 00133 bool ManualMode, ManualActive; 00134 00135 // used to generate names for dcop interfaces 00136 static int idgen; 00137 // how often to update 00138 static int TimerInterval; 00139 }; 00140 00141 #endif