mirror of
https://github.com/vdr-projects/vdr.git
synced 2025-03-01 10:50:46 +00:00
VDR developer version 2.3.1 is now available at ftp://ftp.tvdr.de/vdr/Developer/vdr-2.3.1.tar.bz2 A 'diff' against the previous version is available at ftp://ftp.tvdr.de/vdr/Developer/vdr-2.2.0-2.3.1.diff MD5 checksums: 391c2ed60e2f7d24563fe3ed5854bc4f vdr-2.3.1.tar.bz2 983fd4bad7d19cd98301d54173107129 vdr-2.2.0-2.3.1.diff WARNING: ======== This is a *developer* version. Even though *I* use it in my productive environment, I strongly recommend that you only use it under controlled conditions and for testing and debugging. *** PLEASE BE VERY CAREFUL WHEN USING THIS DEVELOPER VERSION, ESPECIALLY *** IF YOU ENABLE THE NEW SVDRP PEERING! KEEP BACKUPS OF ALL YOUR TIMERS *** AND OBSERVE VERY CLOSELY WHETHER EVERYTHING WORKS AS EXPECTED. THIS *** VERSION INTRODUCES SOME MAJOR CHANGES IN HANDLING GLOBAL LISTS AND *** LOCKING, SO ANYTHING CAN HAPPEN! YOU HAVE BEEN WARNED! The main focus of this developer version is on the new locking mechanism for global lists, and the ability to handle remote timers. Any plugins that access the global lists of timers, channels, schedules or recordings, will need to be adjusted (see below for details). Please do initial tests with plain vanilla VDR and just the output plugin you need. Known bugs/problems: - After deleting the last recording in a sub folder, the cursor may not be positioned correctly. - Instant recordings and pausing live video don't (yet) use the default SVDRP host for recording. From the HISTORY file: - The new function cOsd::MaxPixmapSize() can be called to determine the maximum size a cPixmap may have on the current OSD. The 'osddemo' example has been modified accordingly. Plugin authors may want to use this function in case they use pixmaps that are larger than the full OSD size. The default implementation sets this limit to 2048x2048 pixel. - The Setup/CAM menu now displays which device an individual CAM is currently assigned to (suggested by Frank Neumann). - Added detection of 24fps (thanks to Thomas Reufer). - Added a note about the VDR User Counter and VDR's facebook page to the README file. - The dvbhddevice plugin is no longer part of the VDR source archive. You can get the latest version of this plugin from the author's repository at https://bitbucket.org/powARman/dvbhddevice. - The dvbsddevice and rcu plugins are no longer part of the VDR source archive. You can get the latest versions of these plugins from ftp://ftp.tvdr.de/vdr/Plugins. - Added a section about Output Devices to the INSTALL file. - Fixed setting the source value of newly created channels, in case the NIT is received from a different, but very close satellite position (reported by Daniel Ribeiro). The code for handling different NITs has been removed from nit.c, because according to the DVB standard table id 0x40 carries only the NIT of the actual network. - Added some comment to cPixmap about the relation between OSD, ViewPort and DrawPort (suggested by Thomas Reufer). - Improved syncing on sections when parsing the NIT and SDT. - Fixed scaling subtitles (their areas could sometimes extend outside the actual OSD). - Reduced the priority of the "video directory scanner" thread (suggested by Thomas Reufer) and checking cIoThrottle::Engaged() when it is running. - The script that gets called for recordings is now also called right before a recording is edited, with the first parameter being "editing" (suggested by Dieter Ferdinand). - The new setup option "OSD/Default sort mode for recordings" can be used to define how recordings shall be sorted by default (either by time or by name, with "by time" being the default). If a particular sort mode has been selected for a folder by pressing '0', the default no longer applies to that folder. Repeating timers no longer write a ".sort" file into a recordings folder to have the recordings sorted by time. - The command line option -D now accepts the value '-' (as in -D-), which prevents VDR from using any DVB devices (suggested by Dietmar Spingler). - The -V and -h options now list the plugins in alphabetical order (suggested by Dietmar Spingler). - Fixed a compiler warning in font.c. - Commented out the line #define DEPRECATED_VIDEOSYSTEM in device.h. If a plugin doesn't compile with this version of VDR, you can uncomment this line as a quick workaround. In the long run the plugin will need to be adapted. - The function cOsd::GetBitmap() is now 'protected'. If a plugin doesn't compile with this version of VDR, you can uncomment the line //#define DEPRECATED_GETBITMAP in osd.h as a quick workaround. In the long run the plugin will need to be adapted. - The -u option now also accepts a numerical user id (suggested by Derek Kelly). - The SVDRP port now accepts multiple concurrent connections. You can now keep an SVDRP connection open as long as you wish, without preventing others from connecting. Note, though, that SVDRP connections still get closed automatically if there has been no activity for 300 seconds (configurable via "Setup/Miscellaneous/SVDRP timeout (s)"). - The SVDRP log messages have been unified and now always contain the IP and port number of the remote host. - SVDRP connections are now handled in a separate "SVDRP server handler" thread, which makes them more responsive. Note that there is only one thread that handles all concurrent SVDRP connections. That way each SVDRP command is guaranteed to be processed separately, without interfering with any other SVDRP commands that might be issued at the same time. Plugins that implement SVDRP commands may need to take care of proper locking if the commands access global data. - VDR now sends out a broadcast to port 6419/udp, which was assigned to 'svdrp-disc' by the IANA. VDRs listening on that port will automatically initiate an SVDRP connection to the broadcasting VDR, and in turn send out a broadcast to make other VDRs connect to them. That way all VDRs within the local network will have permanent "peer-to-peer" SVDRP connections between each other. The configuration in the svdrphosts.conf file is taken into account when considering whether or not to respond to an SVDRP discover broadcast. - The new SVDRP command PING is used by automatically established peer-to-peer connections to keep them alive. - The new function GetSVDRPServerNames() can be used to get a list of all VDRs this VDR is connected to via SVDRP. - The new function ExecSVDRPCommand() can be used to execute an SVDRP command on one of the servers this VDR is connected to, and retrieve the result. The helper functions SVDRPCode() and SVDRPValue() can be used to easily access the codes and values returned by ExecSVDRPCommand(). - The cTimer class now has a new member named 'remote', which holds the name of the remote server this timer will record on. If this is NULL, it is a local timer. - Timers from other VDRs that are connected to this VDR via SVDRP are now automatically fetched and stored in the global Timers list. In order for this to work, all of the channels used by timers on the remote VDR must also be defined on the local VDR (however, not necessarily in the same sequence). Automatic channel syncing will be implemented later. - The main menu of the LCARS skin now displays a small rectangle on the left side of a timer if this is a remote timer. The color of that rectangle changes if the timer is currently recording on the remote VDR. - Accessing the global Timers list now has to be protected by proper locking, because SVDRP commands are now executed in a separate thread. The introduction of this locking mechanism required the following changes: + The new classes cStateLock and cStateKey are used to implement locking with quick detection of state changes. + cConfig::cConfig() now has a parameter that indicates whether this list requires locking. + The global lists of Timers, Channels, Schedules and Recordings are no longer static variables. They are now pointers that need to be retrieved through a call to cTimers::GetTimersRead/Write(), cChannels::GetChannelsRead/Write(), cSchedules::GetSchedulesRead/Write() and cRecordings::GetRecordingsRead/Write(), respectively. + References from/to link channels are now removed in cChannels::Del() rather than cChannel::~cChannel(), to make sure the caller holds a proper lock. + cChannel::HasTimer() has been removed. This information is now retrieved via cSchedule::HasTimer(). + Several member functions of cChannel, cTimer, cMarks and cRecording have been made 'const', and some of them are now available as both 'const' and 'non-const' versions. + The cChannel::Set...() functions are now 'bool' and return true if they have actually changed any of the channels's members. + cChannels::SetModified() has been renamed to cChannels::SetModifiedByUser(). + cChannels::Modified() has been renamed to cChannels::ModifiedByUser(), and now has a 'State' parameter that allows the caller to see whether a channel has been modified since the last call to this function with the same State variable. + The macros CHANNELSMOD_NONE/_AUTO/_USER have been removed. + cMarks now requires locking via cStateKey. + cSortedTimers now requires a pointer to the list of timers. + cEvent::HasTimer() no longer scans the list of timers to check whether an event is referenced by a timer, but rather keeps score of how many timers reference it. This was necessary in order to avoid having to lock the list of timers from within a cEvent. + The new class cListGarbageCollector is used to temporary store any objects deleted from cLists that require locking. This allows pointers to such objects to be dereferenced even if the objects are no longer part of the list. + cListBase::Contains() can be used to check whether a particular object is still contained in that list. + Outdated events are no longer "phased out", but rather deleted right away and thus taken care of by the new "garbage collector" of the list. + Deleted cRecording objects are no longer kept in a list of "vanished" recordings, but are rather taken care of by the new "garbage collector" of the list. + cSchedules::ClearAll() has been removed. The functionality is now implemented directly in cSVDRPServer::CmdCLRE(). + tEventID has been changed to u_int16_t in order to make room for the new member numTimers in cEvent. + cSchedule now has a member Modified(), which can be used with a State variable to quickly determine whether this schedule has been modified since the last call to this function with the same State variable. + cSchedulesLock has been removed. Locking the list of schedules is now done via the cList's new locking mechanism. + The 'OnlyRunningStatus' parameters in cEpgHandler::BeginSegmentTransfer() and cEpgHandler::EndSegmentTransfer() are now obsolete. They are still present in the interface for backward compatibility, but may be removed in a future version. Their value is always 'false'. + The constant tcMod is no longer used in cStatus::TimerChange(). The definition is still there for backward compatibility. Plugins that access the global lists of Timers, Channels, Recordings or Schedules will need to be adapted as follows: + Instead of directly accessing the global variables Timers, Channels or Recordings, they need to set up a cStateKey variable and call the proper getter function, as in cStateKey StateKey; if (const cTimers *Timers = cTimers::GetTimersRead(StateKey)) { // access the timers StateKey.Remove(); } and cStateKey StateKey; if (cTimers *Timers = cTimers::GetTimersWrite(StateKey)) { // access the timers StateKey.Remove(); } See timers.h, thread.h and tools.h for details on this new locking mechanism. + There are convenience macros for easily accessing these lists without having to explicitly set up a cStateKey and calling its Remove() function. These macros have the form LOCK_*_READ/WRITE (with '*' being TIMERS, CHANNELS, SCHEDULES or RECORDINGS). Simply put such a macro before the point where you need to access the respective list, and there will be a pointer named Timers, Channels, Schedules or Recordings, respectively, which is valid until the end of the current block. + If a plugin needs to access several of the global lists in parallel, locking must always be done in the sequence Timers, Channels, Recordings, Schedules. This is necessary to make sure that different threads that need to lock several lists at the same time don't end up in a deadlock. + Some pointer variables may need to be made 'const'. The compiler will tell you about these. - cSectionSyncer has been improved to better handle missed sections. - Added a missing initialization of 'seen' in cChannel's copy constructor. - Background modifications of channels, timers and events are now displayed immediately in the corresponding menus. - cEIT now checks the version of the tables before doing any processing, which saves a lot of locking and processing. - If a timer is newly created with the Red button in the Schedule menu, and the timer is presented to the user in the "Edit timer" menu because it will start immediately, it now *must* be confirmed with "Ok" to set the timer. Otherwise the timer will not be created. - Recordings and deleted recordings are now scanned in a single thread. - The new SVDRP command POLL is used by automatically established peer-to-peer connections to trigger fetching remote timers. - You can now set DumpSVDRPDataTransfer in svdrp.c to true to have all SVDRP communication printed to the console for debugging. - Added a missing 'const' to cReceiver::Receive(), to protect the given Data from being modified. - The SVDRP commands that deal with timers (DELT, LSTT, MODT, NEWT, NEXT and UPDT) as well as any log messages that refer to timers, now use a unique id for each timer, which remains valid as long as this instance of VDR is running. This means that timers are no longer continuously numbered from 1 to N in LSTT. There may be gaps in the sequence, in case timers have been deleted. - The Timers menu now displays the name of the remote VDR in front of the timer's file name, if this is a remote timer. - The new options "Setup/Miscellaneous/SVDRP peering", ".../SVDRP host name" and ".../SVDRP default host" can be used to configure automatic peering between VDRs in the same network. Peering is disabled by default and can be enabled by setting "SVDRP peering" to "yes". - The function cTimer::ToText() no longer returns a newline character at the end of the string. The newline is now added by the caller as necessary. This was changed because cTimer::ToText() is now also needed in a context where the terminating newline can't be used. Consequently, cChannel::ToText() and cMark::ToText() have been modified accordingly. - All timer related response strings from SVDRP commands now use the channel ID instead of channel numbers. - The "Edit timer" menu now has a new parameter "Record on", which can be used to select the VDR on which this timer shall record. Timers can be freely moved between connected VDRs by simply selecting the desired machine in this field. - The SVDRP command DELT no longer checks whether the timer that shall be deleted is currently recording. - The character 0x0D is now stripped from EPG texts (reported by Janne Pänkälä). - The EPG scanner no longer moves the dish if there is a positioner. - The 'newplugin' script now creates the 'po' subdirectory for translations (thanks to Thomas Reufer). - Skins can now implement cSkinDisplayMenu::MenuOrientation() to display horizontal menus (thanks to Stefan Braun). - Fixed a possible stack overflow in cListBase::Sort() (thanks to Oliver Endriss). - Changed the description of the --chartab option in the INSTALL file to refer to "DVB SI table strings" instead of "EPG data". - The width and height of the OSD are now limited to the actual maximum dimensions of the output device, taking into account the top and left offset. - The new setup option "Recording/Record key handling" can be used to define what happens if the Record key on the remote control is pressed during live tv (suggested by Dietmar Spingler). - Empty adaptation field TS packets are now skipped when recording (thanks to Christopher Reimer, based on the "AFFcleaner" by Stefan Pöschel).
493 lines
26 KiB
C++
493 lines
26 KiB
C++
/*
|
|
* skins.h: The optical appearance of the OSD
|
|
*
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
* how to reach the author.
|
|
*
|
|
* $Id: skins.h 4.1 2015/09/10 11:19:48 kls Exp $
|
|
*/
|
|
|
|
#ifndef __SKINS_H
|
|
#define __SKINS_H
|
|
|
|
#include "channels.h"
|
|
#include "epg.h"
|
|
#include "keys.h"
|
|
#include "osd.h"
|
|
#include "positioner.h"
|
|
#include "recording.h"
|
|
#include "themes.h"
|
|
#include "thread.h"
|
|
#include "timers.h"
|
|
#include "tools.h"
|
|
|
|
enum eMessageType { mtStatus = 0, mtInfo, mtWarning, mtError }; // will be used to calculate color offsets!
|
|
|
|
class cSkinDisplay {
|
|
private:
|
|
static cSkinDisplay *current;
|
|
int editableWidth; //XXX this is not nice, but how else could we know this value?
|
|
public:
|
|
cSkinDisplay(void);
|
|
virtual ~cSkinDisplay();
|
|
static int AvgCharWidth(void) { return Setup.FontOsdSize * 4 / 6; }
|
|
///< Returns the average width of a character in pixel (just a raw estimate).
|
|
int EditableWidth(void) { return editableWidth; }
|
|
void SetEditableWidth(int Width) { editableWidth = Width; }
|
|
///< If an item is set through a call to cSkinDisplayMenu::SetItem(), this
|
|
///< function shall be called to set the width of the rightmost tab separated
|
|
///< field. This information will be used for editable items.
|
|
virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL) {}
|
|
///< Sets the color buttons to the given strings, provided this cSkinDisplay
|
|
///< actually has a color button display.
|
|
virtual void SetMessage(eMessageType Type, const char *Text) {}
|
|
///< Sets a one line message Text, with the given Type. Type can be used
|
|
///< to determine, e.g., the colors for displaying the Text.
|
|
virtual void Flush(void) {}
|
|
///< Actually draws the OSD display to the output device.
|
|
static cSkinDisplay *Current(void) { return current; }
|
|
///< Returns the currently active cSkinDisplay.
|
|
};
|
|
|
|
class cSkinDisplayChannel : public cSkinDisplay {
|
|
///< This class is used to display the current channel, together with
|
|
///< the present and following EPG event. How and to what extent this
|
|
///< is done is totally up to the derived class.
|
|
private:
|
|
const cPositioner *positioner;
|
|
public:
|
|
cSkinDisplayChannel(void);
|
|
virtual void SetChannel(const cChannel *Channel, int Number) = 0;
|
|
///< Sets the current channel to Channel. If Number is not 0, the
|
|
///< user is in the process of entering a channel number, which must
|
|
///< be displayed accordingly.
|
|
virtual void SetEvents(const cEvent *Present, const cEvent *Following) = 0;
|
|
///< Sets the Present and Following EPG events. If either of these
|
|
///< is not available, NULL will be given.
|
|
virtual void SetMessage(eMessageType Type, const char *Text) = 0;
|
|
///< Sets a one line message Text, with the given Type. Type can be used
|
|
///< to determine, e.g., the colors for displaying the Text.
|
|
///< If Text is NULL, any previously displayed message must be removed, and
|
|
///< any previous contents overwritten by the message must be restored.
|
|
virtual void SetPositioner(const cPositioner *Positioner);
|
|
///< Sets the Positioner used to move the satellite dish. The skin may use the
|
|
///< data provided by Positioner to implement some form of progress display,
|
|
///< since moving the dish may take a while. This function will only be called
|
|
///< if the device receiving the current live channel actually uses a positioner,
|
|
///< and it will be called with NULL once the dish has reached its target
|
|
///< position (or the user switches to a channel that doesn't require positioning
|
|
///< the dish). While the dish is moving, SetPositioner() is called repeatedly,
|
|
///< so the skin has a chance to update the progress display.
|
|
///< The default implementation calls SetMessage() with a text that indicates
|
|
///< that the dish is being moved to a new position.
|
|
/*TODO
|
|
SetButtons
|
|
Red = Video options
|
|
Green = Info now
|
|
Yellow = Info next
|
|
*/
|
|
};
|
|
|
|
enum eMenuCategory {
|
|
mcUndefined = -1,
|
|
mcUnknown = 0,
|
|
mcMain,
|
|
mcSchedule,
|
|
mcScheduleNow,
|
|
mcScheduleNext,
|
|
mcChannel,
|
|
mcChannelEdit,
|
|
mcTimer,
|
|
mcTimerEdit,
|
|
mcRecording,
|
|
mcRecordingInfo,
|
|
mcRecordingEdit,
|
|
mcPlugin,
|
|
mcPluginSetup,
|
|
mcSetup,
|
|
mcSetupOsd,
|
|
mcSetupEpg,
|
|
mcSetupDvb,
|
|
mcSetupLnb,
|
|
mcSetupCam,
|
|
mcSetupRecord,
|
|
mcSetupReplay,
|
|
mcSetupMisc,
|
|
mcSetupPlugins,
|
|
mcCommand,
|
|
mcEvent,
|
|
mcText,
|
|
mcFolder,
|
|
mcCam
|
|
};
|
|
|
|
enum eMenuSortMode {
|
|
msmUnknown = 0,
|
|
msmNumber,
|
|
msmName,
|
|
msmTime,
|
|
msmProvider
|
|
};
|
|
|
|
enum eMenuOrientation {
|
|
moVertical = 0,
|
|
moHorizontal
|
|
};
|
|
|
|
class cSkinDisplayMenu : public cSkinDisplay {
|
|
///< This class implements the general purpose menu display, which is
|
|
///< used throughout the program to display information and let the
|
|
///< user interact with items.
|
|
///< A menu consists of the following fields, each of which is explicitly
|
|
///< set by calls to the member functions below:
|
|
///< - Title: a single line of text, indicating what this menu displays
|
|
///< - Color buttons: the red, green, yellow and blue buttons, used for
|
|
///< various functions
|
|
///< - Message: a one line message, indicating a Status, Info, Warning,
|
|
///< or Error condition
|
|
///< - Central area: the main central area of the menu, used to display
|
|
///< one of the following:
|
|
///< - Items: a list of single line items, of which the user may be
|
|
///< able to select one
|
|
///< - Event: the full information about one EPG event
|
|
///< - Text: a multi line, scrollable text
|
|
public:
|
|
enum { MaxTabs = 6 };
|
|
private:
|
|
eMenuCategory menuCategory;
|
|
int tabs[MaxTabs];
|
|
protected:
|
|
cTextScroller textScroller;
|
|
int Tab(int n) { return (n >= 0 && n < MaxTabs) ? tabs[n] : 0; }
|
|
///< Returns the offset of the given tab from the left border of the
|
|
///< item display area. The value returned is in pixel.
|
|
const char *GetTabbedText(const char *s, int Tab);
|
|
///< Returns the part of the given string that follows the given
|
|
///< Tab (where 0 indicates the beginning of the string). If no such
|
|
///< part can be found, NULL will be returned.
|
|
public:
|
|
cSkinDisplayMenu(void);
|
|
eMenuCategory MenuCategory(void) const { return menuCategory; }
|
|
///< Returns the menu category, set by a previous call to SetMenuCategory().
|
|
virtual void SetMenuCategory(eMenuCategory MenuCategory);
|
|
///< Sets the current menu category. This allows skins to handle known
|
|
///< types of menus in different ways, for instance by displaying icons
|
|
///< or special decorations.
|
|
///< A derived class can reimplement this function to be informed of any
|
|
///< changes in the menu category. If it does, it shall call the base class
|
|
///< function in order to set the members accordingly for later calls to the
|
|
///< MenuCategory() function.
|
|
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
|
|
///< 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 eMenuOrientation MenuOrientation(void) { return moVertical; }
|
|
///< Asks the skin for the orientation of the displayed menu.
|
|
///< If menu orientation is set to horizontal, the keys left/right
|
|
///< and up/down are just toggled.
|
|
virtual void Scroll(bool Up, bool Page);
|
|
///< 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
|
|
///< text shall be scrolled up or down, and Page is true if it shall be
|
|
///< scrolled by a full page, rather than a single line. An object of the
|
|
///< cTextScroller class can be used to implement the scrolling text area.
|
|
virtual int MaxItems(void) = 0;
|
|
///< Returns the maximum number of items the menu can display.
|
|
virtual void Clear(void) = 0;
|
|
///< Clears the entire central area of the menu.
|
|
virtual void SetTitle(const char *Title) = 0;
|
|
///< Sets the title of this menu to Title.
|
|
virtual void SetButtons(const char *Red, const char *Green = NULL, const char *Yellow = NULL, const char *Blue = NULL) = 0;
|
|
///< Sets the color buttons to the given strings. If any of the values is
|
|
///< NULL, any previous text must be removed from the related button.
|
|
virtual void SetMessage(eMessageType Type, const char *Text) = 0;
|
|
///< Sets a one line message Text, with the given Type. Type can be used
|
|
///< to determine, e.g., the colors for displaying the Text.
|
|
///< If Text is NULL, any previously displayed message must be removed, and
|
|
///< any previous contents overwritten by the message must be restored.
|
|
virtual void SetItem(const char *Text, int Index, bool Current, bool Selectable) = 0;
|
|
///< Sets the item at the given Index to Text. Index is between 0 and the
|
|
///< value returned by MaxItems(), minus one. Text may contain tab characters ('\t'),
|
|
///< which shall be used to separate the text into several columns, according to the
|
|
///< values set by a prior call to SetTabs(). If Current is true, this item shall
|
|
///< be drawn in a way indicating to the user that it is the currently selected
|
|
///< one. Selectable can be used to display items differently that can't be
|
|
///< selected by the user.
|
|
///< Whenever the current status is moved from one item to another,
|
|
///< this function will be first called for the old current item
|
|
///< with Current set to false, and then for the new current item
|
|
///< with Current set to true.
|
|
virtual bool SetItemEvent(const cEvent *Event, int Index, bool Current, bool Selectable, const cChannel *Channel, bool WithDate, eTimerMatch TimerMatch) { return false; }
|
|
///< Sets the item at the given Index to Event. See SetItem() for more information.
|
|
///< If a derived skin class implements this function, it can display an Event item
|
|
///< in a more elaborate way than just a simple line of text.
|
|
///< If Channel is not NULL, the channel's name and/or number shall be displayed.
|
|
///< If WithDate is true, the date of the Event shall be displayed (in addition to the time).
|
|
///< TimerMatch tells how much of this event will be recorded by a timer.
|
|
///< If the skin displays the Event item in its own way, it shall return true.
|
|
///< The default implementation does nothing and returns false, which results in
|
|
///< a call to SetItem() with a proper text.
|
|
virtual bool SetItemTimer(const cTimer *Timer, int Index, bool Current, bool Selectable) { return false; }
|
|
///< Sets the item at the given Index to Timer. See SetItem() for more information.
|
|
///< If a derived skin class implements this function, it can display a Timer item
|
|
///< in a more elaborate way than just a simple line of text.
|
|
///< If the skin displays the Timer item in its own way, it shall return true.
|
|
///< The default implementation does nothing and returns false, which results in
|
|
///< a call to SetItem() with a proper text.
|
|
virtual bool SetItemChannel(const cChannel *Channel, int Index, bool Current, bool Selectable, bool WithProvider) { return false; }
|
|
///< Sets the item at the given Index to Channel. See SetItem() for more information.
|
|
///< If a derived skin class implements this function, it can display a Channel item
|
|
///< in a more elaborate way than just a simple line of text.
|
|
///< If WithProvider ist true, the provider shall be displayed in addition to the
|
|
///< channel's name.
|
|
///< If the skin displays the Channel item in its own way, it shall return true.
|
|
///< The default implementation does nothing and returns false, which results in
|
|
///< a call to SetItem() with a proper text.
|
|
virtual bool SetItemRecording(const cRecording *Recording, int Index, bool Current, bool Selectable, int Level, int Total, int New) { return false; }
|
|
///< Sets the item at the given Index to Recording. See SetItem() for more information.
|
|
///< If a derived skin class implements this function, it can display a Recording item
|
|
///< in a more elaborate way than just a simple line of text.
|
|
///< Level is the currently displayed level of the video directory, where 0 is the
|
|
///< top level. A value of -1 means that the full path names of the recordings
|
|
///< shall be displayed. If Total is greater than 0, this is a directory with the given
|
|
///< total number of entries, and New contains the number of new (unwatched) recordings.
|
|
///< If the skin displays the Recording item in its own way, it shall return true.
|
|
///< The default implementation does nothing and returns false, which results in
|
|
///< a call to SetItem() with a proper text.
|
|
virtual void SetScrollbar(int Total, int Offset);
|
|
///< Sets the Total number of items in the currently displayed list, and the
|
|
///< Offset of the first item that is currently displayed (the skin knows how
|
|
///< many items it can display at once, see MaxItems()). This can be used to
|
|
///< display a scrollbar.
|
|
virtual void SetEvent(const cEvent *Event) = 0;
|
|
///< Sets the Event that shall be displayed, using the entire central area
|
|
///< of the menu. The Event's 'description' shall be displayed using a
|
|
///< cTextScroller, and the Scroll() function will be called to drive scrolling
|
|
///< that text if necessary.
|
|
virtual void SetRecording(const cRecording *Recording) = 0;
|
|
///< Sets the Recording that shall be displayed, using the entire central area
|
|
///< of the menu. The Recording's 'description' shall be displayed using a
|
|
///< cTextScroller, and the Scroll() function will be called to drive scrolling
|
|
///< that text if necessary.
|
|
virtual void SetText(const char *Text, bool FixedFont) = 0;
|
|
///< Sets the Text that shall be displayed, using the entire central area
|
|
///< of the menu. The Text shall be displayed using a cTextScroller, and
|
|
///< the Scroll() function will be called to drive scrolling that text if
|
|
///< necessary.
|
|
//XXX ??? virtual void SetHelp(const char *Help) = 0;
|
|
virtual int GetTextAreaWidth(void) const;
|
|
///< Returns the width in pixel of the area which is used to display text
|
|
///< with SetText(). The width of the area is the width of the central area
|
|
///< minus the width of any possibly displayed scroll-bar or other decoration.
|
|
///< The default implementation returns 0. Therefore a caller of this method
|
|
///< must be prepared to receive 0 if the plugin doesn't implement this method.
|
|
virtual const cFont *GetTextAreaFont(bool FixedFont) const;
|
|
///< Returns a pointer to the font which is used to display text with SetText().
|
|
///< The parameter FixedFont has the same meaning as in SetText(). The default
|
|
///< implementation returns NULL. Therefore a caller of this method must be
|
|
///< prepared to receive NULL if the plugin doesn't implement this method.
|
|
///< The returned pointer is valid a long as the instance of cSkinDisplayMenu
|
|
///< exists.
|
|
};
|
|
|
|
class cSkinDisplayReplay : public cSkinDisplay {
|
|
///< This class implements the progress display used during replay of
|
|
///< a recording.
|
|
protected:
|
|
const cMarks *marks;
|
|
class cProgressBar : public cBitmap {
|
|
protected:
|
|
int total;
|
|
int Pos(int p) { return int(int64_t(p) * Width() / total); }
|
|
void Mark(int x, bool Start, bool Current, tColor ColorMark, tColor ColorCurrent);
|
|
public:
|
|
cProgressBar(int Width, int Height, int Current, int Total, const cMarks *Marks, tColor ColorSeen, tColor ColorRest, tColor ColorSelected, tColor ColorMark, tColor ColorCurrent);
|
|
};
|
|
public:
|
|
cSkinDisplayReplay(void);
|
|
virtual void SetMarks(const cMarks *Marks);
|
|
///< Sets the editing marks to Marks, which shall be used to display the
|
|
///< progress bar through a cProgressBar object.
|
|
virtual void SetRecording(const cRecording *Recording);
|
|
///< Sets the recording that is currently being played.
|
|
///< The default implementation calls SetTitle() with the title and short
|
|
///< text of the Recording. A derived class can use any information provided
|
|
///< by the given Recording and display it.
|
|
virtual void SetTitle(const char *Title) = 0;
|
|
///< Sets the title of the recording.
|
|
virtual void SetMode(bool Play, bool Forward, int Speed) = 0;
|
|
///< Sets the current replay mode, which can be used to display some
|
|
///< indicator, showing the user whether we are currently in normal
|
|
///< play mode, fast forward etc.
|
|
virtual void SetProgress(int Current, int Total) = 0;
|
|
///< This function will be called whenever the position in or the total
|
|
///< length of the recording has changed. A cProgressBar shall then be
|
|
///< used to display a progress indicator.
|
|
virtual void SetCurrent(const char *Current) = 0;
|
|
///< Sets the current position within the recording, as a user readable
|
|
///< string if the form "h:mm:ss.ff". The ".ff" part, indicating the
|
|
///< frame number, is optional and the actual implementation needs to
|
|
///< take care that it is erased from the display when a Current string
|
|
///< _with_ ".ff" is followed by one without it.
|
|
virtual void SetTotal(const char *Total) = 0;
|
|
///< Sets the total length of the recording, as a user readable
|
|
///< string if the form "h:mm:ss".
|
|
virtual void SetJump(const char *Jump) = 0;
|
|
///< Sets the prompt that allows the user to enter a jump point.
|
|
///< Jump is a string of the form "Jump: mm:ss". The actual implementation
|
|
///< needs to be able to handle variations in the length of this
|
|
///< string, which will occur when the user enters an actual value.
|
|
///< If Jump is NULL, the jump prompt shall be removed from the display.
|
|
virtual void SetMessage(eMessageType Type, const char *Text) = 0;
|
|
///< Sets a one line message Text, with the given Type. Type can be used
|
|
///< to determine, e.g., the colors for displaying the Text.
|
|
///< If Text is NULL, any previously displayed message must be removed, and
|
|
///< any previous contents overwritten by the message must be restored.
|
|
};
|
|
|
|
class cSkinDisplayVolume : public cSkinDisplay {
|
|
///< This class implements the volume/mute display.
|
|
public:
|
|
virtual void SetVolume(int Current, int Total, bool Mute) = 0;
|
|
///< Sets the volume to the given Current value, which is in the range
|
|
///< 0...Total. If Mute is true, audio is currently muted and a "mute"
|
|
///< indicator shall be displayed.
|
|
};
|
|
|
|
class cSkinDisplayTracks : public cSkinDisplay {
|
|
///< This class implements the track display.
|
|
public:
|
|
virtual void SetTrack(int Index, const char * const *Tracks) = 0;
|
|
///< Sets the current track to the one given by Index, which
|
|
///< points into the Tracks array of strings.
|
|
virtual void SetAudioChannel(int AudioChannel) = 0;
|
|
///< Sets the audio channel indicator.
|
|
///< 0=stereo, 1=left, 2=right, -1=don't display the audio channel indicator.
|
|
};
|
|
|
|
class cSkinDisplayMessage : public cSkinDisplay {
|
|
///< This class implements a simple message display.
|
|
public:
|
|
virtual void SetMessage(eMessageType Type, const char *Text) = 0;
|
|
///< Sets the message to Text. Type can be used to decide how to display
|
|
///< the message, for instance in which colors.
|
|
};
|
|
|
|
class cSkin : public cListObject {
|
|
private:
|
|
char *name;
|
|
cTheme *theme;
|
|
public:
|
|
cSkin(const char *Name, cTheme *Theme = NULL);
|
|
///< Creates a new skin class, with the given Name and Theme.
|
|
///< Name will be used to identify this skin in the 'setup.conf'
|
|
///< file, and is normally not seen by the user. It should
|
|
///< consist of only lowercase letters and digits.
|
|
///< Theme must be a static object that survives the entire lifetime
|
|
///< of this skin.
|
|
///< The constructor of a derived class shall not set up any data
|
|
///< structures yet, because whether or not this skin will actually
|
|
///< be used is not yet known at this point. All actual work shall
|
|
///< be done in the pure functions below.
|
|
///< A cSkin object must be created on the heap and shall not be
|
|
///< explicitly deleted.
|
|
virtual ~cSkin();
|
|
const char *Name(void) { return name; }
|
|
cTheme *Theme(void) { return theme; }
|
|
virtual const char *Description(void) = 0;
|
|
///< Returns a user visible, single line description of this skin,
|
|
///< which may consist of arbitrary text and can, if the skin
|
|
///< implementation wishes to do so, be internationalized.
|
|
///< The actual text shouldn't be too long, so that it can be
|
|
///< fully displayed in the Setup/OSD menu.
|
|
virtual cSkinDisplayChannel *DisplayChannel(bool WithInfo) = 0;
|
|
///< Creates and returns a new object for displaying the current
|
|
///< channel. WithInfo indicates whether it shall display only
|
|
///< the basic channel data, or also information about the present
|
|
///< and following EPG event.
|
|
///< The caller must delete the object after use.
|
|
virtual cSkinDisplayMenu *DisplayMenu(void) = 0;
|
|
///< Creates and returns a new object for displaying a menu.
|
|
///< The caller must delete the object after use.
|
|
virtual cSkinDisplayReplay *DisplayReplay(bool ModeOnly) = 0;
|
|
///< Creates and returns a new object for displaying replay progress.
|
|
///< ModeOnly indicates whether this should be a full featured replay
|
|
///< display, or just a replay mode indicator.
|
|
///< The caller must delete the object after use.
|
|
virtual cSkinDisplayVolume *DisplayVolume(void) = 0;
|
|
///< Creates and returns a new object for displaying the current volume.
|
|
///< The caller must delete the object after use.
|
|
virtual cSkinDisplayTracks *DisplayTracks(const char *Title, int NumTracks, const char * const *Tracks) = 0;
|
|
///< Creates and returns a new object for displaying the available tracks.
|
|
///< NumTracks indicates how many entries in Tracks are available.
|
|
///< Tracks will be valid throughout the entire lifetime of the returned
|
|
///< cSkinDisplayTrack object.
|
|
///< The caller must delete the object after use.
|
|
virtual cSkinDisplayMessage *DisplayMessage(void) = 0;
|
|
///< Creates and returns a new object for displaying a message.
|
|
///< The caller must delete the object after use.
|
|
};
|
|
|
|
class cSkins : public cList<cSkin> {
|
|
private:
|
|
cSkin *current;
|
|
cSkinDisplayMessage *displayMessage;
|
|
cMutex queueMessageMutex;
|
|
public:
|
|
cSkins(void);
|
|
~cSkins();
|
|
bool SetCurrent(const char *Name = NULL);
|
|
///< Sets the current skin to the one indicated by name.
|
|
///< If no such skin can be found, the first one will be used.
|
|
cSkin *Current(void) { return current; }
|
|
///< Returns a pointer to the current skin.
|
|
bool IsOpen(void) { return cSkinDisplay::Current(); }
|
|
///< Returns true if there is currently a skin display object active.
|
|
eKeys Message(eMessageType Type, const char *s, int Seconds = 0);
|
|
///< Displays the given message, either through a currently visible
|
|
///< display object that is capable of doing so, or by creating a
|
|
///< temporary cSkinDisplayMessage object.
|
|
///< The return value is the key pressed by the user. If no user input
|
|
///< has been received within Seconds (the default value of 0 results
|
|
///< in the value defined for "Message time" in the setup), kNone
|
|
///< will be returned.
|
|
int QueueMessage(eMessageType Type, const char *s, int Seconds = 0, int Timeout = 0);
|
|
///< Like Message(), but this function may be called from a background
|
|
///< thread. The given message is put into a queue and the main program
|
|
///< loop will display it as soon as this is suitable. If Timeout is 0,
|
|
///< QueueMessage() returns immediately and the return value will be kNone.
|
|
///< If a positive Timeout is given, the thread will wait at most the given
|
|
///< number of seconds for the message to be actually displayed (note that
|
|
///< the user may currently be doing something that doesn't allow for
|
|
///< queued messages to be displayed immediately). If the timeout expires
|
|
///< and the message hasn't been displayed yet, the return value is -1
|
|
///< and the message will be removed from the queue without being displayed.
|
|
///< Positive values of Timeout are only allowed for background threads.
|
|
///< If QueueMessage() is called from the foreground thread with a Timeout
|
|
///< greater than 0, the call is ignored and nothing is displayed.
|
|
///< Queued messages will be displayed in the sequence they have been
|
|
///< put into the queue, so messages from different threads may appear
|
|
///< mingled. If a particular thread queues a message with a Timeout of
|
|
///< -1, and the previous message from the same thread also had a Timeout
|
|
///< of -1, only the last message will be displayed. This can be used for
|
|
///< progress displays, where only the most recent message is actually
|
|
///< important.
|
|
///< Type may only be mtInfo, mtWarning or mtError. A call with mtStatus
|
|
///< will be ignored. A call with an empty message from a background thread
|
|
///< removes all queued messages from the calling thread. A call with
|
|
///< an empty message from the main thread will be ignored.
|
|
void ProcessQueuedMessages(void);
|
|
///< Processes the first queued message, if any.
|
|
void Flush(void);
|
|
///< Flushes the currently active cSkinDisplay, if any.
|
|
virtual void Clear(void);
|
|
///< Free up all registered skins
|
|
};
|
|
|
|
extern cSkins Skins;
|
|
|
|
#endif //__SKINS_H
|