From a245047c8c60d3acc0af75f5ffc7479cfeacd34d Mon Sep 17 00:00:00 2001 From: Martin Prochnow Date: Thu, 16 Mar 2006 20:17:58 +0100 Subject: Version 0.6 - after the replay of a recording ended, the menu jumps now to the last replayed recording - recording commands like in VDR's recordings menu now work - start to write some documentation in README --- mymenucommands.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 mymenucommands.c (limited to 'mymenucommands.c') diff --git a/mymenucommands.c b/mymenucommands.c new file mode 100644 index 0000000..399df6e --- /dev/null +++ b/mymenucommands.c @@ -0,0 +1,71 @@ +/* + * See the README file for copyright information and how to reach the author. + * + * This code is directly taken from VDR with some changes by me to work with this plugin + */ + +#include +#include +#include +#include "mymenucommands.h" + +myMenuCommands::myMenuCommands(const char *Title,cCommands *Commands,const char *Parameters):cOsdMenu(Title) +{ + SetHasHotkeys(); + commands=Commands; + parameters=Parameters?strdup(Parameters):NULL; + for(cCommand *command=commands->First();command;command=commands->Next(command)) + Add(new cOsdItem(hk(command->Title()))); +} + +myMenuCommands::~myMenuCommands() +{ + free(parameters); +} + +eOSState myMenuCommands::Execute() +{ + cCommand *command=commands->Get(Current()); + if(command) + { + char *buffer=NULL; + bool confirmed=true; + if(command->Confirm()) + { + asprintf(&buffer,"%s?",command->Title()); + confirmed=Interface->Confirm(buffer); + free(buffer); + } + if(confirmed) + { + asprintf(&buffer, "%s...",command->Title()); + Skins.Message(mtStatus,buffer); + free(buffer); + const char *Result=command->Execute(parameters); + Skins.Message(mtStatus, NULL); + if(Result) + return AddSubMenu(new cMenuText(command->Title(),Result,fontFix)); + return osEnd; + } + } + return osContinue; +} + +eOSState myMenuCommands::ProcessKey(eKeys Key) +{ + eOSState state=cOsdMenu::ProcessKey(Key); + + if(state==osUnknown) + { + switch(Key) + { + case kRed: + case kGreen: + case kYellow: + case kBlue: return osContinue; + case kOk: return Execute(); + default: break; + } + } + return state; +} -- cgit v1.2.3