]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Current time bar on EPG
authorChris Tallon <chris@vomp.tv>
Thu, 15 Mar 2007 20:40:46 +0000 (20:40 +0000)
committerChris Tallon <chris@vomp.tv>
Thu, 15 Mar 2007 20:40:46 +0000 (20:40 +0000)
vepg.cc
vepg.h

diff --git a/vepg.cc b/vepg.cc
index 03f293e67895350423c6c677b290f569feadf526..c2db8fe3ff18436e57f4937f768c96469ae734a3 100644 (file)
--- 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 35a58c89deb089c353d2def513ee1e255297528b..a856b405af8f63ac27a5bf9fa3104c11780f8a4a 100644 (file)
--- a/vepg.h
+++ b/vepg.h
 #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;