Qmmp
Loading...
Searching...
No Matches
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
31class QMMP_EXPORT TrackInfo
32{
33public:
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::TrackProperty key, const QVariant &value);
129 void setValue(Qmmp::ReplayGainKey key, double value);
133 void setValue(Qmmp::ReplayGainKey key, const QString &value);
137 void setValues(const QMap<Qmmp::MetaData, QString> &metaData);
141 void setValues(const QMap<Qmmp::TrackProperty, QString> &properties);
145 void setValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
149 void updateValues(const QMap<Qmmp::MetaData, QString> &metaData);
153 void updateValues(const QMap<Qmmp::TrackProperty, QString> &properties);
157 void updateValues(const QMap<Qmmp::ReplayGainKey, double> &replayGainInfo);
161 void setPath(const QString &path);
165 void clear(Parts parts);
169 void clear();
170
171private:
172 QMap<Qmmp::MetaData, QString> m_metaData;
173 QMap<Qmmp::TrackProperty, QString> m_properties;
174 QMap<Qmmp::ReplayGainKey, double> m_replayGainInfo;
175 Parts m_parts = Parts();
176 QString m_path;
177 qint64 m_duration = 0;
178};
179
180Q_DECLARE_OPERATORS_FOR_FLAGS(TrackInfo::Parts)
181
182
183#endif
The Qmmp class stores global settings and enums.
Definition qmmp.h:56
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)