Marble

MarbleClock.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2007-2008 David Roberts <[email protected]>
4 // SPDX-FileCopyrightText: 2010 Harshit Jain <[email protected]>
5 //
6 
7 #ifndef MARBLE_MARBLECLOCK_H
8 #define MARBLE_MARBLECLOCK_H
9 
10 #include "geodata_export.h"
11 
12 #include <QObject>
13 
14 class QDateTime;
15 
16 namespace Marble
17 {
18 
19 class MarbleClockPrivate;
20 
21 class GEODATA_EXPORT MarbleClock : public QObject
22 {
23  Q_OBJECT
24 
25  public:
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 
36  Q_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 
48 public:
49 
50  /**
51  * @brief Sets the internal date and time a custom one
52  * @param datetime The custom date and time
53  **/
54  void setDateTime( const QDateTime& datetime );
55 
56  /**
57  * @brief Returns the internal date and time
58  **/
59  QDateTime dateTime() const;
60 
61  /**
62  * @brief Set the interval at which dateTime() is updated and timeChanged() is emitted.
63  * @param seconds The interval in seconds
64  * @see updateInterval
65  */
66  void setUpdateInterval( int seconds );
67 
68  /**
69  * @brief Returns the interval at which dateTime() is updated and timeChanged() is emitted,
70  * The default is 60 seconds.
71  * @return The interval in seconds.
72  * @see setUpdateInterval
73  */
74  int updateInterval() const;
75 
76  /**
77  * @brief Sets the speed of the timer which is how fast the marble clock can run relative to actual speed of time.
78  * @param speed The new speed (integer)
79  **/
80  void setSpeed( int speed );
81 
82  /**
83  * @brief Returns the speed of the timer
84  **/
85  int speed() const;
86 
87  /**
88  * @brief Sets the timezone of the clock
89  * @param timeInSec The new timezone ( in seconds w.r.t. UTC )
90  **/
91  void setTimezone( int timeInSec );
92 
93  /**
94  * @brief Returns the timezone of the clock
95  **/
96  int timezone() const;
97 
98  private:
99  Q_DISABLE_COPY( MarbleClock )
100 
101  Q_PRIVATE_SLOT( d, void timerTimeout() )
102 
103  MarbleClockPrivate* const d;
104 
105  friend class MarbleClockPrivate;
106 };
107 
108 }
109 #endif
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:09 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.