Sayonara Player
MetaDataList.h
1 /* MetaDataList.h */
2 
3 /* Copyright (C) 2011-2016 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 
22 
23 #ifndef METADATALIST_H
24 #define METADATALIST_H
25 
26 #include <QVector>
27 #include "MetaData.h"
28 #include "Helper/globals.h"
29 
30 #include <functional>
31 
37 class MetaDataInfo;
38 class AlbumInfo;
39 class ArtistInfo;
40 
41 namespace SP {
42  template<typename T>
43  class Set;
44 }
45 
46 class MetaDataList : public QVector<MetaData> {
47 
48 private:
49  int _cur_played_track;
50 
51 public:
52 
53  MetaDataList();
54  MetaDataList(const MetaDataList&);
55  MetaDataList(int n_elems);
56 
57  virtual ~MetaDataList();
58 
59  void set_cur_play_track(int idx);
60  void set_cur_play_track_idx_only(int idx);
61  int get_cur_play_track() const;
62 
63 
64  virtual bool contains(const MetaData& md) const;
65  MetaDataList& remove_track(int idx);
66  MetaDataList& remove_tracks(const SP::Set<int>& rows);
67 
68  MetaDataList& move_tracks(const SP::Set<int>& indexes, int tgt_idx);
69  MetaDataList& insert_tracks(const MetaDataList& v_md, int tgt_idx);
70  MetaDataList& randomize();
71 
72  MetaDataList extract_tracks(std::function<bool (const MetaData& md)> func) const;
73  //MetaDataList extract_tracks(const IdxList& idx_list) const;
74  MetaDataList extract_tracks(const SP::Set<int>& idx_list) const;
75 
76  IdxList findTracks(int id) const;
77  IdxList findTracks(const QString&) const;
78 
79  QStringList toStringList() const;
80 
81  MetaDataList& operator <<(const MetaDataList& v_md);
82  MetaDataList& operator <<(const MetaData& md);
83 
84  bool contains(qint32 id) const;
85 
86 };
87 
88 
89 #endif // METADATALIST_H
Definition: MetaDataList.h:41
Definition: MetaData.h:49
Definition: MetaDataList.h:46
Definition: ArtistInfo.h:33
Set namespace defines the setting: Which key and which type.
Definition: SettingKey.h:173
The MetaDataInfo class.
Definition: MetaDataInfo.h:59
The AlbumInfo class.
Definition: AlbumInfo.h:33