MythTV  master
playlisteditorview.h
Go to the documentation of this file.
1 #ifndef PLAYLISTEDITORVIEW_H_
2 #define PLAYLISTEDITORVIEW_H_
3 
4 // c++
5 #include <utility>
6 
7 // qt
8 #include <QEvent>
9 #include <QVector>
10 
11 // MythTV
16 
17 // mythmusic
18 #include "musiccommon.h"
19 
20 class MythUIButtonTree;
21 class MythUIText;
22 class MythMenu;
23 
24 // This is just so we can use the guarded pointers provided by QPointer in the MusicGenericTree
25 class MPLUGIN_PUBLIC MusicButtonItem : public MythUIButtonListItem, public QObject
26 {
27  public:
28  MusicButtonItem(MythUIButtonList *lbtype, const QString& text,
29  const QString& image = "", bool checkable = false,
30  CheckState state = CantCheck, bool showArrow = false,
31  int listPosition = -1):
32  MythUIButtonListItem(lbtype, text, image, checkable, state, showArrow, listPosition) {}
33 
34  MusicButtonItem(MythUIButtonList *lbtype, const QString& text, QVariant data, int listPosition = -1) :
35  MythUIButtonListItem(lbtype, text, std::move(data), listPosition) {}
36 };
37 
39 {
40  public:
41  MusicGenericTree(MusicGenericTree *parent, const QString &name,
42  const QString &action = "",
44  bool showArrow = true);
45  ~MusicGenericTree() override = default;
46 
47  QString getAction(void) const { return m_action; }
48 
49  MythUIButtonListItem::CheckState getCheck(void) const { return m_check; }
50  void setCheck(MythUIButtonListItem::CheckState state);
51 
52  void setDrawArrow(bool flag);
53 
54  MythUIButtonListItem *CreateListButton(MythUIButtonList *list) override; // MythGenericTree
55 
56  protected:
57  QString m_action;
58  QPointer<MusicButtonItem> m_buttonItem {nullptr};
60  bool m_showArrow {true};
61 };
62 
64 
66 {
67  Q_OBJECT
68  public:
69  PlaylistEditorView(MythScreenStack *parent, MythScreenType *parentScreen,
70  const QString &layout, bool restorePosition = false);
71  ~PlaylistEditorView(void) override;
72 
73  bool Create(void) override; // MythScreenType
74  bool keyPressEvent(QKeyEvent *event) override; // MusicCommon
75 
76  void saveTreePosition(void);
77 
78  void ShowMenu(void) override; // MusicCommon
79 
80  protected:
81  void customEvent(QEvent *event) override; // MusicCommon
82 
83  private slots:
85  static void treeItemVisible(MythUIButtonListItem *item);
86  void treeNodeChanged(MythGenericTree *node);
87  void smartPLChanged(const QString &category, const QString &name);
88  void deleteSmartPlaylist(bool ok);
89  void deletePlaylist(bool ok);
90 
91  private:
92  void filterTracks(MusicGenericTree *node);
93 
94  static void getPlaylists(MusicGenericTree *node);
95  static void getPlaylistTracks(MusicGenericTree *node, int playlistID);
96 
98  static void getSmartPlaylists(MusicGenericTree *node);
99  static void getSmartPlaylistTracks(MusicGenericTree *node, int playlistID);
100 
101  static void getCDTracks(MusicGenericTree *node);
102 
103  void updateSelectedTracks(void);
105  void updateSonglist(MusicGenericTree *node);
106 
107  void createRootNode(void);
108  void reloadTree(void);
109  void restoreTreePosition(const QStringList &route);
110 
113 
114  private:
115  QString m_layout;
116  bool m_restorePosition {false};
118  QList<MetadataPtrList*> m_deleteList;
119 
123 };
124 
125 #endif
PlaylistEditorView::updateSonglist
void updateSonglist(MusicGenericTree *node)
Definition: playlisteditorview.cpp:522
PlaylistEditorView::getSmartPlaylistCategories
static void getSmartPlaylistCategories(MusicGenericTree *node)
Definition: playlisteditorview.cpp:1409
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(MusicGenericTree *)
PlaylistEditorView::treeItemClicked
void treeItemClicked(MythUIButtonListItem *item)
Definition: playlisteditorview.cpp:805
PlaylistEditorView
Definition: playlisteditorview.h:65
PlaylistEditorView::PlaylistEditorView
PlaylistEditorView(MythScreenStack *parent, MythScreenType *parentScreen, const QString &layout, bool restorePosition=false)
Definition: playlisteditorview.cpp:88
MythScreenStack
Definition: mythscreenstack.h:16
PlaylistEditorView::Create
bool Create(void) override
Definition: playlisteditorview.cpp:110
PlaylistEditorView::getSmartPlaylistTracks
static void getSmartPlaylistTracks(MusicGenericTree *node, int playlistID)
Definition: playlisteditorview.cpp:1461
MythScreenType
Screen in which all other widgets are contained and rendered.
Definition: mythscreentype.h:45
PlaylistEditorView::getPlaylists
static void getPlaylists(MusicGenericTree *node)
Definition: playlisteditorview.cpp:1577
mythuibuttonlist.h
MythUIButtonListItem::CheckState
CheckState
Definition: mythuibuttonlist.h:44
PlaylistEditorView::updateSelectedTracks
void updateSelectedTracks(void)
Definition: playlisteditorview.cpp:1638
PlaylistEditorView::smartPLChanged
void smartPLChanged(const QString &category, const QString &name)
Definition: playlisteditorview.cpp:1710
PlaylistEditorView::m_deleteList
QList< MetadataPtrList * > m_deleteList
Definition: playlisteditorview.h:118
PlaylistEditorView::ShowMenu
void ShowMenu(void) override
Definition: playlisteditorview.cpp:621
MythUIButtonListItem
Definition: mythuibuttonlist.h:41
mythpluginexport.h
MusicButtonItem
Definition: playlisteditorview.h:25
MythUIButtonListItem::CantCheck
@ CantCheck
Definition: mythuibuttonlist.h:45
PlaylistEditorView::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: playlisteditorview.cpp:349
PlaylistEditorView::deletePlaylist
void deletePlaylist(bool ok)
Definition: playlisteditorview.cpp:1743
MusicGenericTree::getAction
QString getAction(void) const
Definition: playlisteditorview.h:47
MythGenericTree::CreateListButton
virtual MythUIButtonListItem * CreateListButton(MythUIButtonList *list)
Definition: mythgenerictree.cpp:502
MythUIButtonTree
A tree widget for displaying and navigating a MythGenericTree()
Definition: mythuibuttontree.h:16
mythgenerictree.h
PlaylistEditorView::deleteSmartPlaylist
void deleteSmartPlaylist(bool ok)
Definition: playlisteditorview.cpp:1720
MusicButtonItem::MusicButtonItem
MusicButtonItem(MythUIButtonList *lbtype, const QString &text, QVariant data, int listPosition=-1)
Definition: playlisteditorview.h:34
PlaylistEditorView::~PlaylistEditorView
~PlaylistEditorView(void) override
Definition: playlisteditorview.cpp:97
PlaylistEditorView::reloadTree
void reloadTree(void)
Definition: playlisteditorview.cpp:1664
PlaylistEditorView::treeItemVisible
static void treeItemVisible(MythUIButtonListItem *item)
Definition: playlisteditorview.cpp:833
musiccommon.h
MusicGenericTree
Definition: playlisteditorview.h:38
PlaylistEditorView::getCDTracks
static void getCDTracks(MusicGenericTree *node)
Definition: playlisteditorview.cpp:1593
MythMenu
Definition: mythdialogbox.h:99
PlaylistEditorView::restoreTreePosition
void restoreTreePosition(const QStringList &route)
Definition: playlisteditorview.cpp:1681
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:28
PlaylistEditorView::customEvent
void customEvent(QEvent *event) override
Definition: playlisteditorview.cpp:177
MusicButtonItem::MusicButtonItem
MusicButtonItem(MythUIButtonList *lbtype, const QString &text, const QString &image="", bool checkable=false, CheckState state=CantCheck, bool showArrow=false, int listPosition=-1)
Definition: playlisteditorview.h:28
std
Definition: mythchrono.h:23
MythGenericTree
Definition: mythgenerictree.h:27
MPLUGIN_PUBLIC
#define MPLUGIN_PUBLIC
Definition: mythpluginexport.h:9
PlaylistEditorView::m_restorePosition
bool m_restorePosition
Definition: playlisteditorview.h:116
PlaylistEditorView::createPlaylistMenu
MythMenu * createPlaylistMenu(void)
Definition: playlisteditorview.cpp:676
PlaylistEditorView::m_positionText
MythUIText * m_positionText
Definition: playlisteditorview.h:122
build_compdb.action
action
Definition: build_compdb.py:9
PlaylistEditorView::createRootNode
void createRootNode(void)
Definition: playlisteditorview.cpp:735
PlaylistEditorView::saveTreePosition
void saveTreePosition(void)
Definition: playlisteditorview.cpp:1701
PlaylistEditorView::getPlaylistTracks
static void getPlaylistTracks(MusicGenericTree *node, int playlistID)
Definition: playlisteditorview.cpp:1609
PlaylistEditorView::getSmartPlaylists
static void getSmartPlaylists(MusicGenericTree *node)
Definition: playlisteditorview.cpp:1434
PlaylistEditorView::createSmartPlaylistMenu
MythMenu * createSmartPlaylistMenu(void)
Definition: playlisteditorview.cpp:699
MusicGenericTree::m_action
QString m_action
Definition: playlisteditorview.h:57
PlaylistEditorView::treeNodeChanged
void treeNodeChanged(MythGenericTree *node)
Definition: playlisteditorview.cpp:922
MusicGenericTree::getCheck
MythUIButtonListItem::CheckState getCheck(void) const
Definition: playlisteditorview.h:49
PlaylistEditorView::m_playlistTree
MythUIButtonTree * m_playlistTree
Definition: playlisteditorview.h:120
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:191
PlaylistEditorView::m_layout
QString m_layout
Definition: playlisteditorview.h:115
PlaylistEditorView::m_rootNode
MusicGenericTree * m_rootNode
Definition: playlisteditorview.h:117
MusicCommon::restorePosition
bool restorePosition(int trackID)
Definition: musiccommon.cpp:2602
PlaylistEditorView::filterTracks
void filterTracks(MusicGenericTree *node)
Definition: playlisteditorview.cpp:972
mythscreentype.h
MusicCommon
Definition: musiccommon.h:48
PlaylistEditorView::m_breadcrumbsText
MythUIText * m_breadcrumbsText
Definition: playlisteditorview.h:121