From beea3931a89fb5c93bd1695120e1803b20e87ca6 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 26 Feb 2006 01:39:30 +0000 Subject: [PATCH] Options menu rearrangement, set timer from EPG --- Makefile | 2 +- command.cc | 2 + vdr.cc | 32 ++++++ vdr.h | 2 + vepg.cc | 19 ++-- vepg.h | 1 + vepgsettimer.cc | 257 ++++++++++++++++++++++++++++++++++++++++++++ vepgsettimer.h | 70 ++++++++++++ view.h | 2 +- vinfo.cc | 3 +- voptionsmenu.cc | 272 +++++++++++++++++++++++++++++++++++++++++++++++ voptionsmenu.h | 59 ++++++++++ vrecordinglist.h | 1 + 13 files changed, 710 insertions(+), 12 deletions(-) create mode 100644 vepgsettimer.cc create mode 100644 vepgsettimer.h create mode 100644 voptionsmenu.cc create mode 100644 voptionsmenu.h diff --git a/Makefile b/Makefile index b2c3dc6..f825f83 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ OBJECTS = main.o command.o log.o remote.o led.o mtd.o video.o audio.o tcp.o dire player.o demuxer.o stream.o vfeed.o afeed.o afeedr.o osd.o surface.o viewman.o vdr.o dsock.o box.o \ recording.o channel.o message.o playervideo.o messagequeue.o rectimer.o vtimeredit.o voptionsmenu.o \ view.o vinfo.o vwallpaper.o vvolume.o vrecordinglist.o vlivebanner.o vmute.o vtimerlist.o \ - vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o \ + vrecordingmenu.o vquestion.o vchannellist.o vwelcome.o vvideolive.o vvideorec.o vepgsettimer.o \ vchannelselect.o vserverselect.o colour.o vconnect.o voptions.o vepg.o region.o \ widget.o wselectlist.o wjpeg.o wsymbol.o wbutton.o woptionbox.o wtextbox.o i18n.o timers.o \ fonts/helvB24.o fonts/helvB18.o diff --git a/command.cc b/command.cc index 815309a..7ece424 100644 --- a/command.cc +++ b/command.cc @@ -557,4 +557,6 @@ void Command::doJustConnected(VConnect* vconnect) vw->draw(); viewman->add(vw); viewman->updateView(vw); + + // Enter pre-keys here } diff --git a/vdr.cc b/vdr.cc index 1b3b7aa..3f8c7e7 100644 --- a/vdr.cc +++ b/vdr.cc @@ -892,3 +892,35 @@ RecTimerList* VDR::getRecTimersList() return recTimerList; } + +ULONG VDR::setEventTimer(char* timerString) +{ + if (!connected) return false; + + unsigned long totalLength = 8 + strlen(timerString) + 1; + UCHAR buffer[totalLength]; + + *(unsigned long*)&buffer[0] = htonl(totalLength - 4); + *(unsigned long*)&buffer[4] = htonl(VDR_SETTIMER); + strcpy((char*)&buffer[8], timerString); + + pthread_mutex_lock(&mutex); + unsigned int a = tcp->sendPacket(buffer, totalLength); + if (a != totalLength) + { + pthread_mutex_unlock(&mutex); + return 0; + } + + if (!getPacket()) + { + pthread_mutex_unlock(&mutex); + return 0; + } + + ULONG toReturn = extractULONG(); + freePacket(); + pthread_mutex_unlock(&mutex); + + return toReturn; +} diff --git a/vdr.h b/vdr.h index 4e36245..5622fd0 100644 --- a/vdr.h +++ b/vdr.h @@ -127,6 +127,7 @@ class VDR EventList* getChannelSchedule(ULONG number, time_t start, ULONG duration); int configSave(char* section, char* key, const char* value); char* configLoad(char* section, char* key); + ULONG setEventTimer(char* timerString); RecTimerList* getRecTimersList(); @@ -164,6 +165,7 @@ class VDR const static ULONG VDR_CONFIGLOAD = 12; const static ULONG VDR_RESCANRECORDING = 13; const static ULONG VDR_GETTIMERS = 14; + const static ULONG VDR_SETTIMER = 15; int getPacket(); void freePacket(); diff --git a/vepg.cc b/vepg.cc index e00bc3f..0f7ae5a 100644 --- a/vepg.cc +++ b/vepg.cc @@ -163,7 +163,7 @@ void VEpg::setInfo(Event* event) { time_t t; struct tm* btime; // to hold programme start and end time - char* timeString = new char[9]; // to hold programme start and end time + char timeString[9]; // to hold programme start and end time int length = strlen(event->title); // calculate length of programme title string char* title = new char[length + 15]; // create string to hold start time, end time and programme title btime = localtime((time_t*)&event->time); //get programme start time @@ -180,9 +180,8 @@ void VEpg::setInfo(Event* event) strcpy(info, event->description); progInfo.setText(info); // show programme detail string // destroy dynamically allocated memory - delete info; - delete title; - delete timeString; + delete[] info; + delete[] title; } void VEpg::draw() @@ -233,8 +232,8 @@ void VEpg::draw() drawText(tr("Guide / Back: Close"), keyx + 292 , keyy + 5, Colour::LIGHTTEXT); surface->fillblt(keyx + 290, keyy + Surface::getFontHeight() + 8, 180, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255)); -// Colour red = Colour(130, 0, 0); -// drawText(tr("Rec: Set timer"), keyx + 292, keyy + Surface::getFontHeight() + 9, red); + Colour red = Colour(130, 0, 0); + drawText(tr("Rec: Set timer"), keyx + 292, keyy + Surface::getFontHeight() + 9, red); surface->fillblt(keyx + 474, keyy + 4, 128, Surface::getFontHeight() + 2, surface->rgba( 180, 180, 180, 255)); w.nextSymbol = WSymbol::PLAY; @@ -341,9 +340,11 @@ int VEpg::handleCommand(int command) } case Remote::RECORD: { - Log::getInstance()->log("VEPG", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s\n", thisEvent.id, thisEvent.time, thisEvent.duration, thisEvent.title); - - //TODO FIXME + Log::getInstance()->log("VEPG", Log::DEBUG, "ID %lu TIME %lu DURATION %lu TITLE %s", thisEvent.id, thisEvent.time, thisEvent.duration, thisEvent.title); + VEpgSetTimer* vs = new VEpgSetTimer(&thisEvent, (*chanList)[chanListbox.getCurrentOption()]); + vs->draw(); + viewman->add(vs); + viewman->updateView(vs); return 2; } case Remote::PLAY: diff --git a/vepg.h b/vepg.h index 4d48c50..a00da97 100644 --- a/vepg.h +++ b/vepg.h @@ -39,6 +39,7 @@ #include "event.h" #include "message.h" #include "vvideolive.h" +#include "vepgsettimer.h" class VVideoLive; diff --git a/vepgsettimer.cc b/vepgsettimer.cc new file mode 100644 index 0000000..7fdf590 --- /dev/null +++ b/vepgsettimer.cc @@ -0,0 +1,257 @@ +/* + Copyright 2004-2005 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "vepgsettimer.h" + +VEpgSetTimer::VEpgSetTimer(Event* tevent, Channel* tchannel) +{ + viewman = ViewMan::getInstance(); + vdr = VDR::getInstance(); + logger = Log::getInstance(); + + event = tevent; + channel = tchannel; + + create(400, 240); + if (Video::getInstance()->getFormat() == Video::PAL) + { + setScreenPos(150, 170); + } + else + { + setScreenPos(140, 140); + } + + setBackgroundColour(Colour::VIEWBACKGROUND); + setTitleBarOn(1); + setTitleBarColour(Colour::TITLEBARBACKGROUND); + setBorderOn(true); + setTitleText(tr("Set Timer")); + + buttonYes.setSurface(surface); + buttonNo.setSurface(surface); + buttonYes.setSurfaceOffset(80, 40 + (7 * surface->getFontHeight())); + buttonNo.setSurfaceOffset(220, 40 + (7 * surface->getFontHeight())); + + buttonYes.setText(tr("Yes")); + buttonNo.setText(tr("No")); + buttonYes.setActive(1); + selectedOption = YES; + + logger->log("VEPGST", Log::DEBUG, "Title: %s", event->title); + logger->log("VEPGST", Log::DEBUG, "Time: %lu", event->time); + logger->log("VEPGST", Log::DEBUG, "Duration: %lu", event->duration); + logger->log("VEPGST", Log::DEBUG, "Channel: %i", channel->number); +} + +VEpgSetTimer::~VEpgSetTimer() +{ +} + +char* VEpgSetTimer::genTimerString() +{ + // Allocate to return + char* timerString = new char[1024]; + + // Other + struct tm* btime; + int flags; + char dateString[20]; + char startMargin[10]; + time_t startTime; + char startString[10]; + char endMargin[10]; + time_t endTime; + char endString[10]; + char priority[10]; + char lifetime[10]; + char* eventTitle; + + flags = 1; // hard coded active timer flag + + btime = localtime((time_t*)&event->time); + strftime(dateString, 19, "%Y-%m-%d", btime); + + char* startMarginConfig = vdr->configLoad("Timers", "Start margin"); + if (startMarginConfig) + { + strncpy(startMargin, startMarginConfig, 9); + delete[] startMarginConfig; + } + else strcpy(startMargin, "5"); + + startTime = event->time - (atoi(startMargin) * 60); + btime = localtime(&startTime); + strftime(startString, 9, "%H%M", btime); + + char* endMarginConfig = vdr->configLoad("Timers", "End margin"); + if (endMarginConfig) + { + strncpy(endMargin, endMarginConfig, 9); + delete[] endMarginConfig; + } + else strcpy(endMargin, "5"); + + endTime = event->time + event->duration + (atoi(endMargin) * 60); + btime = localtime(&endTime); + strftime(endString, 9, "%H%M", btime); + + char* priorityConfig = vdr->configLoad("Timers", "Priority"); + if (priorityConfig) + { + strncpy(priority, priorityConfig, 9); + delete[] priorityConfig; + } + else strcpy(priority, "99"); + + char* lifetimeConfig = vdr->configLoad("Timers", "Lifetime"); + if (lifetimeConfig) + { + strncpy(lifetime, lifetimeConfig, 9); + delete[] lifetimeConfig; + } + else strcpy(lifetime, "99"); + + eventTitle = new char[strlen(event->title) + 1]; + strcpy(eventTitle, event->title); + for(UINT i=0; i < strlen(eventTitle); i++) if (eventTitle[i] == ':') eventTitle[i] = '|'; + + snprintf(timerString, 1023, "%i:%lu:%s:%s:%s:%s:%s:%s:", + flags, channel->number, dateString, + startString, endString, + priority, lifetime, eventTitle); + + delete[] eventTitle; + + return timerString; +} + +void VEpgSetTimer::swap() +{ + if (selectedOption == NO) + { + selectedOption = YES; + buttonYes.setActive(1); + buttonNo.setActive(0); + } + else if (selectedOption == YES) + { + selectedOption = NO; + buttonYes.setActive(0); + buttonNo.setActive(1); + } +} + +void VEpgSetTimer::draw() +{ + View::draw(); + drawPara(event->title, 10, 40, Colour::LIGHTTEXT); + drawText(channel->name, 10, 40 + (2 * surface->getFontHeight()), Colour::LIGHTTEXT); + + char fullString[20]; + time_t t; + struct tm* btime; + char timeString[10]; + btime = localtime((time_t*)&event->time); + strftime(timeString, 9, "%0H:%0M - ", btime); // and format it as hh:mm - + strcpy(fullString, timeString); // put it in our buffer + t = event->time + event->duration; //get programme end time + btime = localtime(&t); + strftime(timeString, 9, "%0H:%0M", btime); // and format it as hh:mm - + strcat(fullString, timeString); // put it in our buffer + + drawText(fullString, 10, 40 + (3 * surface->getFontHeight()), Colour::LIGHTTEXT); + drawText(tr("Create this timer?"), 10, 40 + (5 * surface->getFontHeight()), Colour::LIGHTTEXT); + + buttonYes.draw(); + buttonNo.draw(); +} + +int VEpgSetTimer::handleCommand(int command) +{ + switch(command) + { + case Remote::DF_LEFT: + case Remote::LEFT: + { + swap(); + draw(); + ViewMan::getInstance()->updateView(this); + return 2; + } + case Remote::DF_RIGHT: + case Remote::RIGHT: + { + swap(); + draw(); + ViewMan::getInstance()->updateView(this); + return 2; + } + case Remote::BACK: + { + return 4; + } + case Remote::OK: + { + if (selectedOption != YES) return 4; + doit(); + return 4; + } + } + + return 1; +} + + +void VEpgSetTimer::doit() +{ + char* timerString = genTimerString(); + logger->log("VEPGST", Log::DEBUG, "%s", timerString); + + ULONG ret = vdr->setEventTimer(timerString); + delete[] timerString; + + if (ret == 0) logger->log("VEPGST", Log::DEBUG, "Success"); + else if (ret == 1) logger->log("VEPGST", Log::DEBUG, "Fail: Timer already set for this event"); + else if (ret == 2) logger->log("VEPGST", Log::DEBUG, "Fail: General failure setting timer"); + + VInfo* vi = new VInfo(); + vi->create(400, 150); + vi->setExitable(); + vi->setBorderOn(1); + vi->setTitleBarOn(0); + + if (Video::getInstance()->getFormat() == Video::PAL) + vi->setScreenPos(170, 200); + else + vi->setScreenPos(160, 150); + + if (ret == 0) vi->setOneLiner(tr("Timer set successfully")); + else if (ret == 1) vi->setOneLiner(tr("There is already a timer for this event")); + else if (ret == 2) vi->setOneLiner(tr("Failure setting timer")); + vi->draw(); + + Message* m = new Message(); + m->message = Message::ADD_VIEW; + m->to = viewman; + m->parameter = (ULONG)vi; + + viewman->postMessage(m); +} diff --git a/vepgsettimer.h b/vepgsettimer.h new file mode 100644 index 0000000..01f05d4 --- /dev/null +++ b/vepgsettimer.h @@ -0,0 +1,70 @@ +/* + Copyright 2004-2005 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef VEPGSETTIMER_H +#define VEPGSETTIMER_H + +#include +#include "video.h" +#include "view.h" +#include "remote.h" +#include "viewman.h" +#include "vdr.h" +#include "event.h" +#include "channel.h" +#include "i18n.h" +#include "wbutton.h" +#include "vinfo.h" +#include "message.h" + +class VEpgSetTimer : public View +{ + public: + VEpgSetTimer(Event* event, Channel* channel); + ~VEpgSetTimer(); + + int handleCommand(int command); + void draw(); + + private: + Log* logger; + ViewMan* viewman; + VDR* vdr; + + Event* event; + Channel* channel; + + // This lot is borrowed from VQuestion + // A shame not to use it, but this view will probably get + // a whole load more controls on it some day + const static UCHAR NO = 0; + const static UCHAR YES = 1; + + UCHAR selectedOption; + + WButton buttonYes; + WButton buttonNo; + + char* genTimerString(); + void swap(); + void doit(); +}; + +#endif diff --git a/view.h b/view.h index 34bdca6..4da134f 100644 --- a/view.h +++ b/view.h @@ -52,11 +52,11 @@ class View : public Box Colour backgroundColour; char* titleText; - UCHAR titleBarOn; UCHAR borderOn; protected: Colour titleBarColour; + UCHAR titleBarOn; }; #endif diff --git a/vinfo.cc b/vinfo.cc index a687c73..3760da7 100644 --- a/vinfo.cc +++ b/vinfo.cc @@ -75,7 +75,8 @@ void VInfo::draw() if (mainTextType == ONELINER) { - drawTextCentre(mainText, area.w / 2, 75, Colour::LIGHTTEXT); + if (titleBarOn) drawTextCentre(mainText, area.w / 2, 75, Colour::LIGHTTEXT); + else drawTextCentre(mainText, area.w / 2, 55, Colour::LIGHTTEXT); } } } diff --git a/voptionsmenu.cc b/voptionsmenu.cc new file mode 100644 index 0000000..f0ef93b --- /dev/null +++ b/voptionsmenu.cc @@ -0,0 +1,272 @@ +/* + Copyright 2004-2005 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "voptionsmenu.h" + +VOptionsMenu::VOptionsMenu() +{ + viewman = ViewMan::getInstance(); + + create(460, 190); + if (Video::getInstance()->getFormat() == Video::PAL) + { + setScreenPos(140, 170); + } + else + { + setScreenPos(130, 140); + } + + setBackgroundColour(Colour::VIEWBACKGROUND); + setTitleBarOn(1); + setTitleBarColour(Colour::TITLEBARBACKGROUND); + setTitleText(tr("Options")); + + int fontHeight = surface->getFontHeight(); + + // Build gui + WButton* wb; + + wb = new WButton(); + wb->setText("General"); + wb->setSurface(surface); + wb->setSurfaceOffset(160, 70); + wb->setDimensions(140, fontHeight); + wb->setTag(1); + buttons.push_back(wb); + + wb = new WButton(); + wb->setText("Timers"); + wb->setSurface(surface); + wb->setSurfaceOffset(160, 110); + wb->setDimensions(140, fontHeight); + wb->setTag(2); + buttons.push_back(wb); + + selectedButton = buttons.begin(); + (*selectedButton)->setActive(1); +} + +VOptionsMenu::~VOptionsMenu() +{ + while (!buttons.empty()) + { + delete buttons.back(); + buttons.pop_back(); + } +} + +void VOptionsMenu::draw() +{ + View::draw(); + + vector::iterator i; + for(i = buttons.begin(); i != buttons.end(); i++) + { + (*i)->draw(); + } +} + +int VOptionsMenu::handleCommand(int command) +{ + switch(command) + { + case Remote::DF_UP: + case Remote::UP: + { + if (selectedButton == buttons.begin()) return 2; + (*selectedButton)->setActive(0); + selectedButton--; + (*selectedButton)->setActive(1); + draw(); // fixme - just draw buttons + viewman->updateView(this); + return 2; + } + case Remote::DF_DOWN: + case Remote::DOWN: + { + if (selectedButton == (buttons.end() - 1)) return 2; + (*selectedButton)->setActive(0); + selectedButton++; + (*selectedButton)->setActive(1); + draw(); // fixme - just draw buttons + viewman->updateView(this); + return 2; + } + case Remote::BACK: + { + return 4; + } + case Remote::OK: + { + switch((*selectedButton)->getTag()) + { + case 1: doGeneral(); break; + case 2: doTimers(); break; + } + return 2; + } + } + + return 1; +} + +void VOptionsMenu::processMessage(Message* m) +{ + if (m->message == Message::CHANGED_OPTIONS) + { + doApplyChanges((map*)m->parameter); + viewman->removeView(this); + } +} + +void VOptionsMenu::doApplyChanges(map* changedOptions) +{ + Video* video = Video::getInstance(); + map::iterator i; + + for(i = changedOptions->begin(); i != changedOptions->end(); i++) + { + printf("I FIRST = %i SECOND = %i\n", i->first, i->second); + + switch(i->first) + { + case 1: + { + if (i->second == 1) + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting New Remote"); + Remote::getInstance()->setRemoteType(Remote::NEWREMOTE); + } + else + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting Old Remote"); + Remote::getInstance()->setRemoteType(Remote::OLDREMOTE); + } + break; + } + case 2: + { + I18n::initialize(); + VWelcome::getInstance()->redrawLang(); + break; + } + case 3: + { + if (i->second == 1) + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting S-Video"); + video->setConnection(Video::SVIDEO); + } + else + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting RGB/Composite"); + video->setConnection(Video::COMPOSITERGB); + } + break; + } + case 4: + { + if (i->second == 1) + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting 16:9 TV"); + video->setTVsize(Video::ASPECT16X9); + } + else + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting 4:3 TV"); + video->setTVsize(Video::ASPECT4X3); + } + break; + } + case 5: + { + if (i->second == 1) + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting letterbox"); + video->setMode(Video::LETTERBOX); + } + else + { + Log::getInstance()->log("Options", Log::DEBUG, "Setting chop-sides"); + video->setMode(Video::NORMAL); + } + break; + } + } + } + + delete changedOptions; + +} + +void VOptionsMenu::doGeneral() +{ + static const int numOptions = 8; + + static const char* options1[] = {"Old", "New"}; + static const char* options3[] = {"RGB+composite", "S-Video"}; + static const char* options4[] = {"4:3", "16:9"}; + static const char* options5[] = {"Chop sides", "Letterbox"}; + static const char* options6[] = {"On", "Off", "Last state"}; + static const char* options7[] = {"All", "FTA only"}; + + const static OPTIONDATA optionData[numOptions] = + { + {1, "Remote control type", "General", "Remote type", OPTIONTYPE_TEXT, 2, 0, 0, options1 }, + {2, "Language", "General", "Language", OPTIONTYPE_TEXT, I18n::NumLanguages, 0, 0, I18n::Languages }, + {3, "TV connection type", "TV", "Connection", OPTIONTYPE_TEXT, 2, 0, 0, options3 }, + {4, "TV aspect ratio", "TV", "Aspect", OPTIONTYPE_TEXT, 2, 0, 0, options4 }, + {5, "16:9 on 4:3 display mode", "TV", "Widemode", OPTIONTYPE_TEXT, 2, 0, 0, options5 }, + {6, "Power state after bootup", "General", "Power After Boot", OPTIONTYPE_TEXT, 3, 0, 0, options6 }, + {7, "Display channels", "General", "Channels", OPTIONTYPE_TEXT, 2, 0, 0, options7 }, + {8, "VDR-Pri 0=OK !See forums!","General", "Live priority", OPTIONTYPE_INT, 100, 0, 0, NULL } + }; + + // As all the above data is const static, it can be sent to the new View, this stack frame can + // quit and the pointers will all still be valid. I think. (Hope). + + VOptions* v = new VOptions(this, "General Options", optionData, numOptions); + v->draw(); + viewman->add(v); + viewman->updateView(v); +} + + +void VOptionsMenu::doTimers() +{ + static const int numOptions = 4; + + const static OPTIONDATA optionData[numOptions] = + { + {9, "Default start margin (minutes)", "Timers", "Start margin", OPTIONTYPE_INT, 20, 5, 0, NULL }, + {10, "Default end margin (minutes)", "Timers", "End margin", OPTIONTYPE_INT, 20, 5, 0, NULL }, + {11, "Default priority", "Timers", "Priority", OPTIONTYPE_INT, 100, 99, 0, NULL }, + {12, "Default lifetime", "Timers", "Lifetime", OPTIONTYPE_INT, 100, 99, 0, NULL } + }; + + // As all the above data is const static, it can be sent to the new View, this stack frame can + // quit and the pointers will all still be valid. I think. (Hope). + + VOptions* v = new VOptions(this, "Timer Options", optionData, numOptions); + v->draw(); + viewman->add(v); + viewman->updateView(v); +} diff --git a/voptionsmenu.h b/voptionsmenu.h new file mode 100644 index 0000000..fb1cf08 --- /dev/null +++ b/voptionsmenu.h @@ -0,0 +1,59 @@ +/* + Copyright 2004-2005 Chris Tallon + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef VOPTIONSMENU_H +#define VOPTIONSMENU_H + +#include +#include +#include "view.h" +#include "remote.h" +#include "viewman.h" +#include "vdr.h" +#include "colour.h" +#include "video.h" +#include "wbutton.h" +#include "i18n.h" +#include "vwelcome.h" +#include "voptions.h" + +class VOptionsMenu : public View +{ + public: + VOptionsMenu(); + ~VOptionsMenu(); + + int handleCommand(int command); + void processMessage(Message* m); + void draw(); + + private: + void doGeneral(); + void doTimers(); + void doApplyChanges(map* changedOptions); + + VDR* vdr; + ViewMan* viewman; + + vector buttons; + vector::iterator selectedButton; +}; + +#endif diff --git a/vrecordinglist.h b/vrecordinglist.h index 306704f..ac7c823 100644 --- a/vrecordinglist.h +++ b/vrecordinglist.h @@ -23,6 +23,7 @@ #include #include +#include #include #include "view.h" -- 2.39.2