summaryrefslogtreecommitdiff
path: root/channels.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-06-17 12:27:07 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2012-06-17 12:27:07 +0200
commit45d261fb7448daed79b9873e0929386dfee0445f (patch)
tree2487555b5fc227cdb26c930a828b8213938883d8 /channels.c
parent1912d36f00b53ad33155f5788985f23ead69a873 (diff)
downloadvdr-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.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/channels.c b/channels.c
index 65e51348..1136cc52 100644
--- a/channels.c
+++ b/channels.c
@@ -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;