Music Hub ..
A session-wide music playback service
 
Loading...
Searching...
No Matches
track_list_skeleton.h
Go to the documentation of this file.
1/*
2 * Copyright © 2013 Canonical Ltd.
3 * Copyright © 2022 UBports Foundation.
4 *
5 * Contact: Alberto Mardegan <mardy@users.sourceforge.net>
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License version 3,
9 * as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 * Authored by: Thomas Voß <thomas.voss@canonical.com>
20 */
21#ifndef LOMIRI_MEDIAHUBSERVICE_TRACK_LIST_SKELETON_H
22#define LOMIRI_MEDIAHUBSERVICE_TRACK_LIST_SKELETON_H
23
24#include "apparmor/lomiri.h"
25
26#include <QDBusContext>
27#include <QDBusObjectPath>
28#include <QList>
29#include <QObject>
30#include <QScopedPointer>
31#include <QStringList>
32#include <QMap>
33
34class QDBusConnection;
35
36namespace lomiri
37{
38namespace MediaHubService
39{
40
41class TrackListImplementation;
42
43class TrackListSkeletonPrivate;
44class TrackListSkeleton: public QObject, protected QDBusContext
45{
46 Q_OBJECT
47 Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2.TrackList")
48 // FIXME: this should be QDBusObjectPath, and not QString!
49 Q_PROPERTY(QStringList Tracks READ tracks)
50 Q_PROPERTY(bool CanEditTracks READ canEditTracks)
51
52public:
53 TrackListSkeleton(const QDBusConnection &bus,
54 const lomiri::MediaHubService::apparmor::lomiri::RequestContextResolver::Ptr& request_context_resolver,
55 const lomiri::MediaHubService::apparmor::lomiri::RequestAuthenticator::Ptr& request_authenticator,
57 QObject *parent = nullptr);
59
60 QStringList tracks() const;
61 bool canEditTracks() const;
62
63public Q_SLOTS:
64 // FIXME: these should all be QDBusObjectPath, and not QStrings!
65 // FIXME: this should take a list, not just a single track;
66 // and it should return an aa{sv}, not a{ss}
67 QMap<QString,QString> GetTracksMetadata(const QString &id);
68 void AddTrack(const QString &uri, const QString &after, bool makeCurrent);
69 void RemoveTrack(const QString &id);
70 void GoTo(const QString &id);
71
72 // Not in MPRIS:
73 QString GetTracksUri(const QString &id);
74 void AddTracks(const QStringList &uris, const QString &after);
75 void MoveTrack(const QString &id, const QString &to);
76 void Reset();
77
78Q_SIGNALS:
79 // FIXME: these should all be QDBusObjectPath, and not QStrings!
80 Q_SCRIPTABLE void TrackListReplaced(const QStringList &tracks,
81 const QString &currentTrack);
82 // FIXME: For this reason the signature of this signal does not
83 // match the MPRIS specification: the metadata is missing.
84 Q_SCRIPTABLE void TrackAdded(const QString &id);
85 Q_SCRIPTABLE void TrackRemoved(const QString &id);
86 // FIXME: the order of parameters is incorrect!
87 Q_SCRIPTABLE void TrackMetadataChanged(const QVariantMap &metadata,
88 const QDBusObjectPath &path);
89
90 // Not in MPRIS:
91 Q_SCRIPTABLE void TracksAdded(const QStringList &trackURIs);
92 Q_SCRIPTABLE void TrackMoved(const QString &id, const QString &to);
93 Q_SCRIPTABLE void TrackChanged(const QString &id);
94 Q_SCRIPTABLE void TrackListReset();
95
96private:
97 Q_DECLARE_PRIVATE(TrackListSkeleton)
98 QScopedPointer<TrackListSkeletonPrivate> d_ptr;
99};
100
101}
102}
103
104#endif // LOMIRI_MEDIAHUBSERVICE_PROPERTY_H
void AddTracks(const QStringList &uris, const QString &after)
Q_SCRIPTABLE void TrackListReplaced(const QStringList &tracks, const QString &currentTrack)
QMap< QString, QString > GetTracksMetadata(const QString &id)
Q_SCRIPTABLE void TrackMoved(const QString &id, const QString &to)
Q_SCRIPTABLE void TrackAdded(const QString &id)
Q_SCRIPTABLE void TrackMetadataChanged(const QVariantMap &metadata, const QDBusObjectPath &path)
void AddTrack(const QString &uri, const QString &after, bool makeCurrent)
Q_SCRIPTABLE void TrackChanged(const QString &id)
void MoveTrack(const QString &id, const QString &to)
Q_SCRIPTABLE void TrackRemoved(const QString &id)
Q_SCRIPTABLE void TracksAdded(const QStringList &trackURIs)