neutrino: add option to limit CI usage to selected bouquets;

if no bouquets selected, CI used for all channels
This commit is contained in:
[CST] Focus
2015-11-06 17:20:48 +03:00
parent 5a8fc39ef9
commit eab8bbec20
12 changed files with 86 additions and 10 deletions

View File

@@ -223,7 +223,7 @@ int CBouquetList::exec( bool bShowChannelList)
int CBouquetList::doMenu()
{
int i = 0;
int i = 0, ret = 0;
int select = -1;
static int old_selected = 0;
signed int bouquet_id;
@@ -245,13 +245,16 @@ int CBouquetList::doMenu()
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
int old_epg = zapitBouquet ? zapitBouquet->bScanEpg : 0;
int old_ci = zapitBouquet ? zapitBouquet->bUseCI : 0;
sprintf(cnt, "%d", i);
/* FIXME menu centered different than bouquet list ??? */
/* provider bouquet */
if (zapitBouquet && !zapitBouquet->bUser) {
menu->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue), old_selected == i ++);
if (g_settings.epg_scan == CEpgScan::SCAN_SEL)
if (!zapitBouquet->bWebtv && g_settings.epg_scan == CEpgScan::SCAN_SEL)
menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
if (!zapitBouquet->bWebtv)
menu->addItem(new CMenuOptionChooser(LOCALE_CI_USE, &zapitBouquet->bUseCI, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
menu->exec(NULL, "");
delete menu;
delete selector;
@@ -259,6 +262,21 @@ int CBouquetList::doMenu()
if (old_epg != zapitBouquet->bScanEpg) {
save_bouquets = true;
CNeutrinoApp::getInstance()->MarkBouquetsChanged();
ret = -1;
}
if (old_ci != zapitBouquet->bUseCI) {
channels = &zapitBouquet->tvChannels;
for(int li = 0; li < (int) channels->size(); li++)
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
channels = &zapitBouquet->radioChannels;
for(int li = 0; li < (int) channels->size(); li++)
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
CServiceManager::getInstance()->SetCIFilter();
save_bouquets = true;
CNeutrinoApp::getInstance()->MarkBouquetsChanged();
ret = -1;
}
if(select >= 0) {
@@ -304,8 +322,10 @@ int CBouquetList::doMenu()
} else {
/* user or satellite bouquet */
menu->addItem(new CMenuForwarder(LOCALE_BOUQUETEDITOR_DELETE, true, NULL, selector, cnt, CRCInput::RC_red), old_selected == i ++);
if (zapitBouquet && (g_settings.epg_scan == CEpgScan::SCAN_SEL))
if (zapitBouquet && !zapitBouquet->bWebtv && (g_settings.epg_scan == CEpgScan::SCAN_SEL))
menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
if (zapitBouquet && !zapitBouquet->bWebtv)
menu->addItem(new CMenuOptionChooser(LOCALE_CI_USE, &zapitBouquet->bUseCI, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
menu->exec(NULL, "");
delete menu;
@@ -313,6 +333,21 @@ int CBouquetList::doMenu()
if (zapitBouquet && (old_epg != zapitBouquet->bScanEpg)) {
save_bouquets = true;
CNeutrinoApp::getInstance()->MarkFavoritesChanged();
ret = -1;
}
if (zapitBouquet && (old_ci != zapitBouquet->bUseCI)) {
channels = &zapitBouquet->tvChannels;
for(int li = 0; li < (int) channels->size(); li++)
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
channels = &zapitBouquet->radioChannels;
for(int li = 0; li < (int) channels->size(); li++)
(*channels)[li]->bUseCI = zapitBouquet->bUseCI;
CServiceManager::getInstance()->SetCIFilter();
save_bouquets = true;
CNeutrinoApp::getInstance()->MarkFavoritesChanged();
ret = -1;
}
printf("CBouquetList::doMenu: %d selected\n", select);
@@ -342,7 +377,7 @@ int CBouquetList::doMenu()
}
}
}
return 0;
return ret;
}
const struct button_label CBouquetListButtons[4] =
@@ -638,9 +673,19 @@ void CBouquetList::paintItem(int pos)
if (iw && ih) {
int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw;
frameBuffer->paintIcon(NEUTRINO_ICON_EPG, icon_x - iw, ypos, fheight);
iw = iw + 12 + RADIUS_LARGE/2;
iw = iw + 4 + RADIUS_LARGE/2;
}
}
if (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bUseCI) {
int iw2;
frameBuffer->getIconSize(NEUTRINO_ICON_SCRAMBLED2, &iw2, &ih);
if (iw2 && ih) {
int icon_x = (x+width-2) - RADIUS_LARGE/2 - iw - iw2 - 2;
frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED2, icon_x - iw2, ypos, fheight);
iw = iw + iw2 + 4 + RADIUS_LARGE/2;
}
}
int numpos = x+5+numwidth- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos,ypos+fheight, numwidth+5, tmp, color, fheight);