summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--neutrinoepg.c9
-rw-r--r--osdmenu.c155
-rw-r--r--osdmenu.h2
-rw-r--r--po/de_DE.po9
4 files changed, 114 insertions, 61 deletions
diff --git a/neutrinoepg.c b/neutrinoepg.c
index 792919b..48c8ea5 100644
--- a/neutrinoepg.c
+++ b/neutrinoepg.c
@@ -21,8 +21,12 @@ int ChannelNameWidth = 15;
// --- myMenuSetup ------------------------------------------------------------
-class myMenuSetup:public cMenuSetupPage
+class myMenuSetup : public cMenuSetupPage
{
+ private:
+ const char *SwitchGroupKeyTexts[2];
+ const char *SitchWithOKTexts[2];
+
protected:
virtual void Store()
{
@@ -42,10 +46,9 @@ class myMenuSetup:public cMenuSetupPage
public:
myMenuSetup()
{
- const char *SwitchGroupKeyTexts[2];
SwitchGroupKeyTexts[0] = tr("left/right");
SwitchGroupKeyTexts[1] = tr("prev/next");
- const char *SitchWithOKTexts[2];
+
SitchWithOKTexts[0] = tr("Blue");
SitchWithOKTexts[1] = tr("Ok");
diff --git a/osdmenu.c b/osdmenu.c
index ece1cdd..f649139 100644
--- a/osdmenu.c
+++ b/osdmenu.c
@@ -78,17 +78,14 @@ myOsdMenu::myOsdMenu() : cOsdMenu("")
if( CurrentGroupChannel[Group] == -1 )
{
CurrentGroupChannel[Group] = GetFirstChannelOfGroup(Group);
- syslog(LOG_ERR, "neutrinoepg: Group: %d CurrentGroupChannel: %d", Group, CurrentGroupChannel[Group]);
}
if( FirstGroupChannel[Group] == -1 )
{
FirstGroupChannel[Group] = GetFirstChannelOfGroup(Group);
- syslog(LOG_ERR, "neutrinoepg: Group: %d FirstGroupChannel: %d", Group, FirstGroupChannel[Group]);
}
if( LastGroupChannel[Group] == -1 )
{
LastGroupChannel[Group] = GetLastChannelOfGroup(Group);
- syslog(LOG_ERR, "neutrinoepg: Group: %d LastGroupChannel: %d", Group, LastGroupChannel[Group]);
}
}
@@ -152,8 +149,18 @@ int myOsdMenu::GetFirstGroupIndex(void)
int myOsdMenu::GetFirstChannelOfGroup(int Group)
{
- if( ChannelsHasGroup() == false )
- return Channels.First()->Index();
+ if( ChannelsHasGroup() == false ) // no groups -> get First Channel
+ {
+ cChannel *Channel;
+ Channel = Channels.First();
+ if( Channel == NULL )
+ return -1;
+ bool isRadio = ( (!Channel->Vpid()) && (Channel->Apid(0)) ) ? true : false;
+ if( !(isRadio && hideradiochannels) && !(Channel->Ca() && hideencryptedchannels) )
+ return Channel->Index();
+
+ return GetNextChannel( Channel->Index() );
+ }
return GetNextChannel( GetGroupIndex(Group) );
}
@@ -165,7 +172,18 @@ int myOsdMenu::GetLastChannelOfGroup(int Group)
if( NextGroup != -1 )
return GetPrevChannel(NextGroup);
else // no next group -> get last channel
- return Channels.Last()->Index();
+ {
+ cChannel *Channel;
+ Channel = Channels.Last();
+ if( Channel == NULL )
+ return -1;
+ bool isRadio = ( (!Channel->Vpid()) && (Channel->Apid(0)) ) ? true : false;
+ if( !(isRadio && hideradiochannels) && !(Channel->Ca() && hideencryptedchannels) )
+ return Channel->Index();
+
+ return GetPrevChannel( Channel->Index() );
+ }
+
}
int myOsdMenu::GetNextChannel(int ChanIndex)
@@ -186,6 +204,7 @@ int myOsdMenu::GetNextChannel(int ChanIndex)
return Channel->Index();
}
+
int myOsdMenu::GetPrevChannel(int ChanIndex)
{
cChannel *Channel;
@@ -205,6 +224,21 @@ int myOsdMenu::GetPrevChannel(int ChanIndex)
return Channel->Index();
}
+int myOsdMenu::GetNextChannelOfGroup(int ChanIndex, int Group)
+{
+ int NextIndex = GetNextChannel( ChanIndex );
+ if( isChannelInGroup( NextIndex, Group ) == false )
+ return -1;
+ return NextIndex;
+}
+int myOsdMenu::GetPrevChannelOfGroup(int ChanIndex, int Group)
+{
+ int PrevIndex = GetPrevChannel( ChanIndex );
+ if( isChannelInGroup( PrevIndex, Group ) == false )
+ return -1;
+ return PrevIndex;
+}
+
bool myOsdMenu::isChannelInGroup(int ChanIndex, int Group)
{
if( ChannelsHasGroup() == false )
@@ -239,66 +273,77 @@ void myOsdMenu::LoadSchedules(int shift)
Clear();
schedules = cSchedules::Schedules(schedulesLock);
- for( cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel) )
+ if( middlemenuentry )
{
- // is filtered by config?
- bool isRadio = ( (!Channel->Vpid()) && (Channel->Apid(0)) ) ? true : false;
- if( (isRadio && hideradiochannels) || (Channel->Ca() && hideencryptedchannels) )
- continue;
-
- // only channels!
- if( Channel->GroupSep() )
- continue;
-
- // only channels of the current Group
- if( !isChannelInGroup( Channel->Index(), CurrentGroup ) )
- continue;
+ int NumAdded = 0;
+ int AddChanIndex = -1, ChanIndex = -1;
+ AddChanIndex = CurrentGroupChannel[CurrentGroup];
+ ChanIndex = AddChanIndex;
+
+ // count if we have more channels add to the front because we are at the end
+ int ExtraAdded = ChannelsAfter;
+ while( ExtraAdded-- )
+ {
+ ChanIndex = GetNextChannelOfGroup( ChanIndex, CurrentGroup );
+ if( ChanIndex == -1 )
+ break;
+ }
- // Hack to show the current channel in the middle of the screen
- // so do not show channels before
- // do it only if the settings middlemenuentry is set
+ ChanIndex = AddChanIndex;
- // only if channels in group > channels shown on display
- if( (LastGroupChannel[CurrentGroup] - FirstGroupChannel[CurrentGroup]) > ChannelsShown && middlemenuentry)
+ // count Channels
+ NumAdded -= ExtraAdded;
+ for( ; NumAdded <= ChannelsBefore; NumAdded++ )
{
- // at the beginning
- if( (CurrentGroupChannel[CurrentGroup] - FirstGroupChannel[CurrentGroup]) < ChannelsBefore )
- {
- if( (Channel->Index() - FirstGroupChannel[CurrentGroup]) >= ChannelsShown )
- continue;
- }
- else
+ AddChanIndex = GetPrevChannelOfGroup( AddChanIndex, CurrentGroup );
+ if( AddChanIndex == -1 )
+ break;
+ ChanIndex = AddChanIndex;
+ }
+ for( NumAdded = 0; NumAdded < ChannelsShown && ChanIndex != -1; NumAdded++ )
+ {
+ cChannel *Channel = Channels.Get( ChanIndex );
+ const cSchedule *Schedule = schedules->GetSchedule( Channel->GetChannelID() );
+ if(Schedule)
{
- // in the middle
- // don't show channels from the beginning
- if( Channel->Index() < CurrentGroupChannel[CurrentGroup] )
- {
- if( (CurrentGroupChannel[CurrentGroup] - Channel->Index()) > ChannelsBefore )
- continue;
- }
- // don't show channels from the end
- if( Channel->Index() > CurrentGroupChannel[CurrentGroup] )
- {
- if( (Channel->Index() - CurrentGroupChannel[CurrentGroup]) > ChannelsAfter )
- continue;
- }
+ // event from now or any other date (next)
+ const cEvent *Event = next ? Schedule->GetEventAround(t) : Schedule->GetPresentEvent();
+ Add(new myOsdItem(Event, Channel, next), Channel->Index() == CurrentGroupChannel[CurrentGroup] );
}
- if( (LastGroupChannel[CurrentGroup] - CurrentGroupChannel[CurrentGroup]) < ChannelsAfter &&
- (Channel->Index() - LastGroupChannel[CurrentGroup]) >= ChannelsShown )
- continue;
+ else
+ Add(new myOsdItem(NULL, Channel, next), Channel->Index() == CurrentGroupChannel[CurrentGroup] );
+ ChanIndex = GetNextChannelOfGroup( ChanIndex, CurrentGroup );
}
- const cSchedule *Schedule = schedules->GetSchedule( Channel->GetChannelID() );
- if(Schedule)
+ }
+ else
+ {
+ for( cChannel *Channel = Channels.First(); Channel; Channel = Channels.Next(Channel) )
{
- // event from now or any other date (next)
- const cEvent *Event = next ? Schedule->GetEventAround(t) : Schedule->GetPresentEvent();
- Add(new myOsdItem(Event, Channel, next), Channel->Index() == CurrentGroupChannel[CurrentGroup] );
+ // is filtered by config?
+ bool isRadio = ( (!Channel->Vpid()) && (Channel->Apid(0)) ) ? true : false;
+ if( (isRadio && hideradiochannels) || (Channel->Ca() && hideencryptedchannels) )
+ continue;
+
+ // only channels!
+ if( Channel->GroupSep() )
+ continue;
+
+ // only channels of the current Group
+ if( !isChannelInGroup( Channel->Index(), CurrentGroup ) )
+ continue;
+
+ const cSchedule *Schedule = schedules->GetSchedule( Channel->GetChannelID() );
+ if(Schedule)
+ {
+ // event from now or any other date (next)
+ const cEvent *Event = next ? Schedule->GetEventAround(t) : Schedule->GetPresentEvent();
+ Add(new myOsdItem(Event, Channel, next), Channel->Index() == CurrentGroupChannel[CurrentGroup] );
+ }
+ else
+ Add(new myOsdItem(NULL, Channel, next), Channel->Index() == CurrentGroupChannel[CurrentGroup] );
}
- else
- Add(new myOsdItem(NULL, Channel, next), Channel->Index() == CurrentGroupChannel[CurrentGroup] );
}
-
sprintf(tmp, "%d:%d", bookmark / 100, bookmark % 100);
SetMyTitle();
diff --git a/osdmenu.h b/osdmenu.h
index 37de714..9f480c7 100644
--- a/osdmenu.h
+++ b/osdmenu.h
@@ -45,6 +45,8 @@ class myOsdMenu : public cOsdMenu
int GetLastChannelOfGroup(int Group);
int GetNextChannel(int ChanIndex);
int GetPrevChannel(int ChanIndex);
+ int GetNextChannelOfGroup(int ChanIndex, int Group);
+ int GetPrevChannelOfGroup(int ChanIndex, int Group);
bool isChannelInGroup(int ChanIndex, int Group);
bool ChannelsHasGroup(void);
bool FirstChannelsHasGroup(void);
diff --git a/po/de_DE.po b/po/de_DE.po
index 568e581..8a66c4d 100644
--- a/po/de_DE.po
+++ b/po/de_DE.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Neutrinoepg-Plugin 0.3.2\n"
"Report-Msgid-Bugs-To: <see README>\n"
-"POT-Creation-Date: 2013-04-11 15:59+0200\n"
+"POT-Creation-Date: 2013-04-11 18:50+0200\n"
"PO-Revision-Date: 2008-03-30 19:58+0200\n"
"Last-Translator: \n"
"Language-Team: <nordlicht@martins-kabuff.de>\n"
@@ -52,8 +52,8 @@ msgstr "Sprungweite (min)"
msgid "Favorite time"
msgstr "Favoriten Zeit"
-msgid "Key to switch channel"
-msgstr "Taste zum Umschalten"
+msgid "Switch with OK"
+msgstr ""
msgid "Selected item centered"
msgstr "ausgewählten Kanal mittig"
@@ -90,3 +90,6 @@ msgstr "ohne Gruppe"
msgid "Jump to"
msgstr "Springe zu"
+
+#~ msgid "Key to switch channel"
+#~ msgstr "Taste zum Umschalten"