MythTV  master
channel.h
Go to the documentation of this file.
1 // Program Name: channel.h
3 // Created : Apr. 8, 2011
4 //
5 // Copyright (c) 2011 Robert McNamara <rmcnamara@mythtv.org>
6 //
7 // This program is free software; you can redistribute it and/or modify
8 // it under the terms of the GNU General Public License as published by
9 // the Free Software Foundation; either version 2 of the License, or
10 // (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //
25 
26 #ifndef CHANNEL_H
27 #define CHANNEL_H
28 
29 #include <QScriptEngine>
30 
32 
33 class Channel : public ChannelServices
34 {
35  Q_OBJECT
36 
37  public:
38 
39  Q_INVOKABLE explicit Channel( QObject */*parent*/ = nullptr ) {}
40 
41  public:
42 
43  /* Channel Methods */
44 
46  uint ChannelGroupID,
47  uint StartIndex,
48  uint Count,
49  bool OnlyVisible,
50  bool Details,
51  bool OrderByName,
52  bool GroupByCallsign,
53  bool OnlyTunable ) override; // ChannelServices
54 
55  DTC::ChannelInfo* GetChannelInfo ( uint ChanID ) override; // ChannelServices
56 
57  bool UpdateDBChannel ( uint MplexID,
58  uint SourceID,
60  const QString &CallSign,
61  const QString &ChannelName,
62  const QString &ChannelNumber,
64  uint ATSCMajorChannel,
65  uint ATSCMinorChannel,
66  bool UseEIT,
67  bool Visible,
68  const QString &ExtendedVisible,
69  const QString &FrequencyID,
70  const QString &Icon,
71  const QString &Format,
72  const QString &XMLTVID,
73  const QString &DefaultAuthority,
74  uint ServiceType ) override; // ChannelServices
75 
76  bool AddDBChannel ( uint MplexID,
77  uint SourceID,
79  const QString &CallSign,
80  const QString &ChannelName,
81  const QString &ChannelNumber,
83  uint ATSCMajorChannel,
84  uint ATSCMinorChannel,
85  bool UseEIT,
86  bool Visible,
87  const QString &ExtendedVisible,
88  const QString &FrequencyID,
89  const QString &Icon,
90  const QString &Format,
91  const QString &XMLTVID,
92  const QString &DefaultAuthority,
93  uint ServiceType ) override; // ChannelServices
94 
95  bool RemoveDBChannel ( uint ChannelID ) override; // ChannelServices
96 
97  /* Video Source Methods */
98 
99  DTC::VideoSourceList* GetVideoSourceList ( void ) override; // ChannelServices
100 
101  DTC::VideoSource* GetVideoSource ( uint SourceID ) override; // ChannelServices
102 
104  const QString &SourceName,
105  const QString &Grabber,
106  const QString &UserId,
107  const QString &FreqTable,
108  const QString &LineupId,
109  const QString &Password,
110  bool UseEIT,
111  const QString &ConfigPath,
112  int NITId,
113  uint BouquetId,
114  uint RegionId,
116  uint LCNOffset ) override; // ChannelServices
117 
118  int AddVideoSource ( const QString &SourceName,
119  const QString &Grabber,
120  const QString &UserId,
121  const QString &FreqTable,
122  const QString &LineupId,
123  const QString &Password,
124  bool UseEIT,
125  const QString &ConfigPath,
126  int NITId,
127  uint BouquetId,
128  uint RegionId,
130  uint LCNOffset ) override; // ChannelServices
131 
132  bool RemoveVideoSource ( uint SourceID ) override; // ChannelServices
133 
134  DTC::LineupList* GetDDLineupList ( const QString &/*Source*/,
135  const QString &/*UserId*/,
136  const QString &/*Password*/ ) override; // ChannelServices
137 
138  int FetchChannelsFromSource( uint SourceId,
139  uint CardId,
140  bool WaitForFinish ) override; // ChannelServices
141 
142  /* Multiplex Methods */
143 
145  uint StartIndex,
146  uint Count ) override; // ChannelServices
147 
148  DTC::VideoMultiplex* GetVideoMultiplex ( uint MplexID ) override; // ChannelServices
149 
150  QStringList GetXMLTVIdList ( uint SourceID ) override; // ChannelServices
151 
152 };
153 
154 // --------------------------------------------------------------------------
155 // The following class wrapper is due to a limitation in Qt Script Engine. It
156 // requires all methods that return pointers to user classes that are derived from
157 // QObject actually return QObject* (not the user class *). If the user class pointer
158 // is returned, the script engine treats it as a QVariant and doesn't create a
159 // javascript prototype wrapper for it.
160 //
161 // This class allows us to keep the rich return types in the main API class while
162 // offering the script engine a class it can work with.
163 //
164 // Only API Classes that return custom classes needs to implement these wrappers.
165 //
166 // We should continue to look for a cleaning solution to this problem.
167 // --------------------------------------------------------------------------
168 
169 class ScriptableChannel : public QObject
170 {
171  Q_OBJECT
172 
173  private:
174 
176  QScriptEngine *m_pEngine;
177 
178  public:
179 
180  Q_INVOKABLE explicit ScriptableChannel( QScriptEngine *pEngine, QObject *parent = nullptr ) : QObject( parent )
181  {
182  m_pEngine = pEngine;
183  }
184 
185  public slots:
186 
187  QObject* GetChannelInfoList ( int SourceID = 0,
188  int ChannelGroupID = 0,
189  int StartIndex = 0,
190  int Count = 0,
191  bool OnlyVisible = false,
192  bool Details = false,
193  bool OrderByName = false,
194  bool GroupByCallsign = false,
195  bool OnlyTunable = false
196  )
197  {
198  SCRIPT_CATCH_EXCEPTION( nullptr,
199  return m_obj.GetChannelInfoList( SourceID, ChannelGroupID, StartIndex, Count, OnlyVisible, Details, OrderByName, GroupByCallsign, OnlyTunable );
200  )
201  }
202 
203  QObject* GetChannelInfo ( int ChanID )
204  {
205  SCRIPT_CATCH_EXCEPTION( nullptr,
206  return m_obj.GetChannelInfo( ChanID );
207  )
208  }
209 
210  bool UpdateDBChannel ( uint MplexID,
211  uint SourceID,
212  uint ChannelID,
213  const QString &CallSign,
214  const QString &ChannelName,
215  const QString &ChannelNumber,
216  uint ServiceID,
217  uint ATSCMajorChannel,
218  uint ATSCMinorChannel,
219  bool UseEIT,
220  bool Visible,
221  const QString &ExtendedVisible,
222  const QString &FrequencyID,
223  const QString &Icon,
224  const QString &Format,
225  const QString &XMLTVID,
226  const QString &DefaultAuthority,
227  uint ServiceType )
228  {
229  SCRIPT_CATCH_EXCEPTION( false,
230  return m_obj.UpdateDBChannel(MplexID, SourceID, ChannelID,
231  CallSign, ChannelName, ChannelNumber,
232  ServiceID, ATSCMajorChannel, ATSCMinorChannel,
233  UseEIT, Visible, ExtendedVisible, FrequencyID, Icon, Format,
234  XMLTVID, DefaultAuthority, ServiceType);
235  )
236  }
237 
238  bool AddDBChannel ( uint MplexID,
239  uint SourceID,
240  uint ChannelID,
241  const QString &CallSign,
242  const QString &ChannelName,
243  const QString &ChannelNumber,
244  uint ServiceID,
245  uint ATSCMajorChannel,
246  uint ATSCMinorChannel,
247  bool UseEIT,
248  bool Visible,
249  const QString &ExtendedVisible,
250  const QString &FrequencyID,
251  const QString &Icon,
252  const QString &Format,
253  const QString &XMLTVID,
254  const QString &DefaultAuthority,
255  uint ServiceType )
256  {
257  SCRIPT_CATCH_EXCEPTION( false,
258  return m_obj.AddDBChannel(MplexID, SourceID, ChannelID,
259  CallSign, ChannelName, ChannelNumber,
260  ServiceID, ATSCMajorChannel, ATSCMinorChannel,
261  UseEIT, Visible, ExtendedVisible, FrequencyID, Icon, Format,
262  XMLTVID, DefaultAuthority, ServiceType);
263  )
264  }
265 
267  {
268  SCRIPT_CATCH_EXCEPTION( false,
270  )
271  }
272 
273  QObject* GetVideoSourceList ( void )
274  {
275  SCRIPT_CATCH_EXCEPTION( nullptr,
276  return m_obj.GetVideoSourceList();
277  )
278  }
279 
281  {
282  SCRIPT_CATCH_EXCEPTION( nullptr,
283  return m_obj.GetVideoSource( SourceID );
284  )
285  }
286 
288  const QString &SourceName,
289  const QString &Grabber,
290  const QString &UserId,
291  const QString &FreqTable,
292  const QString &LineupId,
293  const QString &Password,
294  bool UseEIT,
295  const QString &ConfigPath,
296  int NITId,
297  uint BouquetId,
298  uint RegionId,
300  uint LCNOffset )
301  {
302  SCRIPT_CATCH_EXCEPTION( false,
303  return m_obj.UpdateVideoSource( SourceID, SourceName, Grabber,
304  UserId, FreqTable, LineupId, Password,
305  UseEIT, ConfigPath, NITId, BouquetId, RegionId,
307  )
308  }
309 
310  bool AddVideoSource ( const QString &SourceName,
311  const QString &Grabber,
312  const QString &UserId,
313  const QString &FreqTable,
314  const QString &LineupId,
315  const QString &Password,
316  bool UseEIT,
317  const QString &ConfigPath,
318  int NITId,
319  uint BouquetId,
320  uint RegionId,
322  uint LCNOffset )
323  {
324  SCRIPT_CATCH_EXCEPTION( false,
325  return m_obj.AddVideoSource( SourceName, Grabber, UserId,
326  FreqTable, LineupId, Password,
327  UseEIT, ConfigPath, NITId, BouquetId, RegionId,
329  )
330  }
331 
333  {
334  SCRIPT_CATCH_EXCEPTION( false,
335  return m_obj.RemoveVideoSource( SourceID );
336  )
337  }
338 
340  int StartIndex,
341  int Count )
342  {
343  SCRIPT_CATCH_EXCEPTION( nullptr,
344  return m_obj.GetVideoMultiplexList( SourceID, StartIndex, Count );
345  )
346  }
347 
348  QObject* GetVideoMultiplex ( int MplexID )
349  {
350  SCRIPT_CATCH_EXCEPTION( nullptr,
351  return m_obj.GetVideoMultiplex( MplexID );
352  )
353  }
354 
355  QStringList GetXMLTVIdList ( int SourceID )
356  {
357  SCRIPT_CATCH_EXCEPTION( QStringList(),
358  return m_obj.GetXMLTVIdList(SourceID);
359  )
360  }
361 };
362 
363 
364 // NOLINTNEXTLINE(modernize-use-auto)
366 
367 #endif
Password
static StandardSetting * Password(bool enabled)
Setting for changing password.
Definition: galleryconfig.cpp:242
Channel::FetchChannelsFromSource
int FetchChannelsFromSource(uint SourceId, uint CardId, bool WaitForFinish) override
Definition: channel.cpp:566
DTC::VideoSourceList
Definition: videoSourceList.h:15
Channel
Definition: channel.h:33
Channel::RemoveDBChannel
bool RemoveDBChannel(uint ChannelID) override
Definition: channel.cpp:278
ScriptableChannel::GetVideoMultiplexList
QObject * GetVideoMultiplexList(int SourceID, int StartIndex, int Count)
Definition: channel.h:339
UseEIT
Definition: videosource.cpp:598
ScriptableChannel
Definition: channel.h:169
ScriptableChannel::GetVideoSourceList
QObject * GetVideoSourceList(void)
Definition: channel.h:273
ScriptableChannel::GetChannelInfo
QObject * GetChannelInfo(int ChanID)
Definition: channel.h:203
Channel::GetVideoMultiplexList
DTC::VideoMultiplexList * GetVideoMultiplexList(uint SourceID, uint StartIndex, uint Count) override
Definition: channel.cpp:595
ChannelServices
Definition: channelServices.h:41
DTC::VideoMultiplex
Definition: videoMultiplex.h:15
Q_SCRIPT_DECLARE_QMETAOBJECT_MYTHTV
Q_SCRIPT_DECLARE_QMETAOBJECT_MYTHTV(ScriptableChannel, QObject *)
Channel::GetXMLTVIdList
QStringList GetXMLTVIdList(uint SourceID) override
Definition: channel.cpp:755
ScriptableChannel::GetVideoSource
QObject * GetVideoSource(uint SourceID)
Definition: channel.h:280
MythDate::Format
Format
Definition: mythdate.h:15
Channel::GetVideoMultiplex
DTC::VideoMultiplex * GetVideoMultiplex(uint MplexID) override
Definition: channel.cpp:693
SourceID
Definition: videosource.cpp:2874
ScriptableChannel::GetXMLTVIdList
QStringList GetXMLTVIdList(int SourceID)
Definition: channel.h:355
Channel::GetDDLineupList
DTC::LineupList * GetDDLineupList(const QString &, const QString &, const QString &) override
Definition: channel.cpp:554
ScriptableChannel::RemoveVideoSource
bool RemoveVideoSource(uint SourceID)
Definition: channel.h:332
DTC::ChannelInfoList
Definition: channelInfoList.h:14
Visible
Definition: channelsettings.cpp:391
Channel::Channel
Q_INVOKABLE Channel(QObject *=nullptr)
Definition: channel.h:39
Channel::GetVideoSourceList
DTC::VideoSourceList * GetVideoSourceList(void) override
Definition: channel.cpp:289
Channel::UpdateDBChannel
bool UpdateDBChannel(uint MplexID, uint SourceID, uint ChannelID, const QString &CallSign, const QString &ChannelName, const QString &ChannelNumber, uint ServiceID, uint ATSCMajorChannel, uint ATSCMinorChannel, bool UseEIT, bool Visible, const QString &ExtendedVisible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority, uint ServiceType) override
Definition: channel.cpp:144
ChannelID
Definition: channelsettings.h:20
Channel::GetChannelInfoList
DTC::ChannelInfoList * GetChannelInfoList(uint SourceID, uint ChannelGroupID, uint StartIndex, uint Count, bool OnlyVisible, bool Details, bool OrderByName, bool GroupByCallsign, bool OnlyTunable) override
Definition: channel.cpp:49
ServiceID
Definition: channelsettings.cpp:312
ScriptableChannel::ScriptableChannel
Q_INVOKABLE ScriptableChannel(QScriptEngine *pEngine, QObject *parent=nullptr)
Definition: channel.h:180
LCNOffset
Definition: videosource.cpp:488
ScriptableChannel::GetChannelInfoList
QObject * GetChannelInfoList(int SourceID=0, int ChannelGroupID=0, int StartIndex=0, int Count=0, bool OnlyVisible=false, bool Details=false, bool OrderByName=false, bool GroupByCallsign=false, bool OnlyTunable=false)
Definition: channel.h:187
DTC::VideoSource
Definition: videoSource.h:14
DTC::LineupList
Definition: lineup.h:66
ScriptableChannel::GetVideoMultiplex
QObject * GetVideoMultiplex(int MplexID)
Definition: channel.h:348
FreqTable
static GlobalComboBoxSetting * FreqTable()
Definition: backendsettings.cpp:247
ScanFrequency
Definition: channelscanmiscsettings.h:278
Channel::GetVideoSource
DTC::VideoSource * GetVideoSource(uint SourceID) override
Definition: channel.cpp:348
ScriptableChannel::RemoveDBChannel
bool RemoveDBChannel(uint ChannelID)
Definition: channel.h:266
uint
unsigned int uint
Definition: compat.h:144
SCRIPT_CATCH_EXCEPTION
#define SCRIPT_CATCH_EXCEPTION(default, code)
Definition: service.h:83
channelServices.h
Channel::UpdateVideoSource
bool UpdateVideoSource(uint SourceID, const QString &SourceName, const QString &Grabber, const QString &UserId, const QString &FreqTable, const QString &LineupId, const QString &Password, bool UseEIT, const QString &ConfigPath, int NITId, uint BouquetId, uint RegionId, uint ScanFrequency, uint LCNOffset) override
Definition: channel.cpp:402
ScriptableChannel::m_pEngine
QScriptEngine * m_pEngine
Definition: channel.h:176
ScriptableChannel::UpdateVideoSource
bool UpdateVideoSource(uint SourceID, const QString &SourceName, const QString &Grabber, const QString &UserId, const QString &FreqTable, const QString &LineupId, const QString &Password, bool UseEIT, const QString &ConfigPath, int NITId, uint BouquetId, uint RegionId, uint ScanFrequency, uint LCNOffset)
Definition: channel.h:287
ScriptableChannel::UpdateDBChannel
bool UpdateDBChannel(uint MplexID, uint SourceID, uint ChannelID, const QString &CallSign, const QString &ChannelName, const QString &ChannelNumber, uint ServiceID, uint ATSCMajorChannel, uint ATSCMinorChannel, bool UseEIT, bool Visible, const QString &ExtendedVisible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority, uint ServiceType)
Definition: channel.h:210
Channel::RemoveVideoSource
bool RemoveVideoSource(uint SourceID) override
Definition: channel.cpp:543
ScriptableChannel::AddDBChannel
bool AddDBChannel(uint MplexID, uint SourceID, uint ChannelID, const QString &CallSign, const QString &ChannelName, const QString &ChannelNumber, uint ServiceID, uint ATSCMajorChannel, uint ATSCMinorChannel, bool UseEIT, bool Visible, const QString &ExtendedVisible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority, uint ServiceType)
Definition: channel.h:238
Icon
Definition: channelsettings.cpp:208
DTC::VideoMultiplexList
Definition: videoMultiplexList.h:15
DTC::ChannelInfo
Definition: programAndChannel.h:30
Channel::AddVideoSource
int AddVideoSource(const QString &SourceName, const QString &Grabber, const QString &UserId, const QString &FreqTable, const QString &LineupId, const QString &Password, bool UseEIT, const QString &ConfigPath, int NITId, uint BouquetId, uint RegionId, uint ScanFrequency, uint LCNOffset) override
Definition: channel.cpp:517
Channel::AddDBChannel
bool AddDBChannel(uint MplexID, uint SourceID, uint ChannelID, const QString &CallSign, const QString &ChannelName, const QString &ChannelNumber, uint ServiceID, uint ATSCMajorChannel, uint ATSCMinorChannel, bool UseEIT, bool Visible, const QString &ExtendedVisible, const QString &FrequencyID, const QString &Icon, const QString &Format, const QString &XMLTVID, const QString &DefaultAuthority, uint ServiceType) override
Definition: channel.cpp:237
ScriptableChannel::AddVideoSource
bool AddVideoSource(const QString &SourceName, const QString &Grabber, const QString &UserId, const QString &FreqTable, const QString &LineupId, const QString &Password, bool UseEIT, const QString &ConfigPath, int NITId, uint BouquetId, uint RegionId, uint ScanFrequency, uint LCNOffset)
Definition: channel.h:310
Channel::GetChannelInfo
DTC::ChannelInfo * GetChannelInfo(uint ChanID) override
Definition: channel.cpp:127
ScriptableChannel::m_obj
Channel m_obj
Definition: channel.h:175