From 233b39dde0e853a8d3034c52baf7d45ac1e746cc Mon Sep 17 00:00:00 2001 From: "[CST] Focus" Date: Tue, 17 Apr 2012 18:42:52 +0400 Subject: [PATCH] gui/scan_setup.cpp, gui/channellist.cpp, gui/bedit/bouqueteditor_channels.cpp, gui/bedit/bouqueteditor_chanselect.cpp: use transponder::description to show channel details Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/1c2363cfb4b96583c1ea24432b234470f96faa51 Author: [CST] Focus Date: 2012-04-17 (Tue, 17 Apr 2012) --- src/gui/bedit/bouqueteditor_channels.cpp | 56 ++++------------------ src/gui/bedit/bouqueteditor_chanselect.cpp | 53 ++++---------------- src/gui/channellist.cpp | 46 ++++-------------- src/gui/scan_setup.cpp | 19 +------- 4 files changed, 31 insertions(+), 143 deletions(-) diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 40fcadd8b..2a3d44938 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -172,53 +172,17 @@ void CBEChannelWidget::paintFoot() void CBEChannelWidget::paintDetails(int index) { - char buf[128] = {0}; - int len = 0; + std::string satname = CServiceManager::getInstance()->GetSatelliteName((*Channels)[index]->getSatellitePosition()); + transponder t; + CServiceManager::getInstance()->GetTransponder((*Channels)[index]->getTransponderId(), t); + std::string desc = t.description(); + if((*Channels)[index]->pname) + desc = desc + " (" + std::string((*Channels)[index]->pname) + ")"; + else + desc = desc + " (" + satname + ")"; - transponder_id_t ct = (*Channels)[index]->getTransponderId(); - transponder_list_t::iterator tpI = transponders.find(ct); - //sat_iterator_t sit = satellitePositions.find((*Channels)[index]->getSatellitePosition()); - std::string satname = CServiceManager::getInstance()->GetSatelliteName((*Channels)[index]->getSatellitePosition()).c_str(); - - len = snprintf(buf, sizeof(buf), "%d ", (*Channels)[index]->getFreqId()); - - if(tpI != transponders.end()) { - char * f, *s, *m; - CFrontend * frontend = CFEManager::getInstance()->getLiveFE(); - transponder & t = tpI->second; - switch(frontend->getInfo()->type) - { - case FE_QPSK: - frontend->getDelSys(t.feparams.u.qpsk.fec_inner, dvbs_get_modulation(t.feparams.u.qpsk.fec_inner), f, s, m); - len += snprintf(&buf[len], sizeof(buf) - len, "%c %d %s %s %s ", transponder::pol(t.polarization), t.feparams.u.qpsk.symbol_rate/1000, f, s, m); - break; - case FE_QAM: - frontend->getDelSys(t.feparams.u.qam.fec_inner, t.feparams.u.qam.modulation, f, s, m); - len += snprintf(&buf[len], sizeof(buf) - len, "%d %s %s %s ", t.feparams.u.qam.symbol_rate/1000, f, s, m); - break; - case FE_OFDM: - case FE_ATSC: - break; - } - } - - if((*Channels)[index]->pname) { - snprintf(&buf[len], sizeof(buf) - len, "(%s)", (*Channels)[index]->pname); - } - else { - snprintf(&buf[len], sizeof(buf) - len, "(%s)", satname.c_str()); -#if 0 - if(sit != satellitePositions.end()) { - snprintf(&buf[len], sizeof(buf) - len, "(%s)", sit->second.name.c_str()); - } -#endif - } - - //if(sit != satellitePositions.end()) - { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true); - } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight, width - 30, buf, COL_MENUCONTENTDARK, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight, width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); } void CBEChannelWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index cbe101504..5b17ef189 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -199,52 +199,17 @@ void CBEChannelSelectWidget::paintFoot() void CBEChannelSelectWidget::paintDetails(int index) { - char buf[128] = {0}; - int len = 0; - transponder_id_t ct = Channels[index]->getTransponderId(); - transponder_list_t::iterator tpI = transponders.find(ct); - //sat_iterator_t sit = satellitePositions.find(Channels[index]->getSatellitePosition()); std::string satname = CServiceManager::getInstance()->GetSatelliteName(Channels[index]->getSatellitePosition()); + transponder t; + CServiceManager::getInstance()->GetTransponder(Channels[index]->getTransponderId(), t); + std::string desc = t.description(); + if(Channels[index]->pname) + desc = desc + " (" + std::string(Channels[index]->pname) + ")"; + else + desc = desc + " (" + satname + ")"; - len = snprintf(buf, sizeof(buf), "%d ", Channels[index]->getFreqId()); - - if(tpI != transponders.end()) { - char * f, *s, *m; - transponder & t = tpI->second; - CFrontend * frontend = CFEManager::getInstance()->getLiveFE(); - switch(frontend->getInfo()->type) - { - case FE_QPSK: - frontend->getDelSys(t.feparams.u.qpsk.fec_inner, dvbs_get_modulation(t.feparams.u.qpsk.fec_inner), f, s, m); - len += snprintf(&buf[len], sizeof(buf) - len, "%c %d %s %s %s ", transponder::pol(t.polarization), t.feparams.u.qpsk.symbol_rate/1000, f, s, m); - break; - case FE_QAM: - frontend->getDelSys(t.feparams.u.qam.fec_inner, t.feparams.u.qam.modulation, f, s, m); - len += snprintf(&buf[len], sizeof(buf) - len, "%d %s %s %s ", t.feparams.u.qam.symbol_rate/1000, f, s, m); - break; - case FE_OFDM: - case FE_ATSC: - break; - } - } - - if(Channels[index]->pname) { - snprintf(&buf[len], sizeof(buf) - len, "(%s)", Channels[index]->pname); - } - else { - snprintf(&buf[len], sizeof(buf) - len, "(%s)", satname.c_str()); -#if 0 - if(sit != satellitePositions.end()) { - snprintf(&buf[len], sizeof(buf) - len, "(%s)", sit->second.name.c_str()); - } -#endif - } - - //if(sit != satellitePositions.end()) - { - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true); - } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight, width - 30, buf, COL_MENUCONTENTDARK, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, width - 30, satname.c_str(), COL_MENUCONTENTDARK, 0, true); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight, width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); } void CBEChannelSelectWidget::paintItem2DetailsLine (int pos, int /*ch_index*/) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index c42602a32..6b2c045ce 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1492,47 +1492,21 @@ void CChannelList::paintDetails(int index) g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ width- 10- seit_len, y+ height+ 5+ fheight, seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_CHANNELLIST : COL_MENUCONTENTDARK, 0, true); // UTF-8 g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ width- 10- noch_len, y+ height+ 5+ 2* fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_CHANNELLIST : COL_MENUCONTENTDARK, 0, true); // UTF-8 } - char buf[128] = {0}; - char cFrom[50] = {0}; // UTF-8 - int len = 0; if(g_settings.channellist_foot == 0) { - transponder_id_t ct = chanlist[index]->getTransponderId(); - transponder_list_t::iterator tpI = transponders.find(ct); - len = snprintf(buf, sizeof(buf), "%d ", chanlist[index]->getFreqId()); - - if(tpI != transponders.end()) { - char * f, *s, *m; - transponder & t = tpI->second; - CFrontend * frontend = CFEManager::getInstance()->getLiveFE(); - switch(frontend->getInfo()->type) { - case FE_QPSK: - frontend->getDelSys(t.feparams.u.qpsk.fec_inner, dvbs_get_modulation(t.feparams.u.qpsk.fec_inner), f, s, m); - len += snprintf(&buf[len], sizeof(buf) - len, "%c %d %s %s %s ", transponder::pol(t.polarization), t.feparams.u.qpsk.symbol_rate/1000, f, s, m); - break; - case FE_QAM: - frontend->getDelSys(t.feparams.u.qam.fec_inner, t.feparams.u.qam.modulation, f, s, m); - len += snprintf(&buf[len], sizeof(buf) - len, "%d %s %s %s ", t.feparams.u.qam.symbol_rate/1000, f, s, m); - break; - case FE_OFDM: - case FE_ATSC: - break; - } - } + transponder t; + CServiceManager::getInstance()->GetTransponder(chanlist[index]->getTransponderId(), t); + std::string desc = t.description(); if(chanlist[index]->pname) - snprintf(&buf[len], sizeof(buf) - len, "(%s)", chanlist[index]->pname); - else { -#if 0 - const char * satname = CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()); - if(satname) - snprintf(&buf[len], sizeof(buf) - len, "(%s)", satname); -#endif - snprintf(&buf[len], sizeof(buf) - len, "(%s)", - CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()).c_str()); - } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, width - 30, buf, COL_MENUCONTENTDARK, 0, true); + desc = desc + " (" + std::string(chanlist[index]->pname) + ")"; + else + desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName(chanlist[index]->getSatellitePosition()) + ")"; + + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 3*fheight, width - 30, desc.c_str(), COL_MENUCONTENTDARK, 0, true); } else if( !displayNext && g_settings.channellist_foot == 1) { // next Event + char buf[128] = {0}; + char cFrom[50] = {0}; // UTF-8 CSectionsdClient::CurrentNextInfo CurrentNext; sectionsd_getCurrentNextServiceKey(chanlist[index]->channel_id & 0xFFFFFFFFFFFFULL, CurrentNext); if (!CurrentNext.next_name.empty()) { diff --git a/src/gui/scan_setup.cpp b/src/gui/scan_setup.cpp index 33971b1ad..01cb55cf6 100644 --- a/src/gui/scan_setup.cpp +++ b/src/gui/scan_setup.cpp @@ -1010,30 +1010,15 @@ int CTPSelectHandler::exec(CMenuTarget* parent, const std::string &/*actionkey*/ int i = 0; transponder_list_t &select_transponders = CServiceManager::getInstance()->GetSatelliteTransponders(position); for (transponder_list_t::iterator tI = select_transponders.begin(); tI != select_transponders.end(); ++tI) { - char buf[128]; sprintf(cnt, "%d", i); - char * f, *s, *m; transponder & t = tI->second; - switch (frontend->getInfo()->type) { - case FE_QPSK: - frontend->getDelSys(t.feparams.u.qpsk.fec_inner, dvbs_get_modulation(t.feparams.u.qpsk.fec_inner), f, s, m); - snprintf(buf, sizeof(buf), "%d %c %d %s %s %s ", t.feparams.frequency/1000, transponder::pol(t.polarization), t.feparams.u.qpsk.symbol_rate/1000, f, s, m); - break; - case FE_QAM: - frontend->getDelSys(t.feparams.u.qam.fec_inner, t.feparams.u.qam.modulation, f, s, m); - snprintf(buf, sizeof(buf), "%d %d %s %s %s ", t.feparams.frequency/1000, t.feparams.u.qam.symbol_rate/1000, f, s, m); - break; - case FE_OFDM: - case FE_ATSC: - break; - } if(!old_selected && channel && channel->getSatellitePosition() == position) { if(channel->getFreqId() == GET_FREQ_FROM_TPID(tI->first)) old_selected = i; } - - CMenuForwarderNonLocalized * ts_item = new CMenuForwarderNonLocalized(buf, true, NULL, selector, cnt, CRCInput::RC_nokey, NULL)/*, false*/; + std::string tname = t.description(); + CMenuForwarderNonLocalized * ts_item = new CMenuForwarderNonLocalized(tname.c_str(), true, NULL, selector, cnt, CRCInput::RC_nokey, NULL)/*, false*/; ts_item->setItemButton(NEUTRINO_ICON_BUTTON_OKAY, true); menu.addItem(ts_item, old_selected == i);