From 5f9f82b8e6f232218f2a47bcdad7cf365a1e395f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 8 May 2017 17:39:30 +0200 Subject: [PATCH] src/gui/eventlist.cpp show prev next channel name on start --- src/gui/eventlist.cpp | 81 +++++++++++++++++++++++++------------------ src/gui/eventlist.h | 3 +- 2 files changed, 50 insertions(+), 34 deletions(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 3d7c56e01..b7102cd00 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -263,6 +263,38 @@ void CEventList::readEvents(const t_channel_id channel_id) return; } +void CEventList::getPrvNextChannelName(t_channel_id &channel_id,std::string &next_channel_name,std::string &prev_channel_name,std::string ¤t_channel_name, neutrino_msg_t msg){ + 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(); + if(channel_nr < 2){ + channel_id = 0; + return; + } + 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)->getChannelID(); + if(channel_id_tmp == channel_id){ + if ( msg==CRCInput::RC_right || msg==CRCInput::RC_forward ) { + channel = (channel+1) %channel_nr; + }else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_rewind ){ //RC_rewind + channel = (channel == 0) ? channel_nr -1 : channel - 1; + } + channel_id = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(channel)->getChannelID(); + current_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id); + + tmp_channel = (channel == 0) ? channel_nr - 1 : channel - 1; + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); + prev_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); + + tmp_channel = (channel+1) %channel_nr; + channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); + next_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); + break; + } + } +} int CEventList::exec(const t_channel_id channel_id, const std::string& channelname, const std::string& channelname_prev, const std::string& channelname_next,const CChannelEventList &followlist) // UTF-8 { @@ -346,7 +378,14 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna UpdateTimerList(); bool dont_hide = false; - paintHead(channel_id, channelname, channelname_prev, channelname_next); + if(channelname_prev.empty() && channelname_prev.empty()){ + std::string nextChannelName,prevChannelName,tmp; + t_channel_id tmp_channel_id = channel_id; + getPrvNextChannelName(tmp_channel_id, nextChannelName, prevChannelName, tmp,0); + paintHead(channel_id, channelname, prevChannelName, nextChannelName); + }else{ + paintHead(channel_id, channelname, channelname_prev, channelname_next); + } paint(channel_id); showFunctionBar(channel_id); @@ -558,39 +597,15 @@ int CEventList::exec(const t_channel_id channel_id, const std::string& channelna } else if ( msg==CRCInput::RC_left || msg==CRCInput::RC_right || msg==CRCInput::RC_rewind || msg==CRCInput::RC_forward ) { // maybe remove RC_rewind and RC_forward in the future? - bgRightBoxPaint = false; - t_bouquet_id current_bouquet_id= bouquetList->getActiveBouquetNumber(); - t_channel_id channel_id_tmp, _channel_id = 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)->getChannelID(); - if(channel_id_tmp == channel_id){ - if ( msg==CRCInput::RC_right || 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)->getChannelID(); - current_channel_name = CServiceManager::getInstance()->GetServiceName(_channel_id); - - tmp_channel = (channel == 0) ? channel_nr - 1 : channel - 1; - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); - prev_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); - - tmp_channel = (channel+1) %channel_nr; - channel_id_tmp = bouquetList->Bouquets[current_bouquet_id]->channelList->getChannelFromIndex(tmp_channel)->getChannelID(); - next_channel_name = CServiceManager::getInstance()->GetServiceName(channel_id_tmp); - break; - } + std::string next_channel_name, prev_channel_name, current_channel_name; + t_channel_id _channel_id = channel_id; + getPrvNextChannelName(_channel_id, next_channel_name, prev_channel_name, current_channel_name, msg); + if(_channel_id){ + bgRightBoxPaint = false; + loop = false; + dont_hide = true; + exec(_channel_id, current_channel_name, prev_channel_name, next_channel_name); } - loop = false; - dont_hide = true; - exec(_channel_id, current_channel_name, prev_channel_name, next_channel_name); } else if (msg == CRCInput::RC_0) { hide(); diff --git a/src/gui/eventlist.h b/src/gui/eventlist.h index 69cf7442c..05d9fbc87 100644 --- a/src/gui/eventlist.h +++ b/src/gui/eventlist.h @@ -116,7 +116,8 @@ class CEventList : public CListHelpers void showProgressBar(int pos); void hide(); void showFunctionBar(t_channel_id channel_id); - + void getPrvNextChannelName(t_channel_id &channel_id,std::string &next_channel_name,std::string &prev_channel_name,std::string ¤t_channel_name, neutrino_msg_t msg); + int timerPre; int timerPost; void UpdateTimerList(void);