Changeset View
Changeset View
Standalone View
Standalone View
mpris2/mprismediaplayer2.h
- This file was added.
1 | /*************************************************************************** | ||||
---|---|---|---|---|---|
2 | * Copyright 2018 Friedrich W. H. Kossebau <kossebau@kde.org> * | ||||
3 | * * | ||||
4 | * This program is free software; you can redistribute it and/or modify * | ||||
5 | * it under the terms of the GNU General Public License as published by * | ||||
6 | * the Free Software Foundation; either version 2 of the License, or * | ||||
7 | * (at your option) any later version. * | ||||
8 | ***************************************************************************/ | ||||
9 | | ||||
10 | #ifndef MPRISMEDIAPLAYER2_H | ||||
11 | #define MPRISMEDIAPLAYER2_H | ||||
12 | | ||||
13 | #include "dbusabstractadaptor.h" | ||||
14 | // Qt | ||||
15 | #include <QStringList> | ||||
16 | | ||||
17 | class QAction; | ||||
18 | | ||||
19 | namespace Okular | ||||
20 | { | ||||
21 | | ||||
22 | // https://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html | ||||
23 | class MprisMediaPlayer2 : public DBusAbstractAdaptor | ||||
24 | { | ||||
25 | Q_OBJECT | ||||
26 | Q_CLASSINFO("D-Bus Interface", "org.mpris.MediaPlayer2") | ||||
27 | | ||||
28 | Q_PROPERTY(bool CanQuit READ canQuit CONSTANT) | ||||
29 | Q_PROPERTY(bool CanRaise READ canRaise CONSTANT) | ||||
30 | Q_PROPERTY(bool CanSetFullscreen READ canSetFullscreen CONSTANT) | ||||
31 | | ||||
32 | Q_PROPERTY(QString Identity READ identity CONSTANT) | ||||
33 | Q_PROPERTY(QString DesktopEntry READ desktopEntry CONSTANT) | ||||
34 | | ||||
35 | Q_PROPERTY(bool HasTrackList READ hasTrackList CONSTANT) | ||||
36 | | ||||
37 | Q_PROPERTY(QStringList SupportedUriSchemes READ supportedUriSchemes CONSTANT) | ||||
38 | Q_PROPERTY(QStringList SupportedMimeTypes READ supportedMimeTypes CONSTANT) | ||||
39 | | ||||
40 | public: | ||||
41 | MprisMediaPlayer2(const QString &objectDBusPath, | ||||
42 | QObject *parent); | ||||
43 | ~MprisMediaPlayer2() override; | ||||
44 | | ||||
45 | public Q_SLOTS: // D-Bus API | ||||
46 | void Quit(); | ||||
47 | void Raise(); | ||||
48 | | ||||
49 | private: | ||||
50 | bool canQuit() const; | ||||
51 | bool canRaise() const; | ||||
52 | bool canSetFullscreen() const; | ||||
53 | bool hasTrackList() const; | ||||
54 | | ||||
55 | QString identity() const; | ||||
56 | QString desktopEntry() const; | ||||
57 | | ||||
58 | QStringList supportedUriSchemes() const; | ||||
59 | QStringList supportedMimeTypes() const; | ||||
60 | | ||||
61 | private: | ||||
62 | }; | ||||
63 | | ||||
64 | } | ||||
65 | | ||||
66 | #endif |