]> git.tdb.fi Git - xinema.git/blob - remote/source/directorymodel.h
Create an icon for the remote
[xinema.git] / remote / source / directorymodel.h
1 #ifndef DIRECTORYMODEL_H_
2 #define DIRECTORYMODEL_H_
3
4 #include <QAbstractListModel>
5 #include <QList>
6
7 class DirectoryModel: public QAbstractListModel
8 {
9         Q_OBJECT
10
11         Q_ENUMS(EntryType)
12
13 public:
14         enum EntryType
15         {
16                 ParentDir,
17                 SubDir,
18                 File
19         };
20
21 private:
22         struct Entry
23         {
24                 QString name;
25                 EntryType type;
26
27                 bool operator<(const Entry &) const;
28         };
29
30         QList<Entry> entries;
31
32 public:
33         void clear();
34         void add_entry(const QString &, EntryType);
35
36         virtual QHash<int, QByteArray> roleNames() const;
37         virtual int rowCount(const QModelIndex &) const;
38         virtual QVariant data(const QModelIndex &, int) const;
39 };
40
41 #endif