Show if recordings are new
authorChris Tallon <chris@vomp.tv>
Sun, 13 Jan 2013 17:03:42 +0000 (17:03 +0000)
committerChris Tallon <chris@vomp.tv>
Sun, 13 Jan 2013 17:03:42 +0000 (17:03 +0000)
directory.cc
directory.h
recman.cc
recman.h
recording.cc
recording.h
vdr.cc
vrecordinglist.cc

index e1587905f6354c5411e4b78125d6e2b9c22bde1e..09b585bf08fe65edfb5e20451c02c2108d42036f 100644 (file)
@@ -69,6 +69,21 @@ ULONG Directory::getNumRecordings()
   return total;
 }
 
+ULONG Directory::getNumNewRecordings()
+{
+  ULONG total = 0;
+  for (UINT i = 0; i < recList.size(); i++)
+  {
+    if (recList[i]->getNew()) ++total;
+  }
+  for(UINT i = 0; i < dirList.size(); i++)
+  {
+    total += dirList[i]->getNumNewRecordings();
+  }
+  return total;
+}
+
 void Directory::sort(bool chronoSortOrder)
 {
   // Sort the directory order
index 1ad4aa8d48e058be4a70a0877204225251f802e0..e37c59d1dcee5d1d0eb10a41b5b792634a78b234 100644 (file)
@@ -41,6 +41,8 @@ class Directory
 
     Directory* getDirByName(char* dirName);
     ULONG getNumRecordings();
+    ULONG getNumNewRecordings();
+    
     void sort(bool chronoSortOrder);
 
     char* name;
index 38121900c2c99a4a50375f32d64780f42337f8fa..8691cc8cba942ca7e85923aa7ace7b7db89f3877 100644 (file)
--- a/recman.cc
+++ b/recman.cc
@@ -47,9 +47,10 @@ void RecMan::setStats(ULONG ttotalSpace, ULONG tfreeSpace, ULONG tusedPercent)
   usedPercent = tusedPercent;
 }
 
-void RecMan::addEntry(ULONG startTime, char* name, char* fileName)
+void RecMan::addEntry(bool isNew, ULONG startTime, char* name, char* fileName)
 {
   Recording* rec = new Recording();
+  rec->setNew(isNew);
   rec->setStartTime(startTime);
   rec->setFileName(fileName);
 
index 82661290d466df7204aa9fd33320456c7bdf80cd..537075b78fb42f909ba5434ce385e25199b3d740 100644 (file)
--- a/recman.h
+++ b/recman.h
@@ -45,7 +45,7 @@ class RecMan
     void setSortOrderChron();
     void toggleSortOrder();
     void setStats(ULONG totalSpace, ULONG freeSpace, ULONG usedPercent);
-    void addEntry(ULONG startTime, char* name, char* filename); // modifies name
+    void addEntry(bool isNew, ULONG startTime, char* name, char* filename); // modifies name
     void sort();
     int deleteRecording(Recording* rec);
     int moveRecording(Recording* toMove, Directory* toDir);
index 5d932f9a0d41c6468e446ecf2a7afe479adb7b57..d173cae2af7d8145d25e8e1e182cd7d8967027ff 100644 (file)
@@ -35,6 +35,7 @@ Recording::Recording()
   logger = Log::getInstance();
   vdr = VDR::getInstance();
 
+  isNew = false;
   start = 0;
   progName = NULL;
   fileName = NULL;
@@ -76,6 +77,11 @@ char* Recording::getFileName() const
   return fileName;
 }
 
+void Recording::setNew(bool param)
+{
+  isNew = param;
+}
+
 void Recording::setStartTime(ULONG tstartTime)
 {
   start = tstartTime;
index 2103bc2ffcfd2bd95083a355cfd3831d7a96a601..be7273461bfb1ef074d7e6a778e616e0c4bc87d4 100644 (file)
@@ -34,6 +34,7 @@ class Recording
     Recording();
     ~Recording();
 
+    void setNew(bool isNew);
     void setStartTime(ULONG startTime);
     void setProgName(char* progName);
     void setFileName(char* fileName);
@@ -47,6 +48,7 @@ class Recording
     void loadRecInfo();
     void dropRecInfo();
 
+    bool getNew() { return isNew; }
     bool isRadio(bool &h264);
     bool IsPesRecording;
 
@@ -62,6 +64,7 @@ class Recording
     Log* logger;
     VDR* vdr;
 
+    bool isNew;
     ULONG start;
     char* progName;
     char* fileName;
diff --git a/vdr.cc b/vdr.cc
index 678e767b8cbbe769afe182c4503130afe90b5c68..9e1bf8a2e6fad37e8af2651b9bd39f709c37f78a 100644 (file)
--- a/vdr.cc
+++ b/vdr.cc
@@ -222,7 +222,7 @@ void VDR::findServers(vector<VDRServer>& servers)
       strcpy(newServer.name,"debug");
       servers.push_back(newServer);
       waitType = 2;
-      haveAtLeastOne = 1;}/**/
+      haveAtLeastOne = 1;}/ * */
 
 
 
@@ -740,16 +740,17 @@ bool VDR::getRecordingsList(RecMan* recman)
   recman->setStats(totalSpace, freeSpace, percent);
 
   ULONG start;
+  UCHAR isNew;
   char* name;
   char* fileName;
 
   while (!vresp->end())
   {
-
     start = vresp->extractULONG();
+    isNew = vresp->extractUCHAR();
     name = vresp->extractString();
     fileName = vresp->extractString();
-    recman->addEntry(start, name, fileName);
+    recman->addEntry(isNew, start, name, fileName);
     delete[] name;
     delete[] fileName;
   }
index c96bd41e8c01cb652a08b50abd076393acaa5c4f..6689ddd058404108e842dfbebf7ea4cd6381219b 100644 (file)
@@ -74,7 +74,8 @@ void VRecordingList::drawData(bool doIndexPop)
   int saveTop = sl.getTopOption();
   sl.clear();
   sl.addColumn(0);
-  sl.addColumn(110);
+  sl.addColumn(102);
+  sl.addColumn(118);
 
   int first = 1;
 
@@ -88,7 +89,7 @@ void VRecordingList::drawData(bool doIndexPop)
   for (i = dirList->begin(); i != dirList->end(); i++)
   {
     currentSubDir = *i;
-    SNPRINTF(tempA, 299, tr("<dir> %lu\t%s"), currentSubDir->getNumRecordings(), currentSubDir->name);
+    SNPRINTF(tempA, 299, tr("<dir> %lu/%lu\t \t%s"), currentSubDir->getNumNewRecordings(), currentSubDir->getNumRecordings(), currentSubDir->name);
     currentSubDir->index = sl.addOption(tempA, 0, first);
     first = 0;
   }
@@ -108,7 +109,8 @@ void VRecordingList::drawData(bool doIndexPop)
 //#else
     strftime(tempA, 299, "%d/%m %H:%M ", btime);
 //#endif
-    sprintf(tempB, "%s\t%s", tempA, currentRec->getProgName());
+    sprintf(tempB, "%s\t%c\t%s", tempA, (currentRec->getNew() ? '*': ' '), currentRec->getProgName());
+      
     currentRec->index = sl.addOption(tempB, 0, first);
     first = 0;
   }
@@ -329,8 +331,7 @@ int VRecordingList::doPlay(bool resume)
   {
     toPlay->loadRecInfo(); // check if still need this
     toPlay->loadMarks();
-       bool ish264;
-
+    bool ish264;
     bool isRadio = toPlay->isRadio(ish264);
 
     if (isRadio)
@@ -340,50 +341,61 @@ int VRecordingList::doPlay(bool resume)
       boxstack->add(radrec);
       boxstack->update(radrec);
       radrec->go();
+      
+      toPlay->setNew(false);
+      draw();
+      boxstack->update(this);
     }
     else
     {
-               if (ish264 && !Video::getInstance()->supportsh264()) {
-                       VInfo* vi = new VInfo();
-                       vi->setSize(360, 200);
-                       vi->createBuffer();
-                       if (Video::getInstance()->getFormat() == Video::PAL)
-                               vi->setPosition(190, 170);
-                       else
-                               vi->setPosition(180, 120);
-                       vi->setOneLiner(tr("H264 video not supported"));
-                       vi->setExitable();
-                       vi->setBorderOn(1);
-                       vi->setTitleBarColour(DrawStyle::DANGER);
-                       vi->okButton();
-                       vi->draw();
-                       boxstack->add(vi);
-                       boxstack->update(vi);
-                       
-               } else if (!ish264 && !Video::getInstance()->supportsmpeg2()) {
-                       VInfo* vi = new VInfo();
-                       vi->setSize(360, 200);
-                       vi->createBuffer();
-                       if (Video::getInstance()->getFormat() == Video::PAL)
-                               vi->setPosition(190, 170);
-                       else
-                               vi->setPosition(180, 120);
-                       vi->setOneLiner(tr("Mpeg2 video not supported"));
-                       vi->setExitable();
-                       vi->setBorderOn(1);
-                       vi->setTitleBarColour(DrawStyle::DANGER);
-                       vi->okButton();
-                       vi->draw();
-                       boxstack->add(vi);
-                       boxstack->update(vi);
-
-               }else {
-                       VVideoRec* vidrec = new VVideoRec(toPlay, ish264);
-                       vidrec->draw();
-                       boxstack->add(vidrec);
-                       boxstack->update(vidrec);
-                       vidrec->go(resume);
-               }
+      if (ish264 && !Video::getInstance()->supportsh264())
+      {
+        VInfo* vi = new VInfo();
+        vi->setSize(360, 200);
+        vi->createBuffer();
+        if (Video::getInstance()->getFormat() == Video::PAL)
+          vi->setPosition(190, 170);
+        else
+          vi->setPosition(180, 120);
+        vi->setOneLiner(tr("H264 video not supported"));
+        vi->setExitable();
+        vi->setBorderOn(1);
+        vi->setTitleBarColour(DrawStyle::DANGER);
+        vi->okButton();
+        vi->draw();
+        boxstack->add(vi);
+        boxstack->update(vi);
+      }
+      else if (!ish264 && !Video::getInstance()->supportsmpeg2())
+      {
+        VInfo* vi = new VInfo();
+        vi->setSize(360, 200);
+        vi->createBuffer();
+        if (Video::getInstance()->getFormat() == Video::PAL)
+          vi->setPosition(190, 170);
+        else
+          vi->setPosition(180, 120);
+        vi->setOneLiner(tr("Mpeg2 video not supported"));
+        vi->setExitable();
+        vi->setBorderOn(1);
+        vi->setTitleBarColour(DrawStyle::DANGER);
+        vi->okButton();
+        vi->draw();
+        boxstack->add(vi);
+        boxstack->update(vi);
+      }
+      else
+      {
+        VVideoRec* vidrec = new VVideoRec(toPlay, ish264);
+        vidrec->draw();
+        boxstack->add(vidrec);
+        boxstack->update(vidrec);
+        vidrec->go(resume);
+
+        toPlay->setNew(false);
+        draw();
+        boxstack->update(this);
+      }
     }
     return 1;
   }