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;
|
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
|
#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 ?? */
|
/* 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()
|
int CChannelList::show()
|
||||||
@@ -766,23 +790,8 @@ int CChannelList::show()
|
|||||||
if (dline)
|
if (dline)
|
||||||
dline->kill(); //kill details line on change to next page
|
dline->kill(); //kill details line on change to next page
|
||||||
if (!bouquetList->Bouquets.empty()) {
|
if (!bouquetList->Bouquets.empty()) {
|
||||||
bool found = true;
|
int nNext = getPrevNextBouquet(msg == (neutrino_msg_t)g_settings.key_bouquet_up);
|
||||||
int dir = msg == (neutrino_msg_t)g_settings.key_bouquet_up ? 1 : -1;
|
if(nNext >= 0) {
|
||||||
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) {
|
|
||||||
bouquetList->activateBouquet(nNext, false);
|
bouquetList->activateBouquet(nNext, false);
|
||||||
res = bouquetList->showChannelList();
|
res = bouquetList->showChannelList();
|
||||||
loop = false;
|
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);
|
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 ((key == g_settings.key_quickzap_down) || (key == CRCInput::RC_left)) {
|
||||||
if(cactive == 0) {
|
if(cactive == 0) {
|
||||||
if(bactive == 0)
|
bactive = getPrevNextBouquet(false);
|
||||||
bactive = bsize - 1;
|
if (bactive >= 0) {
|
||||||
else
|
bouquetList->activateBouquet(bactive, false);
|
||||||
bactive--;
|
cactive = bouquetList->Bouquets[bactive]->channelList->getSize() - 1;
|
||||||
bouquetList->activateBouquet(bactive, false);
|
}
|
||||||
cactive = bouquetList->Bouquets[bactive]->channelList->getSize() - 1;
|
|
||||||
} else
|
} else
|
||||||
--cactive;
|
--cactive;
|
||||||
}
|
}
|
||||||
else if ((key == g_settings.key_quickzap_up) || (key == CRCInput::RC_right)) {
|
else if ((key == g_settings.key_quickzap_up) || (key == CRCInput::RC_right)) {
|
||||||
cactive++;
|
cactive++;
|
||||||
if(cactive >= chanlist.size()) {
|
if(cactive >= chanlist.size()) {
|
||||||
bactive = (bactive + 1) % bsize;
|
bactive = getPrevNextBouquet(true);
|
||||||
bouquetList->activateBouquet(bactive, false);
|
if (bactive >= 0) {
|
||||||
cactive = 0;
|
bouquetList->activateBouquet(bactive, false);
|
||||||
|
cactive = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sl = cactive;
|
sl = cactive;
|
||||||
|
@@ -123,6 +123,7 @@ private:
|
|||||||
int emptyLineCount;
|
int emptyLineCount;
|
||||||
void addTextToArray( const std::string & text, int screening );
|
void addTextToArray( const std::string & text, int screening );
|
||||||
void processTextToArray(std::string text, int screening = 0);
|
void processTextToArray(std::string text, int screening = 0);
|
||||||
|
int getPrevNextBouquet(bool next);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false);
|
CChannelList(const char * const Name, bool historyMode = false, bool _vlist = false);
|
||||||
|
Reference in New Issue
Block a user