Adds the missing KDE Connect MPRIS properties on desktop receive-side

Not currently being used, but available for the future.
This commit is contained in:
Matthijs Tijink 2019-07-19 20:08:56 +00:00 committed by Nicolas Fella
parent edee0e0e9d
commit fbe37092eb
2 changed files with 34 additions and 2 deletions

View file

@ -26,6 +26,10 @@
MprisRemotePlayer::MprisRemotePlayer() :
m_playing(false)
, m_canPlay(true)
, m_canPause(true)
, m_canGoPrevious(true)
, m_canGoNext(true)
, m_nowPlaying()
, m_volume(50)
, m_length(0)
@ -50,13 +54,16 @@ void MprisRemotePlayer::parseNetworkPacket(const NetworkPacket& np)
m_album = np.get<QString>(QStringLiteral("album"), m_album);
m_volume = np.get<int>(QStringLiteral("volume"), m_volume);
m_length = np.get<int>(QStringLiteral("length"), m_length);
if(np.has(QStringLiteral("pos"))){
if (np.has(QStringLiteral("pos"))) {
m_lastPosition = np.get<int>(QStringLiteral("pos"), m_lastPosition);
m_lastPositionTime = QDateTime::currentMSecsSinceEpoch();
}
m_playing = np.get<bool>(QStringLiteral("isPlaying"), m_playing);
m_canSeek = np.get<bool>(QStringLiteral("canSeek"), m_canSeek);
m_canPlay = np.get<bool>(QStringLiteral("canPlay"), m_canPlay);
m_canPause = np.get<bool>(QStringLiteral("canPause"), m_canPause);
m_canGoPrevious = np.get<bool>(QStringLiteral("canGoPrevious"), m_canGoPrevious);
m_canGoNext = np.get<bool>(QStringLiteral("canGoNext"), m_canGoNext);
}
long MprisRemotePlayer::position() const
@ -113,3 +120,19 @@ bool MprisRemotePlayer::canSeek() const
{
return m_canSeek;
}
bool MprisRemotePlayer::canPlay() const {
return m_canPlay;
}
bool MprisRemotePlayer::canPause() const {
return m_canPause;
}
bool MprisRemotePlayer::canGoPrevious() const {
return m_canGoPrevious;
}
bool MprisRemotePlayer::canGoNext() const {
return m_canGoNext;
}

View file

@ -41,10 +41,19 @@ public:
QString album() const;
bool canSeek() const;
bool canPlay() const;
bool canPause() const;
bool canGoPrevious() const;
bool canGoNext() const;
private:
QString id;
bool m_playing;
bool m_canPlay;
bool m_canPause;
bool m_canGoPrevious;
bool m_canGoNext;
QString m_nowPlaying;
int m_volume;
long m_length;