settings_stream_widget_connection Class Reference

Widget for the "connection" options in the stream configuration (for use with a KConfigDialog). More...

#include <settings_stream_widget_connection.h>

Collaboration diagram for settings_stream_widget_connection:

Collaboration graph
[legend]

List of all members.

Public Slots

void load_info_from_kcfg_and_start_recognization ()

Public Member Functions

 settings_stream_widget_connection (QWidget *parent=0)
virtual ~settings_stream_widget_connection ()

Private Slots

void delete_old_streamInfo_and_start_recognization ()
void change_empty_user_visible_widgets_to__connection_failed ()
void setBitrate (void *index, const PropertyValue &bitrate)
void setMetaInterval (void *index, const PropertyValue &metaInterval)
void setServerName (void *index, const PropertyValue &serverName)
void setStreamName (void *index, const PropertyValue &streamName)

Private Member Functions

void helper_disconnect_m_process_and_kill ()
QString helper_qstring_localized__recognizing ()
void helper_setServerUri_connectMProcess_startRecognization ()

Private Attributes

get_stream_info m_process


Detailed Description

Widget for the "connection" options in the stream configuration (for use with a KConfigDialog).

It uses the UI that is generated with Qt-Designer.

The interface design and also the internals of this class are unhandy and it is a dirty hack. I've spend some hours to improve this, but the result is still ugly - and I don't know how to implement the functionality in a more elegant way. Sorry.

This widget provides (through get_stream_info class) on-the-fly recognization of some information about the stream (stream information): get_stream_info::bitrate, get_stream_info::metaInterval, get_stream_info::serverName and get_stream_info::streamName. Always when the user writes something to the field with the URI of the stream, than the widget tries to recognize the stream information immediately. A (grayed out) message "Recognizing" is displayed. If it can't connect to the Internet or the URI isn't valid or isn't a stream, a (grayed out) error message is displayed. If it can recognize the stream information, they are displayed.

To make this possible, this class makes the widgets for the stream information that are connected to the kcfg system and automatically handled be KConfigDialog (kcfg_info_bitrate, kcfg_info_metaInterval, kcfg_info_serverName and kcfg_info_streamName) invisible. Visible for the user are other widgets (QLabels) - that makes nice displaying easier. This way, the bitrate must not be displayed in a QSpinBox, but can be nicly formated and displayed in a QLabel. This class takes care of keeping in sync the visible and the invisible widgets.

However, not everything works automatically. You must call load_info_from_kcfg_and_start_recognization() after adding the widget to a KConfigDialog with KConfigDialog::addWidget().

See also:
settings_stream

Definition at line 65 of file settings_stream_widget_connection.h.


Constructor & Destructor Documentation

settings_stream_widget_connection::settings_stream_widget_connection ( QWidget *  parent = 0  ) 

The constructor.

Definition at line 27 of file settings_stream_widget_connection.cpp.

settings_stream_widget_connection::~settings_stream_widget_connection (  )  [virtual]

The destructor.

Definition at line 50 of file settings_stream_widget_connection.cpp.

References helper_disconnect_m_process_and_kill().

Here is the call graph for this function:


Member Function Documentation

void settings_stream_widget_connection::change_empty_user_visible_widgets_to__connection_failed (  )  [private, slot]

This function tests for each of the 4 streamInfos if it has the value ripping::unset. If so, it changes the corresponding user-visible QLabel to "Connection failed." (without changing if the QLabel is grayed out or not).

Definition at line 236 of file settings_stream_widget_connection.cpp.

References ripping::formatedBitrate(), ripping::formatedMetaInterval(), ripping::formatedServerName(), and PropertyValue::unset.

Referenced by helper_disconnect_m_process_and_kill(), and helper_setServerUri_connectMProcess_startRecognization().

Here is the call graph for this function:

Here is the caller graph for this function:

void settings_stream_widget_connection::delete_old_streamInfo_and_start_recognization (  )  [private, slot]

This slot will

  • stop the possibly actually running recognization
  • reset the values of the kcfg_... widgets for the stream info
  • display "Recognizing..." (grayed out) in the corresponding user visible QLabels
  • start a new recognization with for the actual URI

Definition at line 118 of file settings_stream_widget_connection.cpp.

References ripping::default_value_of_bitrate(), ripping::default_value_of_metaInterval(), ripping::default_value_of_serverName(), ripping::default_value_of_streamName(), helper_disconnect_m_process_and_kill(), helper_qstring_localized__recognizing(), and helper_setServerUri_connectMProcess_startRecognization().

Referenced by load_info_from_kcfg_and_start_recognization().

Here is the call graph for this function:

Here is the caller graph for this function:

void settings_stream_widget_connection::helper_disconnect_m_process_and_kill (  )  [private]

Deletes the connection between signals of m_process and slots from this object and kills the recognization process.

It is a good idea to delete always the connection before killing streamripper - who knows which strange things could happen...?

See also:
helper_setServerUri_connectMProcess_startRecognization()

Definition at line 85 of file settings_stream_widget_connection.cpp.

References streamripper_base::abortStreamripper(), change_empty_user_visible_widgets_to__connection_failed(), m_process, setBitrate(), setMetaInterval(), setServerName(), and setStreamName().

Referenced by delete_old_streamInfo_and_start_recognization(), load_info_from_kcfg_and_start_recognization(), and ~settings_stream_widget_connection().

Here is the call graph for this function:

Here is the caller graph for this function:

QString settings_stream_widget_connection::helper_qstring_localized__recognizing (  )  [private]

Returns:
the localized form of "Recognizing...".

Definition at line 111 of file settings_stream_widget_connection.cpp.

Referenced by delete_old_streamInfo_and_start_recognization(), and load_info_from_kcfg_and_start_recognization().

Here is the caller graph for this function:

void settings_stream_widget_connection::helper_setServerUri_connectMProcess_startRecognization (  )  [private]

Uses the actual URI from the UI for m_process, sets up the connection between signals of m_process and slots from this object and starts the recognization.

Calling this function will propably cause m_process to emit some signals because get_stream_info::setServerUri() resets all recognized streamripper properties.

See also:
helper_disconnect_m_process_and_kill()

Definition at line 58 of file settings_stream_widget_connection.cpp.

References change_empty_user_visible_widgets_to__connection_failed(), m_process, setBitrate(), setMetaInterval(), setServerName(), get_stream_info::setServerUri(), setStreamName(), and ripping::startStreamripper().

Referenced by delete_old_streamInfo_and_start_recognization(), and load_info_from_kcfg_and_start_recognization().

Here is the call graph for this function:

Here is the caller graph for this function:

void settings_stream_widget_connection::load_info_from_kcfg_and_start_recognization (  )  [slot]

This function loads the stream information from the invisible kcfg widgets. This can't be done in the constructor, because when construncting this widget, the fields are still empty. You must call load_info_from_kcfg_and_start_recognization() after adding the widget to a KConfigDialog with KConfigDialog::addWidget(). Example for code used inside a class that's derived from KConfigDialog:

After loading the information, the function tries to actualise them. However, when this doesn't work because there's no connection (to the Internet or because the stream server is down), then nothing is deleted.

Furthermore, this function enables the on-the-fly recognization of URIs that are typed by the user.

It is necessary to request this manual call of load_info_from_kcfg_and_start_recognization(). It isn't possible to make it obsolete by connecting to the signal textChanged of the QLineEdit that contains the URL, because when KConfig sets first the stream information and after that the serverUri, this class would overwrite the yet displayed stream information because the URI has changed and a new recognization starts - and when in this moment no Internet connection is available, all stream information would be deleted.

Definition at line 142 of file settings_stream_widget_connection.cpp.

References delete_old_streamInfo_and_start_recognization(), ripping::formatedBitrate(), ripping::formatedMetaInterval(), ripping::formatedServerName(), ripping::formatedStreamName(), PropertyValue::formatedValue, helper_disconnect_m_process_and_kill(), helper_qstring_localized__recognizing(), helper_setServerUri_connectMProcess_startRecognization(), setBitrate(), setMetaInterval(), setServerName(), setStreamName(), PropertyValue::type, and PropertyValue::value.

Here is the call graph for this function:

void settings_stream_widget_connection::setBitrate ( void *  index,
const PropertyValue bitrate 
) [private, slot]

This slot is used to set some info about the stream for this widget. It sets the value for both, the user visible QLabel (nicly formated - and grayed out if nothing was recognized an an error message is displayed instead) and for the widget kcfg_... which is relevant for the kcfg system.

This parameter index is ignored. It just present to make it possible to connect to the signals of get_stream_info.

Definition at line 212 of file settings_stream_widget_connection.cpp.

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

Referenced by helper_disconnect_m_process_and_kill(), helper_setServerUri_connectMProcess_startRecognization(), and load_info_from_kcfg_and_start_recognization().

Here is the caller graph for this function:

void settings_stream_widget_connection::setMetaInterval ( void *  index,
const PropertyValue metaInterval 
) [private, slot]

This slot is used to set some info about the stream for this widget. It sets the value for both, the user visible QLabel (nicly formated - and grayed out if nothing was recognized an an error message is displayed instead) and for the widget kcfg_... which is relevant for the kcfg system.

This parameter index is ignored. It just present to make it possible to connect to the signals of get_stream_info.

Definition at line 224 of file settings_stream_widget_connection.cpp.

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

Referenced by helper_disconnect_m_process_and_kill(), helper_setServerUri_connectMProcess_startRecognization(), and load_info_from_kcfg_and_start_recognization().

Here is the caller graph for this function:

void settings_stream_widget_connection::setServerName ( void *  index,
const PropertyValue serverName 
) [private, slot]

This slot is used to set some info about the stream for this widget. It sets the value for both, the user visible QLabel (nicly formated - and grayed out if nothing was recognized an an error message is displayed instead) and for the widget kcfg_... which is relevant for the kcfg system.

This parameter index is ignored. It just present to make it possible to connect to the signals of get_stream_info.

Definition at line 200 of file settings_stream_widget_connection.cpp.

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

Referenced by helper_disconnect_m_process_and_kill(), helper_setServerUri_connectMProcess_startRecognization(), and load_info_from_kcfg_and_start_recognization().

Here is the caller graph for this function:

void settings_stream_widget_connection::setStreamName ( void *  index,
const PropertyValue streamName 
) [private, slot]

This slot is used to set some info about the stream for this widget. It sets the value for both, the user visible QLabel (nicly formated - and grayed out if nothing was recognized an an error message is displayed instead) and for the widget kcfg_... which is relevant for the kcfg system.

This parameter index is ignored. It just present to make it possible to connect to the signals of get_stream_info.

Definition at line 188 of file settings_stream_widget_connection.cpp.

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

Referenced by helper_disconnect_m_process_and_kill(), helper_setServerUri_connectMProcess_startRecognization(), and load_info_from_kcfg_and_start_recognization().

Here is the caller graph for this function:


Member Data Documentation

The get_stream_info object that is used to perform the recognization of the stream information.

Definition at line 114 of file settings_stream_widget_connection.h.

Referenced by helper_disconnect_m_process_and_kill(), and helper_setServerUri_connectMProcess_startRecognization().


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

doxygen