diff options
author | Martin Prochnow <nordlicht@martins-kabuff.de> | 2006-03-16 20:17:58 +0100 |
---|---|---|
committer | Andreas Mair <andreas@vdr-developer.org> | 2006-03-16 20:17:58 +0100 |
commit | a245047c8c60d3acc0af75f5ffc7479cfeacd34d (patch) | |
tree | 1623a6f2239d242eb40eaaaa86a2be7a1e72443a /mymenucommands.c | |
parent | dda6babd28ffef10bed47f53f2b4a9168fa90a67 (diff) | |
download | vdr-plugin-extrecmenu-a245047c8c60d3acc0af75f5ffc7479cfeacd34d.tar.gz vdr-plugin-extrecmenu-a245047c8c60d3acc0af75f5ffc7479cfeacd34d.tar.bz2 |
Version 0.6v0.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
Diffstat (limited to 'mymenucommands.c')
-rw-r--r-- | mymenucommands.c | 71 |
1 files changed, 71 insertions, 0 deletions
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 <vdr/menu.h> +#include <vdr/config.h> +#include <vdr/interface.h> +#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; +} |