gui/channellist.cpp: adjust channel list mode on numeric zap

This commit is contained in:
[CST] Focus
2013-04-01 14:15:47 +04:00
parent caca00682d
commit f35065b918
2 changed files with 25 additions and 3 deletions

View File

@@ -1059,7 +1059,6 @@ bool CChannelList::adjustToChannelID(const t_channel_id channel_id, bool bToo)
selected_chid = channel_id; selected_chid = channel_id;
printf("CChannelList::adjustToChannelID me %p [%s] list size %d channel_id %" PRIx64 "\n", this, getName(), (int)chanlist.size(), channel_id); printf("CChannelList::adjustToChannelID me %p [%s] list size %d channel_id %" PRIx64 "\n", this, getName(), (int)chanlist.size(), channel_id);
fflush(stdout);
for (i = 0; i < chanlist.size(); i++) { for (i = 0; i < chanlist.size(); i++) {
if(chanlist[i] == NULL) { if(chanlist[i] == NULL) {
printf("CChannelList::adjustToChannelID REPORT BUG !! ******************************** %d is NULL !!\n", i); printf("CChannelList::adjustToChannelID REPORT BUG !! ******************************** %d is NULL !!\n", i);
@@ -1075,29 +1074,47 @@ bool CChannelList::adjustToChannelID(const t_channel_id channel_id, bool bToo)
int old_mode = CNeutrinoApp::getInstance()->GetChannelMode(); int old_mode = CNeutrinoApp::getInstance()->GetChannelMode();
int new_mode = old_mode; int new_mode = old_mode;
bool has_channel; bool has_channel;
first_mode_found = -1;
if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv) { if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_tv) {
has_channel = TVfavList->adjustToChannelID(channel_id); has_channel = TVfavList->adjustToChannelID(channel_id);
if (has_channel && first_mode_found < 0)
first_mode_found = LIST_MODE_FAV;
if(!has_channel && old_mode == LIST_MODE_FAV) if(!has_channel && old_mode == LIST_MODE_FAV)
new_mode = LIST_MODE_PROV; new_mode = LIST_MODE_PROV;
has_channel = TVbouquetList->adjustToChannelID(channel_id); has_channel = TVbouquetList->adjustToChannelID(channel_id);
if(!has_channel && old_mode == LIST_MODE_PROV) { if (has_channel && first_mode_found < 0)
first_mode_found = LIST_MODE_PROV;
if(!has_channel && old_mode == LIST_MODE_PROV)
new_mode = LIST_MODE_SAT; new_mode = LIST_MODE_SAT;
}
has_channel = TVsatList->adjustToChannelID(channel_id); has_channel = TVsatList->adjustToChannelID(channel_id);
if (has_channel && first_mode_found < 0)
first_mode_found = LIST_MODE_SAT;
if(!has_channel && old_mode == LIST_MODE_SAT) if(!has_channel && old_mode == LIST_MODE_SAT)
new_mode = LIST_MODE_ALL; new_mode = LIST_MODE_ALL;
has_channel = TVallList->adjustToChannelID(channel_id); has_channel = TVallList->adjustToChannelID(channel_id);
} }
else if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio) { else if(CNeutrinoApp::getInstance()->getMode() == NeutrinoMessages::mode_radio) {
has_channel = RADIOfavList->adjustToChannelID(channel_id); has_channel = RADIOfavList->adjustToChannelID(channel_id);
if (has_channel && first_mode_found < 0)
first_mode_found = LIST_MODE_FAV;
if(!has_channel && old_mode == LIST_MODE_FAV) if(!has_channel && old_mode == LIST_MODE_FAV)
new_mode = LIST_MODE_PROV; new_mode = LIST_MODE_PROV;
has_channel = RADIObouquetList->adjustToChannelID(channel_id); has_channel = RADIObouquetList->adjustToChannelID(channel_id);
if (has_channel && first_mode_found < 0)
first_mode_found = LIST_MODE_PROV;
if(!has_channel && old_mode == LIST_MODE_PROV) if(!has_channel && old_mode == LIST_MODE_PROV)
new_mode = LIST_MODE_SAT; new_mode = LIST_MODE_SAT;
has_channel = RADIOsatList->adjustToChannelID(channel_id); has_channel = RADIOsatList->adjustToChannelID(channel_id);
if (has_channel && first_mode_found < 0)
first_mode_found = LIST_MODE_SAT;
if(!has_channel && old_mode == LIST_MODE_SAT) if(!has_channel && old_mode == LIST_MODE_SAT)
new_mode = LIST_MODE_ALL; new_mode = LIST_MODE_ALL;
has_channel = RADIOallList->adjustToChannelID(channel_id); has_channel = RADIOallList->adjustToChannelID(channel_id);
} }
if(old_mode != new_mode) if(old_mode != new_mode)
@@ -1387,6 +1404,10 @@ int CChannelList::numericZap(int key)
if(chan && SameTP(chan)) { if(chan && SameTP(chan)) {
zapToChannel(chan); zapToChannel(chan);
if (g_settings.channellist_numeric_adjust && first_mode_found >= 0) {
CNeutrinoApp::getInstance()->SetChannelMode(first_mode_found);
CNeutrinoApp::getInstance()->channelList->getLastChannels().set_mode(chan->channel_id);
}
res = 0; res = 0;
} else } else
g_InfoViewer->killTitle(); g_InfoViewer->killTitle();

View File

@@ -92,6 +92,7 @@ private:
bool vlist; // "virtual" list, not bouquet bool vlist; // "virtual" list, not bouquet
bool displayNext; bool displayNext;
bool displayList; bool displayList;
int first_mode_found;
int info_height; int info_height;
int ChannelList_Rec; int ChannelList_Rec;