Music Hub ..
A session-wide music playback service
 
Loading...
Searching...
No Matches
track_list.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_LIST_H
20#define LOMIRI_MEDIAHUB_TRACK_LIST_H
21
22#include "global.h"
23#include "track.h"
24
25#include <QObject>
26#include <QScopedPointer>
27#include <QVector>
28
29namespace lomiri {
30namespace MediaHub {
31
32class PlayerPrivate;
33
34class TrackListPrivate;
36{
37 Q_OBJECT
38 Q_DISABLE_COPY(TrackList)
39
40public:
41 TrackList(QObject *parent = nullptr);
43
45 Q_PROPERTY(bool canEditTracks READ canEditTracks
46 NOTIFY canEditTracksChanged)
47 Q_PROPERTY(int currentTrack READ currentTrack WRITE goTo
48 NOTIFY currentTrackChanged)
49
50 const QVector<Track> &tracks() const;
51
52 bool canEditTracks() const;
53 int currentTrack() const;
54
55 /*
56 * Unused:
57 * - query_meta_data_for_track()
58 * - query_uri_for_track() (can use `tracks()[index].url()`)
59 * - has_next()
60 * - has_previous()
61 * - next()
62 * - previous()
63 * - on_track_list_replaced() // Never emitted by the service
64 *
65 * FIXME: remove this comment?
66 * We don't want to allow other processes to modify our own playlist, and
67 * QtMultimedia does not provide a way to track another process's playlist.
68 * Therefore it looks like we can get away without all them.
69 */
70
72 void addTrackWithUriAt(const QUrl &uri, int position, bool makeCurrent);
73
75 void addTracksWithUriAt(const QVector<QUrl> &uris, int position);
76
78 void moveTrack(int index, int to);
79
81 void removeTrack(int index);
82
84 void goTo(int index);
85
87 void reset();
88
89Q_SIGNALS:
90 void canEditTracksChanged();
91 void currentTrackChanged(); // D-Bus: TrackChanged
92
93 void tracksAdded(int start, int end);
94 void trackRemoved(int index);
95 void trackMoved(int index, int to);
96 void trackListReset();
97
98private:
99 friend class PlayerPrivate;
100 Q_DECLARE_PRIVATE(TrackList)
101 QScopedPointer<TrackListPrivate> d_ptr;
102};
103
104} // namespace MediaHub
105} // namespace lomiri
106
107#endif // LOMIRI_MEDIAHUB_TRACK_LIST_H
#define MH_EXPORT
Definition global.h:27