#ifndef FOLDERVIEW_H
#define FOLDERVIEW_H
-#include "filetablemodel.h"
-#include "history.h"
+#include "folderview_private.h"
+#include "foldermodel.h"
#include <QTableView>
class MainWindow;
class FolderView : public QTableView
{
Q_OBJECT
+
public:
explicit FolderView(QWidget *parent = 0);
- QString side() const;
-
- // actions
- void initialize(MainWindow *mainWnd, bool left);
- void updateAppearance(bool darker = false);
- void refresh();
-
- void searchItem(const QString &text);
- void searchNext(const QString &text);
- void searchPrev(const QString &text);
-
- void setCheckStateAll(bool checked);
- void setCheckStateAllFiles();
- void invertCheckState();
- void toggleCheckState(const QModelIndex &index);
-
- bool historyBack();
- bool historyForward();
-
- // getter
- QFileInfo currentItem() const;
- QString dir() const { return m_model.absolutePath(); }
- QFileInfoList checkedItems() const;
- QFileInfoList selectedItems() const;
- const History* history() const { return &m_history; }
- QStringList nameFilters() const { return m_model.nameFilters(); }
-
- // setter
- void setPath(const QString &path, bool addHistory);
- void setFilter(QDir::Filters filter, bool enable);
- void setHistoryIndexAt(int index);
- void setNameFilters(const QStringList &list);
- void setSorting();
+ void initialize(MainWindow *w);
+ FolderModel* folderModel() const;
private:
- MainWindow *m_mainWnd;
- FileTableModel m_model;
- History m_history;
- QPoint m_dragStartPos;
- bool m_dragging;
+ FolderView_Private m_p;
signals:
- void currentChanged(const QFileInfo &info);
- void dataChanged();
- void dropAccepted(const QFileInfoList &list);
- void itemFound();
- void itemNotFound();
- void retrieveStarted(const QString &path);
- void requestContextMenu(QContextMenuEvent *event);
-// void keyPressed(QKeyEvent *event);
+ void prefs_updated();
-public slots:
+private slots:
+ void onScaleUp();
+ void onScaleDown();
// QAbstractItemView interface
-protected slots:
- void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
- void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
+public:
+ void setModel(QAbstractItemModel *model);
- // QWidget interface
-protected:
- void keyPressEvent(QKeyEvent *event);
- void mousePressEvent(QMouseEvent *event);
- void mouseMoveEvent(QMouseEvent *event);
- void dragEnterEvent(QDragEnterEvent *event);
- void dropEvent(QDropEvent *event);
- void contextMenuEvent(QContextMenuEvent *event);
- void focusInEvent(QFocusEvent *event);
- void focusOutEvent(QFocusEvent *event);
};
+inline FolderModel *FolderView::folderModel() const
+{
+ return static_cast<FolderModel*>(model());
+}
+
#endif // FOLDERVIEW_H