From fecc5baa55f3e96b5ebce71a66e7fbed315c054c Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Sat, 11 Oct 2014 13:22:23 +0400 Subject: [PATCH] gui/channellist.cpp: add channels reinit, if target bouquet was empty (hidden), or empty after edit (to hide) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2878b3414133c6d986d1dafbc2648c314864c081 Author: [CST] Focus Date: 2014-10-11 (Sat, 11 Oct 2014) ------------------ This commit was generated by Migit --- src/gui/channellist.cpp | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index dd91eb64e..abce11eee 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -342,6 +342,7 @@ int CChannelList::doChannelMenu(void) t_channel_id channel_id = empty ? 0 : (*chanlist)[selected]->channel_id; bool tvmode = CZapit::getInstance()->getMode() & CZapitClient::MODE_TV; CBouquetList *blist = tvmode ? TVfavList : RADIOfavList; + bool fav_found = true; switch(select) { case 0: // edit mode editMode(true); @@ -351,36 +352,53 @@ int CChannelList::doChannelMenu(void) bouquet_id = AllFavBouquetList->exec(false); hide(); if(bouquet_id < 0) - return 0; + return -1; if (AllFavBouquetList->Bouquets[bouquet_id]->zapitBouquet) { CZapitBouquet *zapitBouquet = AllFavBouquetList->Bouquets[bouquet_id]->zapitBouquet; CZapitChannel *ch = zapitBouquet->getChannelByChannelID(channel_id); if (ch == NULL) { + fav_found = false; zapitBouquet->addService((*chanlist)[selected]); for (unsigned n = 0; n < blist->Bouquets.size(); n++) { if (blist->Bouquets[n]->zapitBouquet == zapitBouquet) { zapitBouquet->getChannels(blist->Bouquets[n]->channelList->channels, tvmode); saveChanges(); + fav_found = true; break; } } } } + if (!fav_found) { + CNeutrinoApp::getInstance()->MarkFavoritesChanged(); + CNeutrinoApp::getInstance()->MarkChannelsInit(); + } ret = 1; break; case 2: // add to my favorites - for (unsigned n = 0; n < blist->Bouquets.size(); n++) { - if (blist->Bouquets[n]->zapitBouquet && blist->Bouquets[n]->zapitBouquet->bFav) { - CZapitChannel *ch = blist->Bouquets[n]->zapitBouquet->getChannelByChannelID(channel_id); + for (unsigned n = 0; n < AllFavBouquetList->Bouquets.size(); n++) { + if (AllFavBouquetList->Bouquets[n]->zapitBouquet && AllFavBouquetList->Bouquets[n]->zapitBouquet->bFav) { + CZapitChannel *ch = AllFavBouquetList->Bouquets[n]->zapitBouquet->getChannelByChannelID(channel_id); if (ch == NULL) { - blist->Bouquets[n]->zapitBouquet->addService((*chanlist)[selected]); - blist->Bouquets[n]->zapitBouquet->getChannels(blist->Bouquets[n]->channelList->channels, tvmode); - saveChanges(); + AllFavBouquetList->Bouquets[n]->zapitBouquet->addService((*chanlist)[selected]); + fav_found = false; } break; } } + for (unsigned n = 0; n < blist->Bouquets.size() && !fav_found; n++) { + if (blist->Bouquets[n]->zapitBouquet && blist->Bouquets[n]->zapitBouquet->bFav) { + blist->Bouquets[n]->zapitBouquet->getChannels(blist->Bouquets[n]->channelList->channels, tvmode); + saveChanges(); + fav_found = true; + break; + } + } + if (!fav_found) { + CNeutrinoApp::getInstance()->MarkFavoritesChanged(); + CNeutrinoApp::getInstance()->MarkChannelsInit(); + } ret = 1; break; case 3: // reset new @@ -2317,6 +2335,8 @@ void CChannelList::editMode(bool enable) channelsChanged = false; bouquet->zapitBouquet->getChannels(channels, tvmode); saveChanges(); + if ((*chanlist).empty()) + CNeutrinoApp::getInstance()->MarkChannelsInit(); } if (selected >= chanlist->size()) selected = chanlist->empty() ? 0 : (chanlist->size() - 1);