MythTV  master
zmdefines.h
Go to the documentation of this file.
1 /* ============================================================
2  * This program is free software; you can redistribute it
3  * and/or modify it under the terms of the GNU General
4  * Public License as published bythe Free Software Foundation;
5  * either version 2, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * ============================================================ */
14 
15 #ifndef ZMDEFINES_H
16 #define ZMDEFINES_H
17 
18 #include <utility>
19 #include <vector>
20 
21 // qt
22 #include <QString>
23 #include <QDateTime>
24 
26 class Event
27 {
28  public:
30  QString eventName,
31  int monitorID,
32  QString monitorName,
33  const QDateTime &startTime,
34  QString length) :
37  m_eventName(std::move(eventName)),
38  m_monitorName(std::move(monitorName)),
39  m_length(std::move(length)),
40  m_startTime(startTime.toLocalTime())
41  {
42  }
43 
44  Event() = default;
45 
46  int monitorID(void) const { return m_monitorID; }
47 
48  int eventID(void) const { return m_eventID; }
49 
50  QString eventName(void) const { return m_eventName; }
51 
52  QString monitorName(void) const { return m_monitorName; }
53 
55  QDateTime startTime(Qt::TimeSpec spec) const
56  {
61  return (Qt::LocalTime == spec) ?
62  m_startTime : m_startTime.toTimeSpec(spec);
63  }
64 
67  QDateTime startTime(void) const { return m_startTime; }
68 
69  QString length(void) const { return m_length; }
70 
71  private:
72  int m_monitorID { -1 };
73  int m_eventID { -1 };
74  QString m_eventName;
75  QString m_monitorName;
76  QString m_length;
80  QDateTime m_startTime;
81 };
82 
83 enum State
84 {
90 };
91 
92 // event frame details
93 struct Frame
94 {
95  QString type;
96  double delta {0.0};
97 };
98 
99 class Monitor
100 {
101  public:
102  Monitor() = default;
103 
104  public:
105  // used by console view
106  int id { 0 };
107  QString name;
108  QString type;
109  QString function;
110  bool enabled { false };
111  QString device;
112  QString zmcStatus;
113  QString zmaStatus;
114  int events { 0 };
115  // used by live view
116  QString status;
117  int width { 0 };
118  int height { 0 };
119  int bytes_per_pixel { 0 };
120  // used by the alarm notiftications
121  bool showNotifications { false };
124 };
125 
127 
128 #endif
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(GrabberScript *)
PREALARM
@ PREALARM
Definition: zmdefines.h:86
Event::monitorName
QString monitorName(void) const
Definition: zmdefines.h:52
Event::m_eventID
int m_eventID
Definition: zmdefines.h:73
Event::m_eventName
QString m_eventName
Definition: zmdefines.h:74
TAPE
@ TAPE
Definition: zmdefines.h:89
Monitor::width
int width
Definition: zmdefines.h:117
Monitor::name
QString name
Definition: zmdefines.h:107
Event::startTime
QDateTime startTime(Qt::TimeSpec spec) const
Returns time using specified Qt::TimeSpec.
Definition: zmdefines.h:55
ALERT
@ ALERT
Definition: zmdefines.h:88
Monitor::status
QString status
Definition: zmdefines.h:116
Event::startTime
QDateTime startTime(void) const
Returns time with native Qt::TimeSpec (subject to revision).
Definition: zmdefines.h:67
Monitor::events
int events
Definition: zmdefines.h:114
Frame
Definition: zmdefines.h:93
Monitor::previousState
State previousState
Definition: zmdefines.h:123
Monitor::zmcStatus
QString zmcStatus
Definition: zmdefines.h:112
Monitor::enabled
bool enabled
Definition: zmdefines.h:110
Event::m_monitorName
QString m_monitorName
Definition: zmdefines.h:75
Event
Event details.
Definition: zmdefines.h:26
Monitor::bytes_per_pixel
int bytes_per_pixel
Definition: zmdefines.h:119
Monitor::device
QString device
Definition: zmdefines.h:111
IDLE
@ IDLE
Definition: zmdefines.h:85
State
State
Definition: zmserver.h:62
Monitor::showNotifications
bool showNotifications
Definition: zmdefines.h:121
ALARM
@ ALARM
Definition: zmdefines.h:87
Event::Event
Event()=default
Frame::delta
double delta
Definition: zmdefines.h:96
Event::Event
Event(int eventID, QString eventName, int monitorID, QString monitorName, const QDateTime &startTime, QString length)
Definition: zmdefines.h:29
Event::eventName
QString eventName(void) const
Definition: zmdefines.h:50
Monitor::zmaStatus
QString zmaStatus
Definition: zmdefines.h:113
Event::m_monitorID
int m_monitorID
Definition: zmdefines.h:72
Monitor::state
State state
Definition: zmdefines.h:122
Frame::type
QString type
Definition: zmdefines.h:95
Monitor::height
int height
Definition: zmdefines.h:118
Event::eventID
int eventID(void) const
Definition: zmdefines.h:48
Monitor::type
QString type
Definition: zmdefines.h:108
Event::monitorID
int monitorID(void) const
Definition: zmdefines.h:46
Event::m_startTime
QDateTime m_startTime
The start time is stored in local time interally since all uses are currently using local time and co...
Definition: zmdefines.h:80
Monitor
Definition: zmdefines.h:99
Event::length
QString length(void) const
Definition: zmdefines.h:69
Monitor::Monitor
Monitor()=default
Event::m_length
QString m_length
Definition: zmdefines.h:76