summaryrefslogtreecommitdiff
path: root/mymenurecordinginfo.c
blob: 70384b37cd77451ab30fb05d68035650289ac4bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * 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/status.h>
#include "myreplaycontrol.h"

myMenuRecordingInfo::myMenuRecordingInfo(const cRecording *Recording,bool WithButtons):cOsdMenu(tr("Recording info"))
{
 recording=Recording;
 withButtons=WithButtons;
 if(withButtons)
  SetHelp(tr("Button$Play"),tr("Button$Rewind"));
}

void myMenuRecordingInfo::Display(void)
{
 cOsdMenu::Display();
 DisplayMenu()->SetRecording(recording);
 cStatus::MsgOsdTextItem(recording->Info()->Description());
}

eOSState myMenuRecordingInfo::Play()
{
 if(recording)
 {
  myReplayControl::SetRecording(recording->FileName(),recording->Title());
  cControl::Shutdown(); // stop running playbacks
  cControl::Launch(new myReplayControl); // start playback
  return osEnd; // close plugin
 }
 return osContinue;
}

eOSState myMenuRecordingInfo::Rewind()
{
 if(recording)
 {
  cDevice::PrimaryDevice()->StopReplay();
  cResumeFile ResumeFile(recording->FileName());
  ResumeFile.Delete();
  return Play();
 }
 return osContinue;
}

eOSState myMenuRecordingInfo::ProcessKey(eKeys Key)
{
 switch (Key)
 {
  case kUp|k_Repeat:
  case kUp:
  case kDown|k_Repeat:
  case kDown:
  case kLeft|k_Repeat:
  case kLeft:
  case kRight|k_Repeat:
  case kRight: DisplayMenu()->Scroll(NORMALKEY(Key)==kUp||NORMALKEY(Key)==kLeft,NORMALKEY(Key)==kLeft||NORMALKEY(Key)==kRight);
               cStatus::MsgOsdTextItem(NULL,NORMALKEY(Key)==kUp);
               return osContinue;
  default: break;
 }

 eOSState state=cOsdMenu::ProcessKey(Key);

 if(state==osUnknown)
 {
  switch (Key)
  {
   case kRed: return Play();
   case kGreen: return Rewind();
   case kOk: return osBack;
   default: break;
  }
 }
 return state;
}