diff options
author | Martin Schirrmacher <vdr.neutrinoepg@schirrmacher.eu> | 2013-08-28 21:51:38 +0200 |
---|---|---|
committer | Martin Schirrmacher <vdr.neutrinoepg@schirrmacher.eu> | 2013-08-28 21:51:38 +0200 |
commit | cd3b278dc35e4851809d35440ca483b567a4a498 (patch) | |
tree | 5d5829ef58a5734aad24b4f668f21c0f4800fe82 | |
parent | ff7f91f75fe13e8c996a894e5c0582740a3ed555 (diff) | |
download | vdr-plugin-neutrinoepg-cd3b278dc35e4851809d35440ca483b567a4a498.tar.gz vdr-plugin-neutrinoepg-cd3b278dc35e4851809d35440ca483b567a4a498.tar.bz2 |
support for text progressbar
-rw-r--r-- | neutrinoepg.c | 15 | ||||
-rw-r--r-- | neutrinoepg.h | 2 | ||||
-rw-r--r-- | osditem.c | 32 | ||||
-rw-r--r-- | osdmenu.c | 144 | ||||
-rw-r--r-- | osdmenu.h | 1 | ||||
-rw-r--r-- | po/de_DE.po | 18 | ||||
-rw-r--r--[-rwxr-xr-x] | vdrsymbols/insert_vdr_symbols.pe | 0 |
7 files changed, 124 insertions, 88 deletions
diff --git a/neutrinoepg.c b/neutrinoepg.c index f5eb5f8..dc762d1 100644 --- a/neutrinoepg.c +++ b/neutrinoepg.c @@ -14,7 +14,7 @@ int hideencryptedchannels = 0; int hideradiochannels = 0; int switchwithok = 1; int hidemainmenu = false; -int percentprogress = false; +int progressbar = false; int middlemenuentry = false; int switchgroupkey = 0; int ChannelNameWidth = 15; @@ -28,6 +28,7 @@ class myMenuSetup : public cMenuSetupPage cStringList SwitchGroupKeyTexts; cStringList SwitchWithOKTexts; cStringList HideGroupsAtTexts; + cStringList ProgressBarTexts; protected: virtual void Store() @@ -40,7 +41,7 @@ class myMenuSetup : public cMenuSetupPage SetupStore("hideradiochannels", hideradiochannels); SetupStore("showchannelnumbers", showchannelnumbers); SetupStore("switchwithok", switchwithok); - SetupStore("percentprogress", percentprogress); + SetupStore("progressbar", progressbar); SetupStore("middlemenuentry", middlemenuentry); SetupStore("switchgroupkey", switchgroupkey); SetupStore("ChannelNameWidth", ChannelNameWidth); @@ -63,6 +64,10 @@ class myMenuSetup : public cMenuSetupPage SwitchWithOKTexts.Append( strdup( tr("Blue")) ); SwitchWithOKTexts.Append( strdup( tr("Ok")) ); + ProgressBarTexts.Append( strdup( tr("VDRSymbols")) ); + ProgressBarTexts.Append( strdup( tr("Text")) ); + ProgressBarTexts.Append( strdup( tr("Percent")) ); + for(cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) { if( Channel->GroupSep() ) @@ -113,7 +118,7 @@ class myMenuSetup : public cMenuSetupPage Add(new cMenuEditStraItem(tr("Hide Groups at"), &HideGroupsAt, HideGroupsAtTexts.Size(), &HideGroupsAtTexts[0])); Add(new cMenuEditBoolItem(tr("Hide encrypted channels"), &hideencryptedchannels)); Add(new cMenuEditBoolItem(tr("Hide radio channels"), &hideradiochannels)); - Add(new cMenuEditBoolItem(tr("Progress as percent"), &percentprogress)); + Add(new cMenuEditStraItem(tr("Progressbar modus"), &progressbar, ProgressBarTexts.Size(), &ProgressBarTexts[0])); } }; @@ -196,8 +201,8 @@ bool cPluginNeutrinoEpg::SetupParse(const char *Name, const char *Value) hideradiochannels = atoi(Value); else if(!strcmp("switchwithok", Name)) switchwithok = atoi(Value); - else if(!strcmp("percentprogress", Name)) - percentprogress = atoi(Value); + else if(!strcmp("progressbar", Name)) + progressbar = atoi(Value); else if(!strcmp("middlemenuentry", Name)) middlemenuentry = atoi(Value); else if(!strcmp("ChannelNameWidth", Name)) diff --git a/neutrinoepg.h b/neutrinoepg.h index e57effc..58029a7 100644 --- a/neutrinoepg.h +++ b/neutrinoepg.h @@ -23,7 +23,7 @@ extern int hideencryptedchannels; extern int showchannelnumbers; extern int hideradiochannels; extern int switchwithok; -extern int percentprogress; +extern int progressbar; extern int middlemenuentry; extern int switchgroupkey; extern int ChannelNameWidth; @@ -64,7 +64,7 @@ void myOsdItem::Set() if(event) { - if( percentprogress == 1 ) + if( progressbar == 2 ) { // calculate progress bar float progress = (int)roundf( (float)(time(NULL) - event->StartTime()) / (float) (event->Duration()) * 100.0); @@ -76,12 +76,12 @@ void myOsdItem::Set() asprintf(&strProgress, "%3.0f%%", progress); if(showchannelnumbers) - asprintf(&buffer,"%s\t%d\t%-10s\t %s\t%s", m, channel->Number(), channel->ShortName(true), + asprintf(&buffer,"%s\t%d\t%-10s\t%s\t %s", m, channel->Number(), channel->ShortName(true), (!(event->RunningStatus()==4)&&next) ? *event->GetTimeString() : strProgress, event->Title()); else - asprintf(&buffer,"%s\t%-10s\t %s\t%s", m, channel->ShortName(true), + asprintf(&buffer,"%s\t%-10s\t%s\t %s", m, channel->ShortName(true), (!(event->RunningStatus()==4)&&next) ? *event->GetTimeString() : strProgress,event->Title()); - } else + } else if( progressbar == 0 ) { // calculate progress bar float progress = (int)roundf( (float)(time(NULL) - event->StartTime()) / (float) (event->Duration()) * 10.0); @@ -102,11 +102,31 @@ void myOsdItem::Set() ProgressBar += Icons::ProgressEnd(); if(showchannelnumbers) - asprintf(&buffer,"%s\t%d\t%-10s\t %s\t%s", m, channel->Number(), channel->ShortName(true), + asprintf(&buffer,"%s\t%d\t%-10s\t%s\t %s", m, channel->Number(), channel->ShortName(true), (!(event->RunningStatus()==4)&&next) ? *event->GetTimeString() : ProgressBar.c_str(), event->Title()); else - asprintf(&buffer,"%s\t%-10s\t %s\t%s", m, channel->ShortName(true), + asprintf(&buffer,"%s\t%-10s\t%s\t %s", m, channel->ShortName(true), (!(event->RunningStatus()==4)&&next) ? *event->GetTimeString() : ProgressBar.c_str(), event->Title()); + } else { + char szProgress[20] = ""; + char szProgressPart[25] = ""; + int progress = (int)roundf( (float)(time(NULL) - event->StartTime()) / (float) (event->Duration()) * 8.0); + progress = min(8, max(0, progress)); + + for(int i = 0; i < 8; i++) { + if( i < progress ) + szProgress[i] = '|'; + else + szProgress[i] = ' '; + } + szProgress[progress] = '\0'; + sprintf(szProgressPart, "%c%-8s%c", '[', szProgress, ']'); + if(showchannelnumbers) + asprintf(&buffer,"%s\t%d\t%-10s\t%s\t %s", m, channel->Number(), channel->ShortName(true), + (!(event->RunningStatus()==4)&&next) ? *event->GetTimeString() : szProgressPart, event->Title()); + else + asprintf(&buffer,"%s\t%-10s\t%s\t %s", m, channel->ShortName(true), + (!(event->RunningStatus()==4)&&next) ? *event->GetTimeString() : szProgressPart, event->Title()); } } else @@ -9,6 +9,8 @@ int *CurrentGroupChannel; int *FirstGroupChannel; int *LastGroupChannel; +int LastMaxGroup; + int ChannelsShown; int ChannelsBefore; int ChannelsAfter; @@ -67,85 +69,81 @@ myOsdMenu::myOsdMenu() : cOsdMenu("") ChannelsAfter = (ChannelsShown / 2)-1; } - // Count the groups and channels - int GroupCount = 0; - for(cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) - { - if( Channel->GroupSep() ) - GroupCount++; - } - MaxGroup = GroupCount; - - if( !Channels.First()->GroupSep() ) - MaxGroup++; - - //syslog(LOG_ERR, "neutrinoepg: MaxGroup %d", MaxGroup); - - // Hide Groups? - if( HideGroupsAt > MaxGroup ) - HideGroupsAt = MaxGroup; - if( HideGroupsAt < 1 ) - HideGroupsAt = 0; - if( HideGroupsAt > 0 ) - { - MaxGroup -= MaxGroup - HideGroupsAt; - } - - //syslog(LOG_ERR, "neutrinoepg: HideGroup %d MaxGroup %d", HideGroupsAt, MaxGroup); + // Count the groups and channels + int GroupCount = 0; + for(cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel)) + { + if( Channel->GroupSep() ) + GroupCount++; + } + MaxGroup = GroupCount; + + if( !Channels.First()->GroupSep() ) + MaxGroup++; + //syslog(LOG_ERR, "neutrinoepg: MaxGroup %d", MaxGroup); + // Hide Groups? + if( HideGroupsAt > MaxGroup ) + HideGroupsAt = MaxGroup; + if( HideGroupsAt < 1 ) + HideGroupsAt = 0; + if( HideGroupsAt > 0 ) + MaxGroup -= MaxGroup - HideGroupsAt; + + // test for different group count + if( LastMaxGroup != MaxGroup ) + { + //:(LOG_ERR, "neutrinoepg: HideGroup %d MaxGroup %d", HideGroupsAt, MaxGroup); - if( GroupIndex != NULL ) - delete[] GroupIndex; - if( CurrentGroupChannel != NULL ) - delete[] CurrentGroupChannel; - if( FirstGroupChannel != NULL ) - delete[] FirstGroupChannel; - if( LastGroupChannel != NULL ) - delete[] LastGroupChannel; - - // store max group count and add a little reserve - GroupIndex = new int[MaxGroup+1]; - CurrentGroupChannel = new int[MaxGroup+1]; - FirstGroupChannel = new int[MaxGroup+1]; - LastGroupChannel = new int[MaxGroup+1]; - - for( int i = 0; i < MaxGroup; i++) - { - CurrentGroupChannel[i] = -1; - FirstGroupChannel[i] = -1; - LastGroupChannel[i] = -1; - } + if( GroupIndex != NULL ) + delete[] GroupIndex; + if( CurrentGroupChannel != NULL ) + delete[] CurrentGroupChannel; + if( FirstGroupChannel != NULL ) + delete[] FirstGroupChannel; + if( LastGroupChannel != NULL ) + delete[] LastGroupChannel; + + // store max group count and add a little reserve + GroupIndex = new int[MaxGroup+1]; + CurrentGroupChannel = new int[MaxGroup+1]; + FirstGroupChannel = new int[MaxGroup+1]; + LastGroupChannel = new int[MaxGroup+1]; + + for( int i = 0; i < MaxGroup; i++) + { + CurrentGroupChannel[i] = -1; + FirstGroupChannel[i] = -1; + LastGroupChannel[i] = -1; + } - int index = 0; - if( FirstChannelsHasGroup() == false ) - { - GroupIndex[0] = -1; - index = 1; - } - for( cChannel *Channel = Channels.First(); Channel && index < MaxGroup; Channel = Channels.Next(Channel) ) + int index = 0; + if( FirstChannelsHasGroup() == false ) + { + GroupIndex[0] = -1; + index = 1; + } + for( cChannel *Channel = Channels.First(); Channel && index < MaxGroup; Channel = Channels.Next(Channel) ) + { + if( Channel->GroupSep() ) { - if( Channel->GroupSep() ) - { - GroupIndex[index] = Channel->Index(); - index++; - } + GroupIndex[index] = Channel->Index(); + index++; } + } - for( int Group = 0; Group < MaxGroup; Group++) - { - if( CurrentGroupChannel[Group] == -1 ) - { - CurrentGroupChannel[Group] = GetFirstChannelOfGroup(Group); - } - if( FirstGroupChannel[Group] == -1 ) - { - FirstGroupChannel[Group] = GetFirstChannelOfGroup(Group); - } - if( LastGroupChannel[Group] == -1 ) - { - LastGroupChannel[Group] = GetLastChannelOfGroup(Group); - } - } + for( int Group = 0; Group < MaxGroup; Group++) + { + if( CurrentGroupChannel[Group] == -1 ) + CurrentGroupChannel[Group] = GetFirstChannelOfGroup(Group); + if( FirstGroupChannel[Group] == -1 ) + FirstGroupChannel[Group] = GetFirstChannelOfGroup(Group); + if( LastGroupChannel[Group] == -1 ) + LastGroupChannel[Group] = GetLastChannelOfGroup(Group); + } + LastMaxGroup = MaxGroup; + + } // what is the current watching channel? int CurrentChannelNr = cDevice::CurrentChannel(); cChannel *CurrentChannel = Channels.GetByNumber(CurrentChannelNr); @@ -9,6 +9,7 @@ extern int *GroupIndex; extern int *CurrentGroupChannel; extern int *FirstGroupChannel; extern int *LastGroupChannel; +extern int LastMaxGroup; // --- myMenuWhatsOn ---------------------------------------------------------- class myOsdMenu : public cOsdMenu diff --git a/po/de_DE.po b/po/de_DE.po index 5f15397..fad74bd 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Neutrinoepg-Plugin 0.3.3\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2013-05-05 14:23+0200\n" +"POT-Creation-Date: 2013-08-28 21:21+0200\n" "PO-Revision-Date: 2008-03-30 19:58+0200\n" "Last-Translator: \n" "Language-Team: <nordlicht@martins-kabuff.de>\n" @@ -43,6 +43,15 @@ msgstr "Blau" msgid "Ok" msgstr "Ok" +msgid "VDRSymbols" +msgstr "VDRSymbols" + +msgid "Text" +msgstr "Text" + +msgid "Percent" +msgstr "Prozent" + msgid "no filter" msgstr "<kein filter>" @@ -88,11 +97,14 @@ msgstr "Verschlüsselte Kanäle ausblenden" msgid "Hide radio channels" msgstr "Radio-Kanäle ausblenden" -msgid "Progress as percent" -msgstr "Fortschrittsanzeige als Prozent" +msgid "Progressbar modus" +msgstr "Progressbar Modus" msgid "without group" msgstr "ohne Gruppe" msgid "Jump to" msgstr "Springe zu" + +#~ msgid "Progress as percent" +#~ msgstr "Fortschrittsanzeige als Prozent" diff --git a/vdrsymbols/insert_vdr_symbols.pe b/vdrsymbols/insert_vdr_symbols.pe index f750f59..f750f59 100755..100644 --- a/vdrsymbols/insert_vdr_symbols.pe +++ b/vdrsymbols/insert_vdr_symbols.pe |