Sayonara Player
Playlist.h
1/* Playlist.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef PLAYLIST_H
22#define PLAYLIST_H
23
24#include "PlaylistDBInterface.h"
25
26#include "Utils/Playlist/PlaylistFwd.h"
27#include "Utils/Playlist/PlaylistMode.h"
28
29#include "Utils/Pimpl.h"
30
31#include <QObject>
32
33class PlayManager;
34
35namespace Playlist
36{
37 class Playlist :
38 public QObject,
39 public DBInterface
40 {
41 Q_OBJECT
42 PIMPL(Playlist)
43
44 friend class Handler;
45
46 signals:
47 void sigFindTrackRequested(const MetaData& track);
48 void sigDeleteFilesRequested(const MetaDataList& tracks);
49
50 void sigItemsChanged(int index);
51 void sigTrackChanged(int oldIndex, int newIndex);
52 void sigBusyChanged(bool b);
53 void sigCurrentScannedFileChanged(const QString& currentFile);
54
55 public:
56 explicit Playlist(int playlistIndex, const QString& name, PlayManager* playManager);
57 virtual ~Playlist() override;
58
59 int createPlaylist(const MetaDataList& tracks);
60
61 virtual int currentTrackIndex() const;
62 bool currentTrack(MetaData& track) const;
63 int currentTrackWithoutDisabled() const;
64
65 int index() const;
66 void setIndex(int idx);
67
68 Mode mode() const;
69 void setMode(const Mode& mode);
70
71 MilliSeconds runningTime() const;
72 int count() const;
73
74 void enableAll();
75
76 void play();
77 void stop();
78 void fwd();
79 void bwd();
80 void next();
81 bool wakeUp();
82
83 void setBusy(bool b);
84 bool isBusy() const;
85
86 void reverse();
87 void randomize();
88 void jumpToNextAlbum();
89
90 const MetaData& track(int index) const;
91 const MetaDataList& tracks() const override;
92
93 void insertTracks(const MetaDataList& tracks, int targetRow);
94 void appendTracks(const MetaDataList& tracks);
95 void removeTracks(const IndexSet& indexes);
96 void replaceTrack(int idx, const MetaData& track);
97 void clear();
98
99 IndexSet moveTracks(const IndexSet& indexes, int targetRow);
100 IndexSet copyTracks(const IndexSet& indexes, int targetRow);
101
102 void findTrack(int index);
103 bool changeTrack(int index, MilliSeconds positionMs = 0);
104 bool wasChanged() const override;
105
106 void reloadFromDatabase();
107 void deleteTracks(const IndexSet& indexes);
108
109 public slots:
110 void metadataDeleted();
111 void metadataChanged();
112 void currentMetadataChanged();
113 void durationChanged();
114
115 private slots:
116 void settingPlaylistModeChanged();
117
118 private:
119 void setCurrentTrack(int index);
120 void setChanged(bool b) override;
121 };
122}
123#endif // PLAYLIST_H
The MetaDataList class.
Definition: MetaDataList.h:39
The MetaData class.
Definition: MetaData.h:47
Global handler for current playback state (Singleton)
Definition: PlayManager.h:36
Definition: PlaylistDBInterface.h:34
Global handler for playlists.
Definition: PlaylistHandler.h:56
The Mode class.
Definition: PlaylistMode.h:42
Definition: Playlist.h:40
A set structure. Inherited from std::set with some useful methods. For integer and String this set is...
Definition: Set.h:37