summaryrefslogtreecommitdiff
path: root/myreplaycontrol.c
blob: d9292726f6f030a75410cdda3da9d219f0a001b6 (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
/*
 * See the README file for copyright information and how to reach the author.
 */

#include <string>
#include <vdr/interface.h>
#include <vdr/status.h>
#include <vdr/menu.h>
#include <vdr/cutter.h>
#include "myreplaycontrol.h"
#include "mymenusetup.h"
#include "tools.h"

using namespace std;

myReplayControl::myReplayControl()
{
  timesearchactive=false;
}

myReplayControl::~myReplayControl()
{
  if(mysetup.ReturnToPlugin)
    cRemote::CallPlugin("extrecmenu");
}

eOSState myReplayControl::ProcessKey(eKeys Key)
{
  if(Key!=kNone)
  {
    if(Key==kBack)
     return osEnd;
 
    if(timesearchactive)
    {
      if(Key<k0 && Key>k9)
        timesearchactive=false;
    }
    else
    {
      if(Key==kEditCut)
      {
        const char *filename=NowReplaying();

        if(filename)
        {
          if(MoveCutterThread->IsCutting(filename))
            Skins.Message(mtError,tr("Recording already in cutter queue!"));
          else
          {
            cMarks marks;
            marks.Load(filename);
  
            if(!marks.Count())
              Skins.Message(mtError,tr("No editing marks defined!"));
            else
            {
              MoveCutterThread->AddToCutterQueue(filename);
              Skins.Message(mtInfo,tr("Added recording to cutter queue"));
            }
          }
        }
        return osContinue;
      }

      if(Key==kRed)
        timesearchactive=true;
    }
  }

  return cReplayControl::ProcessKey(Key);
}