Qmmp
Loading...
Searching...
No Matches
trackinfo.h
1/***************************************************************************
2 * Copyright (C) 2018-2025 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);
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();
182 static QString pathFromUrl(const QString &url, int *track = nullptr);
183
184private:
185 QMap<Qmmp::MetaData, QString> m_metaData;
186 QMap<Qmmp::TrackProperty, QString> m_properties;
187 QMap<Qmmp::ReplayGainKey, double> m_replayGainInfo;
188 Parts m_parts = Parts();
189 QString m_path;
190 qint64 m_duration = 0;
191};
192
193Q_DECLARE_OPERATORS_FOR_FLAGS(TrackInfo::Parts)
194
195
196#endif
const QMap< Qmmp::TrackProperty, QString > & properties() const
void setValue(Qmmp::MetaData key, const QVariant &value)
void clear(Parts parts)
Part
Definition trackinfo.h:54
@ MetaData
Definition trackinfo.h:55
@ Properties
Definition trackinfo.h:56
@ ReplayGainInfo
Definition trackinfo.h:57
@ AllParts
Definition trackinfo.h:58
const QString & path() const
void updateValues(const QMap< Qmmp::MetaData, QString > &metaData)
const QMap< Qmmp::MetaData, QString > & metaData() const
qint64 duration() const
const QMap< Qmmp::ReplayGainKey, double > & replayGainInfo() const
bool isEmpty() const
TrackInfo(const QString &path)
Parts parts() const
void setValues(const QMap< Qmmp::MetaData, QString > &metaData)
void setDuration(qint64 duration)
TrackInfo(const TrackInfo &other)
const QString value(Qmmp::MetaData key) const
static QString pathFromUrl(const QString &url, int *track=nullptr)
void setPath(const QString &path)