From baa97e9ff1b75497274c4a25711896e3c29ce689 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 12 Feb 2025 21:18:53 +0100 Subject: [PATCH] Added missing calls to cStatus::MsgOsdStatusMessage() and added the new virtual function cStatus::OsdStatusMessage2(), which can be used to get the type of the message --- CONTRIBUTORS | 2 ++ HISTORY | 7 ++++++- PLUGINS/src/status/HISTORY | 3 ++- PLUGINS/src/status/status.c | 8 ++++---- osdbase.c | 8 ++++++-- skins.c | 6 +++--- status.c | 6 +++--- status.h | 8 ++++++-- 8 files changed, 32 insertions(+), 16 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 87104638..bbcfab1b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2594,6 +2594,8 @@ Markus Ehrnsperger for reporting an improper call of cStatus::OsdCurrentItem() before cStatus::OsdItem2() for fixing unnecessary calls to DisplayCurrent() for editable menu items for implementing cStatus::OsdCurrentItem2() with the index of the current item + for adding missing calls to cStatus::MsgOsdStatusMessage() and implementing + cStatus::OsdStatusMessage2() with the type of the message Werner Färber for reporting a bug in handling the cPluginManager::Active() result when pressing diff --git a/HISTORY b/HISTORY index ef3e5e1a..6b153f2e 100644 --- a/HISTORY +++ b/HISTORY @@ -10034,7 +10034,7 @@ Video Disk Recorder Revision History (suggested by Stefan Hofmann). - Added vdrrootdir and incdir to vdr.pc (thanks to Stefan Hofmann). -2025-02-05: +2025-02-12: - Removed all DEPRECATED_* code. - Fixed error checking in case the fps value can't be determined by the frame parser. @@ -10073,3 +10073,8 @@ Video Disk Recorder Revision History cStatus::OsdCurrentItem() will still work as before, because the default implementation of cStatus::OsdCurrentItem2() calls cStatus::OsdCurrentItem(). - Fixed unnecessary calls to cStatus::OsdCurrentItem2() when scrolling. +- Added missing calls to cStatus::MsgOsdStatusMessage() and added the new virtual function + cStatus::OsdStatusMessage2(), which can be used to get the type of the message (thanks + to Markus Ehrnsperger). Plugins that implemented cStatus::OsdStatusMessage() will still + work as before, because the default implementation of cStatus::OsdStatusMessage2() calls + cStatus::OsdStatusMessage(). diff --git a/PLUGINS/src/status/HISTORY b/PLUGINS/src/status/HISTORY index a483c4fb..98a9d2e9 100644 --- a/PLUGINS/src/status/HISTORY +++ b/PLUGINS/src/status/HISTORY @@ -77,8 +77,9 @@ VDR Plugin 'status' Revision History - Official release. -2025-01-29: Version 2.6.1 +2025-02-10: Version 2.6.1 - Added cStatus::OsdItem2(). - Activated logging of OsdItem2(). - Added cStatus::OsdCurrentItem2(). +- Added cStatus::OsdStatusMessage2(). diff --git a/PLUGINS/src/status/status.c b/PLUGINS/src/status/status.c index 137cc6c0..8bbd0a4f 100644 --- a/PLUGINS/src/status/status.c +++ b/PLUGINS/src/status/status.c @@ -3,7 +3,7 @@ * * See the README file for copyright information and how to reach the author. * - * $Id: status.c 5.3 2025/01/29 11:15:26 kls Exp $ + * $Id: status.c 5.4 2025/02/12 21:18:53 kls Exp $ */ #include @@ -27,7 +27,7 @@ protected: virtual void SetSubtitleTrack(int Index, const char * const *Tracks); virtual void OsdClear(void); virtual void OsdTitle(const char *Title); - virtual void OsdStatusMessage(const char *Message); + virtual void OsdStatusMessage2(eMessageType Type, const char *Message); virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue); virtual void OsdItem2(const char *Text, int Index, bool Selectable); virtual void OsdCurrentItem2(const char *Text, int Index); @@ -86,9 +86,9 @@ void cStatusTest::OsdTitle(const char *Title) dsyslog("status: cStatusTest::OsdTitle '%s'", Title); } -void cStatusTest::OsdStatusMessage(const char *Message) +void cStatusTest::OsdStatusMessage2(eMessageType Type, const char *Message) { - dsyslog("status: cStatusTest::OsdStatusMessage '%s'", Message); + dsyslog("status: cStatusTest::OsdStatusMessage2 %d '%s'", Type, Message); } void cStatusTest::OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue) diff --git a/osdbase.c b/osdbase.c index 294c2ad8..99f5a997 100644 --- a/osdbase.c +++ b/osdbase.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: osdbase.c 5.6 2025/02/05 22:12:32 kls Exp $ + * $Id: osdbase.c 5.7 2025/02/12 21:18:53 kls Exp $ */ #include "osdbase.h" @@ -170,6 +170,7 @@ void cOsdMenu::SetStatus(const char *s) free(status); status = s ? strdup(s) : NULL; displayMenu->SetMessage(mtStatus, s); + cStatus::MsgOsdStatusMessage(mtStatus, s); } void cOsdMenu::SetTitle(const char *Title) @@ -242,6 +243,7 @@ void cOsdMenu::Display(void) if (cOsdProvider::OsdSizeChanged(osdState)) SetDisplayMenu(); displayMenu->SetMessage(mtStatus, NULL); + cStatus::MsgOsdStatusMessage(mtStatus, NULL); displayMenu->Clear(); if (conveyStatus) cStatus::MsgOsdClear(); @@ -287,8 +289,10 @@ void cOsdMenu::Display(void) } } displayMenu->SetScrollbar(count, first); - if (!isempty(status)) + if (!isempty(status)) { displayMenu->SetMessage(mtStatus, status); + cStatus::MsgOsdStatusMessage(mtStatus, status); + } } void cOsdMenu::SetCurrent(cOsdItem *Item) diff --git a/skins.c b/skins.c index 4915583c..ccd57843 100644 --- a/skins.c +++ b/skins.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: skins.c 5.4 2024/09/21 16:21:08 kls Exp $ + * $Id: skins.c 5.5 2025/02/12 21:18:53 kls Exp $ */ #include "skins.h" @@ -305,7 +305,7 @@ eKeys cSkins::Message(eMessageType Type, const char *s, int Seconds) } cSkinDisplay::Current()->SetMessage(Type, s); cSkinDisplay::Current()->Flush(); - cStatus::MsgOsdStatusMessage(s); + cStatus::MsgOsdStatusMessage(Type, s); eKeys k = kNone; if (Type != mtStatus) { k = Interface->Wait(Seconds); @@ -316,7 +316,7 @@ eKeys cSkins::Message(eMessageType Type, const char *s, int Seconds) } else { cSkinDisplay::Current()->SetMessage(Type, NULL); - cStatus::MsgOsdStatusMessage(NULL); + cStatus::MsgOsdStatusMessage(Type, NULL); } } else if (!s && displayMessage) { diff --git a/status.c b/status.c index 922c35ab..ec58d7eb 100644 --- a/status.c +++ b/status.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.c 5.2 2025/01/29 11:15:26 kls Exp $ + * $Id: status.c 5.3 2025/02/12 21:18:53 kls Exp $ */ #include "status.h" @@ -95,10 +95,10 @@ void cStatus::MsgOsdTitle(const char *Title) sm->OsdTitle(Title); } -void cStatus::MsgOsdStatusMessage(const char *Message) +void cStatus::MsgOsdStatusMessage(eMessageType Type, const char *Message) { for (cStatus *sm = statusMonitors.First(); sm; sm = statusMonitors.Next(sm)) - sm->OsdStatusMessage(Message); + sm->OsdStatusMessage2(Type, Message); } void cStatus::MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue) diff --git a/status.h b/status.h index 7f95b267..f89c8b80 100644 --- a/status.h +++ b/status.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: status.h 5.2 2025/01/29 11:15:26 kls Exp $ + * $Id: status.h 5.3 2025/02/12 21:18:53 kls Exp $ */ #ifndef __STATUS_H @@ -13,6 +13,7 @@ #include "config.h" #include "device.h" #include "player.h" +#include "skins.h" #include "tools.h" // Several member functions of the following classes are called with a pointer to @@ -81,6 +82,7 @@ protected: virtual void OsdTitle(const char *Title) {} // Title has been displayed in the title line of the menu. virtual void OsdStatusMessage(const char *Message) {} + virtual void OsdStatusMessage2(eMessageType Type, const char *Message) { OsdStatusMessage(Message); } // Message has been displayed in the status line of the menu. // If Message is NULL, the status line has been cleared. virtual void OsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue) {} @@ -121,7 +123,9 @@ public: static void MsgSetSubtitleTrack(int Index, const char * const *Tracks); static void MsgOsdClear(void); static void MsgOsdTitle(const char *Title); - static void MsgOsdStatusMessage(const char *Message); + [[deprecated("use MsgOsdStatusMessage(eMessageType Type, const char *Message) instead")]] + static void MsgOsdStatusMessage(const char *Message) { MsgOsdStatusMessage(mtStatus, Message); } + static void MsgOsdStatusMessage(eMessageType Type, const char *Message); static void MsgOsdHelpKeys(const char *Red, const char *Green, const char *Yellow, const char *Blue); static void MsgOsdItem(const char *Text, int Index, bool Selectable = true); static void MsgOsdCurrentItem(const char *Text, int Index = -1);