MythTV  master
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
TVBrowseHelper Class Reference

#include <tvbrowsehelper.h>

Inheritance diagram for TVBrowseHelper:
Inheritance graph
[legend]
Collaboration diagram for TVBrowseHelper:
Collaboration graph
[legend]

Public Member Functions

 TVBrowseHelper (TV *tv, uint browse_max_forward, bool browse_all_tuners, bool use_channel_groups, const QString &db_channel_ordering)
 
virtual ~TVBrowseHelper ()
 
void Stop ()
 
void Wait ()
 
bool BrowseStart (PlayerContext *ctx, bool skip_browse=false)
 Begins channel browsing. More...
 
void BrowseEnd (PlayerContext *ctx, bool change_channel)
 Ends channel browsing. More...
 
void BrowseDispInfo (PlayerContext *ctx, BrowseInfo &bi)
 
void BrowseDispInfo (PlayerContext *ctx, BrowseDirection direction)
 
void BrowseChannel (PlayerContext *ctx, const QString &channum)
 
BrowseInfo GetBrowsedInfo (void) const
 
bool IsBrowsing (void) const
 
uint GetChanId (const QString &channum, uint pref_cardid, uint pref_sourceid) const
 Returns a chanid for the channum, or 0 if none is available. More...
 
- Public Member Functions inherited from MThread
 MThread (const QString &objectName)
 Standard constructor. More...
 
 MThread (const QString &objectName, QRunnable *runnable)
 Use this constructor if you want the default run() method to run the QRunnable's run() method instead of entering the Qt event loop. More...
 
virtual ~MThread ()
 
void RunProlog (void)
 Sets up a thread, call this if you reimplement run(). More...
 
void RunEpilog (void)
 Cleans up a thread's resources, call this if you reimplement run(). More...
 
QThread * qthread (void)
 Returns the thread, this will always return the same pointer no matter how often you restart the thread. More...
 
void setObjectName (const QString &name)
 
QString objectName (void) const
 
void setPriority (QThread::Priority priority)
 
QThread::Priority priority (void) const
 
bool isFinished (void) const
 
bool isRunning (void) const
 
void setStackSize (uint stackSize)
 
uint stackSize (void) const
 
void exit (int retcode=0)
 Use this to exit from the thread if you are using a Qt event loop. More...
 
void start (QThread::Priority=QThread::InheritPriority)
 Tell MThread to start running the thread in the near future. More...
 
void terminate (void)
 Kill a thread unsafely. More...
 
void quit (void)
 calls exit(0) More...
 
bool wait (unsigned long time=ULONG_MAX)
 Wait for the MThread to exit, with a maximum timeout. More...
 

Protected Member Functions

void GetNextProgram (BrowseDirection direction, InfoMap &infoMap) const
 Fetches information on the desired program from the backend. More...
 
void GetNextProgramDB (BrowseDirection direction, InfoMap &infoMap) const
 
void run () override
 Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead. More...
 
- Protected Member Functions inherited from MThread
int exec (void)
 Enters the qt event loop. call exit or quit to exit thread. More...
 

Protected Attributes

TVm_tv {nullptr}
 
ChannelInfoList m_dbAllChannels
 
ChannelInfoList m_dbAllVisibleChannels
 
uint m_dbBrowseMaxForward
 
bool m_dbBrowseAllTuners
 
bool m_dbUseChannelGroups
 
QHash< uint, QString > m_dbChanidToChannum
 
QHash< uint, uintm_dbChanidToSourceid
 
QMultiMap< QString, uintm_dbChannumToChanids
 
QMutex m_lock
 
PlayerContextm_ctx {nullptr}
 
QString m_channum
 
uint m_chanid {0}
 
QString m_starttime
 
bool m_run {true}
 
QWaitCondition m_wait
 
QList< BrowseInfom_list
 
- Protected Attributes inherited from MThread
MThreadInternalm_thread {nullptr}
 
QRunnable * m_runnable {nullptr}
 
bool m_prolog_executed {true}
 
bool m_epilog_executed {true}
 

Additional Inherited Members

- Static Public Member Functions inherited from MThread
static void ThreadSetup (const QString &)
 This is to be called on startup in those few threads that haven't been ported to MThread. More...
 
static void ThreadCleanup (void)
 This is to be called on exit in those few threads that haven't been ported to MThread. More...
 
static void Cleanup (void)
 This will print out all the running threads, call exit(1) on each and then wait up to 5 seconds total for all the threads to exit. More...
 
static void GetAllThreadNames (QStringList &list)
 
static void GetAllRunningThreadNames (QStringList &list)
 
- Static Public Attributes inherited from MThread
static const int kDefaultStartTimeout
 
- Static Protected Member Functions inherited from MThread
static void setTerminationEnabled (bool enabled=true)
 
static void sleep (unsigned long time)
 
static void msleep (unsigned long time)
 
static void usleep (unsigned long time)
 

Detailed Description

Definition at line 63 of file tvbrowsehelper.h.

Constructor & Destructor Documentation

◆ TVBrowseHelper()

TVBrowseHelper::TVBrowseHelper ( TV tv,
uint  browse_max_forward,
bool  browse_all_tuners,
bool  use_channel_groups,
const QString &  db_channel_ordering 
)

Definition at line 30 of file tvbrowsehelper.cpp.

◆ ~TVBrowseHelper()

virtual TVBrowseHelper::~TVBrowseHelper ( )
inlinevirtual

Definition at line 72 of file tvbrowsehelper.h.

Member Function Documentation

◆ Stop()

void TVBrowseHelper::Stop ( void  )
inline

Definition at line 78 of file tvbrowsehelper.h.

Referenced by ~TVBrowseHelper().

◆ Wait()

void TVBrowseHelper::Wait ( )
inline

Definition at line 86 of file tvbrowsehelper.h.

Referenced by ~TVBrowseHelper().

◆ BrowseStart()

bool TVBrowseHelper::BrowseStart ( PlayerContext ctx,
bool  skip_browse = false 
)

Begins channel browsing.

Note
This may only be called from the UI thread.

Definition at line 66 of file tvbrowsehelper.cpp.

Referenced by BrowseDispInfo().

◆ BrowseEnd()

void TVBrowseHelper::BrowseEnd ( PlayerContext ctx,
bool  change_channel 
)

Ends channel browsing.

Changing the channel if change_channel is true.

Note
This may only be called from the UI thread.
Parameters
ctxPlayerContext to end browsing on
change_channeliff true we call ChangeChannel()

Definition at line 105 of file tvbrowsehelper.cpp.

◆ BrowseDispInfo() [1/2]

void TVBrowseHelper::BrowseDispInfo ( PlayerContext ctx,
BrowseInfo bi 
)

Definition at line 141 of file tvbrowsehelper.cpp.

Referenced by BrowseChannel(), BrowseDispInfo(), and BrowseStart().

◆ BrowseDispInfo() [2/2]

void TVBrowseHelper::BrowseDispInfo ( PlayerContext ctx,
BrowseDirection  direction 
)
inline

Definition at line 92 of file tvbrowsehelper.h.

◆ BrowseChannel()

void TVBrowseHelper::BrowseChannel ( PlayerContext ctx,
const QString &  channum 
)

Definition at line 166 of file tvbrowsehelper.cpp.

◆ GetBrowsedInfo()

BrowseInfo TVBrowseHelper::GetBrowsedInfo ( void  ) const

Definition at line 190 of file tvbrowsehelper.cpp.

◆ IsBrowsing()

bool TVBrowseHelper::IsBrowsing ( void  ) const
Note
This may only be called from the UI thread.

Definition at line 206 of file tvbrowsehelper.cpp.

◆ GetChanId()

uint TVBrowseHelper::GetChanId ( const QString &  channum,
uint  pref_cardid,
uint  pref_sourceid 
) const

Returns a chanid for the channum, or 0 if none is available.

This will prefer a given sourceid first, and then a given card id, but if one or the other can not be satisfied but m_dbBrowseAllTuners is set then it will look to see if the chanid is available on any tuner.

Definition at line 221 of file tvbrowsehelper.cpp.

◆ GetNextProgram()

void TVBrowseHelper::GetNextProgram ( BrowseDirection  direction,
InfoMap infoMap 
) const
protected

Fetches information on the desired program from the backend.

Parameters
directionBrowseDirection to get information on.
infoMapInfoMap to fill in with returned data

Definition at line 263 of file tvbrowsehelper.cpp.

Referenced by run().

◆ GetNextProgramDB()

void TVBrowseHelper::GetNextProgramDB ( BrowseDirection  direction,
InfoMap infoMap 
) const
protected

Definition at line 326 of file tvbrowsehelper.cpp.

Referenced by run().

◆ run()

void TVBrowseHelper::run ( void  )
overrideprotectedvirtual

Runs the Qt event loop unless we have a QRunnable, in which case we run the runnable run instead.

Note
If you override this method you must call RunProlog before you do any work and RunEpilog before you exit the run method.

Reimplemented from MThread.

Definition at line 405 of file tvbrowsehelper.cpp.

Member Data Documentation

◆ m_tv

TV* TVBrowseHelper::m_tv {nullptr}
protected

Definition at line 112 of file tvbrowsehelper.h.

Referenced by BrowseDispInfo(), BrowseEnd(), BrowseStart(), and run().

◆ m_dbAllChannels

ChannelInfoList TVBrowseHelper::m_dbAllChannels
protected

Definition at line 113 of file tvbrowsehelper.h.

Referenced by GetChanId(), and TVBrowseHelper().

◆ m_dbAllVisibleChannels

ChannelInfoList TVBrowseHelper::m_dbAllVisibleChannels
protected

Definition at line 114 of file tvbrowsehelper.h.

Referenced by GetNextProgramDB(), and TVBrowseHelper().

◆ m_dbBrowseMaxForward

uint TVBrowseHelper::m_dbBrowseMaxForward
protected

Definition at line 115 of file tvbrowsehelper.h.

Referenced by run().

◆ m_dbBrowseAllTuners

bool TVBrowseHelper::m_dbBrowseAllTuners
protected

Definition at line 116 of file tvbrowsehelper.h.

Referenced by BrowseChannel(), GetChanId(), and run().

◆ m_dbUseChannelGroups

bool TVBrowseHelper::m_dbUseChannelGroups
protected

Definition at line 117 of file tvbrowsehelper.h.

Referenced by run().

◆ m_dbChanidToChannum

QHash<uint,QString> TVBrowseHelper::m_dbChanidToChannum
protected

Definition at line 118 of file tvbrowsehelper.h.

Referenced by GetNextProgramDB(), and TVBrowseHelper().

◆ m_dbChanidToSourceid

QHash<uint,uint> TVBrowseHelper::m_dbChanidToSourceid
protected

Definition at line 119 of file tvbrowsehelper.h.

Referenced by run(), and TVBrowseHelper().

◆ m_dbChannumToChanids

QMultiMap<QString,uint> TVBrowseHelper::m_dbChannumToChanids
protected

Definition at line 120 of file tvbrowsehelper.h.

Referenced by run(), and TVBrowseHelper().

◆ m_lock

QMutex TVBrowseHelper::m_lock
mutableprotected

Definition at line 122 of file tvbrowsehelper.h.

Referenced by BrowseDispInfo(), BrowseEnd(), BrowseStart(), GetBrowsedInfo(), run(), and Stop().

◆ m_ctx

PlayerContext* TVBrowseHelper::m_ctx {nullptr}
protected

◆ m_channum

QString TVBrowseHelper::m_channum
protected

Definition at line 124 of file tvbrowsehelper.h.

Referenced by BrowseEnd(), BrowseStart(), GetBrowsedInfo(), and run().

◆ m_chanid

uint TVBrowseHelper::m_chanid {0}
protected

Definition at line 125 of file tvbrowsehelper.h.

Referenced by BrowseStart(), GetBrowsedInfo(), and run().

◆ m_starttime

QString TVBrowseHelper::m_starttime
protected

Definition at line 126 of file tvbrowsehelper.h.

Referenced by BrowseStart(), GetBrowsedInfo(), and run().

◆ m_run

bool TVBrowseHelper::m_run {true}
protected

Definition at line 127 of file tvbrowsehelper.h.

Referenced by run(), and Stop().

◆ m_wait

QWaitCondition TVBrowseHelper::m_wait
protected

Definition at line 128 of file tvbrowsehelper.h.

Referenced by BrowseDispInfo(), BrowseEnd(), run(), and Stop().

◆ m_list

QList<BrowseInfo> TVBrowseHelper::m_list
protected

Definition at line 129 of file tvbrowsehelper.h.

Referenced by BrowseDispInfo(), BrowseEnd(), run(), and Stop().


The documentation for this class was generated from the following files: