mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
gui/bouquetlist.cpp: mark only changed bouquets/services to save;
enable menu save screen, do not repaint after menu; allow open empty channel list
This commit is contained in:
@@ -234,17 +234,20 @@ int CBouquetList::doMenu()
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
zapitBouquet = Bouquets[selected]->zapitBouquet;
|
zapitBouquet = Bouquets[selected]->zapitBouquet;
|
||||||
/* zapitBouquet not NULL only on real bouquets, not on virtual SAT or HD */
|
/* zapitBouquet not NULL only on real bouquets, satellitePosition is set for providers or SAT */
|
||||||
if(!zapitBouquet && Bouquets[selected]->satellitePosition == INVALID_SAT_POSITION)
|
if(!zapitBouquet && Bouquets[selected]->satellitePosition == INVALID_SAT_POSITION)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS);
|
CMenuWidget* menu = new CMenuWidget(LOCALE_CHANNELLIST_EDIT, NEUTRINO_ICON_SETTINGS);
|
||||||
menu->enableFade(false);
|
menu->enableFade(false);
|
||||||
|
menu->enableSaveScreen(true);
|
||||||
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
|
||||||
|
|
||||||
|
int old_epg = zapitBouquet ? zapitBouquet->bScanEpg : 0;
|
||||||
sprintf(cnt, "%d", i);
|
sprintf(cnt, "%d", i);
|
||||||
|
/* FIXME menu centered different than bouquet list ??? */
|
||||||
|
/* provider bouquet */
|
||||||
if (zapitBouquet && !zapitBouquet->bUser) {
|
if (zapitBouquet && !zapitBouquet->bUser) {
|
||||||
bool old_epg = zapitBouquet->bScanEpg;
|
|
||||||
menu->addItem(new CMenuForwarder(LOCALE_FAVORITES_COPY, true, NULL, selector, cnt, CRCInput::RC_blue), old_selected == i ++);
|
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 (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));
|
menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||||
@@ -252,14 +255,16 @@ int CBouquetList::doMenu()
|
|||||||
delete menu;
|
delete menu;
|
||||||
delete selector;
|
delete selector;
|
||||||
printf("CBouquetList::doMenu: %d selected\n", select);
|
printf("CBouquetList::doMenu: %d selected\n", select);
|
||||||
if (old_epg != zapitBouquet->bScanEpg)
|
if (old_epg != zapitBouquet->bScanEpg) {
|
||||||
save_bouquets = true;
|
save_bouquets = true;
|
||||||
|
CNeutrinoApp::getInstance()->MarkBouquetsChanged();
|
||||||
|
}
|
||||||
|
|
||||||
bool added = false;
|
|
||||||
if(select >= 0) {
|
if(select >= 0) {
|
||||||
|
bool added = false;
|
||||||
old_selected = select;
|
old_selected = select;
|
||||||
switch(select) {
|
switch(select) {
|
||||||
case 0:
|
case 0: // copy to favorites
|
||||||
hide();
|
hide();
|
||||||
bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName());
|
bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName());
|
||||||
if(bouquet_id < 0) {
|
if(bouquet_id < 0) {
|
||||||
@@ -269,7 +274,7 @@ int CBouquetList::doMenu()
|
|||||||
tmp = g_bouquetManager->Bouquets[bouquet_id];
|
tmp = g_bouquetManager->Bouquets[bouquet_id];
|
||||||
|
|
||||||
if(bouquet_id < 0)
|
if(bouquet_id < 0)
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
channels = &zapitBouquet->tvChannels;
|
channels = &zapitBouquet->tvChannels;
|
||||||
for(int li = 0; li < (int) channels->size(); li++) {
|
for(int li = 0; li < (int) channels->size(); li++) {
|
||||||
@@ -285,49 +290,56 @@ int CBouquetList::doMenu()
|
|||||||
tmp->addService((*channels)[li]);
|
tmp->addService((*channels)[li]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return added ? 1 : -1;
|
if (added) {
|
||||||
|
CNeutrinoApp::getInstance()->MarkFavoritesChanged();
|
||||||
|
CNeutrinoApp::getInstance()->MarkChannelsInit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
} else {
|
} else {
|
||||||
|
/* user or satellite bouquet */
|
||||||
menu->addItem(new CMenuForwarder(LOCALE_BOUQUETEDITOR_DELETE, true, NULL, selector, cnt, CRCInput::RC_red), old_selected == i ++);
|
menu->addItem(new CMenuForwarder(LOCALE_BOUQUETEDITOR_DELETE, true, NULL, selector, cnt, CRCInput::RC_red), old_selected == i ++);
|
||||||
int old_epg = zapitBouquet ? zapitBouquet->bScanEpg : 0;
|
|
||||||
if (zapitBouquet && (g_settings.epg_scan == CEpgScan::SCAN_SEL))
|
if (zapitBouquet && (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));
|
menu->addItem(new CMenuOptionChooser(LOCALE_MISCSETTINGS_EPG_SCAN, &zapitBouquet->bScanEpg, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true));
|
||||||
|
|
||||||
menu->exec(NULL, "");
|
menu->exec(NULL, "");
|
||||||
delete menu;
|
delete menu;
|
||||||
delete selector;
|
delete selector;
|
||||||
if (zapitBouquet && (old_epg != zapitBouquet->bScanEpg))
|
if (zapitBouquet && (old_epg != zapitBouquet->bScanEpg)) {
|
||||||
save_bouquets = true;
|
save_bouquets = true;
|
||||||
|
CNeutrinoApp::getInstance()->MarkFavoritesChanged();
|
||||||
|
}
|
||||||
|
|
||||||
printf("CBouquetList::doMenu: %d selected\n", select);
|
printf("CBouquetList::doMenu: %d selected\n", select);
|
||||||
if(select >= 0) {
|
if(select >= 0) {
|
||||||
old_selected = select;
|
old_selected = select;
|
||||||
hide();
|
|
||||||
|
|
||||||
int result = ShowMsg ( LOCALE_BOUQUETEDITOR_DELETE, Bouquets[selected]->channelList->getName(), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo );
|
int result = ShowMsg ( LOCALE_BOUQUETEDITOR_DELETE, Bouquets[selected]->channelList->getName(), CMessageBox::mbrNo, CMessageBox::mbYes | CMessageBox::mbNo );
|
||||||
if(result != CMessageBox::mbrYes)
|
if(result != CMessageBox::mbrYes)
|
||||||
return -1;
|
return 0;
|
||||||
|
|
||||||
if (zapitBouquet) {
|
if (zapitBouquet) {
|
||||||
bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName());
|
bouquet_id = g_bouquetManager->existsUBouquet(Bouquets[selected]->channelList->getName());
|
||||||
if(bouquet_id >= 0) {
|
if(bouquet_id >= 0) {
|
||||||
g_bouquetManager->deleteBouquet(bouquet_id);
|
g_bouquetManager->deleteBouquet(bouquet_id);
|
||||||
|
CNeutrinoApp::getInstance()->MarkFavoritesChanged();
|
||||||
|
CNeutrinoApp::getInstance()->MarkChannelsInit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CServiceManager::getInstance()->RemovePosition(Bouquets[selected]->satellitePosition);
|
CServiceManager::getInstance()->RemovePosition(Bouquets[selected]->satellitePosition);
|
||||||
g_bouquetManager->loadBouquets();
|
g_bouquetManager->loadBouquets();
|
||||||
g_bouquetManager->deletePosition(Bouquets[selected]->satellitePosition);
|
g_bouquetManager->deletePosition(Bouquets[selected]->satellitePosition);
|
||||||
CServiceManager::getInstance()->SetServicesChanged(true);
|
CNeutrinoApp::getInstance()->MarkChannelsChanged();
|
||||||
|
CNeutrinoApp::getInstance()->MarkBouquetsChanged();
|
||||||
|
CNeutrinoApp::getInstance()->MarkChannelsInit();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -362,7 +374,7 @@ int CBouquetList::show(bool bShowChannelList)
|
|||||||
{
|
{
|
||||||
neutrino_msg_t msg;
|
neutrino_msg_t msg;
|
||||||
neutrino_msg_data_t data;
|
neutrino_msg_data_t data;
|
||||||
int res = -1;
|
int res = CHANLIST_CANCEL;
|
||||||
int icol_w, icol_h;
|
int icol_w, icol_h;
|
||||||
int w_max_text = 0;
|
int w_max_text = 0;
|
||||||
int w_max_icon = 0;
|
int w_max_icon = 0;
|
||||||
@@ -438,33 +450,32 @@ int CBouquetList::show(bool bShowChannelList)
|
|||||||
if (!favonly && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_FAV) {
|
if (!favonly && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_FAV) {
|
||||||
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_FAV);
|
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_FAV);
|
||||||
hide();
|
hide();
|
||||||
return -3;
|
return CHANLIST_CHANGE_MODE;
|
||||||
}
|
}
|
||||||
} else if(msg == CRCInput::RC_green) {
|
} else if(msg == CRCInput::RC_green) {
|
||||||
if (!favonly && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_PROV) {
|
if (!favonly && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_PROV) {
|
||||||
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_PROV);
|
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_PROV);
|
||||||
hide();
|
hide();
|
||||||
return -3;
|
return CHANLIST_CHANGE_MODE;
|
||||||
}
|
}
|
||||||
} else if(msg == CRCInput::RC_yellow || msg == CRCInput::RC_sat) {
|
} else if(msg == CRCInput::RC_yellow || msg == CRCInput::RC_sat) {
|
||||||
if(!favonly && bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_SAT) {
|
if(!favonly && bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_SAT) {
|
||||||
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_SAT);
|
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_SAT);
|
||||||
hide();
|
hide();
|
||||||
return -3;
|
return CHANLIST_CHANGE_MODE;
|
||||||
}
|
}
|
||||||
} else if(msg == CRCInput::RC_blue) {
|
} else if(msg == CRCInput::RC_blue) {
|
||||||
if(!favonly && bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_ALL) {
|
if(!favonly && bShowChannelList && CNeutrinoApp::getInstance()->GetChannelMode() != LIST_MODE_ALL) {
|
||||||
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_ALL);
|
CNeutrinoApp::getInstance()->SetChannelMode(LIST_MODE_ALL);
|
||||||
hide();
|
hide();
|
||||||
return -3;
|
return CHANLIST_CHANGE_MODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( msg == CRCInput::RC_setup) {
|
else if ( msg == CRCInput::RC_setup) {
|
||||||
if (!favonly && !Bouquets.empty()) {
|
if (!favonly && !Bouquets.empty()) {
|
||||||
int ret = doMenu();
|
int ret = doMenu();
|
||||||
if(ret > 0) {
|
if(ret > 0) {
|
||||||
CNeutrinoApp::getInstance()->MarkChannelListChanged();
|
res = CHANLIST_NO_RESTORE;
|
||||||
res = -4;
|
|
||||||
loop = false;
|
loop = false;
|
||||||
} else if(ret < 0) {
|
} else if(ret < 0) {
|
||||||
paintHead();
|
paintHead();
|
||||||
@@ -520,11 +531,11 @@ int CBouquetList::show(bool bShowChannelList)
|
|||||||
mode = 0;
|
mode = 0;
|
||||||
CNeutrinoApp::getInstance()->SetChannelMode(mode);
|
CNeutrinoApp::getInstance()->SetChannelMode(mode);
|
||||||
hide();
|
hide();
|
||||||
return -3;
|
return CHANLIST_CHANGE_MODE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( msg == CRCInput::RC_ok ) {
|
else if ( msg == CRCInput::RC_ok ) {
|
||||||
if(!Bouquets.empty() && (!bShowChannelList || !Bouquets[selected]->channelList->isEmpty())) {
|
if(!Bouquets.empty() /* && (!bShowChannelList || !Bouquets[selected]->channelList->isEmpty())*/) {
|
||||||
zapOnExit = true;
|
zapOnExit = true;
|
||||||
loop=false;
|
loop=false;
|
||||||
}
|
}
|
||||||
@@ -552,12 +563,12 @@ int CBouquetList::show(bool bShowChannelList)
|
|||||||
int new_selected = (chn - 1) % Bouquets.size(); // is % necessary (i.e. can firstselected be > Bouquets.size()) ?
|
int new_selected = (chn - 1) % Bouquets.size(); // is % necessary (i.e. can firstselected be > Bouquets.size()) ?
|
||||||
updateSelection(new_selected);
|
updateSelection(new_selected);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (msg > CRCInput::RC_MaxRC) {
|
||||||
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
if ( CNeutrinoApp::getInstance()->handleMsg( msg, data ) & messages_return::cancel_all ) {
|
||||||
loop = false;
|
loop = false;
|
||||||
res = -2;
|
res = CHANLIST_CANCEL_ALL;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
hide();
|
hide();
|
||||||
|
|
||||||
@@ -566,19 +577,19 @@ int CBouquetList::show(bool bShowChannelList)
|
|||||||
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
CVFD::getInstance()->setMode(CVFD::MODE_TVRADIO);
|
||||||
if (save_bouquets) {
|
if (save_bouquets) {
|
||||||
save_bouquets = false;
|
save_bouquets = false;
|
||||||
|
#if 0
|
||||||
if (CNeutrinoApp::getInstance()->GetChannelMode() == LIST_MODE_FAV)
|
if (CNeutrinoApp::getInstance()->GetChannelMode() == LIST_MODE_FAV)
|
||||||
g_bouquetManager->saveUBouquets();
|
g_bouquetManager->saveUBouquets();
|
||||||
else
|
else
|
||||||
g_bouquetManager->saveBouquets();
|
g_bouquetManager->saveBouquets();
|
||||||
|
#endif
|
||||||
if (g_settings.epg_scan == CEpgScan::SCAN_SEL)
|
if (g_settings.epg_scan == CEpgScan::SCAN_SEL)
|
||||||
CEpgScan::getInstance()->Start();
|
CEpgScan::getInstance()->Start();
|
||||||
}
|
}
|
||||||
if(zapOnExit) {
|
if(zapOnExit)
|
||||||
return (selected);
|
return (selected);
|
||||||
} else {
|
|
||||||
return (res);
|
return (res);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CBouquetList::hide()
|
void CBouquetList::hide()
|
||||||
|
@@ -67,6 +67,7 @@ class CBouquet
|
|||||||
bLocked = locked;
|
bLocked = locked;
|
||||||
satellitePosition = INVALID_SAT_POSITION;
|
satellitePosition = INVALID_SAT_POSITION;
|
||||||
channelList = new CChannelList(Name, false, vlist);
|
channelList = new CChannelList(Name, false, vlist);
|
||||||
|
channelList->bouquet = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
~CBouquet()
|
~CBouquet()
|
||||||
|
Reference in New Issue
Block a user