From cce60c8094cff7e1355df9c869c40942730390d8 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Fri, 4 Oct 2019 18:26:15 +0100 Subject: [PATCH] UI feedback for recording: mark as new --- message.h | 3 ++- recinfo.cc | 6 ++++-- recinfo.h | 2 +- recording.cc | 4 ++-- recording.h | 2 +- vrecording.cc | 54 +++++++++++++++++++++++++++++++++++++++++------ vrecording.h | 1 + vrecordinglist.cc | 7 +++++- 8 files changed, 65 insertions(+), 14 deletions(-) diff --git a/message.h b/message.h index ccddee0..d6a124c 100644 --- a/message.h +++ b/message.h @@ -1,5 +1,5 @@ /* - Copyright 2004-2005 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -82,6 +82,7 @@ class Message const static ULONG MOUSE_SCROLL = 35; const static ULONG NEW_PICTURE = 36; const static ULONG NEW_PICTURE_STATIC = 37; + const static ULONG REDRAW = 38; const static ULONG HACK_MVP_RETURN_FROM_QUARTER = 999; }; diff --git a/recinfo.cc b/recinfo.cc index 1b7e238..45a34f0 100644 --- a/recinfo.cc +++ b/recinfo.cc @@ -156,10 +156,12 @@ bool RecInfo::hasNoVideo() return true; } -char* RecInfo::buildSummaryWithDetails() +char* RecInfo::buildSummaryWithDetails(bool forceRefresh) { - if (!summaryWithDetails) + if (!summaryWithDetails || forceRefresh) { + if (forceRefresh && summaryWithDetails) delete[] summaryWithDetails; + Log* logger = Log::getInstance(); int swdLength = strlen(summary) + diff --git a/recinfo.h b/recinfo.h index 7180203..195147a 100644 --- a/recinfo.h +++ b/recinfo.h @@ -64,7 +64,7 @@ class RecInfo void setNumComponents(ULONG); void addComponent(ULONG componentNum, UCHAR tstream, UCHAR ttype, char* tlanguage, char* tdescription); // addComponent accepts a pointer to a buffer that RecInfo will free, not the caller - char* buildSummaryWithDetails(); + char* buildSummaryWithDetails(bool forceRefresh = false); void print(); diff --git a/recording.cc b/recording.cc index 6921c33..c1bcff9 100644 --- a/recording.cc +++ b/recording.cc @@ -261,7 +261,7 @@ MarkList* Recording::getMarkList() return markList; } -void Recording::resetResume() +int Recording::resetResume() { - vdr->deleteRecResume(fileName); + return vdr->deleteRecResume(fileName); } diff --git a/recording.h b/recording.h index 674061b..50ff7f2 100644 --- a/recording.h +++ b/recording.h @@ -49,7 +49,7 @@ class Recording void dropRecInfo(); bool getNew() { return isNew; } - void resetResume(); + int resetResume(); bool isRadio(bool &h264); bool IsPesRecording; diff --git a/vrecording.cc b/vrecording.cc index 48d78fb..9a14028 100644 --- a/vrecording.cc +++ b/vrecording.cc @@ -78,18 +78,18 @@ VRecording::VRecording(RecMan* trecman, Recording* trec) + epgSummaryTextBox = new WTextbox(); - WTextbox * summary=new WTextbox(); - summary->setParaMode(true); + epgSummaryTextBox->setParaMode(true); if (rec->recInfo) - summary->setText(rec->recInfo->buildSummaryWithDetails()); + epgSummaryTextBox->setText(rec->recInfo->buildSummaryWithDetails()); else - summary->setText(tr("Summary unavailable")); + epgSummaryTextBox->setText(tr("Summary unavailable")); OsdVector *osdv=dynamic_cast(Osd::getInstance()); - tabbar.addTab(tr("EPG"), summary); + tabbar.addTab(tr("EPG"), epgSummaryTextBox); if (rec->movieInfo) { WMovieView *movieview = new WMovieView(rec->movieInfo); movieview->setParaMode(true); @@ -243,7 +243,49 @@ int VRecording::handleCommand(int command) if (selected == MARKASNEW) { - rec->resetResume(); + int ret = rec->resetResume(); + + VInfo* vi = new VInfo(); + vi->setSize(400, 150); + vi->createBuffer(); + vi->setExitable(); + vi->setBorderOn(1); + vi->setTitleBarOn(0); + + if (Video::getInstance()->getFormat() == Video::PAL) + vi->setPosition(170, 200); + else + vi->setPosition(160, 150); + + if (ret == 1) vi->setOneLiner(tr("Success")); + else if (ret == 2) vi->setOneLiner(tr("No resume point exists")); + else if (ret == 4) vi->setOneLiner(tr("Failure deleting resume point")); + else if (ret == 5) vi->setOneLiner(tr("Not supported with VDR < 2.4.0")); + vi->draw(); + + Message* m = new Message(); + m->message = Message::ADD_VIEW; + m->to = BoxStack::getInstance(); + m->parameter.num = (ULONG)vi; + Command::getInstance()->postMessageNoLock(m); + + if (ret == 1) + { + // Change Resume at text in summary + rec->recInfo->resumePoint = 0; + epgSummaryTextBox->setText(rec->recInfo->buildSummaryWithDetails(true)); + draw(); + BoxStack::getInstance()->update(this); + + // Update vrecordingslist to remove the * for new + rec->setNew(true); + Message* m2 = new Message(); + m2->from = this; + m2->to = vRecList; + m2->message = Message::REDRAW; + Command::getInstance()->postMessageNoLock(m2); + } + return 2; } diff --git a/vrecording.h b/vrecording.h index faf8d0d..9cab393 100644 --- a/vrecording.h +++ b/vrecording.h @@ -51,6 +51,7 @@ class VRecording : public TBBoxx VRecordingList* vRecList; Recording* rec; WTabBar tabbar; + WTextbox* epgSummaryTextBox; enum Action { PLAY=0, RESUME, MARKASNEW, MOVE, A_DELETE, last }; WButton button[last]; diff --git a/vrecordinglist.cc b/vrecordinglist.cc index b99b991..bbb0e87 100644 --- a/vrecordinglist.cc +++ b/vrecordinglist.cc @@ -1,5 +1,5 @@ /* - Copyright 2004-2007 Chris Tallon + Copyright 2004-2019 Chris Tallon This file is part of VOMP. @@ -98,6 +98,11 @@ void VRecordingList::processMessage(Message* m) { doPlay(true); } + else if (m->message == Message::REDRAW) + { + draw(); + BoxStack::getInstance()->update(this); + } } void VRecordingList::doDeleteSelected() -- 2.39.2