Marble

MarbleClock.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007-2008 David Roberts <dvdr18@gmail.com>
4// SPDX-FileCopyrightText: 2010 Harshit Jain <hjain.itbhu@gmail.com>
5//
6
7#ifndef MARBLE_MARBLECLOCK_H
8#define MARBLE_MARBLECLOCK_H
9
10#include "geodata_export.h"
11
12#include <QObject>
13
14class QDateTime;
15
16namespace Marble
17{
18
19class MarbleClockPrivate;
20
21class GEODATA_EXPORT MarbleClock : public QObject
22{
23 Q_OBJECT
24
25public:
26 explicit MarbleClock(QObject *parent = nullptr);
27
28 ~MarbleClock() override;
29
30 /**
31 * @brief Determine how much of the current day has elapsed
32 * @return A value between 0 and 1 corresponding to the fraction of the day that has elapsed
33 */
34 qreal dayFraction() const;
35
36Q_SIGNALS:
37 /**
38 * @brief the timeChanged signal will be triggered at updateInterval() rate
39 * or at most every second.
40 **/
41 void timeChanged();
42
43 /**
44 * @brief Emitted when setUpdateInterval() is called.
45 */
46 void updateIntervalChanged(int seconds);
47
48public:
49 /**
50 * @brief Sets the internal date and time a custom one
51 * @param datetime The custom date and time
52 **/
53 void setDateTime(const QDateTime &datetime);
54
55 /**
56 * @brief Returns the internal date and time
57 **/
58 QDateTime dateTime() const;
59
60 /**
61 * @brief Set the interval at which dateTime() is updated and timeChanged() is emitted.
62 * @param seconds The interval in seconds
63 * @see updateInterval
64 */
65 void setUpdateInterval(int seconds);
66
67 /**
68 * @brief Returns the interval at which dateTime() is updated and timeChanged() is emitted,
69 * The default is 60 seconds.
70 * @return The interval in seconds.
71 * @see setUpdateInterval
72 */
73 int updateInterval() const;
74
75 /**
76 * @brief Sets the speed of the timer which is how fast the marble clock can run relative to actual speed of time.
77 * @param speed The new speed (integer)
78 **/
79 void setSpeed(int speed);
80
81 /**
82 * @brief Returns the speed of the timer
83 **/
84 int speed() const;
85
86 /**
87 * @brief Sets the timezone of the clock
88 * @param timeInSec The new timezone ( in seconds w.r.t. UTC )
89 **/
90 void setTimezone(int timeInSec);
91
92 /**
93 * @brief Returns the timezone of the clock
94 **/
95 int timezone() const;
96
97private:
98 Q_DISABLE_COPY(MarbleClock)
99
100 Q_PRIVATE_SLOT(d, void timerTimeout())
101
102 MarbleClockPrivate *const d;
103
104 friend class MarbleClockPrivate;
105};
106
107}
108#endif
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.