Qmmp
Loading...
Searching...
No Matches
playlistcontainer_p.h
1/***************************************************************************
2 * Copyright (C) 2013-2022 by Ilya Kotov *
3 * forkotov02@ya.ru *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
20
21#ifndef PLAYLISTCONTAINER_P_H
22#define PLAYLISTCONTAINER_P_H
23
24#include <QList>
25#include <QQueue>
26#include "playlistitem.h"
27#include "playlisttrack.h"
28#include "playlistgroup.h"
29
30
36class PlayListContainer
37{
38public:
39 PlayListContainer(){}
40 virtual ~PlayListContainer(){}
41
42 virtual void addTrack(PlayListTrack *track);
43 virtual void addTracks(const QList<PlayListTrack *> &tracks) = 0;
44 virtual int insertTrack(int index, PlayListTrack *track) = 0;
45 virtual void replaceTracks(const QList<PlayListTrack *> &tracks) = 0;
46 virtual QList<PlayListGroup *> groups() const = 0;
47 virtual const QList<PlayListItem *> &items() const = 0;
48 virtual QList<PlayListTrack *> tracks() const = 0;
49 virtual int count() const = 0;
50 virtual int trackCount() const = 0;
51 virtual QList<PlayListItem *> mid(int pos, int count) const = 0;
52 virtual bool isEmpty() const = 0;
53 virtual bool isSelected(int index) const = 0;
54 virtual void setSelected(int index, bool selected) = 0;
55 virtual void clearSelection() = 0;
56 virtual int indexOf(PlayListItem *item) const = 0;
57 virtual PlayListItem *item(int index) const = 0;
58 virtual PlayListTrack *track(int index) const = 0;
59 virtual PlayListGroup *group(int index) const = 0;
60 virtual bool contains(PlayListItem *item) const = 0;
61 virtual int indexOfTrack(int index) const = 0;
62 virtual PlayListTrack *findTrack(int number) const = 0;
63 virtual void removeTrack(PlayListTrack *track) = 0;
64 virtual void removeTracks(QList<PlayListTrack *> tracks) = 0;
65 virtual bool move(const QList<int> &indexes, int from, int to) = 0;
66 virtual QList<PlayListTrack *> takeAllTracks() = 0;
67 virtual void clear() = 0;
68
69 virtual void reverseList() = 0;
70 virtual void randomizeList() = 0;
71
72 PlayListTrack *dequeue();
73 void enqueue(PlayListTrack *track);
74 void removeFromQueue(PlayListTrack *track);
75 void clearQueue();
76 void restoreQueue(const QList<PlayListTrack *> &tracks);
77 const QList<PlayListTrack *> &queuedTracks() const;
78
79protected:
80 void swapTrackNumbers(QList<PlayListItem *> *container, int index1, int index2);
81
82private:
83 void updateQueueIndexes();
84 QQueue<PlayListTrack *> m_queue;
85};
86
87#endif // PLAYLISTCONTAINER_P_H
The PlayListTrack class provides a group for use with the PlayListModel class.
Definition playlistgroup.h:34
The PlayListItem class provides an item for use with the PlayListModel class.
Definition playlistitem.h:32
The PlayListTrack class provides a track for use with the PlayListModel class.
Definition playlisttrack.h:37