MythTV  master
channelicon.h
Go to the documentation of this file.
1 // Program Name: channelicon.h
3 // Created : Jun. 22, 2014
4 //
5 // Copyright (c) 2014 The MythTV Team
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 CHANNELICON_H
27 #define CHANNELICON_H
28 
29 #include <QScriptEngine>
30 
31 #include "services/channelIconServices.h"
32 
33 class ChannelIcon : public ChannelIconServices
34 {
35  Q_OBJECT
36 
37  public:
38 
39  Q_INVOKABLE explicit ChannelIcon( QObject *parent = nullptr ) {}
40 
41  public:
42 
43  /* ChannelIcon Methods */
44 
45  DTC::ChannelIconList* LookupChannelIcon ( const QString &Query,
46  const QString &FieldName );
47 
48  DTC::ChannelIconList* SearchChannelIcon ( const QString &Query );
49 
50 };
51 
52 // --------------------------------------------------------------------------
53 // The following class wrapper is due to a limitation in Qt Script Engine. It
54 // requires all methods that return pointers to user classes that are derived from
55 // QObject actually return QObject* (not the user class *). If the user class pointer
56 // is returned, the script engine treats it as a QVariant and doesn't create a
57 // javascript prototype wrapper for it.
58 //
59 // This class allows us to keep the rich return types in the main API class while
60 // offering the script engine a class it can work with.
61 //
62 // Only API Classes that return custom classes needs to implement these wrappers.
63 //
64 // We should continue to look for a cleaning solution to this problem.
65 // --------------------------------------------------------------------------
66 
67 class ScriptableChannelIcon : public QObject
68 {
69  Q_OBJECT
70 
71  private:
72 
74 
75  public:
76 
77  Q_INVOKABLE explicit ScriptableChannelIcon( QObject *parent = nullptr ) : QObject( parent ) {}
78 
79  public slots:
80 
81  QObject* LookupChannelIcon ( const QString &Query,
82  const QString &FieldName )
83  {
84  return m_obj.LookupChannelIcon( Query, FieldName );
85  }
86 
87  QObject* SearchChannelIcon ( const QString &Query )
88  {
89  return m_obj.SearchChannelIcon( Query );
90  }
91 };
92 
93 
95 
96 #endif
unsigned int slots[4]
Definition: element.c:38
Q_SCRIPT_DECLARE_QMETAOBJECT(ScriptableChannelIcon, QObject *)
DTC::ChannelIconList * SearchChannelIcon(const QString &Query)
Definition: channelicon.cpp:94
QObject * LookupChannelIcon(const QString &Query, const QString &FieldName)
Definition: channelicon.h:81
DTC::ChannelIconList * LookupChannelIcon(const QString &Query, const QString &FieldName)
Definition: channelicon.cpp:39
QObject * SearchChannelIcon(const QString &Query)
Definition: channelicon.h:87
Q_INVOKABLE ChannelIcon(QObject *parent=nullptr)
Definition: channelicon.h:39
Q_INVOKABLE ScriptableChannelIcon(QObject *parent=nullptr)
Definition: channelicon.h:77