Kstars

timedialog.h
1 /*
2  SPDX-FileCopyrightText: 2001 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include "kstarsdatetime.h"
10 
11 #include <QDialog>
12 #include <QHBoxLayout>
13 #include <QKeyEvent>
14 #include <QLabel>
15 #include <QVariant>
16 #include <QVBoxLayout>
17 
18 class QHBoxLayout;
19 class QVBoxLayout;
20 class KDatePicker;
21 class QTimeEdit;
22 class QPushButton;
23 class GeoLocation;
24 
25 /**
26  * @class TimeDialog
27  *
28  * A class for adjusting the Time and Date. Contains a KDatePicker widget
29  * for selecting the date, and a QTimeEdit for selecting the time. There
30  * is also a "Now" button for selecting the Time and Date from the system clock.
31  *
32  *
33  * @short Dialog for adjusting the Time and Date.
34  * @author Jason Harris
35  * @version 1.0
36  */
37 class TimeDialog : public QDialog
38 {
39  Q_OBJECT
40  public:
41  /**
42  * Constructor. Creates widgets and packs them into QLayouts.
43  * Connects Signals and Slots.
44  */
45  TimeDialog(const KStarsDateTime &now, GeoLocation *_geo, QWidget *parent, bool UTCFrame = false);
46 
47  ~TimeDialog() override = default;
48 
49  /** @returns a QTime object with the selected time */
50  QTime selectedTime(void);
51 
52  /** @returns a QDate object with the selected date */
53  QDate selectedDate(void);
54 
55  /** @returns a KStarsDateTime object with the selected date and time */
57 
58  public slots:
59  /**
60  * When the "Now" button is pressed, read the time and date from the system clock.
61  * Change the selected date in the KDatePicker to the system's date, and the displayed time
62  * to the system time.
63  */
64  void setNow(void);
65 
66  protected:
67  void keyReleaseEvent(QKeyEvent *) override;
68 
69  private:
70  bool UTCNow;
71  QHBoxLayout *hlay { nullptr };
72  QVBoxLayout *vlay { nullptr };
73  KDatePicker *dPicker { nullptr };
74  QTimeEdit *tEdit { nullptr };
75  QPushButton *NowButton { nullptr };
76  GeoLocation *geo { nullptr };
77 };
Q_OBJECTQ_OBJECT
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
void setNow(void)
When the "Now" button is pressed, read the time and date from the system clock.
Definition: timedialog.cpp:92
KStarsDateTime selectedDateTime(void)
Definition: timedialog.cpp:112
QDate selectedDate(void)
Definition: timedialog.cpp:107
TimeDialog(const KStarsDateTime &now, GeoLocation *_geo, QWidget *parent, bool UTCFrame=false)
Constructor.
Definition: timedialog.cpp:24
Dialog for adjusting the Time and Date.
Definition: timedialog.h:37
QTime selectedTime(void)
Definition: timedialog.cpp:102
QObject * parent() const const
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 22 2023 03:57:59 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.