diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index 46522065c..93cfa6120 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -44,12 +44,10 @@ #include #include -#include -#include +#include +#include -extern tallchans allchans; extern CBouquetManager *g_bouquetManager; -void addChannelToBouquet(const unsigned int bouquet, const t_channel_id channel_id); CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsigned int Bouquet, CZapitClient::channelsMode Mode) :CListBox(Caption.c_str()) @@ -141,7 +139,7 @@ void CBEChannelSelectWidget::onOkKeyPressed() if (isChannelInBouquet(selected)) g_bouquetManager->Bouquets[bouquet]->removeService(Channels[selected]->channel_id); else - addChannelToBouquet( bouquet, Channels[selected]->channel_id); + CZapit::getInstance()->addChannelToBouquet( bouquet, Channels[selected]->channel_id); bouquetChannels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); @@ -165,13 +163,9 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & action Channels.clear(); if (mode == CZapitClient::MODE_RADIO) { - for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++) - if (it->second.getServiceType() == ST_DIGITAL_RADIO_SOUND_SERVICE) - Channels.push_back(&(it->second)); + CServiceManager::getInstance()->GetAllRadioChannels(Channels); } else { - for (tallchans_iterator it = allchans.begin(); it != allchans.end(); it++) - if (it->second.getServiceType() == ST_DIGITAL_TELEVISION_SERVICE) - Channels.push_back(&(it->second)); + CServiceManager::getInstance()->GetAllTvChannels(Channels); } sort(Channels.begin(), Channels.end(), CmpChannelByChName()); diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index efc29c085..147d1ea1e 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -61,7 +61,8 @@ #include #include #include -#include + +#include #include #include #include @@ -78,7 +79,6 @@ extern CBouquetList * RADIObouquetList; extern CBouquetList * RADIOsatList; extern CBouquetList * RADIOfavList; extern CBouquetList * RADIOallList; -extern tallchans allchans; //extern t_channel_id rec_channel_id; @@ -88,7 +88,6 @@ extern int g_channel_list_changed; extern CBouquetManager *g_bouquetManager; void sectionsd_getChannelEvents(CChannelEventList &eList, const bool tv_mode, t_channel_id *chidlist, int clen); void sectionsd_getEventsServiceKey(t_channel_id serviceUniqueKey, CChannelEventList &eList, char search = 0, std::string search_text = ""); -void addChannelToBouquet(const unsigned int bouquet, const t_channel_id channel_id); void sectionsd_getCurrentNextServiceKey(t_channel_id uniqueServiceKey, CSectionsdClient::responseGetCurrentNextInfoChannelID& current_next ); extern int old_b_id; @@ -125,8 +124,8 @@ void CChannelList::ClearList(void) void CChannelList::setSize(int newsize) { - chanlist.reserve(newsize); - //chanlist.resize(newsize); + //chanlist.reserve(newsize); + chanlist.resize(newsize); } void CChannelList::SetChannelList(ZapitChannelList* channels) @@ -391,7 +390,7 @@ int CChannelList::doChannelMenu(void) return 0; if(!g_bouquetManager->existsChannelInBouquet(new_bouquet_id, channel_id)) { - addChannelToBouquet(new_bouquet_id, channel_id); + CZapit::getInstance()->addChannelToBouquet(new_bouquet_id, channel_id); } if(g_bouquetManager->existsChannelInBouquet(old_bouquet_id, channel_id)) { g_bouquetManager->Bouquets[old_bouquet_id]->removeService(channel_id); @@ -415,7 +414,7 @@ int CChannelList::doChannelMenu(void) if (bouquet_id == -1) return 0; if(!g_bouquetManager->existsChannelInBouquet(bouquet_id, channel_id)) { - addChannelToBouquet(bouquet_id, channel_id); + CZapit::getInstance()->addChannelToBouquet(bouquet_id, channel_id); return 1; } break; @@ -426,7 +425,7 @@ int CChannelList::doChannelMenu(void) bouquet_id = g_bouquetManager->existsUBouquet(g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME), true); } if(!g_bouquetManager->existsChannelInBouquet(bouquet_id, channel_id)) { - addChannelToBouquet(bouquet_id, channel_id); + CZapit::getInstance()->addChannelToBouquet(bouquet_id, channel_id); return 1; } @@ -1157,22 +1156,21 @@ void CChannelList::zapTo(int pos, bool /* forceStoreToLastChannels */) /* to replace zapTo_ChannelID and zapTo from "whole" list ? */ void CChannelList::NewZap(t_channel_id channel_id) { - tallchans_iterator it = allchans.find(channel_id); + CZapitChannel * chan = CServiceManager::getInstance()->FindChannel(channel_id); - if(it == allchans.end()) + if(chan == NULL) return; - CZapitChannel* chan = &it->second; printf("**************************** CChannelList::NewZap me %p %s tuned %d new %s -> %llx\n", this, name.c_str(), tuned, chan->name.c_str(), chan->channel_id); - if(selected_chid != chan->channel_id) { - selected_chid = chan->channel_id; - g_RemoteControl->zapTo_ChannelID(chan->channel_id, chan->name, !chan->bAlwaysLocked); + if(selected_chid != chan->getChannelID()) { + selected_chid = chan->getChannelID(); + g_RemoteControl->zapTo_ChannelID(chan->getChannelID(), chan->name, !chan->bAlwaysLocked); /* remove recordModeActive from infobar */ if(g_settings.auto_timeshift && !CNeutrinoApp::getInstance()->recordingstatus) { g_InfoViewer->handleMsg(NeutrinoMessages::EVT_RECORDMODE, 0); } - CNeutrinoApp::getInstance()->channelList->adjustToChannelID(chan->channel_id); + CNeutrinoApp::getInstance()->channelList->adjustToChannelID(chan->getChannelID()); g_RCInput->postMsg( NeutrinoMessages::SHOW_INFOBAR, 0 ); } } diff --git a/src/gui/favorites.cpp b/src/gui/favorites.cpp index 00b702940..ba64fd7eb 100644 --- a/src/gui/favorites.cpp +++ b/src/gui/favorites.cpp @@ -40,13 +40,13 @@ #include #include +#include #include extern CBouquetList * bouquetList; /* neutrino.cpp */ extern t_channel_id live_channel_id; -void addChannelToBouquet(const unsigned int bouquet, const t_channel_id channel_id); extern CBouquetManager *g_bouquetManager; // // -- Add current channel to Favorites-Bouquet @@ -92,7 +92,7 @@ int CFavorites::addChannelToFavorites(bool show_list) channel_id = live_channel_id; if(!g_bouquetManager->existsChannelInBouquet(bouquet_id, channel_id)) { - addChannelToBouquet(bouquet_id, channel_id); + CZapit::getInstance()->addChannelToBouquet(bouquet_id, channel_id); status |= 2; }