-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathClockCalibrationDialog.h
56 lines (48 loc) · 1.41 KB
/
ClockCalibrationDialog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef CLOCKCALIBRATIONDIALOG_H
#define CLOCKCALIBRATIONDIALOG_H
#include <QDialog>
#include <AbstractSubApplication.h>
#include <QTimer>
#include <QDateTime>
namespace Ui {
class ClockCalibrationDialog;
}
class ClockCalibrationDialog : public QDialog,public AbstractSubApplication
{
Q_OBJECT
public:
explicit ClockCalibrationDialog(QWidget *parent = nullptr);
~ClockCalibrationDialog();
void regActions(QMenu *contextMenu) override;
public slots:
void refreshClock();
void keyboardAttached() override;
void keyboardDettached() override;
void syncTimeDiff();
void checkAutoSync();
void setupTimeImmediately();
void resetTimeEdit();
void syncClockTriggered();
void saveConfiguration();
protected:
void showEvent(QShowEvent *) override;
void closeEvent(QCloseEvent *) override;
private:
bool setupTime(QDateTime dateTime);
const QString optionSyncEnabled = "rtc_sync_enabled";
const QString optionSyncCount = "rtc_sync_time_count";
const QString optionSyncUnit = "rtc_sync_time_unit";
const QString optionNextSync = "rtc_next_sync";
Ui::ClockCalibrationDialog *ui;
QMenu* subMenu;
QAction* calibrateAction;
QAction* showAction;
QTimer* refreshTimer;
QTimer* autoSyncTimer;
bool autoSyncEnabled;
QDateTime nextSyncTime;
qint32 timeCount;
qint32 timeUnit;
qint32 timeDiff = 0;
};
#endif // CLOCKCALIBRATIONDIALOG_H