OSDN Git Service

3b235448ddd0f41b9781b954f31eb1dde345ec28
[gefu/Gefu.git] / folderview.h
1 #ifndef FOLDERVIEW_H
2 #define FOLDERVIEW_H
3
4 #include "filetablemodel.h"
5 #include "history.h"
6
7 #include <QTableView>
8
9 class FolderView : public QTableView
10 {
11     Q_OBJECT
12 public:
13     explicit FolderView(QWidget *parent = 0);
14
15     QString side() const;
16
17     // actions
18     void initialize();
19     void updateAppearance();
20     void refresh();
21
22     void searchItem(const QString &text);
23     void searchNext(const QString &text);
24     void searchPrev(const QString &text);
25
26     void setCheckStateAll(bool checked);
27     void setCheckStateAllFiles();
28     void invertCheckState();
29     void toggleCheckState(const QModelIndex &index);
30
31     bool historyBack();
32     bool historyForward();
33
34
35     // getter
36     QFileInfo currentItem() const;
37     QString dir() const { return m_model.absolutePath(); }
38     QFileInfoList selectedItems() const;
39     const History* history() const { return &m_history; }
40     QStringList nameFilters() const { return m_model.nameFilters(); }
41
42     // setter
43     void setPath(const QString &path, bool addHistory);
44     void setFilter(QDir::Filters filter, bool enable);
45     void setHistoryIndexAt(int index);
46     void setNameFilters(const QStringList &list);
47     void setSorting(QDir::SortFlags flags);
48
49 private:
50     FileTableModel m_model;
51     History m_history;
52
53
54 signals:
55     void itemFound(FolderView *view);
56     void itemNotFound(FolderView *view);
57     void retrieveStarted(const QString &path);
58     void retrieveFinished();
59     void keyPressed(FolderView *view, QKeyEvent *event);
60
61 public slots:
62
63
64     // QWidget interface
65 protected:
66     void keyPressEvent(QKeyEvent *event);
67
68 };
69
70 #endif // FOLDERVIEW_H