gui/bouquetlist.cpp: fix message loop, if bouquet list is empty

This commit is contained in:
[CST] Focus
2012-10-22 15:49:55 +04:00
parent 6a0b42e962
commit 6fad279231

View File

@@ -332,8 +332,7 @@ int CBouquetList::show(bool bShowChannelList)
frameBuffer->getIconSize(CBouquetListButtons[count].button, &icol_w, &icol_h);
w_max_icon = std::max(w_max_icon, icol_w);
}
//if(Bouquets.size()==0)
// return res;
int need_width = sizeof(CBouquetListButtons)/sizeof(CBouquetListButtons[0])*(w_max_icon + w_max_text + 20);
CVFD::getInstance()->setMode(CVFD::MODE_MENU_UTF8, "");
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight();
@@ -419,9 +418,8 @@ int CBouquetList::show(bool bShowChannelList)
return -3;
}
}
else if(Bouquets.empty())
continue; //FIXME msgs not forwarded to neutrino !!
else if ( msg == CRCInput::RC_setup) {
if (!Bouquets.empty()) {
int ret = doMenu();
if(ret > 0) {
CNeutrinoApp::getInstance ()->g_channel_list_changed = true;
@@ -430,14 +428,18 @@ int CBouquetList::show(bool bShowChannelList)
} else if(ret < 0)
paint();
}
}
else if ( msg == (neutrino_msg_t) g_settings.key_list_start ) {
if (!Bouquets.empty())
updateSelection(0);
}
else if ( msg == (neutrino_msg_t) g_settings.key_list_end ) {
if (!Bouquets.empty())
updateSelection(Bouquets.size()-1);
}
else if (msg == CRCInput::RC_up || (int) msg == g_settings.key_channelList_pageup)
{
if (!Bouquets.empty()) {
int step = ((int) msg == g_settings.key_channelList_pageup) ? listmaxshow : 1; // browse or step 1
int new_selected = selected - step;
if (new_selected < 0) {
@@ -446,11 +448,12 @@ int CBouquetList::show(bool bShowChannelList)
else
new_selected = Bouquets.size() - 1;
}
updateSelection(new_selected);
}
}
else if (msg == CRCInput::RC_down || (int) msg == g_settings.key_channelList_pagedown)
{
if (!Bouquets.empty()) {
int step = ((int) msg == g_settings.key_channelList_pagedown) ? listmaxshow : 1; // browse or step 1
int new_selected = selected + step;
if (new_selected >= (int) Bouquets.size()) {
@@ -463,6 +466,7 @@ int CBouquetList::show(bool bShowChannelList)
}
updateSelection(new_selected);
}
}
else if(msg == (neutrino_msg_t)g_settings.key_bouquet_up || msg == (neutrino_msg_t)g_settings.key_bouquet_down) {
if(bShowChannelList) {
int mode = CNeutrinoApp::getInstance()->GetChannelMode();
@@ -475,16 +479,15 @@ int CBouquetList::show(bool bShowChannelList)
hide();
return -3;
}
}
else if ( msg == CRCInput::RC_ok ) {
if(!bShowChannelList || !Bouquets[selected]->channelList->isEmpty()) {
if(!Bouquets.empty() && (!bShowChannelList || !Bouquets[selected]->channelList->isEmpty())) {
zapOnExit = true;
loop=false;
}
}
else if (CRCInput::isNumeric(msg)) {
if (!Bouquets.empty()) {
if (pos == lmaxpos) {
if (msg == CRCInput::RC_0) {
chn = firstselected;
@@ -505,6 +508,7 @@ int CBouquetList::show(bool bShowChannelList)
int new_selected = (chn - 1) % Bouquets.size(); // is % necessary (i.e. can firstselected be > Bouquets.size()) ?
updateSelection(new_selected);
}
} else {
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
loop = false;