File indexing completed on 2024-04-21 03:50:01

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2010 Harshit Jain <hjain.itbhu@gmail.com>
0004 //
0005 
0006 #ifndef MARBLE_TIMECONTROLWIDGET_H
0007 #define MARBLE_TIMECONTROLWIDGET_H
0008 
0009 // Qt
0010 #include <QDateTime>
0011 #include <QDialog>
0012 
0013 // Marble
0014 #include "marble_export.h"
0015 
0016 namespace Ui
0017 {
0018     class TimeControlWidget;
0019 }
0020 
0021 namespace Marble
0022 {
0023 
0024 class MarbleClock;
0025 
0026 class MARBLE_EXPORT TimeControlWidget : public QDialog
0027 {
0028     Q_OBJECT
0029 
0030  public:
0031     explicit TimeControlWidget( MarbleClock* clock, QWidget* parent = nullptr );
0032     ~TimeControlWidget() override;
0033 
0034  private Q_SLOTS:
0035     /**
0036     * @brief  apply the settings to internal clock
0037     */
0038     void apply();
0039 
0040     /**
0041     * @brief  set the newDateTimeEdit to current system time
0042     */
0043     void nowClicked();
0044 
0045     /**
0046      * @brief Set the refreshIntervalSpinBox value to @p seconds.
0047      */
0048     void updateRefreshRate( int seconds );
0049 
0050     /**
0051     * @brief  set the text of speedLabel to @p speed
0052     */
0053     void updateSpeedLabel( int speed );
0054 
0055     /**
0056     * @brief  update the currentDateTimeEdit to current internal time
0057     */
0058     void updateDateTime();
0059 
0060  protected:
0061     Q_DISABLE_COPY( TimeControlWidget )
0062 
0063     void showEvent( QShowEvent* event ) override;
0064 
0065     Ui::TimeControlWidget *m_uiWidget;
0066 
0067     MarbleClock *m_clock;
0068     QDateTime    m_lastDateTime;
0069 };
0070 
0071 }
0072 
0073 #endif  //MARBLE_TIMECONTROLWIDGET_H