1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Plugins can now implement the function SetMenuSortMode() in their skin objects derived from cSkinDisplayMenu, to get informed about the currently used sort mode

This commit is contained in:
Klaus Schmidinger 2015-01-15 10:51:37 +01:00
parent b3954aefd5
commit be9a6de0ef
6 changed files with 36 additions and 4 deletions

View File

@ -3319,3 +3319,7 @@ Dieter Ferdinand <dieter.ferdinand@gmx.de>
Jasmin Jessich <jasmin@anw.at> Jasmin Jessich <jasmin@anw.at>
for modifying the CAM API so that it is possible to implement CAMs that can be freely for modifying the CAM API so that it is possible to implement CAMs that can be freely
assigned to any devices assigned to any devices
Martin Schirrmacher <schirrmie@gmail.com>
for suggesting to provide a way for skin plugins to get informed about the currently
used sort mode of a menu

View File

@ -8373,3 +8373,6 @@ Video Disk Recorder Revision History
Dietmar Spingler). Dietmar Spingler).
- Modified the CAM API so that it is possible to implement CAMs that can be freely - Modified the CAM API so that it is possible to implement CAMs that can be freely
assigned to any devices (thanks to Jasmin Jessich). assigned to any devices (thanks to Jasmin Jessich).
- Plugins can now implement the function SetMenuSortMode() in their skin objects
derived from cSkinDisplayMenu, to get informed about the currently used sort
mode, if applicable (suggested by Martin Schirrmacher).

6
menu.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: menu.c 3.26 2015/01/14 12:10:58 kls Exp $ * $Id: menu.c 3.27 2015/01/15 10:31:41 kls Exp $
*/ */
#include "menu.h" #include "menu.h"
@ -387,6 +387,9 @@ void cMenuChannels::Setup(void)
currentItem = item; currentItem = item;
} }
} }
SetMenuSortMode(cMenuChannelItem::SortMode() == cMenuChannelItem::csmName ? msmName :
cMenuChannelItem::SortMode() == cMenuChannelItem::csmProvider ? msmProvider :
msmNumber);
if (cMenuChannelItem::SortMode() != cMenuChannelItem::csmNumber) if (cMenuChannelItem::SortMode() != cMenuChannelItem::csmNumber)
Sort(); Sort();
SetCurrent(currentItem); SetCurrent(currentItem);
@ -2670,6 +2673,7 @@ void cMenuRecordings::Set(bool Refresh)
LastDir->IncrementCounter(recording->IsNew()); LastDir->IncrementCounter(recording->IsNew());
} }
} }
SetMenuSortMode(RecordingsSortMode == rsmName ? msmName : msmTime);
if (Refresh) if (Refresh)
Display(); Display();
} }

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.c 3.2 2013/09/22 14:01:17 kls Exp $ * $Id: osdbase.c 3.3 2015/01/15 10:11:11 kls Exp $
*/ */
#include "osdbase.h" #include "osdbase.h"
@ -86,6 +86,7 @@ cOsdMenu::cOsdMenu(const char *Title, int c0, int c1, int c2, int c3, int c4)
displayMenuItems = 0; displayMenuItems = 0;
title = NULL; title = NULL;
menuCategory = mcUnknown; menuCategory = mcUnknown;
menuSortMode = msmUnknown;
SetTitle(Title); SetTitle(Title);
SetCols(c0, c1, c2, c3, c4); SetCols(c0, c1, c2, c3, c4);
first = 0; first = 0;
@ -114,6 +115,11 @@ void cOsdMenu::SetMenuCategory(eMenuCategory MenuCategory)
menuCategory = MenuCategory; menuCategory = MenuCategory;
} }
void cOsdMenu::SetMenuSortMode(eMenuSortMode MenuSortMode)
{
menuSortMode = MenuSortMode;
}
void cOsdMenu::SetDisplayMenu(void) void cOsdMenu::SetDisplayMenu(void)
{ {
if (displayMenu) { if (displayMenu) {
@ -224,6 +230,7 @@ void cOsdMenu::Display(void)
cStatus::MsgOsdClear(); cStatus::MsgOsdClear();
if (menuCategory != displayMenu->MenuCategory()) if (menuCategory != displayMenu->MenuCategory())
displayMenu->SetMenuCategory(menuCategory); displayMenu->SetMenuCategory(menuCategory);
displayMenu->SetMenuSortMode(menuSortMode);
displayMenuItems = displayMenu->MaxItems(); displayMenuItems = displayMenu->MaxItems();
displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX displayMenu->SetTabs(cols[0], cols[1], cols[2], cols[3], cols[4]);//XXX
displayMenu->SetTitle(title); displayMenu->SetTitle(title);

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: osdbase.h 3.1 2013/09/22 14:00:47 kls Exp $ * $Id: osdbase.h 3.2 2015/01/15 10:09:18 kls Exp $
*/ */
#ifndef __OSDBASE_H #ifndef __OSDBASE_H
@ -92,6 +92,7 @@ private:
int cols[cSkinDisplayMenu::MaxTabs]; int cols[cSkinDisplayMenu::MaxTabs];
int first, current, marked; int first, current, marked;
eMenuCategory menuCategory; eMenuCategory menuCategory;
eMenuSortMode menuSortMode;
cOsdMenu *subMenu; cOsdMenu *subMenu;
const char *helpRed, *helpGreen, *helpYellow, *helpBlue; const char *helpRed, *helpGreen, *helpYellow, *helpBlue;
bool helpDisplayed; bool helpDisplayed;
@ -131,6 +132,7 @@ public:
virtual ~cOsdMenu(); virtual ~cOsdMenu();
virtual bool NeedsFastResponse(void) { return subMenu ? subMenu->NeedsFastResponse() : cOsdObject::NeedsFastResponse(); } virtual bool NeedsFastResponse(void) { return subMenu ? subMenu->NeedsFastResponse() : cOsdObject::NeedsFastResponse(); }
void SetMenuCategory(eMenuCategory MenuCategory); void SetMenuCategory(eMenuCategory MenuCategory);
void SetMenuSortMode(eMenuSortMode MenuSortMode);
int Current(void) const { return current; } int Current(void) const { return current; }
void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL); void Add(cOsdItem *Item, bool Current = false, cOsdItem *After = NULL);
void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL); void Ins(cOsdItem *Item, bool Current = false, cOsdItem *Before = NULL);

14
skins.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: skins.h 3.3 2014/02/18 13:48:05 kls Exp $ * $Id: skins.h 3.4 2015/01/15 10:45:47 kls Exp $
*/ */
#ifndef __SKINS_H #ifndef __SKINS_H
@ -121,6 +121,14 @@ enum eMenuCategory {
mcCam mcCam
}; };
enum eMenuSortMode {
msmUnknown = 0,
msmNumber,
msmName,
msmTime,
msmProvider
};
class cSkinDisplayMenu : public cSkinDisplay { class cSkinDisplayMenu : public cSkinDisplay {
///< This class implements the general purpose menu display, which is ///< This class implements the general purpose menu display, which is
///< used throughout the program to display information and let the ///< used throughout the program to display information and let the
@ -167,6 +175,10 @@ public:
virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0); virtual void SetTabs(int Tab1, int Tab2 = 0, int Tab3 = 0, int Tab4 = 0, int Tab5 = 0);
///< Sets the tab columns to the given values, which are the number of ///< Sets the tab columns to the given values, which are the number of
///< characters in each column. ///< characters in each column.
virtual void SetMenuSortMode(eMenuSortMode MenuSortMode) {}
///< Sets the mode by which the items in this menu are sorted.
///< This is purely informative and may be used by a skin to display the
///< current sort mode by means of some text or symbol.
virtual void Scroll(bool Up, bool Page); virtual void Scroll(bool Up, bool Page);
///< If this menu contains a text area that can be scrolled, this function ///< If this menu contains a text area that can be scrolled, this function
///< will be called to actually scroll the text. Up indicates whether the ///< will be called to actually scroll the text. Up indicates whether the