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(RecMan* trecman)
29 if (Video::getInstance()->getFormat() == Video::PAL)
31 setScreenPos(260, 190);
35 setScreenPos(250, 160);
38 setBackgroundColour(Colour::VIEWBACKGROUND);
41 setTitleText(tr("Programme menu"));
42 setTitleBarColour(Colour::TITLEBARBACKGROUND);
44 sl.setSurface(surface);
45 sl.setSurfaceOffset(10, 30 + 5);
46 sl.setDimensions(area.w - 20, area.h - 30 - 15);
47 sl.addOption(tr("Play"), 1, 1);
48 sl.addOption(tr("Resume"), 2, 0);
49 sl.addOption(tr("Summary"), 3, 0);
50 sl.addOption(tr("Move"), 4, 0);
51 sl.addOption(tr("Delete"), 5, 0);
54 VRecordingMenu::~VRecordingMenu()
58 void VRecordingMenu::setParent(VRecordingList* tvRecList)
63 void VRecordingMenu::setRecording(Recording* trec)
68 void VRecordingMenu::draw()
74 int VRecordingMenu::handleCommand(int command)
83 ViewMan::getInstance()->updateView(this);
91 ViewMan::getInstance()->updateView(this);
96 if (sl.getCurrentOptionData() == 1)
98 Message* m = new Message(); // Must be done after this view deleted
101 m->message = Message::PLAY_SELECTED_RECORDING;
102 Command::getInstance()->postMessageNoLock(m);
106 if (sl.getCurrentOptionData() == 2)
108 Message* m = new Message(); // Must be done after this view deleted
111 m->message = Message::RESUME_SELECTED_RECORDING;
112 Command::getInstance()->postMessageNoLock(m);
116 if (sl.getCurrentOptionData() == 3)
120 VInfo* vi = new VInfo();
121 vi->setTitleText(tr("Programme summary"));
124 if (strlen(rec->recInfo->summary))
125 vi->setMainText(rec->recInfo->summary);
127 vi->setMainText(tr("Summary unavailable"));
128 if (Video::getInstance()->getFormat() == Video::PAL)
130 vi->setScreenPos(120, 130);
134 vi->setScreenPos(110, 90);
136 vi->create(490, 300);
138 ViewMan::getInstance()->add(vi);
139 ViewMan::getInstance()->updateView(vi);
144 if (sl.getCurrentOptionData() == 4)
146 VRecMove* vrm = new VRecMove(recman);
147 vrm->setParent(this);
149 ViewMan::getInstance()->add(vrm);
150 ViewMan::getInstance()->updateView(vrm);
154 if (sl.getCurrentOptionData() == 5)
156 VQuestion* v = new VQuestion(this);
158 v->setBackgroundColour(Colour::VIEWBACKGROUND);
159 v->setTitleBarColour(Colour::DANGER);
162 v->setTitleText(tr("Delete recording"));
163 v->setMainText(tr("Are you sure you want to delete this recording?"));
164 v->setDefault(VQuestion::NO);
165 if (Video::getInstance()->getFormat() == Video::PAL)
167 v->setScreenPos(230, 160);
171 v->setScreenPos(220, 140);
175 ViewMan::getInstance()->add(v);
176 ViewMan::getInstance()->updateView(v);
185 // stop command getting to any more views
189 void VRecordingMenu::processMessage(Message* m)
191 if (m->message == Message::QUESTION_YES)
193 if (sl.getCurrentOptionData() == 5)
195 Message* m2 = new Message(); // Delete self
197 m2->to = ViewMan::getInstance();
198 m2->message = Message::CLOSE_ME;
199 Command::getInstance()->postMessageNoLock(m2);
201 m2 = new Message(); // OK. Want this to delete before this message does its job
204 m2->message = Message::DELETE_SELECTED_RECORDING;
205 Command::getInstance()->postMessageNoLock(m2);
208 else if (m->message == Message::MOVE_RECORDING)
210 Message* m2 = new Message(); // Delete self
212 m2->to = ViewMan::getInstance();
213 m2->message = Message::CLOSE_ME;
214 Command::getInstance()->postMessageNoLock(m2);
219 m2->message = Message::MOVE_RECORDING;
220 m2->parameter = m->parameter;
221 Command::getInstance()->postMessageNoLock(m2);