]> Shamusworld >> Repos - virtualjaguar/blob - src/gui/filelistmodel.h
78d73e92c91fd2c8d72f6bd94da7258303939045
[virtualjaguar] / src / gui / filelistmodel.h
1 //
2 // filelistmodel.h: Class definition
3 //
4 // by James L. Hammons
5 // (C) 2010 Underground Software
6 //
7
8 #ifndef __FILELISTMODEL_H__
9 #define __FILELISTMODEL_H__
10
11 #include <QtGui>
12 #include <vector>
13
14 struct FileListData
15 {
16 //      FileListData(unsigned long ul=0, QString str="", QImage img=QImage()): dbIndex(ul), filename(str), label(img) {}
17 //      FileListData(unsigned long ul=0, QString str, QImage img): dbIndex(ul), filename(str), label(img) {}
18
19         unsigned long dbIndex;
20         unsigned long fileSize;
21         QString filename;
22         QImage label;
23 };
24
25 //hm.
26 #define FLM_INDEX               (Qt::UserRole + 1)
27 #define FLM_FILESIZE    (Qt::UserRole + 2)
28 #define FLM_FILENAME    (Qt::UserRole + 3)
29 #define FLM_LABEL               (Qt::UserRole + 4)
30
31 class FileListModel: public QAbstractListModel
32 {
33         public:
34                 FileListModel(QObject * parent = 0);
35
36                 int rowCount(const QModelIndex & parent = QModelIndex()) const;
37                 QVariant data(const QModelIndex & index, int role) const;
38                 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
39
40 //              void AddData(QIcon pix);
41 //              void AddData(unsigned long);
42                 void AddData(unsigned long, QString, QImage, unsigned long);
43
44 //              FileListData GetData(const QModelIndex & index) const;
45
46         private:
47 //              std::vector<QIcon> pixList;
48 //              std::vector<unsigned long> dbIndex;
49                 std::vector<FileListData> list;
50 //              std::vector<unsigned long> size;
51 };
52
53 #endif  // __FILELISTMODEL_H__