Added MedialibModels but still are disabled because they don't work.
This commit is contained in:
parent
d114edf75f
commit
02c64bf99b
9 changed files with 218 additions and 35 deletions
62
MedialibItem.h
Normal file
62
MedialibItem.h
Normal file
|
@ -0,0 +1,62 @@
|
|||
#ifndef __MEDIALIBITEM_H__
|
||||
#define __MEDIALIBITEM_H__
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
class MedialibItem {
|
||||
public:
|
||||
enum MedialibItemType {
|
||||
NoneItem,
|
||||
ArtistItem,
|
||||
AlbumItem,
|
||||
SongItem
|
||||
};
|
||||
|
||||
MedialibItem (const QStringList &text = QStringList (), MedialibItem *parent = NULL, MedialibItemType type = NoneItem) {
|
||||
m_text = text;
|
||||
m_type = type;
|
||||
m_parent = parent;
|
||||
if (parent) {
|
||||
parent->m_childs.append (this);
|
||||
}
|
||||
};
|
||||
|
||||
bool mayHaveChilds () const {
|
||||
if (m_type == NoneItem || m_type == SongItem)
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
QString data (int c) const {
|
||||
if (m_text.size () > c) {
|
||||
return m_text.at (c);
|
||||
}
|
||||
return QString ();
|
||||
};
|
||||
|
||||
MedialibItem *child (int c) const {
|
||||
return m_childs.value (c);
|
||||
}
|
||||
|
||||
int childCount () const {
|
||||
return m_childs.count ();
|
||||
};
|
||||
|
||||
MedialibItem *parent () const {
|
||||
return m_parent;
|
||||
};
|
||||
|
||||
int row () const {
|
||||
if (m_parent)
|
||||
return m_parent->m_childs.indexOf (const_cast<MedialibItem*> (this));
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
MedialibItemType m_type;
|
||||
QStringList m_text;
|
||||
MedialibItem *m_parent;
|
||||
QList<MedialibItem *> m_childs;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue