streamDirectoryService Class Reference

Abstract base class for stream directory plugins. More...

#include <streamdirectoryservice.h>

List of all members.

Public Member Functions

 streamDirectoryService (QObject *parent=0)
virtual ~streamDirectoryService ()
bool isEnabled () const
void setEnabled (const bool value)

Protected Member Functions

void addStreamToWidget (const QString &genre, const QString &streamName, const quint64 bitrate, const QString &currentlyPlaying=QString())
virtual void kickOffStreamFetch ()=0
virtual void stopStreamFetch ()=0

Properties

bool enabled

Private Member Functions

void helper_start ()
void helper_stop ()
void setWidget (stationDirectoryTree *newWidget)

Private Attributes

bool fetchIsRunning
bool internal_enabled
QPointer< stationDirectoryTreewidget

Friends

class stationDirectoryTree


Detailed Description

Abstract base class for stream directory plugins.

This is the abstract base class for service plugins for the stationDirectoryTree widget. Each plugin makes a streams from a specific service (for example http://shoutcast.com) available for a stationDirectoryTree widget. With the property enabled, you can enable or disable the plugin.

To register plugins in stationDirectoryTree, please see the documentation of stationDirectoryTree.

To implement plugins, you have to implement asynchroniously the processing. Reimplement virtual void kickOffStreamFetch() = 0; in a way that it just kicks off the fetching of the stream - and returns imediatly. (You can do this with the KIO library of maybe also with threads). Once the data has arrived, process it and use addStreamToWidget() to make the streams available. Furthermore, you have to implement virtual void stopStreamFetch() = 0;, which stopps all fetching and processing of data. You don't have to worry about removing existing items from the widget - this is done automatically.

Definition at line 45 of file streamdirectoryservice.h.


Constructor & Destructor Documentation

streamDirectoryService::streamDirectoryService ( QObject *  parent = 0  )  [explicit]

Constructor of the class.

Parameters:
parent Sets the parent widget of this object. It is not necessary to use the stationDirectoryTree object as parent, but it is possible.

Definition at line 25 of file streamdirectoryservice.cpp.

References fetchIsRunning, and internal_enabled.

streamDirectoryService::~streamDirectoryService (  )  [virtual]

The desctructor.

Definition at line 31 of file streamdirectoryservice.cpp.

References helper_stop().

Here is the call graph for this function:


Member Function Documentation

bool streamDirectoryService::isEnabled (  )  const

See property enabled.

Definition at line 46 of file streamdirectoryservice.cpp.

References internal_enabled.

Referenced by setWidget().

Here is the caller graph for this function:

void streamDirectoryService::setEnabled ( const bool  value  ) 

See property enabled.

Definition at line 51 of file streamdirectoryservice.cpp.

References helper_start(), helper_stop(), internal_enabled, and widget.

Here is the call graph for this function:

void streamDirectoryService::addStreamToWidget ( const QString &  genre,
const QString &  streamName,
const quint64  bitrate,
const QString &  currentlyPlaying = QString() 
) [protected]

Adds a stream entry with the specified values to the stationDirectoryTree widget where this object is used as plugin.

Use this function in your implementation of kickOffStreamFetch(). TODO Parameter dokumentieren

Definition at line 36 of file streamdirectoryservice.cpp.

References widget.

virtual void streamDirectoryService::kickOffStreamFetch (  )  [protected, pure virtual]

This function kicks of the fetching of the stream list.

The fetching of the stream list must be asynchronious. This function only kicks of the necessary processes, but it expected to return itself imediatly.

Once the information that you have requested from the internet is available, process it and use addStreamToWidget() to make it available.

Referenced by helper_start().

Here is the caller graph for this function:

virtual void streamDirectoryService::stopStreamFetch (  )  [protected, pure virtual]

This function stopps all running file transfers from the internet and stopps all processing of data. It is expected, that after calling this function, there will be no call of addStreamToWidget() anymore (until kickOffStreamFetch() is called the next time).

You don't have to worry about removing existing items from the widget - this is done automatically.

Referenced by helper_stop().

Here is the caller graph for this function:

void streamDirectoryService::helper_start (  )  [private]

Helper function to start the fetching of the stream list.

See also:
fetchIsRunning

Definition at line 76 of file streamdirectoryservice.cpp.

References fetchIsRunning, and kickOffStreamFetch().

Referenced by setEnabled(), and setWidget().

Here is the call graph for this function:

Here is the caller graph for this function:

void streamDirectoryService::helper_stop (  )  [private]

Helper function to stop the fetching of the stream list and to remove all stream of this plugin from widget.

See also:
fetchIsRunning

Definition at line 84 of file streamdirectoryservice.cpp.

References fetchIsRunning, stopStreamFetch(), and widget.

Referenced by setEnabled(), setWidget(), and ~streamDirectoryService().

Here is the call graph for this function:

Here is the caller graph for this function:

void streamDirectoryService::setWidget ( stationDirectoryTree newWidget  )  [private]

Registers this object as plugin of the specified stationDirectoryTree widget.

Although this function is private, it is acessible from stationDirectoryTree because of a friend declaration.

Parameters:
newWidget A pointer to the widget where this object is registered as plugin. Can also be set to 0 to unregister the object.

Definition at line 65 of file streamdirectoryservice.cpp.

References helper_start(), helper_stop(), isEnabled(), and widget.

Referenced by stationDirectoryTree::registerPlugin().

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class stationDirectoryTree [friend]

Definition at line 50 of file streamdirectoryservice.h.


Member Data Documentation

Used to remember if the object is fetching the stream directory data. This is only possible if the widget is enabled and registered as plugin.

It is used and managed by helper_start() and helper_stop().

Definition at line 105 of file streamdirectoryservice.h.

Referenced by helper_start(), helper_stop(), and streamDirectoryService().

Used internally to store the property enabled.

Definition at line 112 of file streamdirectoryservice.h.

Referenced by isEnabled(), setEnabled(), and streamDirectoryService().

A pointer to the stationDirectoryTree where this object is used as plugin. If you want to register this object as plugin, don't set this directly, but use setWidget()!

Definition at line 115 of file streamdirectoryservice.h.

Referenced by addStreamToWidget(), helper_stop(), setEnabled(), and setWidget().


Property Documentation

bool streamDirectoryService::enabled [read, write]

This property holds whether the plugin is enabled.

If the plugin is disabled, it's streams will not be shown in stationDirectoryTree.

See also:
bool internal_enabled

Definition at line 60 of file streamdirectoryservice.h.


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

Generated on Sat May 2 10:44:04 2009 for kradioripper by  doxygen 1.5.6