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 #ifndef METADATALIST_H
22 #define METADATALIST_H
23 
24 #include <QList>
25 #include "MetaData.h"
26 #include "Helper/globals.h"
27 
28 #include <functional>
29 
35 class MetaDataInfo;
36 class AlbumInfo;
37 class ArtistInfo;
38 
39 namespace SP {
40  template<typename T>
41  class Set;
42 }
43 
44 class MetaDataList : public QList<MetaData> {
45 
46 private:
47  int _cur_played_track;
48 
49 public:
50 
51  enum class Interpretation : quint8
52  {
53  None=0,
54  Artists,
55  Albums,
56  Tracks
57  };
58 
59  MetaDataList();
60  MetaDataList(const MetaDataList&);
61 
62  virtual ~MetaDataList();
63 
64  void set_cur_play_track(int idx);
65  void set_cur_play_track_idx_only(int idx);
66  int get_cur_play_track() const;
67 
68 
69  virtual bool contains(const MetaData& md) const;
70  MetaDataList& remove_track(int idx);
71  MetaDataList& remove_tracks(const SP::Set<int>& rows);
72  MetaDataList& remove_tracks(int first, int last);
73 
74  MetaDataList& move_tracks(const SP::Set<int>& indexes, int tgt_idx);
75  MetaDataList& copy_tracks(const SP::Set<int>& indexes, int tgt_idx);
76  MetaDataList& insert_tracks(const MetaDataList& v_md, int tgt_idx);
77  MetaDataList& randomize();
78 
79  MetaDataList extract_tracks(std::function<bool (const MetaData& md)> func) const;
80  //MetaDataList extract_tracks(const IdxList& idx_list) const;
81  MetaDataList extract_tracks(const SP::Set<int>& idx_list) const;
82 
83  IdxList findTracks(int id) const;
84  IdxList findTracks(const QString&) const;
85 
86  QStringList toStringList() const;
87 
88  MetaDataList& operator <<(const MetaDataList& v_md);
89  MetaDataList& operator <<(const MetaData& md);
90 
91  bool contains(qint32 id) const;
92 
93 };
94 
95 
96 #endif // METADATALIST_H
Definition: MetaDataList.h:39
Definition: MetaData.h:49
Definition: MetaDataList.h:44
Definition: ArtistInfo.h:33
Set namespace defines the setting: Which key and which type.
Definition: SettingKey.h:177
The MetaDataInfo class.
Definition: MetaDataInfo.h:56
The AlbumInfo class.
Definition: AlbumInfo.h:33
Definition: org_mpris_media_player2_adaptor.h:20