/
playlisteditorview.h
119 lines (91 loc) · 3.54 KB
/
playlisteditorview.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
#ifndef PLAYLISTEDITORVIEW_H_
#define PLAYLISTEDITORVIEW_H_
// qt
#include <QEvent>
#include <QVector>
// mythui
#include <mythscreentype.h>
#include <mythgenerictree.h>
#include <mythuibuttonlist.h>
// mythmusic
#include "musiccommon.h"
class MythUIButtonTree;
class MythUIText;
class MythMenu;
// This is just so we can use the guarded pointers provided by QPointer in the MusicGenericTree
class MPUBLIC MusicButtonItem : public MythUIButtonListItem, public QObject
{
public:
MusicButtonItem(MythUIButtonList *lbtype, const QString& text,
const QString& image = "", bool checkable = false,
CheckState state = CantCheck, bool showArrow = false,
int listPosition = -1):
MythUIButtonListItem(lbtype, text, image, checkable, state, showArrow, listPosition) {}
MusicButtonItem(MythUIButtonList *lbtype, const QString& text, QVariant data, int listPosition = -1) :
MythUIButtonListItem(lbtype, text, data, listPosition) {}
};
class MPUBLIC MusicGenericTree : public MythGenericTree
{
public:
MusicGenericTree(MusicGenericTree *parent, const QString &name,
const QString &action = "",
MythUIButtonListItem::CheckState state = MythUIButtonListItem::CantCheck,
bool showArrow = true);
virtual ~MusicGenericTree();
QString getAction(void) const { return m_action; }
MythUIButtonListItem::CheckState getCheck(void) const { return m_check; }
void setCheck(MythUIButtonListItem::CheckState state);
void setDrawArrow(bool flag);
MythUIButtonListItem *CreateListButton(MythUIButtonList *list);
protected:
QString m_action;
QPointer<MusicButtonItem> m_buttonItem;
MythUIButtonListItem::CheckState m_check;
bool m_showArrow;
//bool m_active;
};
Q_DECLARE_METATYPE(MusicGenericTree*)
class PlaylistEditorView : public MusicCommon
{
Q_OBJECT
public:
PlaylistEditorView(MythScreenStack *parent, const QString &layout, bool restorePosition = false);
~PlaylistEditorView(void);
bool Create(void);
bool keyPressEvent(QKeyEvent *);
void saveTreePosition(void);
virtual void ShowMenu(void);
protected:
void customEvent(QEvent *event);
private slots:
void treeItemClicked(MythUIButtonListItem *item);
void treeItemVisible(MythUIButtonListItem *item);
void treeNodeChanged(MythGenericTree *node);
void smartPLChanged(const QString &category, const QString &name);
void deleteSmartPlaylist(bool ok);
void deletePlaylist(bool ok);
private:
void filterTracks(MusicGenericTree *node);
void getPlaylists(MusicGenericTree *node);
void getPlaylistTracks(MusicGenericTree *node, int playlistID);
void getSmartPlaylistCategories(MusicGenericTree *node);
void getSmartPlaylists(MusicGenericTree *node);
void getSmartPlaylistTracks(MusicGenericTree *node, int playlistID);
void updateSelectedTracks(void);
void updateSelectedTracks(MusicGenericTree *node);
void updateSonglist(MusicGenericTree *node);
void createRootNode(void);
void reloadTree(void);
void restoreTreePosition(const QStringList &route);
MythMenu* createPlaylistMenu(void);
MythMenu* createSmartPlaylistMenu(void);
private:
QString m_layout;
bool m_restorePosition;
MusicGenericTree *m_rootNode;
QList<MetadataPtrList*> m_deleteList;
MythUIButtonTree *m_playlistTree;
MythUIText *m_breadcrumbsText;
MythUIText *m_positionText;
};
#endif