From dff665259f40b9500b0a6c7f4f39502dc33f8302 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 15 Mar 2007 20:40:46 +0000 Subject: [PATCH] Current time bar on EPG --- vepg.cc | 30 +++++++++++++++++++++++++++++- vepg.h | 4 +++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/vepg.cc b/vepg.cc index 03f293e..c2db8fe 100644 --- a/vepg.cc +++ b/vepg.cc @@ -143,6 +143,8 @@ VEpg::VEpg(VVideoLive* v, UINT currentChannel) VEpg::~VEpg() { + Timers::getInstance()->cancelTimer(this, 1); + instance = NULL; for(UINT listIndex = 0; listIndex < gridRows; listIndex++) @@ -278,8 +280,27 @@ void VEpg::drawData() chanName.draw(); // TODO this should be dealt with by vvideolive progTitle.draw(); progInfo.draw(); + + // Set timer to redraw to move the current time bar + time_t t, dt; + time(&t); + dt = 60 - (t % 60); + if (dt == 0) dt = 60; + dt += t; + Timers::getInstance()->setTimerT(this, 1, dt); } +void VEpg::timercall(int clientReference) +{ + drawData(); + // Put updateView through master mutex since viewman is not mutex protected + Message* m = new Message(); + m->message = Message::REDRAW; + m->to = ViewMan::getInstance(); + m->from = this; + m->parameter = 0; + Command::getInstance()->postMessageFromOuterSpace(m); +} int VEpg::handleCommand(int command) { @@ -445,7 +466,14 @@ void VEpg::drawgrid() // redraws grid and select programme drawText(timeString, timex + 360, timey, Colour::LIGHTTEXT); // print right time rectangle(515, timey + Surface::getFontHeight(), 2, 7, Colour(255, 255, 255, 255)); // pointer to selTime - rectangle(155 + (selTime - ltime) / 20, timey + Surface::getFontHeight(), 2, 7, Colour(255, 50, 50, 255)); + //rectangle(155 + (selTime - ltime) / 20, timey + Surface::getFontHeight(), 2, 7, Colour(255, 50, 50, 255)); + + // current time line + time(&t); + if ((t >= ltime) && (t < (ltime + 9000))) + { + rectangle(155 + (t - ltime) / 20, timey + Surface::getFontHeight(), 2, ((Surface::getFontHeight() + 2) * 7) + 7 + 2, Colour::RED); + } // TODO should the above two comditional statements be combined to avoid calling updateEventList() twice? Event* event; diff --git a/vepg.h b/vepg.h index 35a58c8..a856b40 100644 --- a/vepg.h +++ b/vepg.h @@ -40,10 +40,11 @@ #include "message.h" #include "vvideolive.h" #include "vepgsettimer.h" +#include "timers.h" class VVideoLive; -class VEpg : public View +class VEpg : public View, public TimerReceiver { public: VEpg(VVideoLive* v, UINT currentChannel = 0); @@ -54,6 +55,7 @@ class VEpg : public View void draw(); // draw epg view void setCurrentChannel(char* chname); void processMessage(Message* m); + void timercall(int clientReference); private: static VEpg* instance; -- 2.39.5