Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Services V2: Add GetGrabberList and GetFreqTableList to channel service
These are needed by the webapp Video Source setup.
- Loading branch information
1 parent
06da311
commit 21cb48c
Showing
5 changed files
with
233 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
////////////////////////////////////////////////////////////////////////////// | ||
// Program Name: v2freqtable.h | ||
// Created : Sep 22, 2022 | ||
// | ||
// Copyright (c) 2022 Peter Bennett <pbennett@mythtv.org> | ||
// | ||
// Licensed under the GPL v2 or later, see COPYING for details | ||
// | ||
////////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef V2FREQTABLE_H_ | ||
#define V2FREQTABLE_H_ | ||
|
||
#include <QString> | ||
|
||
#include "libmythbase/http/mythhttpservice.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
|
||
class V2FreqTableList : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_CLASSINFO( "Version", "1.0" ); | ||
|
||
SERVICE_PROPERTY2( QStringList, FreqTables ) | ||
|
||
public: | ||
|
||
Q_INVOKABLE V2FreqTableList(QObject *parent = nullptr) | ||
: QObject( parent ) | ||
{ | ||
} | ||
|
||
// Copy not needed | ||
|
||
|
||
private: | ||
Q_DISABLE_COPY(V2FreqTableList); | ||
}; | ||
|
||
Q_DECLARE_METATYPE(V2FreqTableList*) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
////////////////////////////////////////////////////////////////////////////// | ||
// Program Name: v2grabber.h | ||
// Created : Sep 22, 2022 | ||
// | ||
// Copyright (c) 2022 Peter Bennett <pbennett@mythtv.org> | ||
// | ||
// Licensed under the GPL v2 or later, see COPYING for details | ||
// | ||
////////////////////////////////////////////////////////////////////////////// | ||
|
||
#ifndef V2GRABBER_H_ | ||
#define V2GRABBER_H_ | ||
|
||
#include <QString> | ||
|
||
#include "libmythbase/http/mythhttpservice.h" | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
class V2Grabber : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_CLASSINFO( "Version" , "1.0" ); | ||
|
||
SERVICE_PROPERTY2( QString , Program ) | ||
SERVICE_PROPERTY2( QString , DisplayName ) | ||
|
||
public: | ||
|
||
Q_INVOKABLE V2Grabber(QObject *parent = nullptr) | ||
: QObject( parent ) | ||
{ | ||
} | ||
|
||
void Copy( const V2Grabber *src ) | ||
{ | ||
m_Program = src->m_Program; | ||
m_DisplayName = src->m_DisplayName; | ||
} | ||
|
||
private: | ||
Q_DISABLE_COPY(V2Grabber); | ||
}; | ||
|
||
Q_DECLARE_METATYPE(V2Grabber*) | ||
|
||
|
||
class V2GrabberList : public QObject | ||
{ | ||
Q_OBJECT | ||
Q_CLASSINFO( "Version", "1.0" ); | ||
Q_CLASSINFO( "Grabbers", "type=V2Grabber"); | ||
|
||
SERVICE_PROPERTY2( QVariantList, Grabbers ); | ||
|
||
public: | ||
|
||
Q_INVOKABLE V2GrabberList(QObject *parent = nullptr) | ||
: QObject( parent ) | ||
{ | ||
} | ||
|
||
// Copy not needed | ||
// void Copy( const V2GrabberList *src ) | ||
// { | ||
// CopyListContents< V2Grabber >( this, m_Grabbers, src->m_Grabbers ); | ||
// } | ||
|
||
V2Grabber *AddNewGrabber() | ||
{ | ||
// We must make sure the object added to the QVariantList has | ||
// a parent of 'this' | ||
|
||
auto *pObject = new V2Grabber( this ); | ||
m_Grabbers.append( QVariant::fromValue<QObject *>( pObject )); | ||
|
||
return pObject; | ||
} | ||
|
||
bool containsProgram(QString &program) | ||
{ | ||
for (const auto& entry : m_Grabbers) | ||
{ | ||
V2Grabber *grabber = entry.value<V2Grabber*>(); | ||
if (grabber->GetProgram() == program) | ||
return true; | ||
} | ||
return false; | ||
} | ||
|
||
private: | ||
Q_DISABLE_COPY(V2GrabberList); | ||
}; | ||
|
||
Q_DECLARE_METATYPE(V2GrabberList*) | ||
|
||
|
||
#endif |