-
Notifications
You must be signed in to change notification settings - Fork 1
/
PlaylistView.h
129 lines (102 loc) · 2.83 KB
/
PlaylistView.h
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
122
123
124
125
126
127
128
129
#ifndef PLAYLISTVIEW_H
#define PLAYLISTVIEW_H
#include <QStandardItemModel>
#include <QDropEvent>
#include <QUrl>
#include <QMenu>
#include <QDialog>
#include <QFormLayout>
#include <QLineEdit>
#include <QComboBox>
#include <QLabel>
#include <QDialogButtonBox>
#include <QMimeData>
#include "DBApi.h"
#include "PlaylistModel.h"
#include <QTreeView>
#include <QStyledItemDelegate>
class AutoToolTipDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
AutoToolTipDelegate(QObject* parent);
public slots:
bool helpEvent(QHelpEvent* e, QAbstractItemView* view, const QStyleOptionViewItem& option,
const QModelIndex& index);
};
class PlaylistView : public QTreeView, public DBWidget {
Q_OBJECT
public:
PlaylistView(QWidget *parent = nullptr, DBApi *Api = nullptr, PlayItemTableModel *ptm = nullptr);
~PlaylistView();
// cursor
void restoreCursor();
void storeCursor();
void goToLastSelection();
PlayItemTableModel *pi_model;
protected:
void startDrag(Qt::DropActions supportedActions);
void dragMoveEvent(QDragMoveEvent* event);
// Actions
QAction *add_to_playback_queue;
QAction *remove_from_playback_queue;
QAction *cut;
QAction *copy;
QAction *paste;
QAction *delete_action;
// Menu position
QPoint menu_pos;
//
QMenu headerContextMenu;
QList<QAction*> headerActions;
QMenu *headerGrouping;
// header num for current header menu
int headerMenu_pos;
// Enter event
bool eventFilter(QObject *obj, QEvent *event);
signals:
// Enter event
void enterRelease(QModelIndex);
protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
protected slots:
void headerContextMenuRequested(QPoint);
void lockColumns(bool);
void lockPlaylist(bool);
void onTrackChanged(DB_playItem_t *, DB_playItem_t *);
void showContextMenu(QPoint);
void saveHeaderState();
// Actions
void onAddToPlaybackQueue();
void onRemoveFromPlaybackQueue();
void onCut();
void onCopy();
void onPaste();
void onDelete();
void onHeaderDialogAdd();
void onHeaderDialogEdit();
void onHeaderDialogRemove();
};
class HeaderDialog : public QDialog {
Q_OBJECT
public:
HeaderDialog(PlayItemTableModel *pt_model, QWidget *parent = nullptr, int headernum = -1);
QFormLayout layout;
QDialogButtonBox buttons;
QLineEdit title;
QComboBox type;
QWidget format_parent;
QHBoxLayout format_layout;
QLineEdit format;
QString format_saved;
QLabel format_help;
int n;
int editting = 0;
PlayItemTableModel *pt;
private slots:
void onTypeChanged(int index);
void onAccepted();
void onRejected();
};
#endif // PLAYLISTVIEW_H