SimClock

Search for usage in LXR

#include <simclock.h>

Inheritance diagram for SimClock:

Signals

void clockToggled (bool)
 
void scaleChanged (float)
 
void timeAdvanced ()
 
void timeChanged ()
 

Public Slots

void manualTick (bool force=false, bool backward=false)
 
Q_SCRIPTABLE Q_NOREPLY void setClockScale (double scale)
 
Q_SCRIPTABLE Q_NOREPLY void setNow ()
 
Q_SCRIPTABLE Q_NOREPLY void setUTC (const KStarsDateTime &newtime)
 
Q_SCRIPTABLE Q_NOREPLY void start ()
 
Q_SCRIPTABLE Q_NOREPLY void stop ()
 
void tick ()
 

Public Member Functions

 SimClock (QObject *parent=nullptr, const KStarsDateTime &when=KStarsDateTime::currentDateTimeUtc())
 
Q_INVOKABLE bool isActive ()
 
bool isManualMode () const
 
double scale () const
 
void setManualMode (bool on=true)
 
const KStarsDateTimeutc () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Additional Inherited Members

- Properties inherited from QObject
 objectName
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

kstars simulation clock

Author
Mark Hollomon
Version
1.0

Definition at line 24 of file simclock.h.

Constructor & Destructor Documentation

◆ SimClock()

SimClock::SimClock ( QObject parent = nullptr,
const KStarsDateTime when = KStarsDateTime::currentDateTimeUtc() 
)
explicit

Constructor.

Parameters
parentparent object for the clock
whenthe date/time to which the SimClock should be initialized in UTC

Definition at line 18 of file simclock.cpp.

Member Function Documentation

◆ clockToggled

void SimClock::clockToggled ( bool  )
signal

This is an signal that is called on either clock start or clock stop with an appropriate boolean argument.

Required so that we can bind it to KToggleAction::slotToggled(bool)

◆ isActive()

bool SimClock::isActive ( )

Whether the clock is active or not is a bit complicated by the introduction of "manual mode".

In manual mode, SimClock's internal timer is stopped, because the clock is ticked manually when the current update has finished. So, if ManualMode is true, then isActive() checks whether ManualActive is true. Otherwise, it checks whether the timer is running.

Returns
true if the Simulation clock is actively running.

Definition at line 96 of file simclock.cpp.

◆ isManualMode()

bool SimClock::isManualMode ( ) const
inline

Manual Mode is a new (04/2002) addition to the SimClock.

It is intended to be activated for large timesteps, when we want each frame drawn to the screen to be precisely Scale seconds later than the previous frame. (i.e., if the timescale is 1 year, then each successive frame should be 1 year later than the previous frame). ManualMode accomplishes this by stopping the internal timer and allowing the clock to be advanced manually (the manualTick() slot is called at the end of each KStars::updateTime()).

Returns
whether Manual Mode is active.

Definition at line 68 of file simclock.h.

◆ manualTick

void SimClock::manualTick ( bool  force = false,
bool  backward = false 
)
slot

Equivalent of tick() for manual mode.

If ManualActive is true, add Scale seconds to the SimClock time. (we may want to modify this slightly...e.g., the number of seconds in a year is not constant (leap years), so it is better to increment the year, instead of adding 31 million seconds. set backward to true to reverse sign of Scale value

Definition at line 83 of file simclock.cpp.

◆ scale()

double SimClock::scale ( ) const
inline
Returns
the current timestep setting

Definition at line 53 of file simclock.h.

◆ scaleChanged

void SimClock::scaleChanged ( float  )
signal

The timestep has changed.

◆ setClockScale

void SimClock::setClockScale ( double  scale)
slot

DBUS function to set scale of simclock.

setClockScale Set simulation clock scale per second.

Parameters
scaleScale per second. 1 means normal scale, each 1 simulation second equals 1 real second. Value less than one slows the simulation clock, while values over 1 speeds it up. A scale of 0.5 makes the simulation clock ticks once every 2 actual seconds (or half-ticks per one actual second), while a value of 60 make the simulation clock ticks 60 simulation seconds (1 simulation minute) for every 1 actual second.

Definition at line 169 of file simclock.cpp.

◆ setManualMode()

void SimClock::setManualMode ( bool  on = true)

Sets Manual Mode on/off according to the bool argument.

Definition at line 61 of file simclock.cpp.

◆ setNow

Q_SCRIPTABLE Q_NOREPLY void SimClock::setNow ( )
inlineslot

DBUS function to set the current time of the SimClock.

Definition at line 88 of file simclock.h.

◆ setUTC

void SimClock::setUTC ( const KStarsDateTime newtime)
slot

DBUS function to set the time of the SimClock.

Definition at line 143 of file simclock.cpp.

◆ start

void SimClock::start ( )
slot

DBUS function to start the SimClock.

Definition at line 120 of file simclock.cpp.

◆ stop

void SimClock::stop ( )
slot

DBUS function to stop the SimClock.

Definition at line 104 of file simclock.cpp.

◆ tick

void SimClock::tick ( )
slot

Respond to the QTimer::timeout signal.

Definition at line 32 of file simclock.cpp.

◆ timeAdvanced

void SimClock::timeAdvanced ( )
signal

The clock has ticked (emitted by tick() )

◆ timeChanged

void SimClock::timeChanged ( )
signal

The time has changed (emitted by setUTC() )

◆ utc()

const KStarsDateTime& SimClock::utc ( ) const
inline
Returns
const reference to the current simulation Universal Time.

Definition at line 37 of file simclock.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Dec 8 2022 03:59:54 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.