add show epg with rc forward/rewind from prev/nex channel in bouquet (test version)

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@765 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: e08246132c
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2010-09-12 (Sun, 12 Sep 2010)

Origin message was:
------------------
-add show epg with rc forward/rewind from prev/nex channel in bouquet (test version)

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@765 e54a6e83-5905-42d5-8d5c-058d10e6a962


------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2010-09-12 17:56:44 +00:00
parent 9c40c53247
commit 4fc4b069a2
2 changed files with 137 additions and 81 deletions

View File

@@ -65,19 +65,21 @@ void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventL
bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata); bool sectionsd_getActualEPGServiceKey(const t_channel_id uniqueServiceKey, CEPGData * epgdata);
bool sectionsd_getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors); bool sectionsd_getLinkageDescriptorsUniqueKey(const event_id_t uniqueKey, CSectionsdClient::LinkageDescriptorList& descriptors);
#if 0
// sort operators // sort operators
bool sortById (const CChannelEvent& a, const CChannelEvent& b) bool sortById (const CChannelEvent& a, const CChannelEvent& b)
{ {
return a.eventID < b.eventID ; return a.eventID < b.eventID ;
} }
bool sortByDescription (const CChannelEvent& a, const CChannelEvent& b) #endif
inline bool sortByDescription (const CChannelEvent& a, const CChannelEvent& b)
{ {
if(a.description == b.description) if(a.description == b.description)
return a.eventID < b.eventID; return a.eventID < b.eventID;
else else
return a.description < b.description ; return a.description < b.description ;
} }
static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b) inline static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b)
{ {
return a.startTime < b.startTime; return a.startTime < b.startTime;
} }
@@ -109,8 +111,7 @@ void EventList::readEvents(const t_channel_id channel_id)
time_t azeit=time(NULL); time_t azeit=time(NULL);
CChannelEventList::iterator e; CChannelEventList::iterator e;
if ( !evtlist.empty() ) {
if ( evtlist.size() != 0 ) {
CEPGData epgData; CEPGData epgData;
// todo: what if there are more than one events in the Portal // todo: what if there are more than one events in the Portal
@@ -210,11 +211,11 @@ void EventList::readEvents(const t_channel_id channel_id)
} }
int EventList::exec(const t_channel_id channel_id, const std::string& channelname) // UTF-8 int EventList::exec(const t_channel_id channel_id, const std::string& channelname, const std::string& channelname_prev, const std::string& channelname_next) // UTF-8
{ {
neutrino_msg_t msg; neutrino_msg_t msg;
neutrino_msg_data_t data; neutrino_msg_data_t data;
bool in_search = 0; bool in_search = false;
int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth(); int fw = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getWidth();
int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); int fh = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight();
width = w_max (62 * fw, 40); width = w_max (62 * fw, 40);
@@ -224,19 +225,17 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
if(iheight < fh) if(iheight < fh)
iheight = fh; iheight = fh;
int icol_w, icol_h; int icol_w = 0, icol_h = 0;
const int pic_h = 39;
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_RED, &icol_w, &icol_h);
iheight = std::max(iheight, icol_h); iheight = std::max(iheight, icol_h);
theight = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getHeight(); theight = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getHeight();
const int pic_h = 39;
theight = std::max(theight, pic_h); theight = std::max(theight, pic_h);
int iw, ih; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HELP, &icol_w, &icol_h);
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HELP, &iw, &ih); theight = std::max(theight, icol_h);
theight = std::max(theight, ih);
fheight1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->getHeight(); fheight1 = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->getHeight();
{ {
@@ -269,7 +268,6 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
m_search_channel_id = channel_id; m_search_channel_id = channel_id;
m_showChannel = false; // do not show the channel in normal mode, we just need it in search mode m_showChannel = false; // do not show the channel in normal mode, we just need it in search mode
name = channelname;
sort_mode=0; sort_mode=0;
bool fadeIn = g_settings.widget_fade; bool fadeIn = g_settings.widget_fade;
@@ -281,9 +279,14 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
frameBuffer->setBlendLevel(fadeValue, fadeValue); frameBuffer->setBlendLevel(fadeValue, fadeValue);
fadeTimer = g_RCInput->addTimer( FADE_TIME, false ); fadeTimer = g_RCInput->addTimer( FADE_TIME, false );
} }
paintHead(channel_id, name);
readEvents(channel_id); readEvents(channel_id);
if(channelname_prev.empty(), channelname_next.empty()){
paintHead(channel_id, channelname);
}else{
paintHead(channel_id, channelname, channelname_prev, channelname_next);
}
paint(channel_id); paint(channel_id);
showFunctionBar(true); showFunctionBar(true);
@@ -429,7 +432,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
else else
liststart=(selected/listmaxshow)*listmaxshow; liststart=(selected/listmaxshow)*listmaxshow;
hide(); hide();
paintHead(channel_id, name); paintHead(channel_id, channelname);
paint(channel_id); paint(channel_id);
showFunctionBar(true); showFunctionBar(true);
@@ -537,8 +540,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
{ {
if(in_search) { if(in_search) {
in_search = false; in_search = false;
name = channelname; paintHead(channel_id, channelname);
paintHead(channel_id, name);
readEvents(channel_id); readEvents(channel_id);
paint(channel_id); paint(channel_id);
showFunctionBar(true); showFunctionBar(true);
@@ -558,10 +560,43 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
loop = false; loop = false;
} }
} }
else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_red ) else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_red ){
{
loop= false; loop= false;
} }
else if ( msg==CRCInput::RC_rewind || msg==CRCInput::RC_forward) {
t_bouquet_id current_bouquet_id= bouquetList->getActiveBouquetNumber();
t_channel_id channel_id_tmp, _channel_id;
const unsigned int channel_nr = bouquetList->Bouquets[current_bouquet_id]->channelList->getSize();
std::string next_channel_name;
std::string prev_channel_name ;
std::string current_channel_name;
unsigned int tmp_channel = 0;
for(unsigned int channel = 0; channel < channel_nr; channel++)
{
channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->channel_id;
if(channel_id_tmp == channel_id){
if ( msg==CRCInput::RC_forward) {
channel = (channel+1) %channel_nr;
}else { //RC_rewind
channel = (channel == 0) ? channel_nr -1 : channel - 1;
}
_channel_id = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->channel_id;
current_channel_name = g_Zapit->getChannelName(_channel_id);
tmp_channel = (channel == 0) ? channel_nr - 1 : channel - 1;
channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->channel_id;
prev_channel_name = g_Zapit->getChannelName(channel_id_tmp);
tmp_channel = (channel+1) %channel_nr;
channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->channel_id;
next_channel_name = g_Zapit->getChannelName(channel_id_tmp);
break;
}
}
loop = false;
exec(_channel_id, current_channel_name, prev_channel_name, next_channel_name);
}
else if (msg == CRCInput::RC_0) { else if (msg == CRCInput::RC_0) {
hide(); hide();
@@ -571,7 +606,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
timerlist.clear(); timerlist.clear();
g_Timerd->getTimerList (timerlist); g_Timerd->getTimerList (timerlist);
paintHead(channel_id, name); paintHead(channel_id, channelname);
paint(channel_id); paint(channel_id);
showFunctionBar(true); showFunctionBar(true);
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);
@@ -608,8 +643,7 @@ int EventList::exec(const t_channel_id channel_id, const std::string& channelnam
/* in case timer was added in g_EpgData */ /* in case timer was added in g_EpgData */
timerlist.clear(); timerlist.clear();
g_Timerd->getTimerList (timerlist); g_Timerd->getTimerList (timerlist);
paintHead(channel_id,in_search ? search_head_name: channelname);
paintHead(channel_id, name);
paint(channel_id); paint(channel_id);
showFunctionBar(true); showFunctionBar(true);
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]); timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_EPG]);
@@ -670,7 +704,7 @@ CTimerd::CTimerEventTypes EventList::isScheduled(t_channel_id channel_id, CChann
return (CTimerd::CTimerEventTypes) 0; return (CTimerd::CTimerEventTypes) 0;
} }
void EventList::paintItem(unsigned int pos, t_channel_id channel_id) void EventList::paintItem(unsigned int pos, t_channel_id channel_idI)
{ {
uint8_t color; uint8_t color;
fb_pixel_t bgcolor; fb_pixel_t bgcolor;
@@ -727,7 +761,7 @@ void EventList::paintItem(unsigned int pos, t_channel_id channel_id)
duration_str = tmpstr; duration_str = tmpstr;
} }
CTimerd::CTimerEventTypes etype = isScheduled(channel_id, &evtlist[liststart+pos]); CTimerd::CTimerEventTypes etype = isScheduled(channel_idI, &evtlist[liststart+pos]);
icontype = etype == CTimerd::TIMER_ZAPTO ? NEUTRINO_ICON_BUTTON_YELLOW : etype == CTimerd::TIMER_RECORD ? NEUTRINO_ICON_BUTTON_RED : 0; icontype = etype == CTimerd::TIMER_ZAPTO ? NEUTRINO_ICON_BUTTON_YELLOW : etype == CTimerd::TIMER_RECORD ? NEUTRINO_ICON_BUTTON_RED : 0;
// 1st line // 1st line
@@ -754,17 +788,44 @@ void EventList::paintItem(unsigned int pos, t_channel_id channel_id)
g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x+10+iw, ypos+ fheight, width- 25- 20, evtlist[liststart+pos].description, color, 0, true); g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMLARGE]->RenderString(x+10+iw, ypos+ fheight, width- 25- 20, evtlist[liststart+pos].description, color, 0, true);
} }
} }
void EventList::paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next)
{
const short font_h = 8;
int iw = 0, ih = 0;
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HELP, &iw, &ih);
frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);
int name_width =((width-8-iw)/3);
void EventList::paintHead(t_channel_id channel_id, std::string channelname) short prev_len = g_Font[font_h]->getRenderWidth(_channelname_prev.c_str(),true);
short next_len = g_Font[font_h]->getRenderWidth(_channelname_next.c_str(),true);
short middle_len = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->getRenderWidth(_channelname.c_str(),true);
short middle_offset = (width- next_len- prev_len- middle_len-iw-8)/2;
if(middle_offset < 0){
int fw = g_Font[font_h]->getWidth();
int newsize = abs(middle_offset / fw) + 1;
if(_channelname_prev.size() > _channelname_next.size() ){
_channelname_prev.resize( _channelname_prev.size() - newsize);
}else{
_channelname_next.resize( _channelname_next.size() - newsize);
}
middle_offset = 0;
}
g_Font[font_h]->RenderString(x+4,y+theight+1, width, _channelname_prev.c_str(), COL_INFOBAR, 0, true); // UTF-8
g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+prev_len+middle_offset,y+theight+1, width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8
g_Font[font_h]->RenderString(x+(name_width*3)- next_len,y+theight+1, width, _channelname_next.c_str(), COL_INFOBAR, 0, true); // UTF-8
}
void EventList::paintHead(t_channel_id _channel_id, std::string _channelname)
{ {
bool logo_ok = false; bool logo_ok = false;
frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP); frameBuffer->paintBoxRel(x,y, width,theight+0, COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);
std::string lname; std::string lname;
int logo_w = 0; int logo_w = 0;
int logo_h = 0; int logo_h = 0;
if(g_PicViewer->GetLogoName(channel_id, channelname, lname, &logo_w, &logo_h)){ if(g_PicViewer->GetLogoName(_channel_id, _channelname, lname, &logo_w, &logo_h)){
if(logo_h > theight){ if(logo_h > theight){
if((theight/(logo_h-theight))>1){ if((theight/(logo_h-theight))>1){
logo_w -= (logo_w/(theight/(logo_h-theight))); logo_w -= (logo_w/(theight/(logo_h-theight)));
@@ -773,22 +834,22 @@ void EventList::paintHead(t_channel_id channel_id, std::string channelname)
} }
logo_ok = g_PicViewer->DisplayImage(lname, x+10, y+(theight-logo_h)/2, logo_w, logo_h); logo_ok = g_PicViewer->DisplayImage(lname, x+10, y+(theight-logo_h)/2, logo_w, logo_h);
} }
//logo_ok = g_PicViewer->DisplayLogo(channel_id, x+10, y+(theight-PIC_H)/2, PIC_W, PIC_H); //logo_ok = g_PicViewer->DisplayLogo(_channel_id, x+10, y+(theight-PIC_H)/2, PIC_W, PIC_H);
g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+15+(logo_ok? 5+logo_w:0),y+theight+1, width, name.c_str(), COL_MENUHEAD, 0, true); // UTF-8 g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_TITLE]->RenderString(x+15+(logo_ok? 5+logo_w:0),y+theight+1, width, _channelname.c_str(), COL_MENUHEAD, 0, true); // UTF-8
} }
void EventList::paint(t_channel_id channel_id) void EventList::paint(t_channel_id channel_id)
{ {
liststart = (selected/listmaxshow)*listmaxshow; liststart = (selected/listmaxshow)*listmaxshow;
int iw = 0, ih; int iw = 0, ih = 0;
if (evtlist[0].eventID != 0) { if (evtlist[0].eventID != 0) {
frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HELP, &iw, &ih); frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_HELP, &iw, &ih);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HELP, x+ width - 4 - iw, y, theight); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HELP, x+ width - 4 - iw, y, theight);
} }
frameBuffer->paintBoxRel(x, y+theight, width, height-theight-iheight, COL_MENUCONTENT_PLUS_0, 0, CORNER_TOP); frameBuffer->paintBoxRel(x, y+theight, width, height-theight-iheight, COL_INFOBAR, 0, CORNER_TOP);
for(unsigned int count=0;count<listmaxshow;count++) for(unsigned int count=0;count<listmaxshow;count++)
{ {
paintItem(count, channel_id); paintItem(count, channel_id);
@@ -808,15 +869,12 @@ void EventList::paint(t_channel_id channel_id)
void EventList::showFunctionBar (bool show) void EventList::showFunctionBar (bool show)
{ {
int bx,by,bw,bh; int bx = x + 8;
int cellwidth; // 4 cells int bw = width - 16;
int pos; int bh = iheight;
int by = y + height-iheight;
bx = x + 8; int cellwidth = bw / 4;// 4 cells
bw = width - 16; int pos = 0;
bh = iheight;
by = y + height-iheight;
cellwidth = bw / 4;
frameBuffer->paintBackgroundBoxRel(x,by,width,bh); frameBuffer->paintBackgroundBoxRel(x,by,width,bh);
// -- hide only? // -- hide only?
@@ -879,7 +937,6 @@ int CEventListHandler::exec(CMenuTarget* parent, const std::string &/*actionkey*
if (parent) { if (parent) {
parent->hide(); parent->hide();
} }
e = new EventList; e = new EventList;
channelList = CNeutrinoApp::getInstance()->channelList; channelList = CNeutrinoApp::getInstance()->channelList;
@@ -894,10 +951,10 @@ int CEventListHandler::exec(CMenuTarget* parent, const std::string &/*actionkey*
/************************************************************************************************/ /************************************************************************************************/
int EventList::findEvents(void) bool EventList::findEvents(void)
/************************************************************************************************/ /************************************************************************************************/
{ {
int res = 0; bool res = false;
int event = 0; int event = 0;
t_channel_id channel_id; //g_Zapit->getCurrentServiceID() t_channel_id channel_id; //g_Zapit->getCurrentServiceID()
@@ -910,10 +967,11 @@ int EventList::findEvents(void)
); );
hide(); hide();
menu.exec(NULL,""); menu.exec(NULL,"");
search_head_name = g_Locale->getText(LOCALE_EVENTFINDER_SEARCH);
if(event == 1) if(event == 1)
{ {
res = 1; res = true;
m_showChannel = true; // force the event list to paint the channel name m_showChannel = true; // force the event list to paint the channel name
evtlist.clear(); evtlist.clear();
if(m_search_list == SEARCH_LIST_CHANNEL) if(m_search_list == SEARCH_LIST_CHANNEL)
@@ -975,12 +1033,11 @@ int EventList::findEvents(void)
current_event = 0; current_event = 0;
selected= current_event; selected= current_event;
name = g_Locale->getText(LOCALE_EVENTFINDER_SEARCH); search_head_name += ": '";
name += ": '"; search_head_name += m_search_keyword;
name += m_search_keyword; search_head_name += "'";
name += "'";
} }
paintHead(0, ""); paintHead(0, search_head_name);
paint(); paint();
showFunctionBar(true); showFunctionBar(true);
return(res); return(res);

View File

@@ -77,46 +77,45 @@ class EventList
t_bouquet_id m_search_bouquet_id; t_bouquet_id m_search_bouquet_id;
bool m_showChannel; bool m_showChannel;
private: bool findEvents(void);
int findEvents(void);
// Eventfinder end // Eventfinder end
private: CFrameBuffer *frameBuffer;
CFrameBuffer *frameBuffer; CChannelEventList evtlist;
CChannelEventList evtlist; CTimerd::TimerList timerlist;
CTimerd::TimerList timerlist; void readEvents(const t_channel_id channel_id);
void readEvents(const t_channel_id channel_id); unsigned int selected;
unsigned int selected; unsigned int current_event;
unsigned int current_event; unsigned int liststart;
unsigned int liststart; unsigned int listmaxshow;
unsigned int listmaxshow; unsigned int numwidth;
unsigned int numwidth; int fheight; // Fonthoehe Channellist-Inhalt
int fheight; // Fonthoehe Channellist-Inhalt int fheight1,fheight2;
int fheight1,fheight2; int fwidth1,fwidth2;
int fwidth1,fwidth2; int theight; // Fonthoehe Channellist-Titel
int theight; // Fonthoehe Channellist-Titel int iheight; // Height info bar
int iheight; // Height info bar
int key; int key;
std::string name; std::string search_head_name;
int width; int width;
int height; int height;
int x; int x;
int y; int y;
int sort_mode; int sort_mode;
void paintItem(unsigned pos, t_channel_id channel_id = 0); void paintItem(unsigned pos, t_channel_id channel_id = 0);
void paint(t_channel_id channel_id = 0); void paint(t_channel_id channel_id = 0);
void paintHead(t_channel_id channel_id, std::string name); void paintHead(t_channel_id channel_id, std::string name);
void hide(); void paintHead(t_channel_id _channel_id, std::string _channelname, std::string _channelname_prev, std::string _channelname_next);
void showFunctionBar(bool show); void hide();
CTimerd::CTimerEventTypes isScheduled(t_channel_id channel_id, CChannelEvent * event, int * tID = NULL); void showFunctionBar(bool show);
CTimerd::CTimerEventTypes isScheduled(t_channel_id channel_id, CChannelEvent * event, int * tID = NULL);
public: public:
EventList(); EventList();
~EventList(); ~EventList();
int exec(const t_channel_id channel_id, const std::string& channelname); // UTF-8 int exec(const t_channel_id channel_id, const std::string& channelname, const std::string& prev = "", const std::string& next = ""); // UTF-8
}; };
class CEventListHandler : public CMenuTarget class CEventListHandler : public CMenuTarget