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();
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 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
76  QString channum;
77  QString freqid;
79 
80  QString callsign;
81  QString name;
82  QString icon;
83 
84  int finetune;
85  QString videofilters;
86  QString xmltvid;
88 
93 
94  QString tvformat;
95  bool visible;
96  QString outputfilters;
98 
103 
104  QDateTime last_record;
105 
108  int tmoffset;
110 
111  QString old_xmltvid; // Used by mythfilldatabase when updating the xmltvid
112 
113  private:
114  QString m_sourcename; // Cache here rather than looking up each time
115  // Following not in database - Cached
116  QList<uint> m_groupIdList;
117  QList<uint> m_inputIdList;
118 };
119 typedef vector<ChannelInfo> ChannelInfoList;
120 
122 {
123  public:
125  db_mplexid(0), source_id(0), channel_id(0),
126  callsign(""), service_name(""),
127  chan_num(""), service_id(0),
128  atsc_major_channel(0), atsc_minor_channel(0),
129  use_on_air_guide(false),
130  hidden(false), hidden_in_guide(false),
131  freqid(""), icon(""),
132  format(""), xmltvid(""),
133  default_authority(""),
134  pat_tsid(0), vct_tsid(0), vct_chan_tsid(0), sdt_tsid(0),
135  orig_netid(0), netid(0),
136  si_standard(""),
137  in_channels_conf(false),
138  in_pat(false), in_pmt(false),
139  in_vct(false),
140  in_nit(false), in_sdt(false),
141  is_encrypted(false),
142  is_data_service(false), is_audio_service(false),
143  is_opencable(false), could_be_opencable(false),
144  decryption_status(0) { }
145 
147  uint _db_mplexid, uint _source_id,
148  uint _channel_id, QString _callsign,
149  QString _service_name, QString _chan_num,
150  uint _service_id,
151 
152  uint _atsc_major_channel, uint _atsc_minor_channel,
153  bool _use_on_air_guide, bool _hidden,
154  bool _hidden_in_guide,
155 
156  QString _freqid, QString _icon,
157  QString _format, QString _xmltvid,
158 
159  uint _pat_tsid, uint _vct_tsid,
160  uint _vct_chan_tsid, uint _sdt_tsid,
161 
162  uint _orig_netid, uint _netid,
163 
164  QString _si_standard,
165 
166  bool _in_channels_conf, bool _in_pat,
167  bool _in_pmt, bool _in_vct,
168  bool _in_nit, bool _in_sdt,
169 
170  bool _is_encrypted, bool _is_data_service,
171  bool _is_audio_service, bool _is_opencable,
172  bool _could_be_opencable, int _decryption_status,
173  QString _default_authority) :
174  db_mplexid(_db_mplexid),
175  source_id(_source_id),
176  channel_id(_channel_id),
177  callsign(_callsign),
178  service_name(_service_name),
179  chan_num(_chan_num),
180  service_id(_service_id),
181  atsc_major_channel(_atsc_major_channel),
182  atsc_minor_channel(_atsc_minor_channel),
183  use_on_air_guide(_use_on_air_guide),
184  hidden(_hidden),
185  hidden_in_guide(_hidden_in_guide),
186  freqid(_freqid),
187  icon(_icon),
188  format(_format),
189  xmltvid(_xmltvid),
190  default_authority(_default_authority),
191  pat_tsid(_pat_tsid),
192  vct_tsid(_vct_tsid),
193  vct_chan_tsid(_vct_chan_tsid),
194  sdt_tsid(_sdt_tsid),
195  orig_netid(_orig_netid),
196  netid(_netid),
197  si_standard(_si_standard),
198  in_channels_conf(_in_channels_conf),
199  in_pat(_in_pat),
200  in_pmt(_in_pmt),
201  in_vct(_in_vct),
202  in_nit(_in_nit),
203  in_sdt(_in_sdt),
204  is_encrypted(_is_encrypted),
205  is_data_service(_is_data_service),
206  is_audio_service(_is_audio_service),
207  is_opencable(_is_opencable),
208  could_be_opencable(_could_be_opencable),
209  decryption_status(_decryption_status) {}
210 
211  ChannelInsertInfo(const ChannelInsertInfo &other) { (*this = other); }
212  ChannelInsertInfo &operator=(const ChannelInsertInfo &other);
213 
214  bool IsSameChannel(const ChannelInsertInfo&, bool relaxed = false) const;
215 
216  bool SaveScan(uint scanid, uint transportid) const;
217 
218  void ImportExtraInfo(const ChannelInsertInfo &other);
219 
220  public:
224  QString callsign;
225  QString service_name;
226  QString chan_num;
231  bool hidden;
233  QString freqid;
234  QString icon;
235  QString format;
236  QString xmltvid;
238 
239  // non-DB info
246  QString si_standard;
248  bool in_pat;
249  bool in_pmt;
250  bool in_vct;
251  bool in_nit;
252  bool in_sdt;
259 };
260 typedef vector<ChannelInsertInfo> ChannelInsertInfoList;
261 
263 
264 #endif // DB_CHANNEL_INFO_H_
uint sourceid
Definition: channelinfo.h:78
int recpriority
Definition: channelinfo.h:87
uint SaveScan(const ScanDTVTransportList &scan)
Definition: scaninfo.cpp:23
void RemoveInputId(uint linputid)
Definition: channelinfo.h:66
QString channum
Definition: channelinfo.h:76
void SetSourceName(const QString &lname)
Definition: channelinfo.h:44
QString tvformat
Definition: channelinfo.h:94
QString freqid
Definition: channelinfo.h:77
void AddInputId(uint linputid)
Definition: channelinfo.h:61
unsigned int uint
Definition: compat.h:140
uint serviceid
Definition: channelinfo.h:100
uint mplexid
Definition: channelinfo.h:99
Q_DECLARE_METATYPE(GrabberScript *)
QDateTime last_record
Definition: channelinfo.h:104
QString m_sourcename
Definition: channelinfo.h:114
QString callsign
Definition: channelinfo.h:80
ChannelInsertInfo(const ChannelInsertInfo &other)
Definition: channelinfo.h:211
VERBOSE_PREAMBLE false
Definition: verbosedefs.h:85
void AddGroupId(uint lgroupid)
Definition: channelinfo.h:49
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QString default_authority
Definition: channelinfo.h:237
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
void RemoveGroupId(uint lgroupid)
Definition: channelinfo.h:54
QString videofilters
Definition: channelinfo.h:85
QString outputfilters
Definition: channelinfo.h:96
QList< uint > m_inputIdList
Definition: channelinfo.h:117
QString service_name
Definition: channelinfo.h:225
const QList< uint > GetGroupIds() const
Definition: channelinfo.h:47
static HostComboBoxSetting * ChannelFormat()
ChannelInsertInfo(uint _db_mplexid, uint _source_id, uint _channel_id, QString _callsign, QString _service_name, 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, QString _freqid, QString _icon, QString _format, QString _xmltvid, uint _pat_tsid, uint _vct_tsid, uint _vct_chan_tsid, uint _sdt_tsid, uint _orig_netid, uint _netid, 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, QString _default_authority)
Definition: channelinfo.h:146
vector< ChannelInsertInfo > ChannelInsertInfoList
Definition: channelinfo.h:260
vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:119
QString old_xmltvid
Definition: channelinfo.h:111
bool operator==(const DialogCode &a, const QDialog::DialogCode &b)
Definition: mythdialogs.h:38
QString icon
Definition: channelinfo.h:82
uint contrast
Definition: channelinfo.h:89
bool useonairguide
Definition: channelinfo.h:97
bool visible
Definition: channelinfo.h:95
uint brightness
Definition: channelinfo.h:90
QString name
Definition: channelinfo.h:81
QString xmltvid
Definition: channelinfo.h:86
const QList< uint > GetInputIds() const
Definition: channelinfo.h:57
QList< uint > m_groupIdList
Definition: channelinfo.h:116
uint atsc_major_chan
Definition: channelinfo.h:101
uint atsc_minor_chan
Definition: channelinfo.h:102
QString default_authority
Definition: channelinfo.h:106