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