From 77f39d4979fb5e8264b9462569276179a5534155 Mon Sep 17 00:00:00 2001 From: Dima Gerasimov Date: Sun, 17 Dec 2017 15:28:59 +0000 Subject: [PATCH] Add support for starting playback in stopped state --- src/actions.cpp | 11 +++++++++++ src/actions.h | 10 ++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/actions.cpp b/src/actions.cpp index e2150137..14b8185a 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -804,6 +804,11 @@ void NextSong::run() Mpd.Next(); } +bool Pause::canBeRun() +{ + return Status::State::player() != MPD::psStop; +} + void Pause::run() { Mpd.Toggle(); @@ -845,6 +850,11 @@ void Stop::run() Mpd.Stop(); } +void Play::run() +{ + Mpd.Play(); +} + void ExecuteCommand::run() { using Global::wFooter; @@ -2734,6 +2744,7 @@ void populateActions() insert_action(new Actions::NextSong()); insert_action(new Actions::Pause()); insert_action(new Actions::Stop()); + insert_action(new Actions::Play()); insert_action(new Actions::ExecuteCommand()); insert_action(new Actions::SavePlaylist()); insert_action(new Actions::MoveSortOrderUp()); diff --git a/src/actions.h b/src/actions.h index 9d01d632..c5548e90 100644 --- a/src/actions.h +++ b/src/actions.h @@ -68,6 +68,7 @@ enum class Type Next, Pause, Stop, + Play, ExecuteCommand, SavePlaylist, MoveSortOrderUp, @@ -515,6 +516,7 @@ struct Pause: BaseAction Pause(): BaseAction(Type::Pause, "pause") { } private: + virtual bool canBeRun() override; virtual void run() override; }; @@ -526,6 +528,14 @@ private: virtual void run() override; }; +struct Play: BaseAction +{ + Play(): BaseAction(Type::Play, "play") { } + +private: + virtual void run() override; +}; + struct ExecuteCommand: BaseAction { ExecuteCommand(): BaseAction(Type::ExecuteCommand, "execute_command") { }