TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
trackinfo.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2018-2024 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 
21 #ifndef TRACKINFO_H
22 #define TRACKINFO_H
23 
24 #include <QMap>
25 #include <QVariant>
26 #include "qmmp.h"
27 #include "regularexpression.h"
28 
33 {
34 public:
38  TrackInfo() = default;
42  explicit TrackInfo(const QString &path);
46  TrackInfo(const TrackInfo &other);
47 
51  enum Part
52  {
53  MetaData = 0x1,
54  Properties = 0x2,
55  ReplayGainInfo = 0x4,
56  AllParts = MetaData | Properties | ReplayGainInfo
57  };
58 
59  Q_DECLARE_FLAGS(Parts, Part)
63  TrackInfo &operator=(const TrackInfo &info);
67  bool operator==(const TrackInfo &info) const;
71  bool operator!=(const TrackInfo &info) const;
75  qint64 duration() const;
79  bool isEmpty() const;
83  const QString &path() const;
87  const QString value(Qmmp::MetaData key) const;
91  const QString value(Qmmp::TrackProperty key) const;
95  double value(Qmmp::ReplayGainKey key) const;
99  const QMap<Qmmp::MetaData, QString> &metaData() const;
103  const QMap<Qmmp::TrackProperty, QString> &properties() const;
107  const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo() const;
111  Parts parts() const;
115  void setDuration(qint64 duration);
119  void setValue(Qmmp::MetaData key, const QVariant &value);
123  void setValue(Qmmp::TrackProperty key, const QVariant &value);
127  void setValue(Qmmp::ReplayGainKey key, double value);
131  void setValue(Qmmp::ReplayGainKey key, const QString &value);
135  void setValues(const QMap<Qmmp::MetaData, QString> &metaData);
139  void setValues(const QMap<Qmmp::TrackProperty, QString> &properties);
143  void setValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
147  void updateValues(const QMap<Qmmp::MetaData, QString> &metaData);
151  void updateValues(const QMap<Qmmp::TrackProperty, QString> &properties);
155  void updateValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
159  void setPath(const QString &path);
163  void clear(Parts parts);
167  void clear();
168 
169 private:
170  QMap<Qmmp::MetaData, QString> m_metaData;
171  QMap<Qmmp::TrackProperty, QString> m_properties;
172  QMap<Qmmp::ReplayGainKey, double> m_replayGainInfo;
173  Parts m_parts = Parts();
174  QString m_path;
175  qint64 m_duration = 0;
176 
177 };
178 
179 Q_DECLARE_OPERATORS_FOR_FLAGS(TrackInfo::Parts)
180 
181 
182 #endif
static constexpr wchar_t key[]
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:32
#define QMMP_EXPORT
Definition: qmmp_export.h:29
#define const
Definition: zconf.h:233
The Qmmp class stores global settings and enums.
Definition: qmmp.h:70