stationlistItem Class Reference

An item for stationlistModel. More...

#include <stationlistitem.h>

Collaboration diagram for stationlistItem:

Collaboration graph
[legend]

List of all members.

Public Types

enum  itemType { folder, stream }

Public Member Functions

 stationlistItem (const QString &folderName)
 stationlistItem (radioStation *streamObject)
virtual ~stationlistItem ()
bool appendChild (stationlistItem *child)
stationlistItemchild (int row) const
int childCount () const
void detach ()
QString folderName () const
bool insertChild (stationlistItem *child, int row)
stationlistItemparent () const
int row () const
void setFolderName (const QString &folderName)
radioStationstreamObject () const
stationlistItem::itemType type () const

Private Member Functions

void initialize ()

Private Attributes

QList< stationlistItem * > childItems
QString m_folderName
itemType m_itemType
QPointer< radioStationm_radiostation
stationlistItemparentItem
stationlistItemself


Detailed Description

An item for stationlistModel.

This class provides item objects for stationlistModel that can be organized in a tree structure. It has a determinated itemType available through type().

See also:
streamDirectoryModel

Definition at line 35 of file stationlistitem.h.


Member Enumeration Documentation

An enumeration that identifies the type of this item.

  • folder This is a folder item and it can contain child items.
  • stream This is a stream item and it can not have child items.
Enumerator:
folder 
stream 

Definition at line 42 of file stationlistitem.h.


Constructor & Destructor Documentation

stationlistItem::stationlistItem ( const QString &  folderName  )  [explicit]

Constructs a folder item.

Parameters:
folderName The name of the folder

Definition at line 25 of file stationlistitem.cpp.

References folder, initialize(), m_folderName, and m_itemType.

Here is the call graph for this function:

stationlistItem::stationlistItem ( radioStation streamObject  )  [explicit]

Constructs a stream item.

Parameters:
streamObject The stream object
Note:
The stream object will be deleted in the desctructor of this class!

Definition at line 32 of file stationlistitem.cpp.

References initialize(), m_itemType, m_radiostation, and stream.

Here is the call graph for this function:

stationlistItem::~stationlistItem (  )  [virtual]

The destructor.

Will delete all child items.

Note:
The radioStation objects will not be deleted!

Definition at line 39 of file stationlistitem.cpp.

References childItems.


Member Function Documentation

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.

Parameters:
child A pointer to the new child.
Returns:
Whether the operation has been performed.
Warning:
Don't call this function with a child that has yet a parent!

Definition at line 66 of file stationlistitem.cpp.

References childItems, folder, m_itemType, and parentItem.

Referenced by stationlistModel::stationlistModel().

Here is the caller graph for this function:

stationlistItem * stationlistItem::child ( int  row  )  const

Returns:
A pointer to the child entry at the specified row (or NULL if the row doesn't exist).
Parameters:
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().

Here is the caller graph for this function:

int stationlistItem::childCount (  )  const

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().

Here is the call graph for this function:

QString stationlistItem::folderName (  )  const

Returns:
The folder name of this item (or an empty string if this is not a folder item).
Note:
Test the type of this object with type() before using this function!

Definition at line 125 of file stationlistitem.cpp.

References m_folderName.

Referenced by stationlistModel::data(), stationlistModel::helper_firstIsAfterSecond(), stationlistModel::showConfigDialog(), and stationlistModel::writeItemToFile().

Here is the caller graph for this function:

void stationlistItem::initialize (  )  [private]

Initializes the object.

Definition at line 46 of file stationlistitem.cpp.

References parentItem.

Referenced by stationlistItem().

Here is the caller graph for this function:

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.

Parameters:
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.
Returns:
Whether the operation has been performed.
Warning:
Don't call this function with a child that has yet a parent!

Definition at line 77 of file stationlistitem.cpp.

References childCount(), childItems, folder, m_itemType, and parentItem.

Referenced by stationlistModel::helper_insertItems().

Here is the call graph for this function:

Here is the caller graph for this function:

stationlistItem * stationlistItem::parent (  )  const

Returns:
A pointer to the parent of this object (or NULL if it has no parent).

Definition at line 110 of file stationlistitem.cpp.

References parentItem.

Referenced by stationlistModel::helper_isInTree(), stationlistModel::modelindexOfItem(), stationlistModel::parent(), and stationlistModel::stationlistModel().

Here is the caller graph for this function:

int stationlistItem::row (  )  const

Returns:
The row number that this object has within it's parent (or 0 if it has no parent).

Definition at line 101 of file stationlistitem.cpp.

References childItems, and parentItem.

Referenced by detach(), stationlistModel::modelindexOfItem(), and stationlistModel::parent().

Here is the caller graph for this function:

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().

Here is the caller graph for this function:

radioStation * stationlistItem::streamObject (  )  const

Returns:
The stream object of this item (or NULL if the object has been deleted or if this is not a stream item).
Note:
Test the type of this object with type() before using this function!

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().

Here is the caller graph for this function:

stationlistItem::itemType stationlistItem::type (  )  const


Member Data Documentation

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().

The type of this object.

Definition at line 109 of file stationlistitem.h.

Referenced by appendChild(), insertChild(), stationlistItem(), and type().

A pointer to the radioStation object.

Definition at line 111 of file stationlistitem.h.

Referenced by stationlistItem(), and streamObject().

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().

A pointer to this.

Definition at line 116 of file stationlistitem.h.


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

doxygen