Music Hub ..
A session-wide music playback service
 
Loading...
Searching...
No Matches
track.h
Go to the documentation of this file.
1/*
2 * Copyright © 2021-2022 UBports Foundation.
3 *
4 * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License version 3,
8 * as published by the Free Software Foundation.
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 Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LOMIRI_MEDIAHUB_TRACK_H
20#define LOMIRI_MEDIAHUB_TRACK_H
21
22#include "global.h"
23
24#include <QSharedData>
25#include <QSharedDataPointer>
26#include <QUrl>
27#include <QVariantMap>
28
29namespace lomiri {
30namespace MediaHub {
31
32class Track;
33
35{
36public:
37 TrackData(const QUrl &uri): m_uri(uri) {}
38
39private:
40 friend class Track;
41 QUrl m_uri;
42};
43
45{
46public:
47 struct MetaData: public QVariantMap
48 {
49 public:
50 using QVariantMap::QVariantMap;
51 MetaData(const QVariantMap &map = {}): QVariantMap(map) {}
52 static constexpr const char* TrackArtlUrlKey = "mpris:artUrl";
53 static constexpr const char* TrackLengthKey = "mpris:length";
54 static constexpr const char* TrackIdKey = "mpris:trackid";
55 };
56
57 Track(const QUrl &uri = QUrl()): d(new TrackData(uri)) {}
58
59 QUrl uri() const { return d->m_uri; }
60
61private:
62 QSharedDataPointer<TrackData> d;
63};
64
65} // namespace MediaHub
66} // namespace lomiri
67
68Q_DECLARE_METATYPE(lomiri::MediaHub::Track::MetaData)
69
70#endif // LOMIRI_MEDIAHUB_TRACK_H
TrackData(const QUrl &uri)
Definition track.h:37
QUrl uri() const
Definition track.h:59
Track(const QUrl &uri=QUrl())
Definition track.h:57
#define MH_EXPORT
Definition global.h:27
MetaData(const QVariantMap &map={})
Definition track.h:51