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(140, 200);
38 setBackgroundColour(Colour::VIEWBACKGROUND);
41 setTitleText("Programme menu");
42 setTitleBarColour(Colour::TITLEBARBACKGROUND);
44 sl.setScreenPos(screenX + 10, screenY + 30 + 5);
45 sl.setDimensions(height - 30 - 15, width - 20);
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)
74 if (command == Remote::UP)
81 else if (command == Remote::DOWN)
88 else if (command == Remote::OK)
90 if (sl.getCurrentOption() == 0)
92 Message* m = new Message();
95 m->message = Message::PLAY_SELECTED_RECORDING;
96 ViewMan::getInstance()->postMessage(m);
100 if (sl.getCurrentOption() == 1)
102 Message* m = new Message();
105 m->message = Message::RESUME_SELECTED_RECORDING;
106 ViewMan::getInstance()->postMessage(m);
110 if (sl.getCurrentOption() == 2)
112 char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
114 VInfo* vi = new VInfo();
115 vi->setTitleText("Programme summary");
118 if (summary) vi->setMainText(summary);
119 else vi->setMainText("Summary unavailable");
120 if (Video::getInstance()->getFormat() == Video::PAL)
122 vi->setScreenPos(120, 130);
126 vi->setScreenPos(110, 90);
128 vi->setDimensions(300, 490);
130 ViewMan::getInstance()->addNoLock(vi);
134 if (summary) delete[] summary;
138 else if (sl.getCurrentOption() == 3)
140 VQuestion* v = new VQuestion();
142 v->setBackgroundColour(Colour::VIEWBACKGROUND);
143 v->setTitleBarColour(Colour::DANGER);
146 v->setTitleText("Delete recording");
147 v->setMainText("Are you sure you want to delete this recording?");
148 v->setDefault(VQuestion::NO);
149 if (Video::getInstance()->getFormat() == Video::PAL)
151 v->setScreenPos(230, 160);
155 v->setScreenPos(220, 140);
157 v->setDimensions(180, 260);
159 ViewMan::getInstance()->addNoLock(v);
165 else if (command == Remote::BACK)
170 // stop command getting to any more views
174 void VRecordingMenu::processMessage(Message* m)
176 if (m->message == Message::QUESTION_YES)
178 if (sl.getCurrentOption() == 3)
180 Message* m = new Message();
182 m->to = ViewMan::getInstance();
183 m->message = Message::CLOSE_ME;
184 ViewMan::getInstance()->postMessage(m);
189 m->message = Message::DELETE_SELECTED_RECORDING;
190 ViewMan::getInstance()->postMessage(m);