#include <stationlistmodel.h>
Public Types | |
enum | columnInfoType { columnHeaderTitle, columnHeaderToolTip, columnHeaderWhatsThis, columnWidth, setColumnWidth, columnVisibility, setColumnVisibility, columnData } |
Public Slots | |
void | addNewFolder () |
void | addNewFolderInFolder () |
void | addNewStation () |
void | addNewStationInFolder () |
void | enableListeningIn () |
void | disableListeningIn () |
void | paste () |
void | pasteSelection (const QModelIndex &index) |
void | record () |
void | showConfigDialog () |
void | stopRecording () |
Signals | |
void | bandwidthChanged () |
void | numberOfActiveStreamsChanged () |
void | numberOfActiveStreamsIsZero () |
void | relayportChanged () |
void | selectedStreamsChanged () |
void | statusChanged () |
Public Member Functions | |
stationlistModel (stationlistWidget *parent, QWidget *mainWidget=0) | |
virtual | ~stationlistModel () |
quint64 | bandwidth () const |
virtual int | columnCount (const QModelIndex &parent=QModelIndex()) const |
QVariant | columnInfo (const columnInfoType type, const int column, const radioStation *stream=0, const quint64 value=(-1)) const |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
virtual bool | dropMimeData (const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role) const |
virtual QModelIndex | index (int row, int column, const QModelIndex &parent=QModelIndex()) const |
virtual QStringList | mimeTypes () const |
int | numberOfActiveStreams () const |
virtual QModelIndex | parent (const QModelIndex &index) const |
virtual bool | queryClose () |
virtual void | readProperties (const KConfigGroup &m_configGroup) |
virtual bool | removeRows (int row, int count, const QModelIndex &parent=QModelIndex()) |
virtual int | rowCount (const QModelIndex &parent=QModelIndex()) const |
virtual void | saveProperties (KConfigGroup &m_configGroup) |
QList< radioStation * > | selectedStreams () const |
virtual void | sort (int column, Qt::SortOrder order=Qt::AscendingOrder) |
Public Attributes | |
listenSupport | listen |
Protected Attributes | |
QPointer< stationlistWidget > | view |
Properties | |
quint64 | bandwidth |
QList | radioStation |
int | numberOfActiveStreams |
Private Types | |
enum | mode { add, move } |
Private Slots | |
void | recalculate_numberOfActiveStreams_and_bandwidth () |
void | recalculateSelectedStreams () |
void | reloadBitrate (void *stationIndex) |
void | reloadDataSize (void *stationIndex) |
void | reloadMetaInterval (void *stationIndex) |
void | reloadMetaInterval_milliSeconds (void *stationIndex) |
void | reloadRelayPort (void *stationIndex) |
void | reloadServerName (void *stationIndex) |
void | reloadSong (void *stationIndex) |
void | reloadStatus (void *stationIndex) |
void | reloadStreamName (void *stationIndex) |
void | reloadUri (void *stationIndex) |
void | rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone () |
Private Member Functions | |
void | helper_addNewFolder (const QModelIndex &index) |
void | helper_addNewStation (const QModelIndex &index) |
void | helper_connectSignalsAndSlots (radioStation *m_stream) |
QList< QUrl > | helper_convertToUrl (const QMimeData *data) |
stationlistItem * | helper_createStreamItem (radioStation *stream) |
void | helper_deleteRadiostationobjectAndRemoveConfigfiles (radioStation *station) |
void | helper_deleteRadiostationobjectAndRemoveConfigfiles (stationlistItem *item) |
bool | helper_firstIsAfterSecond (stationlistItem *firstItem, stationlistItem *secondItem, int column, Qt::SortOrder order) |
bool | helper_firstIsAfterSecond (const PropertyValue &firstValue, const PropertyValue &secondValue, Qt::SortOrder order) |
bool | helper_hasStreams (stationlistItem *item) |
QList< radioStation * > | helper_listOfAllStreams (stationlistItem *parentItem) |
void | helper_insertItems (QList< stationlistItem * > itemList, const QModelIndex &parent, int row) |
void | helper_insertItem (stationlistItem *item, const QModelIndex &parent, int row) |
bool | helper_isInTree (stationlistItem *child, stationlistItem *parent) |
bool | helper_isNumericValue (const QVariant &value) |
void | helper_moveItems (const QModelIndex &oldParent, int first, int last, const QModelIndex &newParent, int newRow) |
QList< stationlistItem * > | helper_removeItems (const QModelIndex &parent, int first, int last) |
void | helper_selectAndScrollTo (const QModelIndexList &modelIndexList) |
QString | helper_stationlistXmlFilepath () |
qlonglong | helper_toLongLong (const PropertyValue &value) |
void | helper_writeStationList () |
stationlistItem * | item (const QModelIndex &index) const |
QModelIndex | modelindexOfItem (stationlistItem *item, int column) |
void | sortChildItems (stationlistItem *parent, int column, Qt::SortOrder order) |
void | writeItemToFile (stationlistItem *item, QXmlStreamWriter &file) |
Private Attributes | |
quint64 | internal_bandwidth |
int | internal_numberOfActiveStreams |
QList< radioStation * > | internal_selectedStreams |
QStringList * | m_listOfStreamsOfWhichTheUserWantsThatTheyRip |
QPointer< QWidget > | m_mainWidget |
stationlistItem * | rootItem |
This class handels radio stations. It reads the list of configuration files of radio stations from settings_general and represents these radio stations. Internally, it uses objects of the class radioStation to handle the stations. This class can also create new radio stations or delete existing ones - and takes care of creating/changing/removing the corresponding config files.
This class inherits from QAbstractTableModel (and this way indirectly from QAbstractItemModel). So it can be used as model for Qt's model-view-programming. Use a QTableView object to watch the data of this model.
You can use only one view to show the content of this model!
Definition at line 57 of file stationlistmodel.h.
This enum is used in columnInfo() to determinate which action will be performed:
columnHeaderTitle | |
columnHeaderToolTip | |
columnHeaderWhatsThis | |
columnWidth | |
setColumnWidth | |
columnVisibility | |
setColumnVisibility | |
columnData |
Definition at line 148 of file stationlistmodel.h.
enum stationlistModel::mode [private] |
stationlistModel::stationlistModel | ( | stationlistWidget * | parent, | |
QWidget * | mainWidget = 0 | |||
) | [explicit] |
The constructor.
parent | The parent of this object. This is important for the necessary interaction between model and view (for example: selection handling). | |
mainWidget | The widget to which configuration dialogs will be centered. |
setModel()
in parent
. Definition at line 43 of file stationlistmodel.cpp.
References stationlistItem::appendChild(), helper_createStreamItem(), helper_stationlistXmlFilepath(), helper_writeStationList(), m_listOfStreamsOfWhichTheUserWantsThatTheyRip, m_mainWidget, modelindexOfItem(), stationlistItem::parent(), radioStation, recalculate_numberOfActiveStreams_and_bandwidth(), recalculateSelectedStreams(), rootItem, and view.
stationlistModel::~stationlistModel | ( | ) | [virtual] |
void stationlistModel::addNewFolder | ( | ) | [slot] |
This function adds a new folder: It displays a configuration dialog for the new folder. If accepted by the user (= clicking OK), the new folder is inserted in the root folder.)
Definition at line 1071 of file stationlistmodel.cpp.
References helper_addNewFolder().
void stationlistModel::addNewFolderInFolder | ( | ) | [slot] |
This function adds a new folder: It displays a configuration dialog for the new folder. If accepted by the user (= clicking OK), the new folder is inserted in the actually selected folder. (Works only if actually exactly one item is selected and this item is a folder. Otherwise, the new folder is simply inserted in the root folder.)
Definition at line 1056 of file stationlistmodel.cpp.
References helper_addNewFolder(), and view.
void stationlistModel::addNewStation | ( | ) | [slot] |
This function adds a new radio station: It displays a configuration dialog for the new stream. If accepted by the user (= clicking OK), the new stream is inserted in the root folder.
Definition at line 1066 of file stationlistmodel.cpp.
References helper_addNewStation().
void stationlistModel::addNewStationInFolder | ( | ) | [slot] |
This function adds a new radio station: It displays a configuration dialog for the new stream. If accepted by the user (= clicking OK), the new stream is inserted in the actually selected folder. (Works only if actually exactly one item is selected and this item is a folder. Otherwise, the new stream is simply inserted in the root folder.)
Definition at line 1046 of file stationlistmodel.cpp.
References helper_addNewStation(), and view.
quint64 stationlistModel::bandwidth | ( | ) | const |
See property bandwidth.
void stationlistModel::bandwidthChanged | ( | ) | [signal] |
See property bandwidth.
Referenced by recalculate_numberOfActiveStreams_and_bandwidth().
int stationlistModel::columnCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const [virtual] |
Reimplemented from QAbstractTableModel.
parent | As this is a table model (non-hirarchical!), this parameter is ignored. |
Definition at line 164 of file stationlistmodel.cpp.
Referenced by sort().
QVariant stationlistModel::columnInfo | ( | const columnInfoType | type, | |
const int | column, | |||
const radioStation * | stream = 0 , |
|||
const quint64 | value = (-1) | |||
) | const |
This function is the central place to access all information about the data in the model and also about related things (column width, visibility, header title...).
type | Specifies the type of action that will be performed. See columnInfoType for details. | |
column | The column to access. | |
stream | The stream to access. Is ignored if the action is independent from the stream. | |
value | The value to write. Is ignored if the action is not a writing action. |
Definition at line 169 of file stationlistmodel.cpp.
References ripping::bitrate, columnData, columnHeaderTitle, columnHeaderToolTip, columnHeaderWhatsThis, columnVisibility, columnWidth, ripping::dataSize, PropertyValue::error, ripping::error, PropertyValue::formatedValue, PropertyValue::internalValue, ripping::metaInterval, ripping::metaInterval_milliSeconds, ripping::relayPort, ripping::serverName, setColumnVisibility, setColumnWidth, ripping::song, ripping::status, ripping::streamName, PropertyValue::toolTip, PropertyValue::type, PropertyValue::unset, radioStation::uri, PropertyValue::value, and PropertyValue::whatsThis.
Referenced by data(), headerData(), and helper_firstIsAfterSecond().
QVariant stationlistModel::data | ( | const QModelIndex & | index, | |
int | role = Qt::DisplayRole | |||
) | const [virtual] |
Reimplemented from QAbstractTableModel.
Uses columnInfo() to deliver the data.
index | As this is a table model (non-hirarchical!), only rows and columns of the index are relevant. The parent is ignored. If the index doesn't belong to this model, an invalid QVariant is returned. | |
role | The type of information that is requested. Supported are
|
Definition at line 666 of file stationlistmodel.cpp.
References AND, columnData, columnInfo(), EQUAL, stationlistItem::folderName(), stationlistItem::stream, stationlistItem::streamObject(), and stationlistItem::type().
void stationlistModel::disableListeningIn | ( | ) | [slot] |
Disables listening in.
Definition at line 1436 of file stationlistmodel.cpp.
References listen, and listenSupport::setStation().
bool stationlistModel::dropMimeData | ( | const QMimeData * | data, | |
Qt::DropAction | action, | |||
int | row, | |||
int | column, | |||
const QModelIndex & | parent | |||
) | [virtual] |
Reimplemented function that provides support for dropping URL lists via "drag and drop.
Definition at line 1353 of file stationlistmodel.cpp.
References stationlistItem::childCount(), stationlistItem::folder, helper_convertToUrl(), helper_createStreamItem(), helper_insertItems(), helper_selectAndScrollTo(), helper_writeStationList(), index(), item(), m_mainWidget, modelindexOfItem(), and radioStation.
Referenced by paste(), and pasteSelection().
void stationlistModel::enableListeningIn | ( | ) | [slot] |
Enables the listening in to the actually selected stream.
Definition at line 1422 of file stationlistmodel.cpp.
References listen, listenSupport::setStation(), stationlistItem::stream, stationlistItem::streamObject(), stationlistItem::type(), and view.
Qt::ItemFlags stationlistModel::flags | ( | const QModelIndex & | index | ) | const [virtual] |
Reimplemented function that says that dropping streams via "drag and drop" is accepted at each place in the view widget.
Definition at line 1410 of file stationlistmodel.cpp.
QVariant stationlistModel::headerData | ( | int | section, | |
Qt::Orientation | orientation, | |||
int | role | |||
) | const [virtual] |
Reimplemented from QAbstractTableModel.
Uses columnInfo() if orientation is horizontal.
Definition at line 641 of file stationlistmodel.cpp.
References columnHeaderTitle, columnHeaderToolTip, columnHeaderWhatsThis, columnInfo(), and EQUAL.
void stationlistModel::helper_addNewFolder | ( | const QModelIndex & | index | ) | [private] |
Helps to create a new folder. Displays a settings dialog for the folder that will be created. If accepted, the folder will be inserted. If index is a folder, it will be added in this folder. If not, it will be added in the root folder.
Definition at line 978 of file stationlistmodel.cpp.
References folderPropertiesDialog::centralWidget, stationlistItem::childCount(), stationlistItem::folder, helper_insertItem(), helper_selectAndScrollTo(), helper_writeStationList(), modelindexOfItem(), rootItem, and folderProperties::text().
Referenced by addNewFolder(), and addNewFolderInFolder().
void stationlistModel::helper_addNewStation | ( | const QModelIndex & | index | ) | [private] |
Helps to create a new station. Displays a settings dialog for the station that will be created. If accepted, the station will be inserted. If index is a folder, it will be added in this folder. If not, it will be added in the root folder.
Definition at line 1005 of file stationlistmodel.cpp.
References stationlistItem::childCount(), radioStation::execSettingsDialogWithoutApplyButton(), stationlistItem::folder, helper_createStreamItem(), helper_deleteRadiostationobjectAndRemoveConfigfiles(), helper_insertItem(), helper_selectAndScrollTo(), helper_writeStationList(), m_mainWidget, modelindexOfItem(), radioStation, and rootItem.
Referenced by addNewStation(), and addNewStationInFolder().
void stationlistModel::helper_connectSignalsAndSlots | ( | radioStation * | m_stream | ) | [private] |
This helper function sets up all the necessary connection of signals and slots which are needed to keep this model up to date.
m_stream | a pointer to the station for which you want to set up the connection |
Definition at line 115 of file stationlistmodel.cpp.
References recalculate_numberOfActiveStreams_and_bandwidth(), reloadBitrate(), reloadDataSize(), reloadMetaInterval(), reloadMetaInterval_milliSeconds(), reloadRelayPort(), reloadServerName(), reloadSong(), reloadStatus(), reloadStreamName(), reloadUri(), and statusChanged().
Referenced by helper_createStreamItem().
QList< QUrl > stationlistModel::helper_convertToUrl | ( | const QMimeData * | data | ) | [private] |
Extracts a list of URLs from mime data.
Definition at line 1309 of file stationlistmodel.cpp.
Referenced by dropMimeData().
stationlistItem * stationlistModel::helper_createStreamItem | ( | radioStation * | stream | ) | [private] |
Creates an item for a given stream, adjusts radioStation::index, and connects the signals of radioStation to the slots of this class.
stream | A radioStation object |
Definition at line 966 of file stationlistmodel.cpp.
References helper_connectSignalsAndSlots(), and streamripper_base::setIndex().
Referenced by dropMimeData(), helper_addNewStation(), and stationlistModel().
void stationlistModel::helper_deleteRadiostationobjectAndRemoveConfigfiles | ( | stationlistItem * | item | ) | [private] |
Deletes the radioStation objects of this respective of all its direct and indirect child items.
item | A pointer to the item |
Definition at line 1076 of file stationlistmodel.cpp.
References stationlistItem::child(), stationlistItem::childCount(), helper_deleteRadiostationobjectAndRemoveConfigfiles(), stationlistItem::stream, stationlistItem::streamObject(), and stationlistItem::type().
void stationlistModel::helper_deleteRadiostationobjectAndRemoveConfigfiles | ( | radioStation * | station | ) | [private] |
Deletes the radioStation object and removes its config files from disk.
station | A pointer to the station (must be on the heap) |
Definition at line 1087 of file stationlistmodel.cpp.
References radioStation::fullConfigFileName.
Referenced by helper_addNewStation(), helper_deleteRadiostationobjectAndRemoveConfigfiles(), and removeRows().
bool stationlistModel::helper_firstIsAfterSecond | ( | const PropertyValue & | firstValue, | |
const PropertyValue & | secondValue, | |||
Qt::SortOrder | order | |||
) | [private] |
This function compares 2 values for sorting. It uses the following sort order:
If both values have the same order, it returns always true.
Definition at line 847 of file stationlistmodel.cpp.
References PropertyValue::error, PropertyValue::formatedValue, helper_isNumericValue(), helper_toLongLong(), PropertyValue::internalValue, PropertyValue::type, PropertyValue::unset, and PropertyValue::value.
bool stationlistModel::helper_firstIsAfterSecond | ( | stationlistItem * | firstItem, | |
stationlistItem * | secondItem, | |||
int | column, | |||
Qt::SortOrder | order | |||
) | [private] |
Overloaded function that supports to compare items directly. See the other function for details. This one, as it permits folders to be compared, always says that folder are before streams when comparing a folder with a stream. When comparing two folders than it uses alphabetical order, following the argument order.
Definition at line 816 of file stationlistmodel.cpp.
References columnData, columnInfo(), stationlistItem::folderName(), stationlistItem::stream, stationlistItem::streamObject(), and stationlistItem::type().
Referenced by sortChildItems().
bool stationlistModel::helper_hasStreams | ( | stationlistItem * | item | ) | [private] |
Definition at line 1475 of file stationlistmodel.cpp.
References stationlistItem::child(), stationlistItem::folder, and stationlistItem::type().
void stationlistModel::helper_insertItem | ( | stationlistItem * | item, | |
const QModelIndex & | parent, | |||
int | row | |||
) | [private] |
Definition at line 942 of file stationlistmodel.cpp.
References helper_insertItems().
Referenced by helper_addNewFolder(), and helper_addNewStation().
void stationlistModel::helper_insertItems | ( | QList< stationlistItem * > | itemList, | |
const QModelIndex & | parent, | |||
int | row | |||
) | [private] |
Inserts items to the model, handling also beginInsertRows
and endInsertRows
.
itemList | The list of the items that will be added. These items can not be yet part of the model! | |
parent | The parent in which the items will be inserted. If invalid, that the function will insert to the root item. | |
row | The row number within the parent where the new items will be inserted. |
Definition at line 951 of file stationlistmodel.cpp.
References stationlistItem::insertChild(), and item().
Referenced by dropMimeData(), helper_insertItem(), and helper_moveItems().
bool stationlistModel::helper_isInTree | ( | stationlistItem * | child, | |
stationlistItem * | parent | |||
) | [private] |
child | The child item to test | |
parent | The parent item to test |
Definition at line 909 of file stationlistmodel.cpp.
References OR, and stationlistItem::parent().
bool stationlistModel::helper_isNumericValue | ( | const QVariant & | value | ) | [private] |
Definition at line 783 of file stationlistmodel.cpp.
Referenced by helper_firstIsAfterSecond().
QList< radioStation * > stationlistModel::helper_listOfAllStreams | ( | stationlistItem * | parentItem | ) | [private] |
parentItem | The base item |
Definition at line 522 of file stationlistmodel.cpp.
References stationlistItem::child(), stationlistItem::childCount(), stationlistItem::stream, stationlistItem::streamObject(), and stationlistItem::type().
Referenced by queryClose(), readProperties(), recalculate_numberOfActiveStreams_and_bandwidth(), recalculateSelectedStreams(), and rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone().
void stationlistModel::helper_moveItems | ( | const QModelIndex & | oldParent, | |
int | first, | |||
int | last, | |||
const QModelIndex & | newParent, | |||
int | newRow | |||
) | [private] |
Moves the respective items within the tree model.
oldParent | The parent of the items that will be moved. | |
first | The row number of the first child that will be moved. | |
last | The row number of the last child that will be moved. | |
newParent | The parent to which the items will be moved. | |
newRow | The row number where the items will be inserted. |
Definition at line 750 of file stationlistmodel.cpp.
References helper_insertItems(), and helper_removeItems().
Referenced by sortChildItems().
QList< stationlistItem * > stationlistModel::helper_removeItems | ( | const QModelIndex & | parent, | |
int | first, | |||
int | last | |||
) | [private] |
Removes items from the model, handling also beginRemoveRows
and endRemoveRows
.
parent | The parent of the items that will be removed. | |
first | The row number of the first item to be removed (within the parent) | |
last | The row number of the last item to be removed (within the parent) |
Definition at line 924 of file stationlistmodel.cpp.
References stationlistItem::child(), and item().
Referenced by helper_moveItems(), and removeRows().
void stationlistModel::helper_selectAndScrollTo | ( | const QModelIndexList & | modelIndexList | ) | [private] |
If modelIndexList is not empty, than this function deletes the actual selection, selects the given rows, if necessary expands it's parents and scrolls to them.
modelIndexList | The list of rows. (One index per row is enough.) |
Definition at line 1034 of file stationlistmodel.cpp.
References view.
Referenced by dropMimeData(), helper_addNewFolder(), and helper_addNewStation().
QString stationlistModel::helper_stationlistXmlFilepath | ( | ) | [inline, private] |
Definition at line 147 of file stationlistmodel.cpp.
Referenced by helper_writeStationList(), and stationlistModel().
qlonglong stationlistModel::helper_toLongLong | ( | const PropertyValue & | value | ) | [private] |
Converts a PropertyValue.internalValue to a qlonglong if possible (integer values or ripping::statusType).
Definition at line 806 of file stationlistmodel.cpp.
References PropertyValue::internalValue.
Referenced by helper_firstIsAfterSecond().
void stationlistModel::helper_writeStationList | ( | ) | [inline, private] |
Writes the actual list of streams back to the configuration file "stationlist.xml".
Definition at line 1152 of file stationlistmodel.cpp.
References stationlistItem::child(), stationlistItem::childCount(), helper_stationlistXmlFilepath(), rootItem, and writeItemToFile().
Referenced by dropMimeData(), helper_addNewFolder(), helper_addNewStation(), queryClose(), removeRows(), saveProperties(), and stationlistModel().
QModelIndex stationlistModel::index | ( | int | row, | |
int | column, | |||
const QModelIndex & | parent = QModelIndex() | |||
) | const [virtual] |
Reimplemented from base class.
Definition at line 1456 of file stationlistmodel.cpp.
References stationlistItem::child(), and item().
Referenced by dropMimeData(), modelindexOfItem(), and recalculateSelectedStreams().
stationlistItem * stationlistModel::item | ( | const QModelIndex & | index | ) | const [private] |
index | A model index |
Definition at line 1097 of file stationlistmodel.cpp.
References rootItem.
Referenced by dropMimeData(), helper_insertItems(), helper_removeItems(), index(), removeRows(), rowCount(), and showConfigDialog().
QStringList stationlistModel::mimeTypes | ( | ) | const [virtual] |
Reimplemented from Qt. Provides a list of the mime types that are accepted for dropping streams via "drag and drop".
Definition at line 1415 of file stationlistmodel.cpp.
QModelIndex stationlistModel::modelindexOfItem | ( | stationlistItem * | item, | |
int | column | |||
) | [private] |
item | An item of our tree structure | |
column | The column of the item |
Definition at line 570 of file stationlistmodel.cpp.
References index(), stationlistItem::parent(), rootItem, and stationlistItem::row().
Referenced by dropMimeData(), helper_addNewFolder(), helper_addNewStation(), reloadBitrate(), reloadDataSize(), reloadMetaInterval(), reloadMetaInterval_milliSeconds(), reloadRelayPort(), reloadServerName(), reloadSong(), reloadStatus(), reloadStreamName(), reloadUri(), sortChildItems(), stationlistModel(), and writeItemToFile().
int stationlistModel::numberOfActiveStreams | ( | ) | const |
See property numberOfActiveStreams.
Referenced by queryClose().
void stationlistModel::numberOfActiveStreamsChanged | ( | ) | [signal] |
See property numberOfActiveStreams.
Referenced by recalculate_numberOfActiveStreams_and_bandwidth().
void stationlistModel::numberOfActiveStreamsIsZero | ( | ) | [signal] |
See property numberOfActiveStreams.
Referenced by queryClose(), and recalculate_numberOfActiveStreams_and_bandwidth().
QModelIndex stationlistModel::parent | ( | const QModelIndex & | index | ) | const [virtual] |
Reimplemented from base class.
Definition at line 1441 of file stationlistmodel.cpp.
References stationlistItem::parent(), rootItem, and stationlistItem::row().
void stationlistModel::paste | ( | ) | [slot] |
Pastes the content of the clipboard (using dropMimeData()).
Definition at line 1335 of file stationlistmodel.cpp.
References dropMimeData().
void stationlistModel::pasteSelection | ( | const QModelIndex & | index | ) | [slot] |
Pastes the content of the mouse selection (using dropMimeData()).
index | The position where the mouse selection will be inserted. |
Definition at line 1344 of file stationlistmodel.cpp.
References dropMimeData().
bool stationlistModel::queryClose | ( | ) | [virtual] |
Definition at line 1241 of file stationlistmodel.cpp.
References helper_listOfAllStreams(), helper_writeStationList(), m_mainWidget, numberOfActiveStreams(), numberOfActiveStreamsIsZero(), rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone(), and rootItem.
void stationlistModel::readProperties | ( | const KConfigGroup & | m_configGroup | ) | [virtual] |
Reads properties for restoring the previous session (using session management).
m_configGroup | The location where to read the properties from |
Definition at line 1292 of file stationlistmodel.cpp.
References helper_listOfAllStreams(), and rootItem.
void stationlistModel::recalculate_numberOfActiveStreams_and_bandwidth | ( | ) | [private, slot] |
This slot recalculates the values for the properties bandwidth and numberOfActiveStreams from scratch. It caches them in the corresponding member. If for one of the properties or for both of them, the new value differs from the old value, the corresponding signal(s) is/are emitted.
We recalculate the value each time from scratch. We could have implemented a solution the reacts on signals of the radiostation objects that the status has changed, and than increment or decrement our properties. This solution would be more efficient, but also more complicate: We would have to worry about a correct initialization, about session management.... The situation would be confusing and complicate. So it's better to have a clean solution, also when it's not so efficient.
Definition at line 535 of file stationlistmodel.cpp.
References bandwidthChanged(), helper_listOfAllStreams(), ripping::idle, internal_bandwidth, internal_numberOfActiveStreams, numberOfActiveStreamsChanged(), numberOfActiveStreamsIsZero(), rootItem, and PropertyValue::value.
Referenced by helper_connectSignalsAndSlots(), and stationlistModel().
void stationlistModel::recalculateSelectedStreams | ( | ) | [private, slot] |
Recalculates the value of the property selectedStreams.
Definition at line 1490 of file stationlistmodel.cpp.
References helper_listOfAllStreams(), index(), internal_selectedStreams, selectedStreamsChanged(), and view.
Referenced by stationlistModel().
void stationlistModel::record | ( | ) | [slot] |
This slot tries to start the recording of all selected stream. Selected streams means: directly selected or one of its parent folders is selected. Trying means: when the stream is actually shutting down, than the call will be ignored by radioStation.
Definition at line 1177 of file stationlistmodel.cpp.
References internal_selectedStreams, and ripping::startStreamripper().
void stationlistModel::relayportChanged | ( | ) | [signal] |
Is emitted always when one of the streams changes its relay port.
Referenced by reloadRelayPort().
void stationlistModel::reloadBitrate | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 610 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadDataSize | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 604 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadMetaInterval | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 616 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadMetaInterval_milliSeconds | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 622 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadRelayPort | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 634 of file stationlistmodel.cpp.
References modelindexOfItem(), and relayportChanged().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadServerName | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 628 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadSong | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 598 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadStatus | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 591 of file stationlistmodel.cpp.
References modelindexOfItem(), and statusChanged().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::reloadStreamName | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 579 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots(), and showConfigDialog().
void stationlistModel::reloadUri | ( | void * | stationIndex | ) | [private, slot] |
Used internally to emit the signal dataChanged
.
Definition at line 585 of file stationlistmodel.cpp.
References modelindexOfItem().
Referenced by helper_connectSignalsAndSlots().
void stationlistModel::rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone | ( | ) | [private, slot] |
If the application is closed using session management, it is undefined, if saveProperties() or queryClose() is executed first. Because queryClose() shuts the streams down, if saveProperties() is executed later it would not be able to know which streams were running.
To solve this problem, queryClose() and saveProperties() call this function (in the case of queryClose() of course before shutting down streams). This function writes a list of running streams to the member m_listOfStreamsOfWhichTheUserWantsThatTheyRip - but only if there is not yet a list. This way, saveProperties() can call this function and be sure to have now a correct list of running streams at m_listOfStreamsOfWhichTheUserWantsThatTheyRip, indepentently from the execution order of saveProperties() and readProperties().
Definition at line 1225 of file stationlistmodel.cpp.
References helper_listOfAllStreams(), m_listOfStreamsOfWhichTheUserWantsThatTheyRip, and rootItem.
Referenced by queryClose(), and saveProperties().
bool stationlistModel::removeRows | ( | int | row, | |
int | count, | |||
const QModelIndex & | parent = QModelIndex() | |||
) | [virtual] |
Reimplemented from QAbstractItemModel.
Removes count radio stations starting with the given row (radio station) from this model and deletes the corresponding config files.
row | You must pass the index (= the row) of the first stream which you want to delete. When you pass an invalid index, nothing happens. | |
count | number of streams that will be deleted. | |
parent | is ignored. |
Definition at line 1106 of file stationlistmodel.cpp.
References stationlistItem::childCount(), helper_deleteRadiostationobjectAndRemoveConfigfiles(), helper_removeItems(), helper_writeStationList(), and item().
int stationlistModel::rowCount | ( | const QModelIndex & | parent = QModelIndex() |
) | const [virtual] |
Reimplemented from QAbstractTableModel.
parent | As this is a table model (non-hirarchical!), this parameter is ignored. |
Definition at line 152 of file stationlistmodel.cpp.
References stationlistItem::childCount(), and item().
void stationlistModel::saveProperties | ( | KConfigGroup & | m_configGroup | ) | [virtual] |
Saves properties for restoring this session later (using session management).
m_configGroup | The location where to save the properties |
Definition at line 1283 of file stationlistmodel.cpp.
References helper_writeStationList(), m_listOfStreamsOfWhichTheUserWantsThatTheyRip, and rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone().
QList< radioStation * > stationlistModel::selectedStreams | ( | ) | const |
See property selectedStreams.
Definition at line 1511 of file stationlistmodel.cpp.
References internal_selectedStreams.
void stationlistModel::selectedStreamsChanged | ( | ) | [signal] |
See property selectedStreams.
Referenced by recalculateSelectedStreams().
void stationlistModel::showConfigDialog | ( | ) | [slot] |
If exactly one stream or folder is selected, then this slot shows the config dialog. Else nothing happens.
Definition at line 1191 of file stationlistmodel.cpp.
References stationlistItem::folderName(), item(), reloadStreamName(), stationlistItem::setFolderName(), radioStation::showSettingsDialogWithApplyButton(), stationlistItem::stream, stationlistItem::streamObject(), stationlistItem::type(), and view.
void stationlistModel::sort | ( | int | column, | |
Qt::SortOrder | order = Qt::AscendingOrder | |||
) | [virtual] |
Reimplemented from QAbstractTableModel.
This is just a dummy function. It (still) does nothing.
Definition at line 718 of file stationlistmodel.cpp.
References columnCount(), rootItem, and sortChildItems().
void stationlistModel::sortChildItems | ( | stationlistItem * | parent, | |
int | column, | |||
Qt::SortOrder | order | |||
) | [private] |
Sorts the child items of a given parent.
parent | The parent. | |
column | The column following to which we will sort the children. | |
order | The sort order. |
Definition at line 760 of file stationlistmodel.cpp.
References stationlistItem::child(), stationlistItem::childCount(), helper_firstIsAfterSecond(), helper_moveItems(), and modelindexOfItem().
Referenced by sort().
void stationlistModel::statusChanged | ( | ) | [signal] |
Is emitted always when one of the streams changes its status or its error.
Referenced by helper_connectSignalsAndSlots(), and reloadStatus().
void stationlistModel::stopRecording | ( | ) | [slot] |
This slot stops the recording of all selected stream. Selected streams means: directly selected or one of its parent folders is selected.
Definition at line 1184 of file stationlistmodel.cpp.
References internal_selectedStreams, and ripping::shutDown().
void stationlistModel::writeItemToFile | ( | stationlistItem * | item, | |
QXmlStreamWriter & | file | |||
) | [private] |
Writes the XML elements for a given item.
item | The item that has to be saved | |
file | The file to which the XML data will be written |
Definition at line 1135 of file stationlistmodel.cpp.
References stationlistItem::child(), stationlistItem::childCount(), radioStation::configFileName, stationlistItem::folderName(), modelindexOfItem(), stationlistItem::stream, stationlistItem::streamObject(), stationlistItem::type(), and view.
Referenced by helper_writeStationList().
quint64 stationlistModel::internal_bandwidth [private] |
Used internally to cache the value of the property bandwidth.
Definition at line 498 of file stationlistmodel.h.
Referenced by recalculate_numberOfActiveStreams_and_bandwidth().
int stationlistModel::internal_numberOfActiveStreams [private] |
Used internally to cache the value of the property numberOfActiveStreams.
Definition at line 500 of file stationlistmodel.h.
Referenced by recalculate_numberOfActiveStreams_and_bandwidth().
QList<radioStation *> stationlistModel::internal_selectedStreams [private] |
Used internally to cache the value of the property selectedStreams.
Definition at line 502 of file stationlistmodel.h.
Referenced by recalculateSelectedStreams(), record(), selectedStreams(), and stopRecording().
With this object, we can listen in streams.
Definition at line 236 of file stationlistmodel.h.
Referenced by disableListeningIn(), and enableListeningIn().
QStringList* stationlistModel::m_listOfStreamsOfWhichTheUserWantsThatTheyRip [private] |
Here you can save a list of the streams for which radioStation::doesTheUserWantsThatTheStreamIsRipping() is true. Used for session management handling.
By initialization, this pointer is null.
Definition at line 512 of file stationlistmodel.h.
Referenced by rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone(), saveProperties(), and stationlistModel().
QPointer<QWidget> stationlistModel::m_mainWidget [private] |
A pointer to the widget to which configuration dialogs should be centered. This member is initialized in the constructor.
Definition at line 515 of file stationlistmodel.h.
Referenced by dropMimeData(), helper_addNewStation(), queryClose(), and stationlistModel().
stationlistItem* stationlistModel::rootItem [private] |
A pointer to the root item of the tree structure.
Definition at line 521 of file stationlistmodel.h.
Referenced by helper_addNewFolder(), helper_addNewStation(), helper_writeStationList(), item(), modelindexOfItem(), parent(), queryClose(), readProperties(), recalculate_numberOfActiveStreams_and_bandwidth(), rememberListOfStreamsWhichTheUserWantsToRip_ifNotYetDone(), sort(), stationlistModel(), and ~stationlistModel().
QPointer<stationlistWidget> stationlistModel::view [protected] |
A pointer to the view that shows this model.
Definition at line 358 of file stationlistmodel.h.
Referenced by addNewFolderInFolder(), addNewStationInFolder(), enableListeningIn(), helper_selectAndScrollTo(), recalculateSelectedStreams(), showConfigDialog(), stationlistModel(), and writeItemToFile().
quint64 stationlistModel::bandwidth [read] |
This property holds the total bandwidth that is actually really used by the streams (summation of the bitrate of all streams which are not ripping::idle).
quint64 bandwidth() const
void bandwidthChanged()
quint64 internal_bandwidth
Definition at line 74 of file stationlistmodel.h.
int stationlistModel::numberOfActiveStreams [read] |
This property holds the number of active streams (number of all streams which are not ripping::idle).
int numberOfActiveStreams() const
void numberOfActiveStreamsChanged()
void numberOfActiveIsZero()
Definition at line 102 of file stationlistmodel.h.
QList stationlistModel::radioStation [read] |
This property gives access to a duplicate-free list of all actually selected streams (either selected directly or because one of its parent folders is selected).
The value is always keept up to date.
QList<radioStation *> selectedStreams() const
void selectedStreamsChanged()
QItemSelectionModel
because this makes sure that at the time of the slot call, all properties are yet updated.void recalculateSelectedStreams()
QList<radioStation *> internal_selectedStreams
Definition at line 90 of file stationlistmodel.h.
Referenced by dropMimeData(), helper_addNewStation(), and stationlistModel().