]> git.vomp.tv Git - vompclient.git/commitdiff
View timer
authorChris Tallon <chris@vomp.tv>
Sun, 8 Jan 2006 18:19:59 +0000 (18:19 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 8 Jan 2006 18:19:59 +0000 (18:19 +0000)
Makefile
language-data.h
rectimer.h
vtimeredit.cc [new file with mode: 0644]
vtimeredit.h [new file with mode: 0644]
vtimerlist.cc
vtimerlist.h
vwelcome.cc

index 276a265ba261ebc71b1e70e2ea75868f2e22ff22..557dbaae9e042f801ef8527b8008254045134d1c 100644 (file)
--- 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 \
index 437b9f8e3d5d72bff68f3129327ddc20b676f79f..f940882e5b93ac31110552988a4b7e10ce05e1d8 100644 (file)
@@ -676,6 +676,15 @@ const I18n::tI18nPhrase I18n::Phrases[] =
     "Pas de detail du programme",\r
     "66",\r
   },\r
+  // Edit timer\r
+  { "Edit Timer",\r
+    "",\r
+    "",\r
+    "",\r
+    "",\r
+    "",\r
+    "67",\r
+  },\r
  // End marker.\r
   { NULL }\r
 };\r
index 42ba46f2ecc3f5fab479ff371cb76514726ea86a..840af9b6d9d72adbe41801c07e2d685ce5739c5a 100644 (file)
@@ -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 (file)
index 0000000..e5e1eaf
--- /dev/null
@@ -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 (file)
index 0000000..0279248
--- /dev/null
@@ -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 <stdio.h>
+#include <string.h>
+
+#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
index 088dd3608499f3d24159bdc90f28d2247fa95574..19ffbab5568cd630c8cd845c9a4b4371e5076a43 100644 (file)
@@ -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;
     }
index 9aff6c3863d5b727dea4359ed2009af93cd84f69..415f561230f6a0fc92b47fd69b411c7728567511 100644 (file)
@@ -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;
index 5fa09a949133b0518c4897145d4cb11e5d8c336f..cf2e74515a294f228aea9fb0037c8a6b979548a2 100644 (file)
@@ -272,7 +272,6 @@ void VWelcome::doTimersList()
   {
     VTimerList* vtl = new VTimerList(recTimerList);
 
-    vtl->draw();
     viewman->add(vtl);
     viewman->updateView(vtl);
   }