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#include <QTimeZone>
25
27class Event
28{
29 public:
31 QString eventName,
32 int monitorID,
33 QString monitorName,
34 const QDateTime &startTime,
35 QString length) :
40 m_length(std::move(length)),
41 m_startTime(startTime.toLocalTime())
42 {
43 }
44
45 Event() = default;
46
47 int monitorID(void) const { return m_monitorID; }
48
49 int eventID(void) const { return m_eventID; }
50
51 QString eventName(void) const { return m_eventName; }
52
53 QString monitorName(void) const { return m_monitorName; }
54
55#if QT_VERSION < QT_VERSION_CHECK(6,5,0)
57 QDateTime startTime(Qt::TimeSpec spec) const
58 {
63 return (Qt::LocalTime == spec) ?
64 m_startTime : m_startTime.toTimeSpec(spec);
65 }
66#else
68 QDateTime startTime(const QTimeZone& zone) const
69 {
70 return m_startTime.toTimeZone(zone);
71 }
72#endif
73
76 QDateTime startTime(void) const { return m_startTime; }
77
78 QString length(void) const { return m_length; }
79
80 private:
81 int m_monitorID { -1 };
82 int m_eventID { -1 };
83 QString m_eventName;
85 QString m_length;
89 QDateTime m_startTime;
90};
91
92enum State : std::uint8_t
93{
98 TAPE
99};
100
101// event frame details
102struct Frame
103{
104 QString type;
105 double delta {0.0};
106};
107
109{
110 public:
111 Monitor() = default;
112
113 public:
114 // used by console view
115 int id { 0 };
116 QString name;
117 QString type;
118 QString function;
119 bool enabled { false };
120 QString device;
121 QString zmcStatus;
122 QString zmaStatus;
123 int events { 0 };
124 // used by live view
125 QString status;
126 int width { 0 };
127 int height { 0 };
129 // used by the alarm notiftications
130 bool showNotifications { false };
133};
134
136
137#endif
Event details.
Definition: zmdefines.h:28
QString eventName(void) const
Definition: zmdefines.h:51
int m_eventID
Definition: zmdefines.h:82
QString m_eventName
Definition: zmdefines.h:83
QString monitorName(void) const
Definition: zmdefines.h:53
int eventID(void) const
Definition: zmdefines.h:49
QDateTime startTime(const QTimeZone &zone) const
Returns time using specified QTimeZone.
Definition: zmdefines.h:68
int monitorID(void) const
Definition: zmdefines.h:47
QString length(void) const
Definition: zmdefines.h:78
int m_monitorID
Definition: zmdefines.h:81
QString m_monitorName
Definition: zmdefines.h:84
Event(int eventID, QString eventName, int monitorID, QString monitorName, const QDateTime &startTime, QString length)
Definition: zmdefines.h:30
QDateTime startTime(void) const
Returns time with native Qt::TimeSpec (subject to revision).
Definition: zmdefines.h:76
QString m_length
Definition: zmdefines.h:85
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:89
Event()=default
Monitor()=default
State state
Definition: zmdefines.h:131
int events
Definition: zmdefines.h:123
QString device
Definition: zmdefines.h:120
QString function
Definition: zmdefines.h:118
QString zmaStatus
Definition: zmdefines.h:122
int width
Definition: zmdefines.h:126
bool enabled
Definition: zmdefines.h:119
bool showNotifications
Definition: zmdefines.h:130
QString status
Definition: zmdefines.h:125
QString name
Definition: zmdefines.h:116
State previousState
Definition: zmdefines.h:132
int bytes_per_pixel
Definition: zmdefines.h:128
int height
Definition: zmdefines.h:127
QString type
Definition: zmdefines.h:117
QString zmcStatus
Definition: zmdefines.h:121
Q_DECLARE_METATYPE(std::chrono::seconds)
STL namespace.
double delta
Definition: zmdefines.h:105
QString type
Definition: zmdefines.h:104
State
Definition: zmdefines.h:93
@ TAPE
Definition: zmdefines.h:98
@ ALERT
Definition: zmdefines.h:97
@ ALARM
Definition: zmdefines.h:96
@ PREALARM
Definition: zmdefines.h:95
@ IDLE
Definition: zmdefines.h:94
State
Definition: zmserver.h:69