Add support for starting playback in stopped state

master
Dima Gerasimov 8 years ago
parent b7da5d1b9a
commit 77f39d4979
  1. 11
      src/actions.cpp
  2. 10
      src/actions.h

@ -804,6 +804,11 @@ void NextSong::run()
Mpd.Next(); Mpd.Next();
} }
bool Pause::canBeRun()
{
return Status::State::player() != MPD::psStop;
}
void Pause::run() void Pause::run()
{ {
Mpd.Toggle(); Mpd.Toggle();
@ -845,6 +850,11 @@ void Stop::run()
Mpd.Stop(); Mpd.Stop();
} }
void Play::run()
{
Mpd.Play();
}
void ExecuteCommand::run() void ExecuteCommand::run()
{ {
using Global::wFooter; using Global::wFooter;
@ -2734,6 +2744,7 @@ void populateActions()
insert_action(new Actions::NextSong()); insert_action(new Actions::NextSong());
insert_action(new Actions::Pause()); insert_action(new Actions::Pause());
insert_action(new Actions::Stop()); insert_action(new Actions::Stop());
insert_action(new Actions::Play());
insert_action(new Actions::ExecuteCommand()); insert_action(new Actions::ExecuteCommand());
insert_action(new Actions::SavePlaylist()); insert_action(new Actions::SavePlaylist());
insert_action(new Actions::MoveSortOrderUp()); insert_action(new Actions::MoveSortOrderUp());

@ -68,6 +68,7 @@ enum class Type
Next, Next,
Pause, Pause,
Stop, Stop,
Play,
ExecuteCommand, ExecuteCommand,
SavePlaylist, SavePlaylist,
MoveSortOrderUp, MoveSortOrderUp,
@ -515,6 +516,7 @@ struct Pause: BaseAction
Pause(): BaseAction(Type::Pause, "pause") { } Pause(): BaseAction(Type::Pause, "pause") { }
private: private:
virtual bool canBeRun() override;
virtual void run() override; virtual void run() override;
}; };
@ -526,6 +528,14 @@ private:
virtual void run() override; virtual void run() override;
}; };
struct Play: BaseAction
{
Play(): BaseAction(Type::Play, "play") { }
private:
virtual void run() override;
};
struct ExecuteCommand: BaseAction struct ExecuteCommand: BaseAction
{ {
ExecuteCommand(): BaseAction(Type::ExecuteCommand, "execute_command") { } ExecuteCommand(): BaseAction(Type::ExecuteCommand, "execute_command") { }

Loading…
Cancel
Save