Qmmp
groupedcontainer_p.h
1 /***************************************************************************
2  * Copyright (C) 2013-2015 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 GROUPEDCONTAINER_P_H
22 #define GROUPEDCONTAINER_P_H
23 
24 #include "playlistcontainer_p.h"
25 
30 class GroupedContainer : public PlayListContainer
31 {
32 public:
33  GroupedContainer();
34 
35  virtual ~GroupedContainer();
36 
37  void addTrack(PlayListTrack *track) override;
38  void addTracks(const QList<PlayListTrack *> &tracks) override;
39  void insertTrack(int index, PlayListTrack *track) override;
40  void replaceTracks(const QList<PlayListTrack *> &tracks) override;
41  QList<PlayListGroup *> groups() const override;
42  QList<PlayListTrack *> tracks() const override;
43  QList<PlayListItem *> items() const override;
44  int count() const override;
45  int trackCount() const override;
46  QList<PlayListItem *> mid(int pos, int count) const override;
47  bool isEmpty() const override;
48  bool isSelected(int index) const override;
49  void setSelected(int index, bool selected) override;
50  void clearSelection() override;
51  int indexOf(PlayListItem *item) const override;
52  PlayListItem *item(int index) const override;
53  PlayListTrack *track(int index) const override;
54  PlayListGroup *group(int index) const override;
55  bool contains(PlayListItem *item) const override;
56  int indexOfTrack(int index) const override;
57  PlayListTrack *findTrack(int number) const override;
58  void removeTrack(PlayListTrack *track) override;
59  void removeTracks(QList<PlayListTrack *> tracks) override;
60  bool move(const QList<int> &indexes, int from, int to) override;
61  QList<PlayListTrack *> takeAllTracks() override;
62  void clear() override;
63 
64  void reverseList() override;
65  void randomizeList() override;
66 
67 private:
68  void updateCache() const;
69  QList<PlayListGroup *> m_groups;
70 
71  mutable QList<PlayListItem *> m_items;
72  mutable bool m_update;
73 
74 };
75 
76 #endif // GROUPEDCONTAINER_P_H
The PlayListItem class provides an item for use with the PlayListModel class.
Definition: playlistitem.h:31
The PlayListTrack class provides a group for use with the PlayListModel class.
Definition: playlistgroup.h:33
The PlayListTrack class provides a track for use with the PlayListModel class.
Definition: playlisttrack.h:36