Qmmp
trackinfo.h
1 /***************************************************************************
2  * Copyright (C) 2018 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 #ifndef TRACKINFO_H
21 #define TRACKINFO_H
22 
23 #include <QMap>
24 #include <QString>
25 #include <QVariant>
26 #include "qmmp.h"
27 
31 class QMMP_EXPORT TrackInfo
32 {
33 public:
37  TrackInfo();
41  TrackInfo(const QString &path);
45  TrackInfo(const TrackInfo &other);
49  ~TrackInfo();
53  enum Part
54  {
55  NoParts = 0x0,
56  MetaData = 0x1,
57  Properties = 0x2,
58  ReplayGainInfo = 0x4,
59  AllParts = MetaData | Properties | ReplayGainInfo
60  };
61 
62  Q_DECLARE_FLAGS(Parts, Part)
66  TrackInfo &operator=(const TrackInfo &info);
70  bool operator==(const TrackInfo &info) const;
74  bool operator!=(const TrackInfo &info) const;
78  qint64 duration () const;
82  bool isEmpty() const;
86  const QString path() const;
90  const QString value(Qmmp::MetaData key) const;
94  const QString value(Qmmp::TrackProperty key) const;
98  double value(Qmmp::ReplayGainKey key) const;
102  const QMap<Qmmp::MetaData, QString> &metaData() const;
106  const QMap<Qmmp::TrackProperty, QString> &properties() const;
110  const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo() const;
114  Parts parts() const;
118  void setDuration(qint64 duration);
122  void setValue(Qmmp::MetaData key, const QVariant &value);
126  void setValue(Qmmp::TrackProperty key, const QVariant &value);
130  void setValue(Qmmp::ReplayGainKey key, double value);
134  void setValue(Qmmp::ReplayGainKey key, const QString &value);
138  void setValues(const QMap<Qmmp::MetaData, QString> &metaData);
142  void setValues(const QMap<Qmmp::TrackProperty, QString> &properties);
146  void setValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
150  void updateValues(const QMap<Qmmp::MetaData, QString> &metaData);
154  void updateValues(const QMap<Qmmp::TrackProperty, QString> &properties);
158  void updateValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
162  void setPath(const QString &path);
166  void clear(Parts parts);
170  void clear();
171 
172 private:
173  QMap<Qmmp::MetaData, QString> m_metaData;
174  QMap<Qmmp::TrackProperty, QString> m_properties;
175  QMap<Qmmp::ReplayGainKey, double> m_replayGainInfo;
176  Parts m_parts;
177  QString m_path;
178  qint64 m_duration;
179 };
180 
181 Q_DECLARE_OPERATORS_FOR_FLAGS(TrackInfo::Parts)
182 
183 
184 #endif
MetaData
Definition: qmmp.h:64
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:31
ReplayGainKey
Definition: qmmp.h:95
Part
Definition: trackinfo.h:53
TrackProperty
Definition: qmmp.h:81