1 #ifndef FILETABLEMODEL_H
\r
2 #define FILETABLEMODEL_H
\r
4 #include <QAbstractTableModel>
\r
6 #include <QFileIconProvider>
\r
7 #include <QFileSystemWatcher>
\r
9 class FileTableModel : public QAbstractTableModel
\r
13 explicit FileTableModel(QObject *parent = 0);
\r
15 bool setPath(const QString &path);
\r
17 QDir::Filters filter() const { return m_dir.filter(); }
\r
18 void setFilter(QDir::Filters filters) { m_dir.setFilter(filters); }
\r
20 QDir::SortFlags sorting() const { return m_dir.sorting(); }
\r
21 void setSorting(QDir::SortFlags sort) { m_dir.setSorting(sort); }
\r
23 Qt::CheckState checkState(const QModelIndex &index) const;
\r
24 void setCheckState(const QModelIndex &index, Qt::CheckState state);
\r
25 void setCheckStateAll(Qt::CheckState state);
\r
27 bool isDir(const QModelIndex &index) const;
\r
28 const QString absolutePath() const { return m_dir.absolutePath(); }
\r
29 const QString absoluteFilePath(const QModelIndex &index) const;
\r
30 QFileInfoList checkedItems() const;
\r
31 QFileInfo fileInfo(const QModelIndex &index) const;
\r
34 void rootChanged(const QString &root);
\r
35 void stateChanged(int checkedFoldrs, int checkedFiles, quint64 totalSize);
\r
38 void refresh() { setPath(m_dir.absolutePath()); }
\r
42 QFileInfoList m_fileInfoList;
\r
43 QVector<Qt::CheckState> m_checkStates;
\r
44 QFileIconProvider m_IconFactory;
\r
45 QFileSystemWatcher *m_fsWatcher;
\r
47 void stateChanged();
\r
49 // QAbstractItemModel interface
\r
51 int rowCount(const QModelIndex &parent = QModelIndex()) const;
\r
52 int columnCount(const QModelIndex &parent = QModelIndex()) const;
\r
53 QVariant data(const QModelIndex &index, int role) const;
\r
54 QVariant headerData(int section, Qt::Orientation orientation, int role) const;
\r
55 Qt::ItemFlags flags(const QModelIndex &index) const;
\r
56 bool setData(const QModelIndex &index, const QVariant &value, int role);
\r
59 #endif // FILETABLEMODEL_H
\r