2 Copyright 2004-2005 Chris Tallon
4 This file is part of VOMP.
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.
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.
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
21 #include "vrecordingmenu.h"
23 VRecordingMenu::VRecordingMenu()
27 if (Video::getInstance()->getFormat() == Video::PAL)
29 setScreenPos(260, 190);
33 setScreenPos(250, 160);
36 setDimensions(200, 140);
38 setBackgroundColour(Colour::VIEWBACKGROUND);
41 setTitleText("Programme menu");
42 setTitleBarColour(Colour::TITLEBARBACKGROUND);
44 sl.setScreenPos(screenX + 10, screenY + 30 + 5);
45 sl.setDimensions(width - 20, height - 30 - 15);
46 sl.addOption("Play", 1);
47 sl.addOption("Resume", 0);
48 sl.addOption("Summary", 0);
49 sl.addOption("Delete", 0);
52 VRecordingMenu::~VRecordingMenu()
56 void VRecordingMenu::setParent(VRecordingList* tvRecList)
61 void VRecordingMenu::setRecording(Recording* trec)
66 void VRecordingMenu::draw()
72 int VRecordingMenu::handleCommand(int command)
94 if (sl.getCurrentOption() == 0)
96 Message* m = new Message();
99 m->message = Message::PLAY_SELECTED_RECORDING;
100 ViewMan::getInstance()->postMessage(m);
104 if (sl.getCurrentOption() == 1)
106 Message* m = new Message();
109 m->message = Message::RESUME_SELECTED_RECORDING;
110 ViewMan::getInstance()->postMessage(m);
114 if (sl.getCurrentOption() == 2)
116 char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
118 VInfo* vi = new VInfo();
119 vi->setTitleText("Programme summary");
122 if (summary) vi->setMainText(summary);
123 else vi->setMainText("Summary unavailable");
124 if (Video::getInstance()->getFormat() == Video::PAL)
126 vi->setScreenPos(120, 130);
130 vi->setScreenPos(110, 90);
132 vi->setDimensions(490, 300);
134 ViewMan::getInstance()->addNoLock(vi);
138 if (summary) delete[] summary;
142 else if (sl.getCurrentOption() == 3)
144 VQuestion* v = new VQuestion();
146 v->setBackgroundColour(Colour::VIEWBACKGROUND);
147 v->setTitleBarColour(Colour::DANGER);
150 v->setTitleText("Delete recording");
151 v->setMainText("Are you sure you want to delete this recording?");
152 v->setDefault(VQuestion::NO);
153 if (Video::getInstance()->getFormat() == Video::PAL)
155 v->setScreenPos(230, 160);
159 v->setScreenPos(220, 140);
161 v->setDimensions(260, 180);
163 ViewMan::getInstance()->addNoLock(v);
174 // stop command getting to any more views
178 void VRecordingMenu::processMessage(Message* m)
180 if (m->message == Message::QUESTION_YES)
182 if (sl.getCurrentOption() == 3)
184 Message* m = new Message();
186 m->to = ViewMan::getInstance();
187 m->message = Message::CLOSE_ME;
188 ViewMan::getInstance()->postMessage(m);
193 m->message = Message::DELETE_SELECTED_RECORDING;
194 ViewMan::getInstance()->postMessage(m);