radioStation Class Reference

This class rips radio streams and uses the options available from a config file. More...

#include <radiostation.h>

Inheritance diagram for radioStation:

Inheritance graph
[legend]
Collaboration diagram for radioStation:

Collaboration graph
[legend]

List of all members.

Public Slots

int execSettingsDialogWithoutApplyButton ()
void showSettingsDialogWithApplyButton ()

Signals

void uriChanged (void *index, PropertyValue newUri)

Public Member Functions

 radioStation (QObject *parent=0, QWidget *mainWidget=0, const QString &configFileName=QString())
 radioStation (QObject *parent, QWidget *mainWidget, const QString &configFileName, void *index)
virtual ~radioStation ()
QString configFileName () const
QString fullConfigFileName () const
QString fullParseRulesFileName () const
virtual PropertyValue uri () const
virtual void setServerUri (const QUrl &uri)

Static Public Member Functions

static PropertyValue formatedUri (const QString &theUri)

Protected Slots

virtual void setBitrate (void *ignored, const PropertyValue &newBitrate)
virtual void setMetaInterval (void *ignored, const PropertyValue &newMetaInterval)
virtual void setServerName (void *ignored, const PropertyValue &newServerName)
virtual void setStreamName (void *ignored, const PropertyValue &newStreamName)

Protected Member Functions

virtual QStringList parameterList () const
virtual QString serverUri () const
virtual QString workingDirectory () const
Reimplemented properties
These functions for property access are reimplemented. They write both to the property system of ripping and to the file configFileName.

virtual void setBitrate (const qint64 bitrate)
virtual void setMetaInterval (const qint64 metaInterval)
virtual void setServerName (const QString &newServerName)
virtual void setStreamName (const QString &newStreamName)

Protected Attributes

QPointer< settings_stream > config_skeleton
QPointer< QWidget > m_mainWidget
QPointer< settings_stream_dialogsettingsDialog

Properties

QString configFileName
QString fullConfigFileName
QString fullParseRulesFileName
PropertyValue uri

Private Types

enum  applyButton { showApplyButton, hideApplyButton }
enum  returnType { immediately, after_execution }

Private Slots

void helper_write_properties_from_file_to_class_ripping ()
void updateMetaData ()

Private Member Functions

QString helper_locateConfigfile (const QString &configfileName) const
void helper_setupConfigSystem (const QString &configFile)
int helper_displaySettingsDialog (const returnType returnMode, const applyButton applyButtonMode)

Private Attributes

QString internal_configFileName
KSharedConfig::Ptr shared_config
QPointer< get_stream_infoinfoCatcher


Detailed Description

This class rips radio streams and uses the options available from a config file.

It uses via config_skeleton a config file (see property configFileName) to determinate the URI of the stream and further options for the record (pregrap, postgrab, user agent string...).

It provides the public slot void showSettingsDialogWithApplyButton(), who shows a dialog that is a graphical interface to the config file.

Definition at line 36 of file radiostation.h.


Member Enumeration Documentation

enum radioStation::applyButton [private]

Private enumeration for conveciance.

Enumerator:
showApplyButton 
hideApplyButton 

Definition at line 222 of file radiostation.h.

enum radioStation::returnType [private]

Private enumeration for conveciance.

Enumerator:
immediately 
after_execution 

Definition at line 227 of file radiostation.h.


Constructor & Destructor Documentation

radioStation::radioStation ( QObject *  parent = 0,
QWidget *  mainWidget = 0,
const QString &  configFileName = QString() 
) [explicit]

Constructor of the class.

Parameters:
parent Sets the parent of this object.
mainWidget When an options dialog gets displayed, this widget is used as parent and the dialog gets centerd to this Widget.
configFileName Here you can give the name of the configuration file (only the name, not the full path). The constructor will look up in the appdata directory for the specified file. If the file doesn't exist then a new configuration file is created in the appdata directory, with the name stream_??????_rc with the six ? replaced by random letters. To intentionally create a new configuration file, just leave this parameter empty. You can obtain the full path of the really used file later trough the property configFileName.

Definition at line 35 of file radiostation.cpp.

References helper_setupConfigSystem(), helper_write_properties_from_file_to_class_ripping(), and m_mainWidget.

Here is the call graph for this function:

radioStation::radioStation ( QObject *  parent,
QWidget *  mainWidget,
const QString &  configFileName,
void *  index 
) [explicit]

Conveniance constructor of the class.

Parameters:
parent Sets the parent of this object.
mainWidget When an options dialog gets displayed, this widget is used as parent and the dialog gets centerd to this Widget.
configFileName Here you can give the name of the configuration file (only the name, not the full path). The constructor will look up in the appdata directory for the specified file. If the file doesn't exist then a new configuration file is created in the appdata directory, with the name stream_??????_rc with the six ? replaced by random letters. To intentionally create a new configuration file, just leave this parameter empty. You can obtain the full path of the really used file later trough the property configFileName.
index Initializes the property index.

Definition at line 44 of file radiostation.cpp.

References helper_setupConfigSystem(), helper_write_properties_from_file_to_class_ripping(), m_mainWidget, and streamripper_base::setIndex().

Here is the call graph for this function:

radioStation::~radioStation (  )  [virtual]

The destructor.

Definition at line 64 of file radiostation.cpp.

References config_skeleton, and settingsDialog.


Member Function Documentation

QString radioStation::configFileName (  )  const

See property configFileName.

int radioStation::execSettingsDialogWithoutApplyButton (  )  [slot]

Execs a configuration dialog.

See also:
helper_displaySettingsDialog()

Definition at line 262 of file radiostation.cpp.

References after_execution, helper_displaySettingsDialog(), and hideApplyButton.

Referenced by stationlistModel::helper_addNewStation().

Here is the call graph for this function:

Here is the caller graph for this function:

PropertyValue radioStation::formatedUri ( const QString &  theUri  )  [static]

Returns:
A full-featured formateded version for the property uri.

Definition at line 291 of file radiostation.cpp.

References PropertyValue::formatedValue, PropertyValue::internalValue, PropertyValue::type, PropertyValue::unset, and PropertyValue::value.

Referenced by helper_write_properties_from_file_to_class_ripping().

Here is the caller graph for this function:

QString radioStation::fullConfigFileName (  )  const

See property fullConfigFileName.

QString radioStation::fullParseRulesFileName (  )  const

See property fullParseRulesFileName.

Referenced by parameterList().

Here is the caller graph for this function:

int radioStation::helper_displaySettingsDialog ( const returnType  returnMode,
const applyButton  applyButtonMode 
) [private]

Displays a configuration dialog for the settings in the config file. The dialog is centered to m_mainWidget. When the dialog becomes closed, it will be deleted automatically.

Warning:
The parent of the dialog isn't this object (because it isn't a widget), but m_mainWidget. So the destructor must delete the dialog manually (if it still exists because it hasn't been closed).
Parameters:
returnMode Whether we show() or exec() the dialog.
applyButtonMode Determine which buttons are displayed.
Returns:
If using exec(), it returns the exit code (see QDialog::DialogCode). Else the return value is undefined.
See also:
settingsDialog

Definition at line 226 of file radiostation.cpp.

References config_skeleton, immediately, internal_configFileName, m_mainWidget, settingsDialog, and showApplyButton.

Referenced by execSettingsDialogWithoutApplyButton(), and showSettingsDialogWithApplyButton().

Here is the caller graph for this function:

QString radioStation::helper_locateConfigfile ( const QString &  configfileName  )  const [private]

Locates a config file in KStreamRipper's appdata directory.

Note:
Missing directories are created - but not the file itself.
Parameters:
configfileName The name of the config file (without path) which you want to locate
Returns:
An absolute file path including the file name

Definition at line 367 of file radiostation.cpp.

Referenced by helper_setupConfigSystem().

Here is the caller graph for this function:

void radioStation::helper_setupConfigSystem ( const QString &  configFile  )  [inline, private]

A helper function used in the constructors.

Definition at line 81 of file radiostation.cpp.

References config_skeleton, helper_locateConfigfile(), helper_write_properties_from_file_to_class_ripping(), internal_configFileName, and shared_config.

Referenced by radioStation().

Here is the call graph for this function:

Here is the caller graph for this function:

void radioStation::helper_write_properties_from_file_to_class_ripping (  )  [private, slot]

This function loads the values of the properties that are stored in configFileName from this file and writes them to the property system of the inherited class ripping, causing the notify signals to be emitted if necessary. It also emits always the notify signal for the property uri.

This slot is necessary to catch changes to the config that that are not done by this class itself (for example by the settings dialog, see helper_displaySettingsDialog()).

As we must catch this, in consequenze we don't need to worry about writing to the properties of the class ripping when implementing set functions - this is done automatically by this function here after that the values are written to the config file.

Definition at line 55 of file radiostation.cpp.

References config_skeleton, formatedUri(), streamripper_base::index(), setBitrate(), setMetaInterval(), setServerName(), setStreamName(), and uriChanged().

Referenced by helper_setupConfigSystem(), and radioStation().

Here is the call graph for this function:

Here is the caller graph for this function:

QStringList radioStation::parameterList (  )  const [protected, virtual]

This function provides the necessary parameters for calling streamripper. Uses ripping::parameterList() and adds the parameters readed from configFileName.

Reimplemented from ripping.

Definition at line 165 of file radiostation.cpp.

References config_skeleton, and fullParseRulesFileName().

Here is the call graph for this function:

QString radioStation::serverUri (  )  const [protected, virtual]

Returns:
The stream URI readed from configFileName.

Implements ripping.

Definition at line 160 of file radiostation.cpp.

References config_skeleton.

Referenced by updateMetaData().

Here is the caller graph for this function:

void radioStation::setBitrate ( void *  ignored,
const PropertyValue newBitrate 
) [protected, virtual, slot]

Provided for conveniance. It relies on the regular set method of the property. It is important to guard a clear concept of responsabilities and to make sure that all necessary updates to internal data is done.

Parameters:
ignored This argument hasn't any function.
newBitrate The new value. Only the value of its member internalValue is used.

Definition at line 337 of file radiostation.cpp.

References PropertyValue::internalValue, and setBitrate().

Here is the call graph for this function:

void radioStation::setBitrate ( const qint64  bitrate  )  [protected, virtual]

Reimplemented virtual function that uses the file configFileName.

Reimplemented from ripping.

Definition at line 142 of file radiostation.cpp.

References config_skeleton.

Referenced by helper_write_properties_from_file_to_class_ripping(), setBitrate(), setServerUri(), and updateMetaData().

Here is the caller graph for this function:

void radioStation::setMetaInterval ( void *  ignored,
const PropertyValue newMetaInterval 
) [protected, virtual, slot]

Provided for conveniance. It relies on the regular set method of the property. It is important to guard a clear concept of responsabilities and to make sure that all necessary updates to internal data is done.

Parameters:
ignored This argument hasn't any function.
newMetaInterval The new value. Only the value of its member internalValue is used.

Definition at line 342 of file radiostation.cpp.

References PropertyValue::internalValue, and setMetaInterval().

Here is the call graph for this function:

void radioStation::setMetaInterval ( const qint64  metaInterval  )  [protected, virtual]

Reimplemented virtual function that uses the file configFileName.

Reimplemented from ripping.

Definition at line 151 of file radiostation.cpp.

References config_skeleton.

Referenced by helper_write_properties_from_file_to_class_ripping(), setMetaInterval(), setServerUri(), and updateMetaData().

Here is the caller graph for this function:

void radioStation::setServerName ( void *  ignored,
const PropertyValue newServerName 
) [protected, virtual, slot]

Provided for conveniance. It relies on the regular set method of the property. It is important to guard a clear concept of responsabilities and to make sure that all necessary updates to internal data is done.

Parameters:
ignored This argument hasn't any function.
newServerName The new value. Only the value of its member internalValue is used.

Definition at line 347 of file radiostation.cpp.

References PropertyValue::internalValue, and setServerName().

Here is the call graph for this function:

void radioStation::setServerName ( const QString &  newServerName  )  [protected, virtual]

Reimplemented virtual function that uses the file configFileName.

Reimplemented from ripping.

Definition at line 134 of file radiostation.cpp.

References config_skeleton.

Referenced by helper_write_properties_from_file_to_class_ripping(), setServerName(), setServerUri(), and updateMetaData().

Here is the caller graph for this function:

void radioStation::setServerUri ( const QUrl &  uri  )  [virtual]

Sets the URI of the stream and actualizes the meta data.

Parameters:
uri The new URI

Definition at line 267 of file radiostation.cpp.

References config_skeleton, ripping::default_value_of_bitrate(), ripping::default_value_of_metaInterval(), ripping::default_value_of_serverName(), ripping::default_value_of_streamName(), setBitrate(), setMetaInterval(), setServerName(), setStreamName(), and updateMetaData().

Here is the call graph for this function:

void radioStation::setStreamName ( void *  ignored,
const PropertyValue newStreamName 
) [protected, virtual, slot]

Provided for conveniance. It relies on the regular set method of the property. It is important to guard a clear concept of responsabilities and to make sure that all necessary updates to internal data is done.

Parameters:
ignored This argument hasn't any function.
newStreamName The new value. Only the value of its member internalValue is used.

Definition at line 352 of file radiostation.cpp.

References PropertyValue::internalValue, and setStreamName().

Here is the call graph for this function:

void radioStation::setStreamName ( const QString &  newStreamName  )  [protected, virtual]

Reimplemented virtual function that uses the file configFileName.

Reimplemented from ripping.

Definition at line 126 of file radiostation.cpp.

References config_skeleton.

Referenced by helper_write_properties_from_file_to_class_ripping(), setServerUri(), setStreamName(), and updateMetaData().

Here is the caller graph for this function:

void radioStation::showSettingsDialogWithApplyButton (  )  [slot]

Shows a configuration dialog.

See also:
helper_displaySettingsDialog()

Definition at line 257 of file radiostation.cpp.

References helper_displaySettingsDialog(), immediately, and showApplyButton.

Referenced by stationlistModel::showConfigDialog().

Here is the call graph for this function:

Here is the caller graph for this function:

void radioStation::updateMetaData (  )  [private, slot]

Releads parts of the meta data that has typically changed after the URI has changed.

See also:
setServerUri()

Definition at line 313 of file radiostation.cpp.

References ripping::bitrateChanged(), infoCatcher, ripping::metaIntervalChanged(), ripping::serverNameChanged(), serverUri(), setBitrate(), setMetaInterval(), setServerName(), setStreamName(), and ripping::streamNameChanged().

Referenced by setServerUri().

Here is the call graph for this function:

Here is the caller graph for this function:

virtual PropertyValue radioStation::uri (  )  const [virtual]

See property uri.

void radioStation::uriChanged ( void *  index,
PropertyValue  newUri 
) [signal]

Referenced by helper_write_properties_from_file_to_class_ripping().

Here is the caller graph for this function:

QString radioStation::workingDirectory (  )  const [protected, virtual]

Provides the working directory for the Streamripper process.

Implements ripping.

Definition at line 308 of file radiostation.cpp.


Member Data Documentation

QPointer<settings_stream> radioStation::config_skeleton [protected]

See also:
updateMetaData()

Definition at line 270 of file radiostation.h.

Referenced by updateMetaData().

Used internally to store the property configFileName.

Definition at line 258 of file radiostation.h.

Referenced by helper_displaySettingsDialog(), and helper_setupConfigSystem().

QPointer<QWidget> radioStation::m_mainWidget [protected]

Is set by the constructor. The settings dialog will be centered to this widget.

See also:
showSettingsDialogWithApplyButton()

Definition at line 165 of file radiostation.h.

Referenced by helper_displaySettingsDialog(), and radioStation().

A pointer to the settings dialog (if actually exists one).

See also:
showSettingsDialogWithApplyButton()

Definition at line 187 of file radiostation.h.

Referenced by helper_displaySettingsDialog(), and ~radioStation().

KSharedConfig::Ptr radioStation::shared_config [private]

This points to a KSharedConfig object that uses configFileName. Use config_skeleton to get comfortable access all these things.

This is a KSharedConfig::Ptr (a KSharedPtr to a KSharedConfig object). The constructor will create a KSharedConfig object that uses configFileName - and this pointer will point on it. When the pointer is deleted (=when the radiostation object it belongs to becomes deleted), it will automatically delete also the KSharedConfig object it points to.

Definition at line 268 of file radiostation.h.

Referenced by helper_setupConfigSystem().


Property Documentation

QString radioStation::configFileName [read]

This property holds the name of the configuration file used by this object (only the name, not the full path). You can determine the configuration file in the constructor (see there for further details). Once set there, it can't be changed anymore.

Use config_skeleton for comfortable access to the settings that are stored in the configuration file.
See also:
fullConfigFileName

QString internal_configFileName

Definition at line 52 of file radiostation.h.

Referenced by stationlistModel::writeItemToFile().

QString radioStation::fullConfigFileName [read]

This property holds the full path (including the file name) to the configuration file used by this object. You can determinate the configuration file in the constructor (see there for further details). Once set there, it can't be changed anymore.

Use config_skeleton for comfortable access to the settings that are stored in the configuration file.
See also:
configFileName

QString internal_configFileName

Definition at line 65 of file radiostation.h.

Referenced by stationlistModel::helper_deleteRadiostationobjectAndRemoveConfigfiles().

QString radioStation::fullParseRulesFileName [read]

This property holds the full path (including the file name) to the parse rule file used by this object. The name of the parse rule file is chosen automatically depending on configFileName.

Note:
This property returns always the path under which the parse rules file is expected. This does not mean that it really exists. When it doesn't exist, make sure that you use the default values instead.

Definition at line 76 of file radiostation.h.

PropertyValue radioStation::uri [read]

This property holds the URI from which the stream comes.

This property doesn't exist on it's own. It uses serverUri() to get the URI. The notify signal is emitted always when the config file changes.

Initialization value: an empty string

This property guards it's last value also when streamripper terminates.

See also:
 static PropertyValue formatedServerName(const QString theServerName) 

Definition at line 92 of file radiostation.h.

Referenced by stationlistModel::columnInfo().


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

doxygen