MythTV  master
channelinfo.h
Go to the documentation of this file.
1 #ifndef DB_CHANNEL_INFO_H_
2 #define DB_CHANNEL_INFO_H_
3 
4 // C++ headers
5 #include <cstdint>
6 #include <vector>
7 
8 using namespace std;
9 
10 // Qt headers
11 #include <QString>
12 #include <QImage>
13 #include <QVariant>
14 #include <QDateTime>
15 
16 // MythTV headers
17 #include "mythtvexp.h"
18 #include "mythtypes.h"
19 #include "programtypes.h"
20 
22 {
23  public:
24  ChannelInfo() = default;
25  ChannelInfo(const ChannelInfo&);
26  ChannelInfo(const QString &_channum, const QString &_callsign,
27  uint _chanid, uint _major_chan, uint _minor_chan,
28  uint _mplexid, bool _visible,
29  const QString &_name, const QString &_icon,
30  uint _sourceid);
31 
32  ChannelInfo& operator=(const ChannelInfo&);
33 
34  bool operator == (uint chanid) const
35  { return m_chanid == chanid; }
36 
37  bool Load(uint lchanid = -1);
38 
39  enum ChannelFormat { kChannelShort, kChannelLong };
40  QString GetFormatted(const ChannelFormat &format) const;
41  void ToMap(InfoMap &infoMap);
42 
43  QString GetSourceName();
44  void SetSourceName(const QString &lname) { m_sourcename = lname; }
45 
46 
47  const QList<uint> GetGroupIds() const { return m_groupIdList; }
48  void LoadGroupIds();
49  void AddGroupId(uint lgroupid)
50  {
51  if (!m_groupIdList.contains(lgroupid))
52  m_groupIdList.push_back(lgroupid);
53  }
54  void RemoveGroupId(uint lgroupid) { m_groupIdList.removeOne(lgroupid); }
55 
56 
57  const QList<uint> GetInputIds() const { return m_inputIdList; }
58  void LoadInputIds();
59  // Since inputids must only appear once in a list, protect access
60  // to it
61  void AddInputId(uint linputid)
62  {
63  if (!m_inputIdList.contains(linputid))
64  m_inputIdList.push_back(linputid);
65  }
66  void RemoveInputId(uint linputid) { m_inputIdList.removeOne(linputid); }
67 
68 
69  private:
70  void Init();
71 
72  public:
73 
74  // Ordered to match channel table
75  uint m_chanid {0};
76  QString m_channum;
77  QString m_freqid; // May be overloaded to a
78  // non-frequency identifier
79  uint m_sourceid {0};
80 
81  QString m_callsign;
82  QString m_name;
83  QString m_icon;
84 
85  int m_finetune {0};
86  QString m_videofilters;
87  QString m_xmltvid;
88  int m_recpriority {0};
89 
90  uint m_contrast {32768};
91  uint m_brightness {32768};
92  uint m_colour {32768};
93  uint m_hue {32768};
94 
95  QString m_tvformat;
96  bool m_visible {true};
97  QString m_outputfilters;
98  bool m_useonairguide {false};
99 
100  uint m_mplexid {0};
101  uint m_serviceid {0};
102  uint m_atsc_major_chan {0};
103  uint m_atsc_minor_chan {0};
104 
105  QDateTime m_last_record;
106 
108  int m_commmethod {-1};
109  int m_tmoffset {0};
110  uint m_iptvid {0};
111 
112  QString m_old_xmltvid; // Used by mythfilldatabase when updating the xmltvid
113 
114  private:
115  QString m_sourcename; // Cache here rather than looking up each time
116  // Following not in database - Cached
117  QList<uint> m_groupIdList;
118  QList<uint> m_inputIdList;
119 };
120 typedef vector<ChannelInfo> ChannelInfoList;
121 
123 {
124  public:
125  ChannelInsertInfo(void) = default;
127  uint _db_mplexid, uint _source_id,
128  uint _channel_id, const QString& _callsign,
129  const QString& _service_name, const QString& _chan_num,
130  uint _service_id,
131 
132  uint _atsc_major_channel, uint _atsc_minor_channel,
133  bool _use_on_air_guide, bool _hidden,
134  bool _hidden_in_guide,
135 
136  const QString& _freqid, const QString& _icon,
137  const QString& _format, const QString& _xmltvid,
138 
139  uint _pat_tsid, uint _vct_tsid,
140  uint _vct_chan_tsid, uint _sdt_tsid,
141 
142  uint _orig_netid, uint _netid,
143 
144  const QString& _si_standard,
145 
146  bool _in_channels_conf, bool _in_pat,
147  bool _in_pmt, bool _in_vct,
148  bool _in_nit, bool _in_sdt,
149 
150  bool _is_encrypted, bool _is_data_service,
151  bool _is_audio_service, bool _is_opencable,
152  bool _could_be_opencable, int _decryption_status,
153  const QString& _default_authority) :
154  m_db_mplexid(_db_mplexid),
155  m_source_id(_source_id),
156  m_channel_id(_channel_id),
157  m_callsign(_callsign),
158  m_service_name(_service_name),
159  m_chan_num(_chan_num),
160  m_service_id(_service_id),
161  m_atsc_major_channel(_atsc_major_channel),
162  m_atsc_minor_channel(_atsc_minor_channel),
163  m_use_on_air_guide(_use_on_air_guide),
164  m_hidden(_hidden),
165  m_hidden_in_guide(_hidden_in_guide),
166  m_freqid(_freqid),
167  m_icon(_icon),
168  m_format(_format),
169  m_xmltvid(_xmltvid),
170  m_default_authority(_default_authority),
171  m_pat_tsid(_pat_tsid),
172  m_vct_tsid(_vct_tsid),
173  m_vct_chan_tsid(_vct_chan_tsid),
174  m_sdt_tsid(_sdt_tsid),
175  m_orig_netid(_orig_netid),
176  m_netid(_netid),
177  m_si_standard(_si_standard),
178  m_in_channels_conf(_in_channels_conf),
179  m_in_pat(_in_pat),
180  m_in_pmt(_in_pmt),
181  m_in_vct(_in_vct),
182  m_in_nit(_in_nit),
183  m_in_sdt(_in_sdt),
184  m_is_encrypted(_is_encrypted),
185  m_is_data_service(_is_data_service),
186  m_is_audio_service(_is_audio_service),
187  m_is_opencable(_is_opencable),
188  m_could_be_opencable(_could_be_opencable),
189  m_decryption_status(_decryption_status) {}
190 
191  ChannelInsertInfo(const ChannelInsertInfo &other) { (*this = other); }
192  ChannelInsertInfo &operator=(const ChannelInsertInfo &other) = default;
193 
194  bool IsSameChannel(const ChannelInsertInfo&, bool relaxed = false) const;
195 
196  bool SaveScan(uint scanid, uint transportid) const;
197 
198  void ImportExtraInfo(const ChannelInsertInfo &other);
199 
200  public:
201  uint m_db_mplexid {0};
202  uint m_source_id {0};
203  uint m_channel_id {0};
204  QString m_callsign;
205  QString m_service_name;
206  QString m_chan_num;
207  uint m_service_id {0};
208  uint m_atsc_major_channel {0};
209  uint m_atsc_minor_channel {0};
210  bool m_use_on_air_guide {false};
211  bool m_hidden {false};
212  bool m_hidden_in_guide {false};
213  QString m_freqid;
214  QString m_icon;
215  QString m_format;
216  QString m_xmltvid;
218 
219  // non-DB info
220  uint m_pat_tsid {0};
221  uint m_vct_tsid {0};
222  uint m_vct_chan_tsid {0};
223  uint m_sdt_tsid {0};
224  uint m_orig_netid {0};
225  uint m_netid {0};
226  QString m_si_standard;
227  bool m_in_channels_conf {false};
228  bool m_in_pat {false};
229  bool m_in_pmt {false};
230  bool m_in_vct {false};
231  bool m_in_nit {false};
232  bool m_in_sdt {false};
233  bool m_is_encrypted {false};
234  bool m_is_data_service {false};
235  bool m_is_audio_service {false};
236  bool m_is_opencable {false};
237  bool m_could_be_opencable {false};
238  int m_decryption_status {0};
239 };
240 typedef vector<ChannelInsertInfo> ChannelInsertInfoList;
241 
243 
244 #endif // DB_CHANNEL_INFO_H_
QString m_name
Definition: channelinfo.h:82
uint SaveScan(const ScanDTVTransportList &scan)
Definition: scaninfo.cpp:21
QString m_service_name
Definition: channelinfo.h:205
void RemoveInputId(uint linputid)
Definition: channelinfo.h:66
void SetSourceName(const QString &lname)
Definition: channelinfo.h:44
QString m_videofilters
Definition: channelinfo.h:86
QString m_outputfilters
Definition: channelinfo.h:97
bool operator==(MusicMetadata &a, MusicMetadata &b)
void AddInputId(uint linputid)
Definition: channelinfo.h:61
unsigned int uint
Definition: compat.h:140
QString m_xmltvid
Definition: channelinfo.h:87
Q_DECLARE_METATYPE(GrabberScript *)
QString m_tvformat
Definition: channelinfo.h:95
QString m_icon
Definition: channelinfo.h:83
QString m_sourcename
Definition: channelinfo.h:115
ChannelInsertInfo(const ChannelInsertInfo &other)
Definition: channelinfo.h:191
void AddGroupId(uint lgroupid)
Definition: channelinfo.h:49
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
QString m_freqid
Definition: channelinfo.h:77
void RemoveGroupId(uint lgroupid)
Definition: channelinfo.h:54
QList< uint > m_inputIdList
Definition: channelinfo.h:118
const QList< uint > GetGroupIds() const
Definition: channelinfo.h:47
static HostComboBoxSetting * ChannelFormat()
QDateTime m_last_record
Definition: channelinfo.h:105
QString m_channum
Definition: channelinfo.h:76
vector< ChannelInsertInfo > ChannelInsertInfoList
Definition: channelinfo.h:240
ChannelInsertInfo(uint _db_mplexid, uint _source_id, uint _channel_id, const QString &_callsign, const QString &_service_name, const QString &_chan_num, uint _service_id, uint _atsc_major_channel, uint _atsc_minor_channel, bool _use_on_air_guide, bool _hidden, bool _hidden_in_guide, const QString &_freqid, const QString &_icon, const QString &_format, const QString &_xmltvid, uint _pat_tsid, uint _vct_tsid, uint _vct_chan_tsid, uint _sdt_tsid, uint _orig_netid, uint _netid, const QString &_si_standard, bool _in_channels_conf, bool _in_pat, bool _in_pmt, bool _in_vct, bool _in_nit, bool _in_sdt, bool _is_encrypted, bool _is_data_service, bool _is_audio_service, bool _is_opencable, bool _could_be_opencable, int _decryption_status, const QString &_default_authority)
Definition: channelinfo.h:126
vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:120
QString m_si_standard
Definition: channelinfo.h:226
QString m_old_xmltvid
Definition: channelinfo.h:112
QString m_callsign
Definition: channelinfo.h:81
QString m_default_authority
Definition: channelinfo.h:217
QString m_default_authority
Definition: channelinfo.h:107
const QList< uint > GetInputIds() const
Definition: channelinfo.h:57
QList< uint > m_groupIdList
Definition: channelinfo.h:117