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 setScreenPos(260, 190);
28 setDimensions(140, 200);
30 setBackgroundColour(0, 0, 100, 255);
33 setTitleText("Programme menu");
34 setTitleBarColour(0, 0, 200, 255);
36 sl.setScreenPos(screenX + 10, screenY + 30 + 5);
37 sl.setDimensions(height - 30 - 15, width - 20);
38 sl.addOption("Play", 1);
39 sl.addOption("Resume", 0);
40 sl.addOption("Summary", 0);
41 sl.addOption("Delete", 0);
44 VRecordingMenu::~VRecordingMenu()
48 void VRecordingMenu::setParent(VRecordingList* tvRecList)
53 void VRecordingMenu::setRecording(Recording* trec)
58 void VRecordingMenu::draw()
64 int VRecordingMenu::handleCommand(int command)
66 if (command == Remote::UP)
73 else if (command == Remote::DOWN)
80 else if (command == Remote::OK)
82 if (sl.getCurrentOption() == 0)
84 Message* m = new Message();
87 m->message = Message::PLAY_SELECTED_RECORDING;
88 ViewMan::getInstance()->postMessage(m);
92 if (sl.getCurrentOption() == 1)
94 Message* m = new Message();
97 m->message = Message::RESUME_SELECTED_RECORDING;
98 ViewMan::getInstance()->postMessage(m);
102 if (sl.getCurrentOption() == 2)
104 char* summary = VDR::getInstance()->getRecordingSummary(rec->fileName);
106 VInfo* vi = new VInfo();
107 vi->setTitleText("Programme summary");
110 if (summary) vi->setMainText(summary);
111 else vi->setMainText("Summary unavailable");
112 vi->setScreenPos(120, 130);
113 vi->setDimensions(300, 490);
115 ViewMan::getInstance()->addNoLock(vi);
119 if (summary) delete[] summary;
123 else if (sl.getCurrentOption() == 3)
125 VQuestion* v = new VQuestion();
127 v->setBackgroundColour(0, 0, 100, 255);
128 v->setTitleBarColour(200, 0, 0, 255);
131 v->setTitleText("Delete recording");
132 v->setMainText("Are you sure you want to delete this recording?");
133 v->setDefault(VQuestion::NO);
134 v->setScreenPos(230, 160);
135 v->setDimensions(180, 260);
137 ViewMan::getInstance()->addNoLock(v);
143 else if (command == Remote::BACK)
148 // stop command getting to any more views
152 void VRecordingMenu::processMessage(Message* m)
154 if (m->message == Message::QUESTION_YES)
156 if (sl.getCurrentOption() == 3)
158 Message* m = new Message();
160 m->to = ViewMan::getInstance();
161 m->message = Message::CLOSE_ME;
162 ViewMan::getInstance()->postMessage(m);
167 m->message = Message::DELETE_SELECTED_RECORDING;
168 ViewMan::getInstance()->postMessage(m);