diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2012-06-17 12:27:07 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2012-06-17 12:27:07 +0200 |
commit | 45d261fb7448daed79b9873e0929386dfee0445f (patch) | |
tree | 2487555b5fc227cdb26c930a828b8213938883d8 /channels.c | |
parent | 1912d36f00b53ad33155f5788985f23ead69a873 (diff) | |
download | vdr-45d261fb7448daed79b9873e0929386dfee0445f.tar.gz vdr-45d261fb7448daed79b9873e0929386dfee0445f.tar.bz2 |
The new setup option "Miscellaneous/Show channel names with source" can be used to turn on adding the source character to channel names whenever they are displayed
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 36 |
1 files changed, 33 insertions, 3 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: channels.c 2.22 2012/04/01 09:27:08 kls Exp $ + * $Id: channels.c 2.23 2012/06/17 11:53:10 kls Exp $ */ #include "channels.h" @@ -112,10 +112,34 @@ cChannel& cChannel::operator= (const cChannel &Channel) provider = strcpyrealloc(provider, Channel.provider); portalName = strcpyrealloc(portalName, Channel.portalName); memcpy(&__BeginData__, &Channel.__BeginData__, (char *)&Channel.__EndData__ - (char *)&Channel.__BeginData__); + nameSource = NULL; // these will be recalculated automatically + shortNameSource = NULL; parameters = Channel.parameters; return *this; } +const char *cChannel::Name(void) const +{ + if (Setup.ShowChannelNamesWithSource) { + if (isempty(nameSource)) + nameSource = cString::sprintf("%s (%c)", name, cSource::ToChar(source)); + return nameSource; + } + return name; +} + +const char *cChannel::ShortName(bool OrName) const +{ + if (OrName && isempty(shortName)) + return Name(); + if (Setup.ShowChannelNamesWithSource) { + if (isempty(shortNameSource)) + shortNameSource = cString::sprintf("%s (%c)", shortName, cSource::ToChar(source)); + return shortNameSource; + } + return shortName; +} + int cChannel::Transponder(int Frequency, char Polarization) { // some satellites have transponders at the same frequency, just with different polarization: @@ -233,10 +257,14 @@ void cChannel::SetName(const char *Name, const char *ShortName, const char *Prov modification |= CHANNELMOD_NAME; Channels.SetModified(); } - if (nn) + if (nn) { name = strcpyrealloc(name, Name); - if (ns) + nameSource = NULL; + } + if (ns) { shortName = strcpyrealloc(shortName, ShortName); + shortNameSource = NULL; + } if (np) provider = strcpyrealloc(provider, Provider); } @@ -721,6 +749,8 @@ bool cChannel::Parse(const char *s) free(tpidbuf); free(caidbuf); free(namebuf); + nameSource = NULL; + shortNameSource = NULL; if (!GetChannelID().Valid()) { esyslog("ERROR: channel data results in invalid ID!"); return false; |