Qmmp
trackinfo.h
1 /***************************************************************************
2  * Copyright (C) 2018-2022 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:
41  TrackInfo(const QString &path);
45  TrackInfo(const TrackInfo &other);
53  enum Part
54  {
55  MetaData = 0x1,
56  Properties = 0x2,
57  ReplayGainInfo = 0x4,
58  AllParts = MetaData | Properties | ReplayGainInfo
59  };
60 
61  Q_DECLARE_FLAGS(Parts, Part)
65  TrackInfo &operator=(const TrackInfo &info);
69  bool operator==(const TrackInfo &info) const;
73  bool operator!=(const TrackInfo &info) const;
77  qint64 duration () const;
81  bool isEmpty() const;
85  const QString &path() const;
89  const QString value(Qmmp::MetaData key) const;
93  const QString value(Qmmp::TrackProperty key) const;
97  double value(Qmmp::ReplayGainKey key) const;
101  const QMap<Qmmp::MetaData, QString> &metaData() const;
105  const QMap<Qmmp::TrackProperty, QString> &properties() const;
109  const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo() const;
113  Parts parts() const;
117  void setDuration(qint64 duration);
121  void setValue(Qmmp::MetaData key, const QVariant &value);
125  void setValue(Qmmp::MetaData key, const char *value);
129  void setValue(Qmmp::TrackProperty key, const QVariant &value);
133  void setValue(Qmmp::TrackProperty key, const char *value);
137  void setValue(Qmmp::ReplayGainKey key, double value);
141  void setValue(Qmmp::ReplayGainKey key, const QString &value);
145  void setValues(const QMap<Qmmp::MetaData, QString> &metaData);
149  void setValues(const QMap<Qmmp::TrackProperty, QString> &properties);
153  void setValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
157  void updateValues(const QMap<Qmmp::MetaData, QString> &metaData);
161  void updateValues(const QMap<Qmmp::TrackProperty, QString> &properties);
165  void updateValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
169  void setPath(const QString &path);
173  void clear(Parts parts);
177  void clear();
178 
179 private:
180  QMap<Qmmp::MetaData, QString> m_metaData;
181  QMap<Qmmp::TrackProperty, QString> m_properties;
182  QMap<Qmmp::ReplayGainKey, double> m_replayGainInfo;
183  Parts m_parts = Parts();
184  QString m_path;
185  qint64 m_duration = 0;
186 };
187 
188 Q_DECLARE_OPERATORS_FOR_FLAGS(TrackInfo::Parts)
189 
190 
191 #endif
The Qmmp class stores global settings and enums.
Definition: qmmp.h:47
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:32
Part
Definition: trackinfo.h:54
TrackInfo(const QString &path)
TrackInfo(const TrackInfo &other)