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

Superclass for making an object have a set of listeners. More...

#include <mythobservable.h>

Inheritance diagram for MythObservable:
Inheritance graph
[legend]

Public Member Functions

 MythObservable ()
 
virtual ~MythObservable ()
 
void addListener (QObject *listener)
 Add a listener to the observable. More...
 
void removeListener (QObject *listener)
 Remove a listener to the observable. More...
 
void dispatch (const MythEvent &event)
 Dispatch an event to all listeners. More...
 
bool hasListeners (void)
 

Protected Attributes

QMutex * m_lock
 
QSet< QObject * > m_listeners
 

Detailed Description

Superclass for making an object have a set of listeners.

This superclass provides the basic API for adding and removing listeners and iterating across them. It is typically used to post events to listening QObjects.

MythEvents can be dispatched to all listeners by calling dispatch

The name MythObservable is 'wrong', since all the methods refer to the observers as listeners (ie. addListener), however, MythListenable just doesn't sound right, and fixing all the calls to addListener was too big a patch.

Definition at line 11 of file mythobservable.h.

Constructor & Destructor Documentation

◆ MythObservable()

MythObservable::MythObservable ( )

Definition at line 22 of file mythobservable.cpp.

◆ ~MythObservable()

MythObservable::~MythObservable ( )
virtual

Definition at line 26 of file mythobservable.cpp.

Member Function Documentation

◆ addListener()

void MythObservable::addListener ( QObject *  listener)

Add a listener to the observable.

Adds the given QObject to the list of objects that observe this observable.

Parameters
listenerthe QObject that will listen to this observable

Definition at line 42 of file mythobservable.cpp.

Referenced by MusicPlayer::addListener(), SSDP::AddListener(), MusicPlayer::addVisual(), AutoExpire::AutoExpire(), BackendConnectionManager::BackendConnectionManager(), BrowserApi::BrowserApi(), ChannelRecPriority::ChannelRecPriority(), ZMMiniPlayer::Create(), PrevRecordedList::Create(), ProgLister::Create(), CustomEdit::CustomEdit(), CustomEventRelayer::CustomEventRelayer(), CustomPriority::CustomPriority(), MusicPlayer::decoderHandlerReady(), EditAlbumartDialog::EditAlbumartDialog(), EditMetadataDialog::EditMetadataDialog(), LyricsData::findLyrics(), IdleScreen::IdleScreen(), MediaServer::Init(), ProgFinder::Init(), PrevRecordedList::Init(), GuideGrid::Init(), TV::InitFromDB(), JobQueue::JobQueue(), LCDProcClient::LCDProcClient(), LyricsView::LyricsView(), MainServer::MainServer(), MessageHandler::MessageHandler(), MusicPlayer::MusicPlayer(), MythMainWindow::MythMainWindow(), MythSystemEventHandler::MythSystemEventHandler(), NetBase::NetBase(), NetworkControl::NetworkControl(), MusicPlayer::openOutputDevice(), PlaybackBox::PlaybackBox(), PlaylistEditorView::PlaylistEditorView(), PreviewGenerator::RemotePreviewRun(), MusicPlayer::setupDecoderHandler(), GallerySlideView::Start(), GalleryThumbView::Start(), UPNPScanner::Start(), HouseKeeper::Start(), ThemeChooser::ThemeChooser(), VideoSetupWizard::VideoSetupWizard(), ViewScheduled::ViewScheduled(), WebSocketMythEvent::WebSocketMythEvent(), WelcomeDialog::WelcomeDialog(), and ZMClient::ZMClient().

◆ removeListener()

void MythObservable::removeListener ( QObject *  listener)

Remove a listener to the observable.

Remove the given QObject from the list of objects that observe this observable.

Parameters
listenerthe QObject that already listens to this observable

Definition at line 59 of file mythobservable.cpp.

Referenced by GallerySlideView::Close(), GalleryThumbView::Close(), LyricsData::customEvent(), CustomEventRelayer::deleteLater(), PreviewGenerator::RemotePreviewRun(), MusicPlayer::removeListener(), SSDP::RemoveListener(), MusicPlayer::removeVisual(), UPNPScanner::Stop(), MusicPlayer::stop(), MainServer::Stop(), AutoExpire::~AutoExpire(), BackendConnectionManager::~BackendConnectionManager(), BrowserApi::~BrowserApi(), ChannelRecPriority::~ChannelRecPriority(), CustomEdit::~CustomEdit(), CustomPriority::~CustomPriority(), EditAlbumartDialog::~EditAlbumartDialog(), GuideGrid::~GuideGrid(), HouseKeeper::~HouseKeeper(), IdleScreen::~IdleScreen(), JobQueue::~JobQueue(), LCDProcClient::~LCDProcClient(), LyricsView::~LyricsView(), MediaServer::~MediaServer(), MusicPlayer::~MusicPlayer(), MythMainWindow::~MythMainWindow(), MythSystemEventHandler::~MythSystemEventHandler(), NetBase::~NetBase(), NetworkControl::~NetworkControl(), PlaybackBox::~PlaybackBox(), PlaylistEditorView::~PlaylistEditorView(), PrevRecordedList::~PrevRecordedList(), ProgFinder::~ProgFinder(), ProgLister::~ProgLister(), ThemeChooser::~ThemeChooser(), TV::~TV(), VideoSetupWizard::~VideoSetupWizard(), ViewScheduled::~ViewScheduled(), WebSocketMythEvent::~WebSocketMythEvent(), WelcomeDialog::~WelcomeDialog(), ZMClient::~ZMClient(), and ZMMiniPlayer::~ZMMiniPlayer().

◆ dispatch()

void MythObservable::dispatch ( const MythEvent event)

◆ hasListeners()

bool MythObservable::hasListeners ( void  )
inline

Member Data Documentation

◆ m_lock

QMutex* MythObservable::m_lock
protected

◆ m_listeners

QSet<QObject*> MythObservable::m_listeners
protected

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