1
0
mirror of https://github.com/clementine-player/Clementine synced 2025-02-02 12:26:48 +01:00

mpris2: add support for CanGoNext, CanGoPrevious, CanSeek

This commit is contained in:
Victor Dodon 2016-03-10 21:07:34 +00:00
parent b33e2e9c3a
commit c973c446e3
2 changed files with 16 additions and 0 deletions

View File

@ -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() {

View File

@ -217,6 +217,8 @@ class Mpris2 : public QObject {
QString current_track_id() const;
bool CanSeek(Engine::State state) const;
QString DesktopEntryAbsolutePath() const;
private: