#include <stationlistitem.h>
Public Types | |
enum | itemType { folder, stream } |
Public Member Functions | |
stationlistItem (const QString &folderName) | |
stationlistItem (radioStation *streamObject) | |
virtual | ~stationlistItem () |
bool | appendChild (stationlistItem *child) |
stationlistItem * | child (int row) const |
int | childCount () const |
void | detach () |
QString | folderName () const |
bool | insertChild (stationlistItem *child, int row) |
stationlistItem * | parent () const |
int | row () const |
void | setFolderName (const QString &folderName) |
radioStation * | streamObject () const |
stationlistItem::itemType | type () const |
Private Member Functions | |
void | initialize () |
Private Attributes | |
QList< stationlistItem * > | childItems |
QString | m_folderName |
itemType | m_itemType |
QPointer< radioStation > | m_radiostation |
stationlistItem * | parentItem |
stationlistItem * | self |
This class provides item objects for stationlistModel that can be organized in a tree structure. It has a determinated itemType available through type().
Definition at line 35 of file stationlistitem.h.
An enumeration that identifies the type of this item.
Definition at line 42 of file stationlistitem.h.
stationlistItem::stationlistItem | ( | const QString & | folderName | ) | [explicit] |
Constructs a folder item.
folderName | The name of the folder |
Definition at line 25 of file stationlistitem.cpp.
References folder, initialize(), m_folderName, and m_itemType.
stationlistItem::stationlistItem | ( | radioStation * | streamObject | ) | [explicit] |
Constructs a stream item.
streamObject | The stream object |
Definition at line 32 of file stationlistitem.cpp.
References initialize(), m_itemType, m_radiostation, and stream.
stationlistItem::~stationlistItem | ( | ) | [virtual] |
The destructor.
Will delete all child items.
Definition at line 39 of file stationlistitem.cpp.
References childItems.
bool stationlistItem::appendChild | ( | stationlistItem * | child | ) |
If this object is of type folder, this function makes another object become a child of this object. Otherwise, it does nothing and returns false.
child | A pointer to the new child. |
Definition at line 66 of file stationlistitem.cpp.
References childItems, folder, m_itemType, and parentItem.
Referenced by stationlistModel::stationlistModel().
stationlistItem * stationlistItem::child | ( | int | row | ) | const |
row | The row number for which the pointer is requested. |
Definition at line 57 of file stationlistitem.cpp.
References childItems.
Referenced by stationlistModel::helper_deleteRadiostationobjectAndRemoveConfigfiles(), stationlistModel::helper_hasStreams(), stationlistModel::helper_listOfAllStreams(), stationlistModel::helper_removeItems(), stationlistModel::helper_writeStationList(), stationlistModel::index(), stationlistModel::sortChildItems(), and stationlistModel::writeItemToFile().
int stationlistItem::childCount | ( | ) | const |
Definition at line 52 of file stationlistitem.cpp.
References childItems.
Referenced by stationlistModel::dropMimeData(), stationlistModel::helper_addNewFolder(), stationlistModel::helper_addNewStation(), stationlistModel::helper_deleteRadiostationobjectAndRemoveConfigfiles(), stationlistModel::helper_listOfAllStreams(), stationlistModel::helper_writeStationList(), insertChild(), stationlistModel::removeRows(), stationlistModel::rowCount(), stationlistModel::sortChildItems(), and stationlistModel::writeItemToFile().
void stationlistItem::detach | ( | ) |
Detaches this item from its parent item (removes it from parent's child list and sets its own parentItem to 0). It is save to execute this function on objects that have no parent.
Definition at line 93 of file stationlistitem.cpp.
References childItems, parentItem, and row().
QString stationlistItem::folderName | ( | ) | const |
Definition at line 125 of file stationlistitem.cpp.
References m_folderName.
Referenced by stationlistModel::data(), stationlistModel::helper_firstIsAfterSecond(), stationlistModel::showConfigDialog(), and stationlistModel::writeItemToFile().
void stationlistItem::initialize | ( | ) | [private] |
Initializes the object.
Definition at line 46 of file stationlistitem.cpp.
References parentItem.
Referenced by stationlistItem().
bool stationlistItem::insertChild | ( | stationlistItem * | child, | |
int | row | |||
) |
If this object is of type folder, this function makes another object become a child of this object. Otherwise, it does nothing and returns false.
child | A pointer to the new child. | |
row | The row where the new child is inserted. If to small, it will be inserted at position 0, if to big it will be appended. |
Definition at line 77 of file stationlistitem.cpp.
References childCount(), childItems, folder, m_itemType, and parentItem.
Referenced by stationlistModel::helper_insertItems().
stationlistItem * stationlistItem::parent | ( | ) | const |
Definition at line 110 of file stationlistitem.cpp.
References parentItem.
Referenced by stationlistModel::helper_isInTree(), stationlistModel::modelindexOfItem(), stationlistModel::parent(), and stationlistModel::stationlistModel().
int stationlistItem::row | ( | ) | const |
Definition at line 101 of file stationlistitem.cpp.
References childItems, and parentItem.
Referenced by detach(), stationlistModel::modelindexOfItem(), and stationlistModel::parent().
void stationlistItem::setFolderName | ( | const QString & | folderName | ) |
Changes the folder name.
Definition at line 130 of file stationlistitem.cpp.
References m_folderName.
Referenced by stationlistModel::showConfigDialog().
radioStation * stationlistItem::streamObject | ( | ) | const |
Definition at line 120 of file stationlistitem.cpp.
References m_radiostation.
Referenced by stationlistModel::data(), stationlistModel::enableListeningIn(), stationlistModel::helper_deleteRadiostationobjectAndRemoveConfigfiles(), stationlistModel::helper_firstIsAfterSecond(), stationlistModel::helper_listOfAllStreams(), stationlistModel::showConfigDialog(), and stationlistModel::writeItemToFile().
stationlistItem::itemType stationlistItem::type | ( | ) | const |
Definition at line 115 of file stationlistitem.cpp.
References m_itemType.
Referenced by stationlistModel::data(), stationlistModel::enableListeningIn(), stationlistModel::helper_deleteRadiostationobjectAndRemoveConfigfiles(), stationlistModel::helper_firstIsAfterSecond(), stationlistModel::helper_hasStreams(), stationlistModel::helper_listOfAllStreams(), stationlistModel::showConfigDialog(), and stationlistModel::writeItemToFile().
QList<stationlistItem *> stationlistItem::childItems [private] |
The list of child items.
Definition at line 103 of file stationlistitem.h.
Referenced by appendChild(), child(), childCount(), detach(), insertChild(), row(), and ~stationlistItem().
QString stationlistItem::m_folderName [private] |
The folder name of this item.
Definition at line 107 of file stationlistitem.h.
Referenced by folderName(), setFolderName(), and stationlistItem().
itemType stationlistItem::m_itemType [private] |
The type of this object.
Definition at line 109 of file stationlistitem.h.
Referenced by appendChild(), insertChild(), stationlistItem(), and type().
QPointer<radioStation> stationlistItem::m_radiostation [private] |
A pointer to the radioStation object.
Definition at line 111 of file stationlistitem.h.
Referenced by stationlistItem(), and streamObject().
stationlistItem* stationlistItem::parentItem [private] |
A pointer to the parent of this object (or NULL if this object doesn't have a parent).
Definition at line 114 of file stationlistitem.h.
Referenced by appendChild(), detach(), initialize(), insertChild(), parent(), and row().
stationlistItem* stationlistItem::self [private] |
A pointer to this.
Definition at line 116 of file stationlistitem.h.