Remove global allchans, use CServiceManager and CZapit.

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@1650 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: 0087dbc950
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2011-09-01 (Thu, 01 Sep 2011)



------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2011-09-01 12:28:04 +00:00
parent 1e0b87cbe3
commit 3982f34dff
3 changed files with 20 additions and 28 deletions

View File

@@ -44,12 +44,10 @@
#include <gui/widget/buttons.h>
#include <zapit/client/zapitclient.h>
#include <zapit/channel.h>
#include <zapit/bouquets.h>
#include <zapit/zapit.h>
#include <zapit/getservices.h>
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());

View File

@@ -61,7 +61,8 @@
#include <daemonc/remotecontrol.h>
#include <zapit/client/zapittools.h>
#include <gui/pictureviewer.h>
#include <zapit/bouquets.h>
#include <zapit/zapit.h>
#include <zapit/satconfig.h>
#include <zapit/getservices.h>
#include <zapit/frontend_c.h>
@@ -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 );
}
}

View File

@@ -40,13 +40,13 @@
#include <gui/widget/stringinput.h>
#include <zapit/client/zapitclient.h>
#include <zapit/zapit.h>
#include <gui/bouquetlist.h>
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;
}