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()
28 if (Video::getInstance()->getFormat() == Video::PAL)
30 setScreenPos(260, 190);
34 setScreenPos(250, 160);
38 setBackgroundColour(Colour::VIEWBACKGROUND);
41 setTitleText("Programme menu");
42 setTitleBarColour(Colour::TITLEBARBACKGROUND);
44 sl.setSurface(surface);
45 sl.setSurfaceOffset(10, 30 + 5);
46 sl.setDimensions(width - 20, height - 30 - 15);
47 sl.addOption("Play", 1);
48 sl.addOption("Resume", 0);
49 sl.addOption("Summary", 0);
50 sl.addOption("Delete", 0);
53 VRecordingMenu::~VRecordingMenu()
57 void VRecordingMenu::setParent(VRecordingList* tvRecList)
62 void VRecordingMenu::setRecording(Recording* trec)
67 void VRecordingMenu::draw()
73 int VRecordingMenu::handleCommand(int command)
95 if (sl.getCurrentOption() == 0)
97 Message* m = new Message();
100 m->message = Message::PLAY_SELECTED_RECORDING;
101 ViewMan::getInstance()->postMessage(m);
105 if (sl.getCurrentOption() == 1)
107 Message* m = new Message();
110 m->message = Message::RESUME_SELECTED_RECORDING;
111 ViewMan::getInstance()->postMessage(m);
115 if (sl.getCurrentOption() == 2)
117 char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
119 VInfo* vi = new VInfo();
120 vi->setTitleText("Programme summary");
123 if (summary) vi->setMainText(summary);
124 else vi->setMainText("Summary unavailable");
125 if (Video::getInstance()->getFormat() == Video::PAL)
127 vi->setScreenPos(120, 130);
131 vi->setScreenPos(110, 90);
133 vi->create(490, 300);
135 ViewMan::getInstance()->addNoLock(vi);
139 if (summary) delete[] summary;
143 else if (sl.getCurrentOption() == 3)
145 VQuestion* v = new VQuestion();
148 v->setBackgroundColour(Colour::VIEWBACKGROUND);
149 v->setTitleBarColour(Colour::DANGER);
152 v->setTitleText("Delete recording");
153 v->setMainText("Are you sure you want to delete this recording?");
154 v->setDefault(VQuestion::NO);
155 if (Video::getInstance()->getFormat() == Video::PAL)
157 v->setScreenPos(230, 160);
161 v->setScreenPos(220, 140);
164 ViewMan::getInstance()->addNoLock(v);
175 // stop command getting to any more views
179 void VRecordingMenu::processMessage(Message* m)
181 if (m->message == Message::QUESTION_YES)
183 if (sl.getCurrentOption() == 3)
185 Message* m = new Message();
187 m->to = ViewMan::getInstance();
188 m->message = Message::CLOSE_ME;
189 ViewMan::getInstance()->postMessage(m);
194 m->message = Message::DELETE_SELECTED_RECORDING;
195 ViewMan::getInstance()->postMessage(m);