summaryrefslogtreecommitdiffstats
path: root/fswidget.h
blob: a66fbd6fbcb0a692b235321b7f662937ecf2191d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef FSWIDGET_H
#define FSWIDGET_H

#include <QWidget>
#include <QSqlQuery>

class QComboBox;
class QTreeView;
class QStandardItemModel;
class QSortFilterProxyModel;
class QContextMenuEvent;
class NewMovieWizard;
class Viewer;
class FSProxy;

class FSWidget : public QWidget {
    Q_OBJECT
    public:
        enum CustomRoles { FullPathRole = Qt::UserRole + 1, DurationRole = Qt::UserRole + 2, SizeRole = Qt::UserRole + 3, MimeRole = Qt::UserRole + 4 };
        explicit FSWidget(QWidget *parent = nullptr);
        ~FSWidget();

    protected:
        virtual void contextMenuEvent(QContextMenuEvent *e);

    public slots:
        void readSettings();
        void writeSettings();
        void refresh();

    private slots:
        void insertItem(QComboBox *cb, const QString &text);
        void removeItem(QComboBox *cb);
        void gatherData(const QString &curDir);
        void deleteFiles();
        void archiveMovie();
        void advanceDir(int by);
        int queryCount(QSqlQuery &q, const QString &arg);
        void filterMime(const QString &mime);
        void unpack();
        void doubleClicked(const QModelIndex &idx);
        void preview();

    signals:
        void message(QString msg);

    private:
        void setupWidget();
        QComboBox *mDirCB;
        QComboBox *mFilterCB;
        QTreeView *mFileView;
        QStandardItemModel *mModel;
        FSProxy *mProxy;
        NewMovieWizard *mMovieWizard;
        Viewer *mViewer;
        int mQueryCount;
};

#endif // FSWIDGET_H