1 #ifndef DATETIMEWIDGET_H 2 #define DATETIMEWIDGET_H 3 4 #include <QWidget> 5 #include "iwidget.h" 6 #include "processhandler.h" 7 8 namespace Ui { 9 class DateTimeWidget; 10 } 11 12 class QComboBox; 13 class NetworkChecker; 14 class DateTimeWidget : public IWidget 15 { 16 Q_OBJECT 17 Q_PLUGIN_METADATA(IID PLUGIN_INTERFACE_iid FILE "rtc.json") 18 19 public: 20 explicit DateTimeWidget(QWidget *parent = 0); 21 ~DateTimeWidget(); 22 23 virtual QString id() override; 24 virtual void initUi()override; 25 26 private: 27 long long NTPGetTimeBeijingMSeconds(); 28 int currentvalue(QComboBox *d); 29 30 private slots: 31 void on_applyBtn_clicked(); 32 33 private: 34 Ui::DateTimeWidget *ui; 35 NetworkChecker *m_checker; 36 }; 37 38 class NetworkChecker:public QObject, public ProcessHandler 39 { 40 Q_OBJECT 41 public: 42 NetworkChecker(QObject *parent=Q_NULLPTR); 43 void processMessage(const QString &info) override; 44 bool networkIsOk(); 45 46 private: 47 QString m_info; 48 bool m_change; 49 }; 50 51 #endif // DATETIMEWIDGET_H 52