SimClock

Search for usage in LXR

#include <simclock.h>

Inheritance diagram for SimClock:

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 KStarsDateTimeutc () const
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
QBindable< QStringbindableObjectName ()
 
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 () const const
 
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 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 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_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
 
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 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)
 
QThreadthread () 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
 
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 22 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 128 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 69 of file simclock.h.

◆ isRealTime()

bool SimClock::isRealTime ( ) const
inline

Definition at line 77 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 112 of file simclock.cpp.

◆ realtimeToogled

void SimClock::realtimeToogled ( bool )
signal

Emitted when realtime clock is toggled.

◆ scale()

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

Definition at line 51 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 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

Q_SCRIPTABLE Q_NOREPLY void SimClock::setNow ( )
inlineslot

DBUS function to set the current time of the SimClock.

Definition at line 94 of file simclock.h.

◆ setRealTime

void SimClock::setRealTime ( bool on = true)
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

void SimClock::setUTC ( const KStarsDateTime & newtime)
slot

DBUS function to set the time of the SimClock.

Definition at line 181 of file simclock.cpp.

◆ start

void SimClock::start ( )
slot

DBUS function to start the SimClock.

Definition at line 155 of file simclock.cpp.

◆ stop

void SimClock::stop ( )
slot

DBUS function to stop the SimClock.

Definition at line 136 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 35 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-2024 The KDE developers.
Generated on Fri Dec 6 2024 12:09:54 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.