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);
38  void addTracks(QList<PlayListTrack *> tracks);
39  void insertTrack(int index, PlayListTrack *track);
40  void replaceTracks(QList<PlayListTrack *> tracks);
41  QList<PlayListGroup *> groups() const;
42  QList<PlayListTrack *> tracks() const;
43  QList<PlayListItem *> items() const;
44  int count() const;
45  int trackCount() const;
46  QList<PlayListItem *> mid(int pos, int count) const;
47  bool isEmpty() const;
48  bool isSelected(int index) const;
49  void setSelected(int index, bool selected);
50  void clearSelection();
51  int indexOf(PlayListItem *item) const;
52  PlayListItem *item(int index) const;
53  PlayListTrack *track(int index) const;
54  PlayListGroup *group(int index) const;
55  bool contains(PlayListItem *item) const;
56  int indexOfTrack(int index) const;
57  PlayListTrack *findTrack(int number) const;
58  void removeTrack(PlayListTrack *track);
59  void removeTracks(QList<PlayListTrack *> tracks);
60  bool move(QList<int> indexes, int from, int to);
61  QList<PlayListTrack *> takeAllTracks();
62  void clear();
63 
64  void reverseList();
65  void randomizeList();
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:32
The PlayListTrack class provides a track for use with the PlayListModel class.
Definition: playlisttrack.h:36