CuteHMI - Services (CuteHMI.Services.2)
PollingTimer.hpp
1 #ifndef H_EXTENSIONS_CUTEHMI_SERVICES_2_INCLUDE_CUTEHMI_SERVICES_POLLINGTIMER_HPP
2 #define H_EXTENSIONS_CUTEHMI_SERVICES_2_INCLUDE_CUTEHMI_SERVICES_POLLINGTIMER_HPP
3 
4 #include "internal/common.hpp"
5 
6 #include <QObject>
7 
8 namespace cutehmi {
9 namespace services {
10 
15 class CUTEHMI_SERVICES_API PollingTimer:
16  public QObject
17 {
18  Q_OBJECT
19 
20  public:
21  static constexpr int INITIAL_INTERVAL = 250;
22  static constexpr int INITIAL_SUBTIMER_INTERVAL = 10;
23 
24  Q_PROPERTY(int interval READ interval WRITE setlInterval NOTIFY intervalChanged)
25  Q_PROPERTY(PollingTimer * subtimer READ subtimer CONSTANT)
26 
27  explicit PollingTimer(int interval = INITIAL_INTERVAL, QObject * parent = nullptr);
28 
29  int interval() const;
30 
31  void setlInterval(int interval);
32 
37  PollingTimer * subtimer();
38 
39  public slots:
43  void start();
44 
45  signals:
46  void intervalChanged();
47 
48  void triggered();
49 
50  private slots:
51  void shoot();
52 
53  private:
54  struct Members {
55  int interval;
56  PollingTimer * subtimer;
57  };
58 
59  MPtr<Members> m;
60 };
61 
62 }
63 }
64 
65 #endif
66 
67 //(c)C: Copyright © 2019, Michał Policht <michal@policht.pl>. All rights reserved.
68 //(c)C: This file is a part of CuteHMI.
69 //(c)C: CuteHMI is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
70 //(c)C: CuteHMI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
71 //(c)C: You should have received a copy of the GNU Lesser General Public License along with CuteHMI. If not, see <https://www.gnu.org/licenses/>.
cutehmi::MPtr< Members >
QObject
cutehmi
cutehmi::services::PollingTimer
Polling timer.
Definition: PollingTimer.hpp:15