Sayonara Player
MetaDataInfo.h
1 /* MetaDataInfo.h */
2 
3 /* Copyright (C) 2011-2017 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 METADATAINFO_H
22 #define METADATAINFO_H
23 
24 #include "Helper/Set.h"
25 #include "Helper/Settings/SayonaraClass.h"
26 #include "Helper/typedefs.h"
27 
28 #include "Components/Covers/CoverLocation.h"
29 
30 #include <QMap>
31 #include <QObject>
32 #include <QStringList>
33 
34 class MetaDataList;
35 class LibraryDatabase;
36 
41 enum class InfoStrings : quint8
42 {
43  nTracks=0, // set by MetaDataInfo
44  nAlbums, // set by ArtistInfo, AlbumInfo
45  nArtists, // set by ArtistInfo, AlbumInfo
46  Filesize, // set by MetaDataInfo
47  PlayingTime, // set by MetaDataInfo
48  Year, // set by MetaDataInfo
49  Sampler, // set by AlbumInfo
50  Bitrate, // set by MetaDataInfo
51  Genre // set by MetaDataInfo
52 };
53 
54 
59 class MetaDataInfo :
60  public QObject,
61  protected SayonaraClass
62 {
63 private:
64  void set_cover_location(const MetaDataList& lst);
65  void set_subheader(quint16 tracknum);
66  void set_header(const MetaDataList& lst);
67 
68  QString get_info_string(InfoStrings idx) const;
69 
70 protected:
71 
72  QString _header;
73  QString _subheader;
75  QMap<QString, QString> _additional_info;
76  QStringList _paths;
77  CoverLocation _cover_location;
78 
79  SP::Set<QString> _albums;
80  SP::Set<QString> _artists;
81  SP::Set<QString> _album_artists;
82  SP::Set<AlbumID> _album_ids;
83  SP::Set<ArtistID> _artist_ids;
84  SP::Set<ArtistID> _album_artist_ids;
85 
86 
87  LibraryDatabase* _db=nullptr;
88 
89  QString calc_tracknum_str( quint16 tracknum );
90  QString calc_artist_str() const;
91  QString calc_album_str();
92 
93  virtual void set_cover_location();
94  virtual void set_subheader();
95  virtual void set_header();
96 
97  void insert_playing_time(quint64 ms);
98  void insert_genre(const QStringList& lst);
99  void insert_filesize(quint64 filesize);
100 
101  void insert_interval(InfoStrings key, int min, int max);
102  void insert_number(InfoStrings key, int number);
103 
104 
105  public:
106 
107  explicit MetaDataInfo(const MetaDataList& v_md);
108  virtual ~MetaDataInfo();
109 
110  QString get_header() const;
111  QString get_subheader() const;
112  QString get_info_as_string() const;
113  virtual QString get_additional_info_as_string() const;
114  QString get_paths_as_string() const;
115  CoverLocation get_cover_location() const;
116 };
117 
118 #endif // METADATAINFO_H
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:29
Definition: MetaDataList.h:39
The CoverLocation class.
Definition: CoverLocation.h:37
The MetaDataInfo class.
Definition: MetaDataInfo.h:59
Definition: LibraryDatabase.h:30
InfoStrings
The InfoStrings enum.
Definition: MetaDataInfo.h:41
Definition: Genre.h:29