]> git.vomp.tv Git - vompclient.git/blob - vtimeredit.cc
Demuxer::scanForVideo()
[vompclient.git] / vtimeredit.cc
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
6     VOMP is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     VOMP is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with VOMP; if not, write to the Free Software
18     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include "vtimeredit.h"
22
23 VTimerEdit::VTimerEdit(RecTimer* trt)
24 {
25   recTimer = trt;
26
27   create(570, 420);
28   if (Video::getInstance()->getFormat() == Video::PAL)
29   {
30     setScreenPos(80, 70);
31   }
32   else
33   {
34     setScreenPos(70, 35);
35   }
36
37
38   setBackgroundColour(Colour::VIEWBACKGROUND);
39   setTitleBarOn(1);
40   setTitleText(tr("Edit Timer"));
41   setTitleBarColour(Colour::TITLEBARBACKGROUND);
42
43
44   // Draw statics
45
46   draw(); // View::draw
47
48   int xpos = 20;
49   int ypos = 50;
50   drawText(tr("Active"), xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
51   drawText(tr("Channel"), xpos, ypos, Colour::LIGHTTEXT);        ypos += surface->getFontHeight();
52   drawText(tr("Name"), xpos, ypos, Colour::LIGHTTEXT);           ypos += surface->getFontHeight();
53   drawText(tr("Directory"), xpos, ypos, Colour::LIGHTTEXT);      ypos += surface->getFontHeight();
54                                                              ypos += surface->getFontHeight();
55   drawText(tr("Start"), xpos, ypos, Colour::LIGHTTEXT);          ypos += surface->getFontHeight();
56   drawText(tr("Stop"), xpos, ypos, Colour::LIGHTTEXT);           ypos += surface->getFontHeight();
57   drawText(tr("Priority"), xpos, ypos, Colour::LIGHTTEXT);       ypos += surface->getFontHeight();
58   drawText(tr("Lifetime"), xpos, ypos, Colour::LIGHTTEXT);       ypos += surface->getFontHeight();
59                                                              ypos += surface->getFontHeight();
60   drawText(tr("Current"), xpos, ypos, Colour::LIGHTTEXT);        ypos += surface->getFontHeight();
61   drawText(tr("Recording"), xpos, ypos, Colour::LIGHTTEXT);      ypos += surface->getFontHeight();
62
63
64   // Temp
65   char buffer[1000];
66   struct tm* tms;
67   xpos = 150;
68   ypos = 50;
69
70   // Active
71   if (recTimer->active) strcpy(buffer, "Yes");
72   else                  strcpy(buffer, "No");
73   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
74
75   // Channel
76   SNPRINTF(buffer, 999, "%lu", recTimer->channelNumber);
77   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
78
79   // Name
80   SNPRINTF(buffer, 999, "%s", recTimer->getName());
81   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
82
83   // Directory
84   if (recTimer->getDirectory()) SNPRINTF(buffer, 999, "%s", recTimer->getDirectory());
85   else strcpy(buffer, "");
86   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
87                                                            ypos += surface->getFontHeight();
88
89   // Start
90   tms = localtime((time_t*)&recTimer->startTime);
91   strftime(buffer, 999, "%d/%m %H:%M", tms);
92   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
93
94   // Stop
95   tms = localtime((time_t*)&recTimer->stopTime);
96   strftime(buffer, 999, "%d/%m %H:%M", tms);
97   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
98
99   // Priority
100   SNPRINTF(buffer, 999, "%lu", recTimer->priority);
101   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
102
103   // Lifetime
104   SNPRINTF(buffer, 999, "%lu", recTimer->lifeTime);
105   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
106                                                            ypos += surface->getFontHeight();
107
108   // Current
109   if (recTimer->pending) strcpy(buffer, "Yes");
110   else                   strcpy(buffer, "No");
111   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
112
113   // Recording now
114   if (recTimer->recording) strcpy(buffer, "Yes");
115   else                     strcpy(buffer, "No");
116   drawText(buffer, xpos, ypos, Colour::LIGHTTEXT);         ypos += surface->getFontHeight();
117
118
119 }
120
121 VTimerEdit::~VTimerEdit()
122 {
123 }
124
125 int VTimerEdit::handleCommand(int command)
126 {
127   switch(command)
128   {
129     case Remote::DF_UP:
130     case Remote::UP:
131     {
132
133       ViewMan::getInstance()->updateView(this);
134       return 2;
135     }
136     case Remote::DF_DOWN:
137     case Remote::DOWN:
138     {
139
140       ViewMan::getInstance()->updateView(this);
141       return 2;
142     }
143     case Remote::OK:
144     {
145
146       return 2;
147     }
148     case Remote::BACK:
149     {
150       return 4;
151     }
152   }
153   // stop command getting to any more views
154   return 1;
155 }