blob: 445210d0e1915b5ba53e9e8c7857d510b967eb38 (
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version
2 of the License, or (at your option) any later version.
*/
#ifndef RANDOMTAB_H
#define RANDOMTAB_H
#include <QWidget>
#include <QSqlDatabase>
#include <QVector>
#include <QTreeView>
class QComboBox;
class QPushButton;
class QTreeView;
class QSortFilterProxyModel;
class QStandardItemModel;
class QLineEdit;
class QTextEdit;
class QAction;
class QMenu;
class QContextMenuEvent;
class RandomFileView;
class RandomTab : public QWidget {
Q_OBJECT
public:
enum CustomRoles { IdRole = Qt::UserRole + 1, SizeRole = Qt::UserRole + 2, DurationRole = Qt::UserRole + 3, DvdNoRole = Qt::UserRole + 4 };
enum Columns { FileName = 0, Size = 1, Duration = 2, Md5 = 3, Location = 4, FullPath = 5 };
enum { ColumnCount = 6 };
explicit RandomTab(QWidget *parent = 0);
virtual ~RandomTab();
const QMenu *contextMenu() const { return mContextMenu; }
QMenu *editMenu() { return mEditMenu; }
public slots:
void setupModels();
void clearAll();
void refreshComboboxes();
void select();
void playAll();
void playSelected();
void playDoubleclicked(QModelIndex idx);
void play(const QStringList &files);
void logMessage(const QString &msg);
signals:
void configure();
private:
void setupGui();
void setupActions();
void writeSettings();
void readSettings();
QStringList validDvdNos();
QComboBox *mGenre1;
QComboBox *mGenre2;
QComboBox *mGenre3;
QVector<QComboBox*> mGenreBoxes;
QComboBox *mActor1;
QComboBox *mActor2;
QComboBox *mActor3;
QVector<QComboBox*> mActorBoxes;
QLineEdit *mNumber;
QPushButton *mSelect;
QPushButton *mClear;
QPushButton *mRefresh;
QPushButton *mPlaySelected;
QPushButton *mPlayAll;
RandomFileView *mFileView;
QTextEdit *mLog;
QStandardItemModel *mFileModel;
QStandardItemModel *mGenreModel;
QStandardItemModel *mActorModel;
QSortFilterProxyModel *mFileProxy;
QSqlDatabase mDb;
QStringList mValidDvds;
QAction *mPlaySelectedA;
QAction *mPlayAllA;
QAction *mClearA;
QAction *mRefreshA;
QAction *mGoA;
QAction *mConfigureA;
QMenu *mContextMenu;
QMenu *mEditMenu;
};
class RandomFileView : public QTreeView {
Q_OBJECT
public:
explicit RandomFileView(QWidget *parent = 0);
void setContextMenu(QMenu *menu) { mCtxMenu = menu; }
protected:
virtual void contextMenuEvent(QContextMenuEvent *e);
private:
QMenu *mCtxMenu;
};
#endif // RANDOMTAB_H
|