blob: 774120acc65fe667cf057a99d84de7775721a522 (
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
/*
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 SERIESTREEWIDGET_H
#define SERIESTREEWIDGET_H
#include <QWidget>
#include <QTreeView>
#include <QSortFilterProxyModel>
#include <QDialog>
class QLineEdit;
class QPushButton;
class QSortFilterProxyModel;
class QComboBox;
class QEvent;
class QLabel;
class SeriesTreeModel;
class SeriesTreeView;
class SeriesTreeSortModel;
class HoverWindow;
class FilesTreeModel;
class AddCoverDialog;
class HoverWindow;
class SeriesTreeWidget : public QWidget {
Q_OBJECT
public:
explicit SeriesTreeWidget(QWidget *parent = 0);
SeriesTreeView *seriesTree() { return mView; }
SeriesTreeSortModel *seriesProxy() { return mProxy; }
public slots:
void newSeries();
void seriesAdded(const QString seriesName, int seriesPart, bool resort = true);
void deleteFromSeries();
void readSettings();
void writeSettings();
void expandCurrent();
void addCover();
private slots:
void filter();
void clearFilter();
void resort();
void itemExpanded(const QModelIndex &);
void itemCollaped(const QModelIndex &);
void expandItems(const QStringList &items);
void editItem();
signals:
void filesReload();
private:
QLineEdit *mFilterEdit;
QPushButton *mFilter;
QPushButton *mClear;
SeriesTreeView *mView;
SeriesTreeSortModel *mProxy;
SeriesTreeModel *mModel;
AddCoverDialog *mCoverDialog;
QStringList mExpandedItems;
};
class SeriesTreeView : public QTreeView {
Q_OBJECT
public:
explicit SeriesTreeView(QWidget *parent = 0);
public slots:
void readConfig();
protected:
virtual void contextMenuEvent(QContextMenuEvent *e);
virtual bool event(QEvent *event);
private:
QStringList children(const QModelIndex &idx) const;
QModelIndex mCurHover;
HoverWindow *mHoverWin;
bool mHover;
};
class SeriesTreeSortModel : public QSortFilterProxyModel {
Q_OBJECT
public:
SeriesTreeSortModel(QObject *parent = 0);
~SeriesTreeSortModel() {}
protected:
virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const;
};
class AddCoverDialog : public QDialog {
Q_OBJECT
public:
explicit AddCoverDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
const QString file() const;
int fileType() const { return mCurrentType; }
private slots:
void selectFile();
void typeChanged(const QString &type);
private:
QLineEdit *mFile;
QComboBox *mFileType;
QPushButton *mSelectFile;
QPushButton *mOk;
QPushButton *mCancel;
QString mLastOpenedDir;
int mCurrentType;
FilesTreeModel *mFilesModel;
};
#endif
|