mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-23 16:28:19 +01:00
Merge pull request #4957 from eduardosm/esm-branch1
mpris: Fix track not restarting when playing the first track on the…
This commit is contained in:
commit
1a968b3a64
@ -244,7 +244,8 @@ int Mpris1Player::GetCaps(Engine::State state) const {
|
||||
if (playlists->active()->next_row() != -1) {
|
||||
caps |= CAN_GO_NEXT;
|
||||
}
|
||||
if (playlists->active()->previous_row() != -1) {
|
||||
if (playlists->active()->previous_row() != -1 ||
|
||||
app_->player()->PreviousWouldRestartTrack()) {
|
||||
caps |= CAN_GO_PREV;
|
||||
}
|
||||
}
|
||||
|
@ -305,6 +305,13 @@ void Player::StopAfterCurrent() {
|
||||
app_->playlist_manager()->active()->current_row());
|
||||
}
|
||||
|
||||
bool Player::PreviousWouldRestartTrack() const {
|
||||
// Check if it has been over two seconds since previous button was pressed
|
||||
return menu_previousmode_ == PreviousBehaviour_Restart &&
|
||||
last_pressed_previous_.isValid() &&
|
||||
last_pressed_previous_.secsTo(QDateTime::currentDateTime()) >= 2;
|
||||
}
|
||||
|
||||
void Player::Previous() { PreviousItem(Engine::Manual); }
|
||||
|
||||
void Player::PreviousItem(Engine::TrackChangeFlags change) {
|
||||
|
@ -142,6 +142,8 @@ class Player : public PlayerInterface {
|
||||
|
||||
const UrlHandler* HandlerForUrl(const QUrl& url) const;
|
||||
|
||||
bool PreviousWouldRestartTrack() const;
|
||||
|
||||
public slots:
|
||||
void ReloadSettings();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user