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 // mythui
12 #include <mythscreentype.h>
13 #include <mythgenerictree.h>
14 #include <mythuibuttonlist.h>
15 
16 // mythmusic
17 #include "musiccommon.h"
18 
19 class MythUIButtonTree;
20 class MythUIText;
21 class MythMenu;
22 
23 // This is just so we can use the guarded pointers provided by QPointer in the MusicGenericTree
24 class MPUBLIC MusicButtonItem : public MythUIButtonListItem, public QObject
25 {
26  public:
27  MusicButtonItem(MythUIButtonList *lbtype, const QString& text,
28  const QString& image = "", bool checkable = false,
29  CheckState state = CantCheck, bool showArrow = false,
30  int listPosition = -1):
31  MythUIButtonListItem(lbtype, text, image, checkable, state, showArrow, listPosition) {}
32 
33  MusicButtonItem(MythUIButtonList *lbtype, const QString& text, QVariant data, int listPosition = -1) :
34  MythUIButtonListItem(lbtype, text, std::move(data), listPosition) {}
35 };
36 
38 {
39  public:
40  MusicGenericTree(MusicGenericTree *parent, const QString &name,
41  const QString &action = "",
43  bool showArrow = true);
44  ~MusicGenericTree() override = default;
45 
46  QString getAction(void) const { return m_action; }
47 
48  MythUIButtonListItem::CheckState getCheck(void) const { return m_check; }
49  void setCheck(MythUIButtonListItem::CheckState state);
50 
51  void setDrawArrow(bool flag);
52 
53  MythUIButtonListItem *CreateListButton(MythUIButtonList *list) override; // MythGenericTree
54 
55  protected:
56  QString m_action;
57  QPointer<MusicButtonItem> m_buttonItem {nullptr};
59  bool m_showArrow {true};
60 };
61 
63 
65 {
66  Q_OBJECT
67  public:
68  PlaylistEditorView(MythScreenStack *parent, MythScreenType *parentScreen,
69  const QString &layout, bool restorePosition = false);
70  ~PlaylistEditorView(void) override;
71 
72  bool Create(void) override; // MythScreenType
73  bool keyPressEvent(QKeyEvent *event) override; // MusicCommon
74 
75  void saveTreePosition(void);
76 
77  void ShowMenu(void) override; // MusicCommon
78 
79  protected:
80  void customEvent(QEvent *event) override; // MusicCommon
81 
82  private slots:
84  static void treeItemVisible(MythUIButtonListItem *item);
85  void treeNodeChanged(MythGenericTree *node);
86  void smartPLChanged(const QString &category, const QString &name);
87  void deleteSmartPlaylist(bool ok);
88  void deletePlaylist(bool ok);
89 
90  private:
91  void filterTracks(MusicGenericTree *node);
92 
93  static void getPlaylists(MusicGenericTree *node);
94  static void getPlaylistTracks(MusicGenericTree *node, int playlistID);
95 
97  static void getSmartPlaylists(MusicGenericTree *node);
98  static void getSmartPlaylistTracks(MusicGenericTree *node, int playlistID);
99 
100  static void getCDTracks(MusicGenericTree *node);
101 
102  void updateSelectedTracks(void);
104  void updateSonglist(MusicGenericTree *node);
105 
106  void createRootNode(void);
107  void reloadTree(void);
108  void restoreTreePosition(const QStringList &route);
109 
112 
113  private:
114  QString m_layout;
115  bool m_restorePosition {false};
117  QList<MetadataPtrList*> m_deleteList;
118 
122 };
123 
124 #endif
PlaylistEditorView::updateSonglist
void updateSonglist(MusicGenericTree *node)
Definition: playlisteditorview.cpp:522
MPUBLIC
#define MPUBLIC
Definition: mythexp.h:10
PlaylistEditorView::getSmartPlaylistCategories
static void getSmartPlaylistCategories(MusicGenericTree *node)
Definition: playlisteditorview.cpp:1408
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(MusicGenericTree *)
PlaylistEditorView::treeItemClicked
void treeItemClicked(MythUIButtonListItem *item)
Definition: playlisteditorview.cpp:803
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
category
QString category
Definition: mythplugins/mytharchive/mytharchivehelper/main.cpp:1422
PlaylistEditorView::getSmartPlaylistTracks
static void getSmartPlaylistTracks(MusicGenericTree *node, int playlistID)
Definition: playlisteditorview.cpp:1460
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:1576
mythuibuttonlist.h
MusicGenericTree::~MusicGenericTree
~MusicGenericTree() override=default
MythUIButtonListItem::CheckState
CheckState
Definition: mythuibuttonlist.h:30
PlaylistEditorView::updateSelectedTracks
void updateSelectedTracks(void)
Definition: playlisteditorview.cpp:1637
PlaylistEditorView::smartPLChanged
void smartPLChanged(const QString &category, const QString &name)
Definition: playlisteditorview.cpp:1709
PlaylistEditorView::m_deleteList
QList< MetadataPtrList * > m_deleteList
Definition: playlisteditorview.h:117
PlaylistEditorView::ShowMenu
void ShowMenu(void) override
Definition: playlisteditorview.cpp:621
MythUIButtonListItem
Definition: mythuibuttonlist.h:28
MusicButtonItem
Definition: playlisteditorview.h:25
MythUIButtonListItem::CantCheck
@ CantCheck
Definition: mythuibuttonlist.h:31
PlaylistEditorView::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition: playlisteditorview.cpp:349
PlaylistEditorView::deletePlaylist
void deletePlaylist(bool ok)
Definition: playlisteditorview.cpp:1742
MusicGenericTree::getAction
QString getAction(void) const
Definition: playlisteditorview.h:46
MythGenericTree::CreateListButton
virtual MythUIButtonListItem * CreateListButton(MythUIButtonList *list)
Definition: mythgenerictree.cpp:502
MythUIButtonTree
A tree widget for displaying and navigating a MythGenericTree()
Definition: mythuibuttontree.h:17
mythgenerictree.h
PlaylistEditorView::deleteSmartPlaylist
void deleteSmartPlaylist(bool ok)
Definition: playlisteditorview.cpp:1719
MusicButtonItem::MusicButtonItem
MusicButtonItem(MythUIButtonList *lbtype, const QString &text, QVariant data, int listPosition=-1)
Definition: playlisteditorview.h:33
PlaylistEditorView::~PlaylistEditorView
~PlaylistEditorView(void) override
Definition: playlisteditorview.cpp:97
PlaylistEditorView::reloadTree
void reloadTree(void)
Definition: playlisteditorview.cpp:1663
PlaylistEditorView::treeItemVisible
static void treeItemVisible(MythUIButtonListItem *item)
Definition: playlisteditorview.cpp:831
musiccommon.h
MusicGenericTree
Definition: playlisteditorview.h:38
PlaylistEditorView::getCDTracks
static void getCDTracks(MusicGenericTree *node)
Definition: playlisteditorview.cpp:1592
MythMenu
Definition: mythdialogbox.h:100
PlaylistEditorView::restoreTreePosition
void restoreTreePosition(const QStringList &route)
Definition: playlisteditorview.cpp:1680
MythUIText
All purpose text widget, displays a text string.
Definition: mythuitext.h:29
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:27
MythGenericTree
Definition: mythgenerictree.h:21
PlaylistEditorView::m_restorePosition
bool m_restorePosition
Definition: playlisteditorview.h:115
PlaylistEditorView::createPlaylistMenu
MythMenu * createPlaylistMenu(void)
Definition: playlisteditorview.cpp:676
PlaylistEditorView::m_positionText
MythUIText * m_positionText
Definition: playlisteditorview.h:121
build_compdb.action
action
Definition: build_compdb.py:9
PlaylistEditorView::createRootNode
void createRootNode(void)
Definition: playlisteditorview.cpp:734
PlaylistEditorView::saveTreePosition
void saveTreePosition(void)
Definition: playlisteditorview.cpp:1700
PlaylistEditorView::getPlaylistTracks
static void getPlaylistTracks(MusicGenericTree *node, int playlistID)
Definition: playlisteditorview.cpp:1608
PlaylistEditorView::getSmartPlaylists
static void getSmartPlaylists(MusicGenericTree *node)
Definition: playlisteditorview.cpp:1433
PlaylistEditorView::createSmartPlaylistMenu
MythMenu * createSmartPlaylistMenu(void)
Definition: playlisteditorview.cpp:699
MusicGenericTree::m_action
QString m_action
Definition: playlisteditorview.h:56
PlaylistEditorView::treeNodeChanged
void treeNodeChanged(MythGenericTree *node)
Definition: playlisteditorview.cpp:920
MusicGenericTree::getCheck
MythUIButtonListItem::CheckState getCheck(void) const
Definition: playlisteditorview.h:48
PlaylistEditorView::m_playlistTree
MythUIButtonTree * m_playlistTree
Definition: playlisteditorview.h:119
MythUIButtonList
List widget, displays list items in a variety of themeable arrangements and can trigger signals when ...
Definition: mythuibuttonlist.h:152
PlaylistEditorView::m_layout
QString m_layout
Definition: playlisteditorview.h:114
PlaylistEditorView::m_rootNode
MusicGenericTree * m_rootNode
Definition: playlisteditorview.h:116
MusicCommon::restorePosition
bool restorePosition(int trackID)
Definition: musiccommon.cpp:2609
PlaylistEditorView::filterTracks
void filterTracks(MusicGenericTree *node)
Definition: playlisteditorview.cpp:970
mythscreentype.h
MusicCommon
Definition: musiccommon.h:48
PlaylistEditorView::m_breadcrumbsText
MythUIText * m_breadcrumbsText
Definition: playlisteditorview.h:120