SimClock
#include <simclock.h>
Signals | |
void | clockToggled (bool) |
void | realtimeToogled (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 () |
void | setRealTime (bool on=true) |
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 |
bool | isRealTime () const |
double | scale () const |
void | setManualMode (bool on=true) |
const KStarsDateTime & | utc () const |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () 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 () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, 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 |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
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 | |
T | qobject_cast (const QObject *object) |
T | 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 | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Additional Inherited Members | |
Public Types inherited from QObject | |
typedef | QObjectList |
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) |
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 |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Detailed Description
Constructor & Destructor Documentation
◆ SimClock()
|
explicit |
Constructor.
- Parameters
-
parent parent object for the clock when the date/time to which the SimClock should be initialized in UTC
Definition at line 18 of file simclock.cpp.
Member Function Documentation
◆ clockToggled
|
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 128 of file simclock.cpp.
◆ isManualMode()
|
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 69 of file simclock.h.
◆ isRealTime()
|
inline |
Definition at line 77 of file simclock.h.
◆ manualTick
|
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 112 of file simclock.cpp.
◆ realtimeToogled
|
signal |
Emitted when realtime clock is toggled.
◆ scale()
|
inline |
- Returns
- the current timestep setting
Definition at line 51 of file simclock.h.
◆ scaleChanged
|
signal |
The timestep has changed.
◆ setClockScale
|
slot |
DBUS function to set scale of simclock.
setClockScale Set simulation clock scale per second.
- Parameters
-
scale Scale 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 210 of file simclock.cpp.
◆ setManualMode()
void SimClock::setManualMode | ( | bool | on = true | ) |
Sets Manual Mode on/off according to the bool argument.
Definition at line 66 of file simclock.cpp.
◆ setNow
|
inlineslot |
DBUS function to set the current time of the SimClock.
Definition at line 94 of file simclock.h.
◆ setRealTime
|
slot |
Realtime mode will lock SimClock with system clock.
This should prevent issues that occur when system goes to sleep and clock stops ticking.
Definition at line 88 of file simclock.cpp.
◆ setUTC
|
slot |
DBUS function to set the time of the SimClock.
Definition at line 181 of file simclock.cpp.
◆ start
|
slot |
DBUS function to start the SimClock.
Definition at line 155 of file simclock.cpp.
◆ stop
|
slot |
DBUS function to stop the SimClock.
Definition at line 136 of file simclock.cpp.
◆ tick
|
slot |
Respond to the QTimer::timeout signal.
Definition at line 32 of file simclock.cpp.
◆ timeAdvanced
|
signal |
The clock has ticked (emitted by tick() )
◆ timeChanged
|
signal |
The time has changed (emitted by setUTC() )
◆ utc()
|
inline |
- Returns
- const reference to the current simulation Universal Time.
Definition at line 35 of file simclock.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.