aboutsummaryrefslogtreecommitdiff
path: root/mpris-plugin/qmpmprisimpl.hpp
blob: b9dec93a34d5f1f40934589b3cc34bf223a2fb14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#ifndef QMPMPRISIMPL_HPP
#define QMPMPRISIMPL_HPP

#include "qmprisdbusinterface.hpp"

class qmpPluginAPI;
class qmpMainWindow;

class QMPPlayer : public QMPrisPlayer
{
public:
    explicit QMPPlayer(qmpPluginAPI *_api, QObject *parent=nullptr);

    QString getPlaybackStatus();
    QString getLoopStatus();
    double getRate();
    bool getShuffle();
    QVariantMap getMetadata();
    //double getVolume();
    qlonglong getPosition();
    //double getMinimumRate();
    //double getMaximumRate();
    bool getCanGoNext();
    bool getCanGoPrevious();
    bool getCanPlay();
    bool getCanPause();
    bool getCanSeek();
    bool getCanControl();

    void Pause();
    void PlayPause();
    void Stop();
    void Play();
    void Next();
    void Previous();
    void Seek(qlonglong t);
    void SetPosition(QDBusObjectPath o, qlonglong t);
private:
    qmpPluginAPI *api;
    qmpMainWindow *qmw;
};

class QMPTrackList : public QMPrisTrackList
{
public:
    explicit QMPTrackList(qmpPluginAPI *_api, QObject *parent=nullptr);

    QList<QVariantMap> GetTracksMetaData(QList<QDBusObjectPath> trackIds);
    QList<QDBusObjectPath> getTracks();
private:
    qmpPluginAPI *api;
};

class QMPMediaPlayer2 : public QMPrisMediaPlayer2
{
public:
    explicit QMPMediaPlayer2(qmpPluginAPI *_api, QObject *parent=nullptr);

    void Raise() override;
    void Quit() override;

    bool getCanQuit() override;
    bool getCanRaise() override;
    QString getIdentity() override;
    QString getDesktopEntry() override;
    bool getHasTrackList() override;
private:
    qmpPluginAPI *api;
    qmpMainWindow *qmw;
};

#endif