From 4ecb5228dcf70d51ac895e34f16fb31ddf10ac80 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 8 Jan 2006 18:19:59 +0000 Subject: [PATCH] View timer --- Makefile | 2 +- language-data.h | 9 +++ rectimer.h | 16 ++++- vtimeredit.cc | 160 ++++++++++++++++++++++++++++++++++++++++++++++++ vtimeredit.h | 51 +++++++++++++++ vtimerlist.cc | 107 ++++++++++++++++++-------------- vtimerlist.h | 7 ++- vwelcome.cc | 1 - 8 files changed, 301 insertions(+), 52 deletions(-) create mode 100644 vtimeredit.cc create mode 100644 vtimeredit.h diff --git a/Makefile b/Makefile index 276a265..557dbaa 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ CROSSLIBS = ../jpeg-6b/libjpeg.a OBJECTS = main.o command.o log.o remote.o led.o mtd.o video.o audio.o tcp.o directory.o thread.o event.o \ 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 \ + recording.o channel.o message.o playervideo.o messagequeue.o rectimer.o vtimeredit.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 \ vchannelselect.o vserverselect.o colour.o vconnect.o voptions.o vepg.o region.o \ diff --git a/language-data.h b/language-data.h index 437b9f8..f940882 100644 --- a/language-data.h +++ b/language-data.h @@ -676,6 +676,15 @@ const I18n::tI18nPhrase I18n::Phrases[] = "Pas de detail du programme", "66", }, + // Edit timer + { "Edit Timer", + "", + "", + "", + "", + "", + "67", + }, // End marker. { NULL } }; diff --git a/rectimer.h b/rectimer.h index 42ba46f..840af9b 100644 --- a/rectimer.h +++ b/rectimer.h @@ -63,4 +63,18 @@ class RecTimer // File = orig VDR info = filename // Directory = Base Dir -// Name = Prog name \ No newline at end of file +// Name = Prog name + +/* +Name +Directory +Active +Recording +Pending +Priority +Lifetime +Channel number +Start time +Stop time +Summary +*/ diff --git a/vtimeredit.cc b/vtimeredit.cc new file mode 100644 index 0000000..e5e1eaf --- /dev/null +++ b/vtimeredit.cc @@ -0,0 +1,160 @@ +/* + 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 "vtimeredit.h" + +VTimerEdit::VTimerEdit(RecTimer* trt) +{ + recTimer = trt; + + create(570, 420); + if (Video::getInstance()->getFormat() == Video::PAL) + { + setScreenPos(80, 70); + } + else + { + setScreenPos(70, 35); + } + + + setBackgroundColour(Colour::VIEWBACKGROUND); + setTitleBarOn(1); + setTitleText(tr("Edit Timer")); + setTitleBarColour(Colour::TITLEBARBACKGROUND); + + + // Draw statics + + draw(); // View::draw + + int xpos = 20; + int ypos = 50; + drawText("Active", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Channel", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Name", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Directory", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + ypos += surface->getFontHeight(); + drawText("Start", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Stop", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Priority", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Lifetime", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + ypos += surface->getFontHeight(); + drawText("Current", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Recording", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + drawText("Summary", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + + // Temp + char buffer[1000]; + struct tm* tms; + xpos = 150; + ypos = 50; + + // Active + if (recTimer->active) strcpy(buffer, "Yes"); + else strcpy(buffer, "No"); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Channel + snprintf(buffer, 999, "%lu", recTimer->channelNumber); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Name + snprintf(buffer, 999, "%s", recTimer->getName()); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Directory + if (recTimer->getDirectory()) snprintf(buffer, 999, "%s", recTimer->getDirectory()); + else strcpy(buffer, ""); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + ypos += surface->getFontHeight(); + + // Start + tms = localtime((time_t*)&recTimer->startTime); + strftime(buffer, 999, "%d/%m %H:%M", tms); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Stop + tms = localtime((time_t*)&recTimer->stopTime); + strftime(buffer, 999, "%d/%m %H:%M", tms); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Priority + snprintf(buffer, 999, "%lu", recTimer->priority); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Lifetime + snprintf(buffer, 999, "%lu", recTimer->lifeTime); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + ypos += surface->getFontHeight(); + + // Current + if (recTimer->pending) strcpy(buffer, "Yes"); + else strcpy(buffer, "No"); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Recording now + if (recTimer->recording) strcpy(buffer, "Yes"); + else strcpy(buffer, "No"); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + // Summary + strcpy(buffer, "View summary"); + drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight(); + + +} + +VTimerEdit::~VTimerEdit() +{ +} + +int VTimerEdit::handleCommand(int command) +{ + switch(command) + { + case Remote::DF_UP: + case Remote::UP: + { + + ViewMan::getInstance()->updateView(this); + return 2; + } + case Remote::DF_DOWN: + case Remote::DOWN: + { + + ViewMan::getInstance()->updateView(this); + return 2; + } + case Remote::OK: + { + + return 2; + } + case Remote::BACK: + { + return 4; + } + } + // stop command getting to any more views + return 1; +} diff --git a/vtimeredit.h b/vtimeredit.h new file mode 100644 index 0000000..0279248 --- /dev/null +++ b/vtimeredit.h @@ -0,0 +1,51 @@ +/* + 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 VTIMEREDIT_H +#define VTIMEREDIT_H + +#include +#include + +#include "view.h" +#include "wselectlist.h" +#include "remote.h" +#include "wsymbol.h" +#include "viewman.h" +#include "vdr.h" +#include "colour.h" +#include "video.h" +#include "i18n.h" +#include "timers.h" + +class VTimerEdit : public View +{ + public: + VTimerEdit(RecTimer* rt); + ~VTimerEdit(); + + int handleCommand(int command); + + private: + RecTimer* recTimer; + +}; + +#endif diff --git a/vtimerlist.cc b/vtimerlist.cc index 088dd36..19ffbab 100644 --- a/vtimerlist.cc +++ b/vtimerlist.cc @@ -49,7 +49,36 @@ VTimerList::VTimerList(RecTimerList* trtl) sl.setSurfaceOffset(10, 30 + 5); sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30); - drawData(); + // Draw statics + + draw(); // View::draw + + WSymbol w; + w.setSurface(surface); + + w.nextSymbol = WSymbol::UP; + w.setSurfaceOffset(20, 385); + w.draw(); + + w.nextSymbol = WSymbol::DOWN; + w.setSurfaceOffset(50, 385); + w.draw(); + + w.nextSymbol = WSymbol::SKIPBACK; + w.setSurfaceOffset(85, 385); + w.draw(); + + w.nextSymbol = WSymbol::SKIPFORWARD; + w.setSurfaceOffset(115, 385); + w.draw(); + + drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT); + + + insertData(); + sl.draw(); + drawShowing(); + drawClock(); } VTimerList::~VTimerList() @@ -67,15 +96,18 @@ VTimerList::~VTimerList() } } -void VTimerList::drawData() +void VTimerList::insertData() { char strA[300]; char strB[300]; + char status; struct tm* btime; + // FIXME all drawing stuff in this class and sl.clear somewhere?! + sl.addColumn(0); - sl.addColumn(110); + sl.addColumn(130); RecTimer* recTimer; int first = 1; @@ -83,9 +115,26 @@ void VTimerList::drawData() for (UINT i = 0; i < recTimerList->size(); i++) { recTimer = (*recTimerList)[i]; + if (recTimer->recording) + { + status = 'R'; + } + else if (recTimer->pending) + { + status = 'X'; + } + else if (recTimer->active == 0) + { + status = 'N'; + } + else + { + status = 'O'; + } + btime = localtime((time_t*)&recTimer->startTime); strftime(strA, 299, "%d/%m %H:%M ", btime); - snprintf(strB, 299, "%s\t%s", strA, recTimer->getName()); + snprintf(strB, 299, "%c %s\t%s", status, strA, recTimer->getName()); recTimer->index = sl.addOption(strB, first); first = 0; } @@ -106,39 +155,7 @@ void VTimerList::drawClock() Timers::getInstance()->setTimer(this, 1, t + 1); } -void VTimerList::draw() -{ - View::draw(); - sl.draw(); - - // Put the status stuff at the bottom - - WSymbol w; - w.setSurface(surface); - - w.nextSymbol = WSymbol::UP; - w.setSurfaceOffset(20, 385); - w.draw(); - - w.nextSymbol = WSymbol::DOWN; - w.setSurfaceOffset(50, 385); - w.draw(); - - w.nextSymbol = WSymbol::SKIPBACK; - w.setSurfaceOffset(85, 385); - w.draw(); - - w.nextSymbol = WSymbol::SKIPFORWARD; - w.setSurfaceOffset(115, 385); - w.draw(); - - drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT); - - doShowingBar(); - drawClock(); -} - -void VTimerList::doShowingBar() +void VTimerList::drawShowing() { int topOption = sl.getTopOption() + 1; if (sl.getNumOptions() == 0) topOption = 0; @@ -164,8 +181,7 @@ int VTimerList::handleCommand(int command) { sl.up(); sl.draw(); - - doShowingBar(); + drawShowing(); ViewMan::getInstance()->updateView(this); return 2; } @@ -174,8 +190,7 @@ int VTimerList::handleCommand(int command) { sl.down(); sl.draw(); - - doShowingBar(); + drawShowing(); ViewMan::getInstance()->updateView(this); return 2; } @@ -183,8 +198,7 @@ int VTimerList::handleCommand(int command) { sl.pageUp(); sl.draw(); - - doShowingBar(); + drawShowing(); ViewMan::getInstance()->updateView(this); return 2; } @@ -192,8 +206,7 @@ int VTimerList::handleCommand(int command) { sl.pageDown(); sl.draw(); - - doShowingBar(); + drawShowing(); ViewMan::getInstance()->updateView(this); return 2; } @@ -213,7 +226,9 @@ int VTimerList::handleCommand(int command) if (recTimer == NULL) return 2; - // recTimer is the one you want FIXME + VTimerEdit* v = new VTimerEdit(recTimer); + ViewMan::getInstance()->add(v); + ViewMan::getInstance()->updateView(v); return 2; } diff --git a/vtimerlist.h b/vtimerlist.h index 9aff6c3..415f561 100644 --- a/vtimerlist.h +++ b/vtimerlist.h @@ -35,6 +35,7 @@ #include "video.h" #include "i18n.h" #include "timers.h" +#include "vtimeredit.h" class VTimerList : public View, public TimerReceiver { @@ -43,16 +44,16 @@ class VTimerList : public View, public TimerReceiver ~VTimerList(); int handleCommand(int command); - void draw(); void timercall(int clientReference); - void drawClock(); private: RecTimerList* recTimerList; WSelectList sl; - void doShowingBar(); + void insertData(); + void drawClock(); + void drawShowing(); void drawData(); Region clockRegion; diff --git a/vwelcome.cc b/vwelcome.cc index 5fa09a9..cf2e745 100644 --- a/vwelcome.cc +++ b/vwelcome.cc @@ -272,7 +272,6 @@ void VWelcome::doTimersList() { VTimerList* vtl = new VTimerList(recTimerList); - vtl->draw(); viewman->add(vtl); viewman->updateView(vtl); } -- 2.39.5