diff options
author | Martin Schirrmacher <vdr.neutrinoepg@schirrmacher.eu> | 2013-04-23 19:01:55 +0200 |
---|---|---|
committer | Martin Schirrmacher <vdr.neutrinoepg@schirrmacher.eu> | 2013-04-23 19:01:55 +0200 |
commit | f5552edd9a62e494948ee97dc8f9812193b989f2 (patch) | |
tree | 158fb0190ae115a075f37fa32ba6673a0b261d39 /neutrinoepg.c | |
parent | 3d4dd169f1f34a80976c735a43080f938991a0c7 (diff) | |
download | vdr-plugin-neutrinoepg-f5552edd9a62e494948ee97dc8f9812193b989f2.tar.gz vdr-plugin-neutrinoepg-f5552edd9a62e494948ee97dc8f9812193b989f2.tar.bz2 |
HideGroupsAt with group names
Diffstat (limited to 'neutrinoepg.c')
-rw-r--r-- | neutrinoepg.c | 52 |
1 files changed, 46 insertions, 6 deletions
diff --git a/neutrinoepg.c b/neutrinoepg.c index 3e395ef..f173d22 100644 --- a/neutrinoepg.c +++ b/neutrinoepg.c @@ -20,13 +20,14 @@ int switchgroupkey = 0; int ChannelNameWidth = 15; int HideGroupsAt = 0; -bool ReloadFilters = false; // --- myMenuSetup ------------------------------------------------------------ class myMenuSetup : public cMenuSetupPage { private: const char *SwitchGroupKeyTexts[2]; const char *SitchWithOKTexts[2]; + const char **HideGroupsAtTexts; + int GroupCount; protected: virtual void Store() { @@ -43,12 +44,53 @@ class myMenuSetup : public cMenuSetupPage SetupStore("switchgroupkey", switchgroupkey); SetupStore("ChannelNameWidth", ChannelNameWidth); SetupStore("HideGroupsAt", HideGroupsAt); - - ReloadFilters = true; } public: + ~myMenuSetup() + { + for(int i = 0; i < GroupCount; i++) + delete[] HideGroupsAtTexts[i]; + delete[] HideGroupsAtTexts; + } myMenuSetup() { + GroupCount = 0; + int index = 0; + bool HideFirst = true; + + for(cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) + { + if( Channel->GroupSep() ) + GroupCount++; + } + // add one group if the first is not one + if( !Channels.First()->GroupSep() ) + { + GroupCount++; + HideFirst = false; + HideGroupsAtTexts[index] = tr("no filter"); + index++; + } + HideGroupsAtTexts = new const char*[GroupCount]; + + for(cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) + { + if( Channel->GroupSep() ) + { + if( HideFirst ) + { + HideFirst = false; + HideGroupsAtTexts[index] = new char( strlen(tr("no filter")) + 1 ); + strcpy((char *)HideGroupsAtTexts[index], (char *)tr("no filter")); + index++; + continue; + } + HideGroupsAtTexts[index] = new char( strlen(Channel->Name()) + 1 ); + strcpy((char *)HideGroupsAtTexts[index], (char *)Channel->Name()); + index++; + } + } + SwitchGroupKeyTexts[0] = tr("left/right"); SwitchGroupKeyTexts[1] = tr("prev/next"); @@ -67,7 +109,7 @@ class myMenuSetup : public cMenuSetupPage Add(new cMenuEditIntItem(tr("Channel name width"), &ChannelNameWidth)); Add(new cMenuEditBoolItem(tr("Keep display after switching"), &keeposd)); Add(new cMenuEditBoolItem(tr("Show channel numbers"), &showchannelnumbers)); - Add(new cMenuEditIntItem(tr("Hide Groups at Groupnr"), &HideGroupsAt)); + Add(new cMenuEditStraItem(tr("Hide Groups at"), &HideGroupsAt, GroupCount, HideGroupsAtTexts)); Add(new cMenuEditBoolItem(tr("Hide encrypted channels"), &hideencryptedchannels)); Add(new cMenuEditBoolItem(tr("Hide radio channels"), &hideradiochannels)); Add(new cMenuEditBoolItem(tr("Progress as percent"), &percentprogress)); @@ -106,8 +148,6 @@ bool cPluginNeutrinoEpg::Start(void) FirstGroupChannel = NULL; LastGroupChannel = NULL; - ReloadFilters = true; - return true; } |