mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-29 16:31:11 +02:00
gui/channellist.cpp: fix quick zap and virtual zap, when
empty bouquets present and zap cycle in current bouquet is disabled
This commit is contained in:
@@ -576,6 +576,30 @@ bool CChannelList::updateSelection(int newpos)
|
||||
return actzap;
|
||||
}
|
||||
|
||||
int CChannelList::getPrevNextBouquet(bool next)
|
||||
{
|
||||
bool found = true;
|
||||
int dir = next ? 1 : -1;
|
||||
int b_size = bouquetList->Bouquets.size(); /* bigger than 0 */
|
||||
int nNext = (bouquetList->getActiveBouquetNumber() + b_size + dir) % b_size;
|
||||
if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) {
|
||||
found = false;
|
||||
int n_old = nNext;
|
||||
nNext = (nNext + b_size + dir) % b_size;
|
||||
for (int i = nNext; i != n_old; i = (i + b_size + dir) % b_size) {
|
||||
if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) {
|
||||
found = true;
|
||||
nNext = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (found)
|
||||
return nNext;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
#define CHANNEL_SMSKEY_TIMEOUT 800
|
||||
/* return: >= 0 to zap, -1 on cancel, -3 on list mode change, -4 list edited, -2 zap but no restore old list/chan ?? */
|
||||
int CChannelList::show()
|
||||
@@ -766,23 +790,8 @@ int CChannelList::show()
|
||||
if (dline)
|
||||
dline->kill(); //kill details line on change to next page
|
||||
if (!bouquetList->Bouquets.empty()) {
|
||||
bool found = true;
|
||||
int dir = msg == (neutrino_msg_t)g_settings.key_bouquet_up ? 1 : -1;
|
||||
int b_size = bouquetList->Bouquets.size(); /* bigger than 0 */
|
||||
int nNext = (bouquetList->getActiveBouquetNumber() + b_size + dir) % b_size;
|
||||
if(bouquetList->Bouquets[nNext]->channelList->isEmpty() ) {
|
||||
found = false;
|
||||
int n_old = nNext;
|
||||
nNext = (nNext + b_size + dir) % b_size;
|
||||
for (int i = nNext; i != n_old; i = (i + b_size + dir) % b_size) {
|
||||
if( !bouquetList->Bouquets[i]->channelList->isEmpty() ) {
|
||||
found = true;
|
||||
nNext = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(found) {
|
||||
int nNext = getPrevNextBouquet(msg == (neutrino_msg_t)g_settings.key_bouquet_up);
|
||||
if(nNext >= 0) {
|
||||
bouquetList->activateBouquet(nNext, false);
|
||||
res = bouquetList->showChannelList();
|
||||
loop = false;
|
||||
@@ -1458,21 +1467,22 @@ CZapitChannel* CChannelList::getPrevNextChannel(int key, unsigned int &sl)
|
||||
printf("CChannelList::getPrevNextChannel: selected %d total %d active bouquet %d total %d\n", (int)cactive, (int)chanlist.size(), bactive, bsize);
|
||||
if ((key == g_settings.key_quickzap_down) || (key == CRCInput::RC_left)) {
|
||||
if(cactive == 0) {
|
||||
if(bactive == 0)
|
||||
bactive = bsize - 1;
|
||||
else
|
||||
bactive--;
|
||||
bouquetList->activateBouquet(bactive, false);
|
||||
cactive = bouquetList->Bouquets[bactive]->channelList->getSize() - 1;
|
||||
bactive = getPrevNextBouquet(false);
|
||||
if (bactive >= 0) {
|
||||
bouquetList->activateBouquet(bactive, false);
|
||||
cactive = bouquetList->Bouquets[bactive]->channelList->getSize() - 1;
|
||||
}
|
||||
} else
|
||||
--cactive;
|
||||
}
|
||||
else if ((key == g_settings.key_quickzap_up) || (key == CRCInput::RC_right)) {
|
||||
cactive++;
|
||||
if(cactive >= chanlist.size()) {
|
||||
bactive = (bactive + 1) % bsize;
|
||||
bouquetList->activateBouquet(bactive, false);
|
||||
cactive = 0;
|
||||
bactive = getPrevNextBouquet(true);
|
||||
if (bactive >= 0) {
|
||||
bouquetList->activateBouquet(bactive, false);
|
||||
cactive = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
sl = cactive;
|
||||
|
Reference in New Issue
Block a user