2018-04-27 23:22:45 +01:00
|
|
|
/**
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nicolas Fella <nicolas.fella@gmx.de>
|
2018-04-27 23:22:45 +01:00
|
|
|
*
|
2020-08-17 10:48:10 +01:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
2018-04-27 23:22:45 +01:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QString>
|
2019-07-25 22:40:58 +01:00
|
|
|
#include <QDBusConnection>
|
2018-04-27 23:22:45 +01:00
|
|
|
|
2019-02-03 00:44:22 +00:00
|
|
|
class NetworkPacket;
|
2019-07-25 22:40:58 +01:00
|
|
|
class MprisRemotePlugin;
|
2019-02-03 00:44:22 +00:00
|
|
|
|
2019-07-25 22:40:58 +01:00
|
|
|
class MprisRemotePlayer : public QObject {
|
|
|
|
Q_OBJECT
|
2018-04-27 23:22:45 +01:00
|
|
|
|
|
|
|
public:
|
2019-07-25 22:40:58 +01:00
|
|
|
explicit MprisRemotePlayer(QString id, MprisRemotePlugin *plugin);
|
2018-04-27 23:22:45 +01:00
|
|
|
virtual ~MprisRemotePlayer();
|
|
|
|
|
|
|
|
void parseNetworkPacket(const NetworkPacket& np);
|
|
|
|
long position() const;
|
|
|
|
void setPosition(long position);
|
|
|
|
int volume() const;
|
|
|
|
long length() const;
|
|
|
|
bool playing() const;
|
|
|
|
QString nowPlaying() const;
|
|
|
|
QString title() const;
|
|
|
|
QString artist() const;
|
|
|
|
QString album() const;
|
2019-07-25 22:40:58 +01:00
|
|
|
QString identity() const;
|
2018-04-27 23:22:45 +01:00
|
|
|
|
2019-07-25 22:40:58 +01:00
|
|
|
bool canSeek() const;
|
2019-07-19 21:08:56 +01:00
|
|
|
bool canPlay() const;
|
|
|
|
bool canPause() const;
|
|
|
|
bool canGoPrevious() const;
|
|
|
|
bool canGoNext() const;
|
|
|
|
|
2019-07-25 22:40:58 +01:00
|
|
|
QDBusConnection &dbus();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void controlsChanged();
|
|
|
|
void trackInfoChanged();
|
|
|
|
void positionChanged();
|
|
|
|
void volumeChanged();
|
|
|
|
void playingChanged();
|
|
|
|
|
2018-04-27 23:22:45 +01:00
|
|
|
private:
|
|
|
|
|
|
|
|
QString id;
|
|
|
|
bool m_playing;
|
2019-07-19 21:08:56 +01:00
|
|
|
bool m_canPlay;
|
|
|
|
bool m_canPause;
|
|
|
|
bool m_canGoPrevious;
|
|
|
|
bool m_canGoNext;
|
2018-04-27 23:22:45 +01:00
|
|
|
QString m_nowPlaying;
|
|
|
|
int m_volume;
|
|
|
|
long m_length;
|
|
|
|
long m_lastPosition;
|
|
|
|
qint64 m_lastPositionTime;
|
|
|
|
QString m_title;
|
|
|
|
QString m_artist;
|
|
|
|
QString m_album;
|
2019-07-17 22:19:53 +01:00
|
|
|
bool m_canSeek;
|
2019-07-25 22:40:58 +01:00
|
|
|
|
|
|
|
//Use an unique connection for every player, otherwise we can't distinguish which mpris player is being controlled
|
|
|
|
QString m_dbusConnectionName;
|
|
|
|
QDBusConnection m_dbusConnection;
|
2018-04-27 23:22:45 +01:00
|
|
|
};
|