OSDN Git Service

Ver0.12
[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 checkedItems() const;
39     QFileInfoList selectedItems() const;
40     const History* history() const { return &m_history; }
41     QStringList nameFilters() const { return m_model.nameFilters(); }
42
43     // setter
44     void setPath(const QString &path, bool addHistory);
45     void setFilter(QDir::Filters filter, bool enable);
46     void setHistoryIndexAt(int index);
47     void setNameFilters(const QStringList &list);
48     void setSorting(QDir::SortFlags flags);
49
50 private:
51     FileTableModel m_model;
52     History m_history;
53     QPoint m_dragStartPos;
54     bool m_dragging;
55
56 signals:
57     void currentChanged(const QFileInfo &info);
58     void dataChanged();
59     void dropAccepted(const QFileInfoList &list);
60     void itemFound();
61     void itemNotFound();
62     void retrieveStarted(const QString &path);
63     void retrieveFinished();
64     void requestContextMenu(QContextMenuEvent *event);
65     void keyPressed(QKeyEvent *event);
66
67 public slots:
68
69     // QAbstractItemView interface
70 protected slots:
71     void currentChanged(const QModelIndex &current, const QModelIndex &previous);
72     void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
73
74     // QWidget interface
75 protected:
76     void keyPressEvent(QKeyEvent *event);
77     void mousePressEvent(QMouseEvent *event);
78     void mouseMoveEvent(QMouseEvent *event);
79     void dragEnterEvent(QDragEnterEvent *event);
80     void dropEvent(QDropEvent *event);
81     void contextMenuEvent(QContextMenuEvent *event);
82 };
83
84 #endif // FOLDERVIEW_H