From c973c446e39533088a95826b8457e6f18aa0d054 Mon Sep 17 00:00:00 2001 From: Victor Dodon Date: Thu, 10 Mar 2016 21:07:34 +0000 Subject: [PATCH] mpris2: add support for CanGoNext, CanGoPrevious, CanSeek --- src/core/mpris2.cpp | 14 ++++++++++++++ src/core/mpris2.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/core/mpris2.cpp b/src/core/mpris2.cpp index ed6db4916..63801b8e0 100644 --- a/src/core/mpris2.cpp +++ b/src/core/mpris2.cpp @@ -171,6 +171,12 @@ void Mpris2::EmitNotification(const QString& name) { value = Volume(); else if (name == "Position") value = Position(); + else if (name == "CanGoNext") + value = CanGoNext(); + else if (name == "CanGoPrevious") + value = CanGoPrevious(); + else if (name == "CanSeek") + value = CanSeek(); if (value.isValid()) EmitNotification(name, value); } @@ -404,6 +410,14 @@ bool Mpris2::CanSeek() const { } } +bool Mpris2::CanSeek(Engine::State state) const { + if (mpris1_->player()) { + return mpris1_->player()->GetCaps(state) & CAN_SEEK; + } else { + return true; + } +} + bool Mpris2::CanControl() const { return true; } void Mpris2::Next() { diff --git a/src/core/mpris2.h b/src/core/mpris2.h index 48ae27c2b..5c3bfdb11 100644 --- a/src/core/mpris2.h +++ b/src/core/mpris2.h @@ -217,6 +217,8 @@ class Mpris2 : public QObject { QString current_track_id() const; + bool CanSeek(Engine::State state) const; + QString DesktopEntryAbsolutePath() const; private: