From fe1f568654095b5837d678418d85a46511d7313f Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 14 Oct 2014 16:25:11 +0400 Subject: [PATCH] zapit/src/bouquets.cpp: allow to change GUI channel name in ubouquets.xml; avoid delete remainChannels bouquet Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/70fa01b3187d5abbfff36af6f22434f948e70886 Author: [CST] Focus Date: 2014-10-14 (Tue, 14 Oct 2014) ------------------ This commit was generated by Migit --- src/zapit/include/zapit/channel.h | 6 ++++-- src/zapit/src/bouquets.cpp | 13 +++++++++---- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/zapit/include/zapit/channel.h b/src/zapit/include/zapit/channel.h index f60a57098..3b15718de 100644 --- a/src/zapit/include/zapit/channel.h +++ b/src/zapit/include/zapit/channel.h @@ -117,6 +117,7 @@ class CZapitChannel private: /* channel name */ std::string name; + std::string uname; /* WebTV */ std::string url; @@ -215,7 +216,7 @@ class CZapitChannel /* get methods - read and write variables */ - const std::string& getName(void) const { return name; } + const std::string& getName(void) const { return (!uname.empty() ? uname : name); } const std::string& getUrl(void) const { return url; } const std::string& getDesc(void) const { return desc; } t_satellite_position getSatellitePosition(void) const { return satellitePosition; } @@ -240,7 +241,8 @@ class CZapitChannel /* set methods */ void setServiceType(const unsigned char pserviceType) { serviceType = pserviceType; } - inline void setName(const std::string pName) { name = pName; } + inline void setName(const std::string &pName) { name = pName; } + inline void setUserName(const std::string &pName) { uname = pName; } void setAudioChannel(unsigned char pAudioChannel) { if (pAudioChannel < audioChannels.size()) currentAudioChannel = pAudioChannel; } void setPcrPid(unsigned short pPcrPid) { pcrPid = pPcrPid; } void setPmtPid(unsigned short pPmtPid) { pmtPid = pPmtPid; } diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 3d719d47d..0b7ceeb1b 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -426,10 +426,8 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser) chan = CServiceManager::getInstance()->FindChannel(chid); if (chan != NULL) { DBG("%04x %04x %04x %s\n", transport_stream_id, original_network_id, service_id, xmlGetAttribute(channel_node, "n")); -#if 0 if(bUser && (name2.length() > 1)) - chan->setName(name2); -#endif + chan->setUserName(name2); if(!bUser) chan->pname = (char *) newBouquet->Name.c_str(); chan->bLocked = clock; @@ -517,7 +515,8 @@ void CBouquetManager::makeRemainingChannelsBouquet(void) sort(unusedChannels.begin(), unusedChannels.end(), CmpChannelByChName()); // TODO: use locales - remainChannels = addBouquet( Bouquets.empty() ? "All Channels" : "Other", false); // UTF-8 encoded + if (remainChannels == NULL) + remainChannels = addBouquet( Bouquets.empty() ? "All Channels" : "Other", false); // UTF-8 encoded remainChannels->bOther = true; for (ZapitChannelList::const_iterator it = unusedChannels.begin(); it != unusedChannels.end(); ++it) { @@ -531,10 +530,16 @@ void CBouquetManager::makeRemainingChannelsBouquet(void) void CBouquetManager::renumServices() { +#if 0 if(remainChannels) deleteBouquet(remainChannels); remainChannels = NULL; +#endif + if(remainChannels) { + remainChannels->tvChannels.clear(); + remainChannels->radioChannels.clear(); + } makeRemainingChannelsBouquet(); }