Miam-Player  0.8.0
A nice music player
tabplaylist.h
Go to the documentation of this file.
1 #ifndef TABPLAYLIST_H
2 #define TABPLAYLIST_H
3 
4 #include <QDir>
5 #include <QTabWidget>
6 #include <QMouseEvent>
7 
9 #include <model/playlistdao.h>
10 #include <mediaplayer.h>
11 #include "playlist.h"
12 #include "playlistmanager.h"
14 
20 class MIAMTABPLAYLISTS_LIBRARY TabPlaylist : public QTabWidget
21 {
22  Q_OBJECT
23 
24 private:
25  MediaPlayer *_mediaPlayer;
26  PlaylistManager *_playlistManager;
27  QMenu *_contextMenu;
28  QAction *_deletePlaylist;
29 
30 public:
32  explicit TabPlaylist(QWidget *parent = nullptr);
33 
34  virtual ~TabPlaylist();
35 
37  Playlist *currentPlayList() const;
38 
39  //QIcon defaultIcon(QIcon::Mode mode) const;
40 
41  void init(MediaPlayer *mediaPlayer);
42 
44  void loadPlaylist(uint playlistId);
45 
47  Playlist *playlist(int index) const;
48 
49  QList<Playlist *> playlists() const;
50 
51  inline PlaylistManager *playlistManager() const { return _playlistManager; }
52 
53 protected:
55  virtual void changeEvent(QEvent *event) override;
56 
57  virtual void contextMenuEvent(QContextMenuEvent * event) override;
58 
59 public slots:
61  Playlist* addPlaylist();
62 
64  void addExtFolders(const QList<QDir> &folders);
65 
66  void closePlaylist(int index);
67 
68  void deletePlaylist(uint playlistId);
69 
70 public slots:
71  void changeCurrentPlaylistPlaybackMode(QMediaPlaylist::PlaybackMode mode);
72 
74  void insertItemsToPlaylist(int rowIndex, const QList<QUrl> &tracks);
75 
77  void removeCurrentPlaylist();
78 
79  void renamePlaylist(Playlist *p);
80  void renameTab(const PlaylistDAO &dao);
81 
83  void removeTabFromCloseButton(int index);
84 
85  void savePlaylist(Playlist *p, bool overwrite);
86 
87 signals:
89  void aboutToChangeMenuLabels(int);
90 
91  void aboutToSavePlaylist(Playlist *p, int index, bool overwrite = false);
92 
93  void aboutToSendToTagEditor(const QList<QUrl> &tracks);
94 
95  void selectionChanged(bool isEmpty);
96 
97  void updatePlaybackModeButton(QMediaPlaylist::PlaybackMode mode);
98 };
99 
100 #endif // TABPLAYLIST_H
unsigned int uint
Definition: taglib.h:68
PlaylistManager * playlistManager() const
Definition: tabplaylist.h:51
The Playlist class is used to display tracks in the MainWindow class.
Definition: playlist.h:21
The PlaylistDAO class is a simple wrapper which contains basic informations about a playlist...
Definition: playlistdao.h:12
The TabPlaylist class is used to manage mutiple playlists in the MainWindow class.
Definition: tabplaylist.h:20
The PlaylistManager class is used to Create/Read/Update/Delete playlists in SQLite DB...
Definition: playlistmanager.h:17
The MediaPlayer class is a central class which controls local and remote sources. ...
Definition: mediaplayer.h:22
#define MIAMTABPLAYLISTS_LIBRARY
Definition: miamtabplaylists_global.hpp:8