diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 7c39654cc..55ee0af45 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -106,7 +106,7 @@ void CBEBouquetWidget::paintItem(int pos) frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_DUMMY_SMALL, x + OFFSET_INNER_MID, ypos, item_height); int text_offset = 2*OFFSET_INNER_MID + action_icon_width; - item_font->RenderString(x + text_offset, ypos + item_height, width - text_offset - SCROLLBAR_WIDTH - 5*OFFSET_INNER_MID - 4*status_icon_width, (*Bouquets)[current]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[current]->Name, color); + item_font->RenderString(x + text_offset, ypos + item_height, width - text_offset - SCROLLBAR_WIDTH - 5*OFFSET_INNER_MID - 4*status_icon_width, (*Bouquets)[current]->bName, color); if ((*Bouquets)[current]->bHidden) frameBuffer->paintIcon(NEUTRINO_ICON_MARKER_HIDDEN, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - status_icon_width, ypos, item_height); @@ -323,7 +323,7 @@ int CBEBouquetWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* { if (selected < Bouquets->size()) /* Bouquets->size() might be 0 */ { - std::string ChannelWidgetCaption=(*Bouquets)[selected]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[selected]->Name; + std::string ChannelWidgetCaption = (*Bouquets)[selected]->bName; #if 0 if (!(*Bouquets)[selected]->tvChannels.empty()) { @@ -389,7 +389,7 @@ void CBEBouquetWidget::deleteBouquet() if (selected >= Bouquets->size()) /* Bouquets->size() might be 0 */ return; - if (ShowMsg(LOCALE_FILEBROWSER_DELETE, (*Bouquets)[selected]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : (*Bouquets)[selected]->Name, CMsgBox::mbrNo, CMsgBox::mbYes|CMsgBox::mbNo)!=CMsgBox::mbrYes) + if (ShowMsg(LOCALE_FILEBROWSER_DELETE, (*Bouquets)[selected]->bName, CMsgBox::mbrNo, CMsgBox::mbYes|CMsgBox::mbNo)!=CMsgBox::mbrYes) return; g_bouquetManager->deleteBouquet(selected); @@ -465,6 +465,7 @@ void CBEBouquetWidget::renameBouquet() if (newName != (*Bouquets)[selected]->Name) { g_bouquetManager->Bouquets[selected]->Name = newName; + g_bouquetManager->Bouquets[selected]->bName = newName; g_bouquetManager->Bouquets[selected]->bUser = true; bouquetsChanged = true; } diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index c7147735c..ec23f3b87 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -370,7 +370,7 @@ int CBEChannelWidget::exec(CMenuTarget* parent, const std::string & /*actionKey* } Channels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels); - caption = g_bouquetManager->Bouquets[bouquet]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[bouquet]->Name; + caption = g_bouquetManager->Bouquets[bouquet]->bName; selected = 0; paintHead(); diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 4ffc6996f..d74ab7627 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -86,15 +86,7 @@ CBouquetList::~CBouquetList() CBouquet* CBouquetList::addBouquet(CZapitBouquet * zapitBouquet) { int BouquetKey= Bouquets.size();//FIXME not used ? - const char * bname; - if (zapitBouquet->bFav) - bname = g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME); - else if (zapitBouquet->bOther) - bname = g_Locale->getText(LOCALE_BOUQUETNAME_OTHER); - else - bname = zapitBouquet->Name.c_str(); - - CBouquet* tmp = new CBouquet(BouquetKey, bname, zapitBouquet->bLocked, !zapitBouquet->bUser); + CBouquet* tmp = new CBouquet(BouquetKey, zapitBouquet->bName.c_str(), zapitBouquet->bLocked, !zapitBouquet->bUser); tmp->zapitBouquet = zapitBouquet; Bouquets.push_back(tmp); return tmp; @@ -655,7 +647,7 @@ void CBouquetList::paintItem(int pos) frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); if (npos < (int) Bouquets.size()) - lname = (Bouquets[npos]->zapitBouquet && Bouquets[npos]->zapitBouquet->bFav) ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : Bouquets[npos]->channelList->getName(); + lname = Bouquets[npos]->channelList->getName(); if (i_selected) { diff --git a/src/gui/favorites.cpp b/src/gui/favorites.cpp index 6214ad0f7..9c0927953 100644 --- a/src/gui/favorites.cpp +++ b/src/gui/favorites.cpp @@ -79,10 +79,10 @@ int CFavorites::addChannelToFavorites(bool show_list) else { // -- check if Favorite Bouquet exists: if not, create it. - bouquet_id = g_bouquetManager->existsUBouquet(g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME), true); + bouquet_id = g_bouquetManager->existsUBouquet(DEFAULT_BQ_NAME_FAV, true); if (bouquet_id == -1) { - g_bouquetManager->addBouquet(g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME), true); - bouquet_id = g_bouquetManager->existsUBouquet(g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME), true); + g_bouquetManager->addBouquet(DEFAULT_BQ_NAME_FAV, true); + bouquet_id = g_bouquetManager->existsUBouquet(DEFAULT_BQ_NAME_FAV, true); // status |= 1; } } diff --git a/src/gui/osdlang_setup.cpp b/src/gui/osdlang_setup.cpp index ad96e009b..e91fcef95 100644 --- a/src/gui/osdlang_setup.cpp +++ b/src/gui/osdlang_setup.cpp @@ -264,6 +264,8 @@ bool COsdLangSetup::changeNotify(const neutrino_locale_t, void *) //apply osd language g_Locale->loadLocale(g_settings.language.c_str()); + // TODO: reload channellists to apply changes to localized bouquet names? + return true; } diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 4a2f0e497..f48947f98 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1772,7 +1772,7 @@ int CTimerList::newTimer() mwtv->addItem(new CMenuForwarder(channels[j]->getName(), true, NULL, this, (std::string(cChannelId) + channels[j]->getName()).c_str(), CRCInput::RC_nokey, NULL, channels[j]->scrambled ? NEUTRINO_ICON_MARKER_SCRAMBLED : (channels[j]->getUrl().empty() ? NULL : NEUTRINO_ICON_MARKER_STREAMING))); } if (!channels.empty()) - mctv.addItem(new CMenuForwarder(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str() /*g_bouquetManager->Bouquets[i]->Name.c_str()*/, true, NULL, mwtv)); + mctv.addItem(new CMenuForwarder(g_bouquetManager->Bouquets[i]->bName.c_str(), true, NULL, mwtv)); g_bouquetManager->Bouquets[i]->getRadioChannels(channels); diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 8aa749952..e26841ced 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -1824,9 +1824,8 @@ void CNeutrinoApp::channelsInit(bool bOnly) memset(tvsort, -1, sizeof(tvsort)); memset(radiosort, -1, sizeof(tvsort)); - const char * fav_bouquetname = g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME); - if(g_bouquetManager && g_bouquetManager->existsUBouquet(fav_bouquetname, true) == -1) - g_bouquetManager->addBouquet(fav_bouquetname, true, true); + if(g_bouquetManager && g_bouquetManager->existsUBouquet(DEFAULT_BQ_NAME_FAV, true) == -1) + g_bouquetManager->addBouquet(DEFAULT_BQ_NAME_FAV, true, true); if(TVbouquetList) delete TVbouquetList; if(RADIObouquetList) delete RADIObouquetList; diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index d67c6a605..1838cd14d 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -1629,7 +1629,7 @@ void CControlAPI::GetBouquetsCGI(CyhookHandler *hh) channel_count = g_bouquetManager->Bouquets[i]->radioChannels.size() + g_bouquetManager->Bouquets[i]->tvChannels.size(); } if (channel_count && (!g_bouquetManager->Bouquets[i]->bHidden || show_hidden) && (!fav || g_bouquetManager->Bouquets[i]->bUser)) { - bouquet = std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str()); + bouquet = std::string(g_bouquetManager->Bouquets[i]->bName.c_str()); if (encode) bouquet = encodeString(bouquet); // encode (URLencode) the bouquetname if (outType == plain) @@ -1784,7 +1784,7 @@ void CControlAPI::epgDetailList(CyhookHandler *hh) for (int i = start_bouquet; i < bouquet_size; i++) { channels = mode == CZapitClient::MODE_RADIO ? g_bouquetManager->Bouquets[i]->radioChannels : g_bouquetManager->Bouquets[i]->tvChannels; - std::string bouquet = std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str()); + std::string bouquet = std::string(g_bouquetManager->Bouquets[i]->bName.c_str()); bouquet = encodeString(bouquet); // encode (URLencode) the bouquetname std::string res_channels = ""; @@ -3336,7 +3336,7 @@ void CControlAPI::xmltvm3uCGI(CyhookHandler *hh) for(int j = 0; j < (int) chanlist.size(); j++) { CZapitChannel * channel = chanlist[j]; - std::string bouq_name = g_bouquetManager->Bouquets[i]->Name; + std::string bouq_name = g_bouquetManager->Bouquets[i]->bName; std::string chan_id_short = string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID() & 0xFFFFFFFFFFFFULL); result += "#EXTINF:-1 tvg-id=\""+chan_id_short+"\" tvg-logo=\""+NeutrinoAPI->getLogoFile(channel->getChannelID())+"\" group-title=\""+bouq_name+"\", "+channel->getName()+"\n"; result += url+string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, channel->getChannelID())+"\n"; diff --git a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp index 0f564b90b..5a6f6f7f1 100644 --- a/src/nhttpd/tuxboxapi/neutrinoyparser.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoyparser.cpp @@ -240,8 +240,8 @@ std::string CNeutrinoYParser::func_get_bouquets_as_dropdown(CyhookHandler *, st sel=(nr==(i+1)) ? "selected=\"selected\"" : ""; if(!channels.empty() && (!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true")) yresult += string_printf("\n", i + 1, sel.c_str(), - std::string(g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) :g_bouquetManager->Bouquets[i]->Name.c_str()).c_str()); - //yresult += string_printf("\n", i + 1, sel.c_str(), (encodeString(std::string(g_bouquetManager->Bouquets[i]->Name.c_str()))).c_str()); + std::string(g_bouquetManager->Bouquets[i]->bName.c_str()).c_str()); + //yresult += string_printf("\n", i + 1, sel.c_str(), (encodeString(std::string(g_bouquetManager->Bouquets[i]->bName.c_str()))).c_str()); } return yresult; } @@ -265,7 +265,7 @@ std::string CNeutrinoYParser::func_get_bouquets_as_templatelist(CyhookHandler * else g_bouquetManager->Bouquets[i]->getTvChannels(channels); if(!channels.empty() && (!g_bouquetManager->Bouquets[i]->bHidden || do_show_hidden == "true")) { - yresult += string_printf(ytemplate.c_str(), i + 1, g_bouquetManager->Bouquets[i]->bFav ? g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME) : g_bouquetManager->Bouquets[i]->Name.c_str()); + yresult += string_printf(ytemplate.c_str(), i + 1, g_bouquetManager->Bouquets[i]->bName.c_str()); yresult += "\r\n"; } } @@ -1216,9 +1216,9 @@ std::string CNeutrinoYParser::func_bouquet_editor_main(CyhookHandler *hh, std:: yresult += string_printf(para.c_str(), classname, akt.c_str(), i + 1, lock_action.c_str(), lock_img.c_str(), lock_alt.c_str(), //lock i + 1, hidden_action.c_str(), hidden_img.c_str(), hidden_alt.c_str(), //hhidden - i + 1, bouquet->Name.c_str(), bouquet->Name.c_str(), //link - i + 1, bouquet->Name.c_str(), //rename - i + 1, bouquet->Name.c_str(), //delete + i + 1, bouquet->bName.c_str(), bouquet->bName.c_str(), //link + i + 1, bouquet->bName.c_str(), //rename + i + 1, bouquet->bName.c_str(), //delete down_show.c_str(), i + 1, //down arrow up_show.c_str(), i + 1); //up arrow } diff --git a/src/zapit/include/zapit/bouquets.h b/src/zapit/include/zapit/bouquets.h index 4d794e080..898e7542b 100644 --- a/src/zapit/include/zapit/bouquets.h +++ b/src/zapit/include/zapit/bouquets.h @@ -30,11 +30,16 @@ typedef ZapitChannelList::iterator zapit_list_it_t; #define DEFAULT_BQ_OTHER false #define DEFAULT_BQ_SCANEPG false +#define DEFAULT_BQ_NAME_FAV "Favorites" +#define DEFAULT_BQ_NAME_ALL "All Channels" +#define DEFAULT_BQ_NAME_OTHER "Other" + class CZapitBouquet { public: std::string Name; + std::string bName; // localized bouquet name, defaults to Name bq_id_t BqID; bool bHidden; bool bLocked; @@ -53,6 +58,7 @@ class CZapitBouquet inline CZapitBouquet(const std::string name) { Name = name; + bName = name; BqID=DEFAULT_BQ_ID; bHidden = DEFAULT_BQ_HIDDEN; bLocked = DEFAULT_BQ_LOCKED; diff --git a/src/zapit/src/bouquets.cpp b/src/zapit/src/bouquets.cpp index 4f6efa93a..fc060cbab 100644 --- a/src/zapit/src/bouquets.cpp +++ b/src/zapit/src/bouquets.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #include @@ -426,7 +427,11 @@ void CBouquetManager::parseBouquetsXml(const char *fname, bool bUser) const char* useci = xmlGetAttribute(search, "ci"); newBouquet->bHidden = hidden ? (strcmp(hidden, "1") == 0) : false; newBouquet->bLocked = locked ? (strcmp(locked, "1") == 0) : false; - newBouquet->bFav = (strcmp(name, "favorites") == 0); + newBouquet->bFav = (strcmp(name, DEFAULT_BQ_NAME_FAV) == 0); + if (newBouquet->bFav) + newBouquet->bName = g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME); + else + newBouquet->bName = name; newBouquet->bScanEpg = scanepg ? (strcmp(scanepg, "1") == 0) : false; newBouquet->bUseCI = useci ? (strcmp(useci, "1") == 0) : false; channel_node = xmlChildrenNode(search); @@ -568,8 +573,9 @@ void CBouquetManager::makeRemainingChannelsBouquet(void) // TODO: use locales if (remainChannels == NULL) - remainChannels = addBouquet( Bouquets.empty() ? "All Channels" : "Other", false); // UTF-8 encoded + remainChannels = addBouquet(Bouquets.empty() ? DEFAULT_BQ_NAME_ALL : DEFAULT_BQ_NAME_OTHER, false); // UTF-8 encoded remainChannels->bOther = true; + remainChannels->bName = g_Locale->getText(LOCALE_BOUQUETNAME_OTHER); for (ZapitChannelList::const_iterator it = unusedChannels.begin(); it != unusedChannels.end(); ++it) { remainChannels->addService(*it); @@ -597,9 +603,13 @@ void CBouquetManager::renumServices() CZapitBouquet* CBouquetManager::addBouquet(const std::string & name, bool ub, bool myfav, bool to_begin) { - CZapitBouquet* newBouquet = new CZapitBouquet(myfav ? "favorites" : name); + CZapitBouquet* newBouquet = new CZapitBouquet(myfav ? DEFAULT_BQ_NAME_FAV : name); newBouquet->bUser = ub; newBouquet->bFav = myfav; + if (newBouquet->bFav) + newBouquet->bName = g_Locale->getText(LOCALE_FAVORITES_BOUQUETNAME); + else + newBouquet->bName = name; newBouquet->satellitePosition = INVALID_SAT_POSITION; //printf("CBouquetManager::addBouquet: %s, user %s\n", name.c_str(), ub ? "YES" : "NO"); @@ -744,9 +754,10 @@ int CBouquetManager::existsUBouquet(char const * const name, bool myfav) if (Bouquets[i]->bFav) return (int)i; } - //else if (Bouquets[i]->bUser && strncasecmp(Bouquets[i]->Name.c_str(), name,Bouquets[i]->Name.length())==0) else if (Bouquets[i]->bUser && (Bouquets[i]->Name == name)) return (int)i; + else if (Bouquets[i]->bUser && (Bouquets[i]->bName == name)) + return (int)i; } return -1; } @@ -906,7 +917,7 @@ void CBouquetManager::loadWebchannels(int mode) if (channel && !IS_WEBCHAN(channel->getChannelID())) { epg_id = channel->getChannelID(); - INFO("* auto epg_id found for %s: " PRINTF_CHANNEL_ID_TYPE "\n", title, epg_id); + INFO("* auto epg_id found for %s: " PRINTF_CHANNEL_ID_TYPE, title, epg_id); } } else