From bb92d937dd7c78b6c4225db769a2014eb062d9f5 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Sun, 13 Jan 2013 17:03:42 +0000 Subject: [PATCH] Show if recordings are new --- directory.cc | 15 +++++++ directory.h | 2 + recman.cc | 3 +- recman.h | 2 +- recording.cc | 6 +++ recording.h | 3 ++ vdr.cc | 7 ++-- vrecordinglist.cc | 104 ++++++++++++++++++++++++++-------------------- 8 files changed, 91 insertions(+), 51 deletions(-) diff --git a/directory.cc b/directory.cc index e158790..09b585b 100644 --- a/directory.cc +++ b/directory.cc @@ -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 diff --git a/directory.h b/directory.h index 1ad4aa8..e37c59d 100644 --- a/directory.h +++ b/directory.h @@ -41,6 +41,8 @@ class Directory Directory* getDirByName(char* dirName); ULONG getNumRecordings(); + ULONG getNumNewRecordings(); + void sort(bool chronoSortOrder); char* name; diff --git a/recman.cc b/recman.cc index 3812190..8691cc8 100644 --- 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); diff --git a/recman.h b/recman.h index 8266129..537075b 100644 --- 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); diff --git a/recording.cc b/recording.cc index 5d932f9..d173cae 100644 --- a/recording.cc +++ b/recording.cc @@ -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; diff --git a/recording.h b/recording.h index 2103bc2..be72734 100644 --- a/recording.h +++ b/recording.h @@ -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 678e767..9e1bf8a 100644 --- a/vdr.cc +++ b/vdr.cc @@ -222,7 +222,7 @@ void VDR::findServers(vector& 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; } diff --git a/vrecordinglist.cc b/vrecordinglist.cc index c96bd41..6689ddd 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -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(" %lu\t%s"), currentSubDir->getNumRecordings(), currentSubDir->name); + SNPRINTF(tempA, 299, tr(" %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; } -- 2.39.5