diff --git a/data/cables.xml b/data/cables.xml index f56dd0ef2..96242eca9 100644 --- a/data/cables.xml +++ b/data/cables.xml @@ -253,6 +253,12 @@ + + + + + + diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index e4a94df7d..eec36ad5f 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -209,13 +209,19 @@ channellist.foot Kanalinformationen channellist.foot_freq Tuning-Parameter channellist.foot_next Nachfolgesendung channellist.foot_off aus +channellist.foot_sort_alpha Sortiert[alpha] +channellist.foot_sort_freq Sortiert[freq] +channellist.foot_sort_sat Sortiert[sat] channellist.head Alle Kanäle channellist.history Verlauf -channellist.make_hdlist Erzeuge "HD"- Bouquet +channellist.make_hdlist Erzeuge Bouquet mit HD-Kanälen +channellist.make_newlist Erzeuge Bouquet mit neuen Kanälen +channellist.make_removedlist Erzeuge Bouquet mit gelöschten Kanälen channellist.new_zap_mode Quickzap in Liste channellist.nonefound Es wurden keine Kanäle gefunden!\nFühren Sie bitte eine Kanalsuche durch\n(MENU-Taste -> Service) channellist.provs Anbieter channellist.recording_not_possible Aufnahme nicht möglich! +channellist.reset_flags Entferne Kanal-Markierung "Neu" channellist.sats Satelliten channellist.since seit channellist.start Start diff --git a/data/locale/english.locale b/data/locale/english.locale index 59c239e8f..5b3e5a713 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -209,6 +209,9 @@ channellist.foot Channel Information channellist.foot_freq Sat/Freq Info channellist.foot_next next Event channellist.foot_off off +channellist.foot_sort_alpha sorted[alpha] +channellist.foot_sort_freq sorted[freq] +channellist.foot_sort_sat sorted[sat] channellist.head All Services channellist.history History channellist.make_hdlist Create list of HD channels diff --git a/data/providermap.xml b/data/providermap.xml index ebe2b57b3..807012f04 100644 --- a/data/providermap.xml +++ b/data/providermap.xml @@ -7,11 +7,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index d71ebd795..7241799b4 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -32,6 +32,7 @@ #ifdef HAVE_CONFIG_H #include #endif +#include #include @@ -797,6 +798,19 @@ int CChannelList::show() paintHead(); // update button bar showChannelLogo(); } + else if ( msg == CRCInput::RC_green ) + { + int mode = CNeutrinoApp::getInstance()->GetChannelMode(); + if(mode){ + g_settings.channellist_sort_mode++; + if(g_settings.channellist_sort_mode > 2) + g_settings.channellist_sort_mode = 0; + CNeutrinoApp::getInstance()->SetChannelMode(mode); + paint(); + paintHead(); // update button bar + } + } + else if ((msg == CRCInput::RC_info) || (msg == CRCInput::RC_help)) { hide(); CChannelEvent *p_event=NULL; @@ -1603,36 +1617,78 @@ struct button_label SChannelListButtons[NUM_LIST_BUTTONS] = { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_INFOVIEWER_NEXT}, { NEUTRINO_ICON_BUTTON_RECORD_INACTIVE, NONEXISTANT_LOCALE} }; +#define NUM_LIST_BUTTONS_SORT 5 +struct button_label SChannelListButtons_SMode[NUM_LIST_BUTTONS_SORT] = +{ + { NEUTRINO_ICON_BUTTON_RED, LOCALE_INFOVIEWER_EVENTLIST}, + { NEUTRINO_ICON_BUTTON_GREEN, LOCALE_CHANNELLIST_FOOT_SORT_ALPHA}, + { NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_BOUQUETLIST_HEAD}, + { NEUTRINO_ICON_BUTTON_BLUE, LOCALE_INFOVIEWER_NEXT}, + { NEUTRINO_ICON_BUTTON_RECORD_INACTIVE, NONEXISTANT_LOCALE} +}; void CChannelList::paintButtonBar(bool is_current) { //printf("[neutrino channellist] %s...%d, selected %d\n", __FUNCTION__, __LINE__, selected); - + unsigned int smode = CNeutrinoApp::getInstance()->GetChannelMode(); + int num_buttons = smode ? NUM_LIST_BUTTONS_SORT : NUM_LIST_BUTTONS; + + struct button_label Button[num_buttons]; + const neutrino_locale_t button_ids[] = {LOCALE_INFOVIEWER_NOW,LOCALE_INFOVIEWER_NEXT,LOCALE_MAINMENU_RECORDING,LOCALE_MAINMENU_RECORDING_STOP,NONEXISTANT_LOCALE, + LOCALE_CHANNELLIST_FOOT_SORT_ALPHA,LOCALE_CHANNELLIST_FOOT_SORT_FREQ,LOCALE_CHANNELLIST_FOOT_SORT_SAT}; + const std::vector buttonID_rest (button_ids, button_ids + sizeof(button_ids) / sizeof(neutrino_locale_t) ); + + for (int i = 0;iRecordingStatus(getActiveChannel_ChannelID()); if (g_settings.recording_type != RECORDING_OFF && !displayNext){ if (is_current && !do_record){ - SChannelListButtons[3].locale = LOCALE_MAINMENU_RECORDING; - SChannelListButtons[3].button = NEUTRINO_ICON_BUTTON_RECORD_ACTIVE; + Button[Bindex].locale = LOCALE_MAINMENU_RECORDING; + Button[Bindex].button = NEUTRINO_ICON_BUTTON_RECORD_ACTIVE; }else if (do_record){ - SChannelListButtons[3].locale = LOCALE_MAINMENU_RECORDING_STOP; - SChannelListButtons[3].button = NEUTRINO_ICON_BUTTON_STOP; + Button[Bindex].locale = LOCALE_MAINMENU_RECORDING_STOP; + Button[Bindex].button = NEUTRINO_ICON_BUTTON_STOP; }else{ - SChannelListButtons[3].locale = NONEXISTANT_LOCALE; - SChannelListButtons[3].button = NEUTRINO_ICON_BUTTON_RECORD_INACTIVE; + Button[Bindex].locale = NONEXISTANT_LOCALE; + Button[Bindex].button = NEUTRINO_ICON_BUTTON_RECORD_INACTIVE; } } - + if(smode) + { + switch (g_settings.channellist_sort_mode) + { + case 0: + Button[1].locale = LOCALE_CHANNELLIST_FOOT_SORT_ALPHA; + break; + case 1: + Button[1].locale = LOCALE_CHANNELLIST_FOOT_SORT_FREQ; + break; + case 2: + Button[1].locale = LOCALE_CHANNELLIST_FOOT_SORT_SAT; + break; + } + } + //paint buttons int y_foot = y + (height - footerHeight); - ::paintButtons(x, y_foot, width, NUM_LIST_BUTTONS, SChannelListButtons, footerHeight/*, (width - 20) / NUM_LIST_BUTTONS*/); //buttonwidth will set automaticly + ::paintButtons(x, y_foot, width,num_buttons, Button, footerHeight,0,false,COL_INFOBAR_SHADOW,NULL,0,true, buttonID_rest); } void CChannelList::paintItem(int pos) @@ -1899,10 +1955,19 @@ void CChannelList::paintHead() void CChannelList::paint() { - liststart = (selected/listmaxshow)*listmaxshow; - //FIXME do we need to find biggest chan number in list ? - numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("0000"); + zapit_list_it_t chan_it; + std::stringstream ss; + std::string chan_width; + int chan_nr_max = 1; + unsigned int nr = 0; + for (chan_it=chanlist.begin(); chan_it!=chanlist.end(); ++chan_it) { + chan_nr_max = std::max(chan_nr_max, chanlist[nr++]->number); + } + ss << chan_nr_max; + ss >> chan_width; + numwidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(chan_width.c_str()); + liststart = (selected/listmaxshow)*listmaxshow; updateEvents(this->historyMode ? 0:liststart, this->historyMode ? 0:(liststart + listmaxshow)); frameBuffer->paintBoxRel(x, y+theight, width, height-footerHeight-theight, COL_MENUCONTENT_PLUS_0, 0, CORNER_BOTTOM); diff --git a/src/gui/plugins.cpp b/src/gui/plugins.cpp index f190c620b..bbc553907 100644 --- a/src/gui/plugins.cpp +++ b/src/gui/plugins.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include @@ -325,12 +326,16 @@ void CPlugins::startScriptPlugin(int number) FILE *f = popen(script,"r"); if (f != NULL) { - char output[1024]; - while (fgets(output,1024,f)) + char *output=NULL; + size_t len = 0; + while (( getline(&output, &len, f)) != -1) + { scriptOutput += output; } pclose(f); + if(output) + free(output); } else { diff --git a/src/neutrino.cpp b/src/neutrino.cpp index bcadaa14b..b8da51879 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -611,6 +611,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.channellist_extended = configfile.getBool("channellist_extended" , true); g_settings.channellist_foot = configfile.getInt32("channellist_foot" , 1);//default next Event g_settings.channellist_new_zap_mode = configfile.getInt32("channellist_new_zap_mode", 1); + g_settings.channellist_sort_mode = configfile.getInt32("channellist_sort_mode", 0);//sort mode: alpha, freq, sat //screen configuration g_settings.screen_xres = configfile.getInt32("screen_xres", 100); @@ -1028,6 +1029,7 @@ void CNeutrinoApp::saveSetup(const char * fname) configfile.setInt32("channellist_new_zap_mode", g_settings.channellist_new_zap_mode); configfile.setInt32("remote_control_hardware", g_settings.remote_control_hardware); configfile.setBool ( "audiochannel_up_down_enable", g_settings.audiochannel_up_down_enable ); + configfile.setInt32("channellist_sort_mode", g_settings.channellist_sort_mode); //screen configuration configfile.setInt32( "screen_xres", g_settings.screen_xres); @@ -1459,6 +1461,16 @@ printf("CNeutrinoApp::SetChannelMode %d\n", newmode); } break; } + if( newmode != LIST_MODE_FAV && g_settings.channellist_sort_mode < 3){ + for (uint32_t i = 0; i < bouquetList->Bouquets.size(); i++) { + if(g_settings.channellist_sort_mode == 0) + bouquetList->Bouquets[i]->channelList->SortAlpha(); + if(g_settings.channellist_sort_mode == 1) + bouquetList->Bouquets[i]->channelList->SortTP(); + if(g_settings.channellist_sort_mode == 2) + bouquetList->Bouquets[i]->channelList->SortSat(); + } + } lastChannelMode = newmode; } diff --git a/src/system/localize.cpp b/src/system/localize.cpp index 40f55c79c..dc924a4f6 100644 --- a/src/system/localize.cpp +++ b/src/system/localize.cpp @@ -149,13 +149,14 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l } } - char buf[1000]; + char *buf=NULL; + size_t len = 0; i = 1; while(!feof(fd)) { - if(fgets(buf,sizeof(buf),fd)!=NULL) + if(getline(&buf, &len, fd)!=-1) { char * val = NULL; char * tmpptr = buf; @@ -203,6 +204,9 @@ CLocaleManager::loadLocale_ret_t CLocaleManager::loadLocale(const char * const l } } fclose(fd); + if(buf) + free(buf); + for (unsigned j = 1; j < (sizeof(locale_real_names)/sizeof(const char *)); j++) if (loadData[j] == locale_real_names[j]) { diff --git a/src/system/locals.h b/src/system/locals.h index 91c53c24c..578827bb3 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -236,6 +236,9 @@ typedef enum LOCALE_CHANNELLIST_FOOT_FREQ, LOCALE_CHANNELLIST_FOOT_NEXT, LOCALE_CHANNELLIST_FOOT_OFF, + LOCALE_CHANNELLIST_FOOT_SORT_ALPHA, + LOCALE_CHANNELLIST_FOOT_SORT_FREQ, + LOCALE_CHANNELLIST_FOOT_SORT_SAT, LOCALE_CHANNELLIST_HEAD, LOCALE_CHANNELLIST_HISTORY, LOCALE_CHANNELLIST_MAKE_HDLIST, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index b19ee79e0..a96b8315e 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -236,6 +236,9 @@ const char * locale_real_names[] = "channellist.foot_freq", "channellist.foot_next", "channellist.foot_off", + "channellist.foot_sort_alpha", + "channellist.foot_sort_freq", + "channellist.foot_sort_sat", "channellist.head", "channellist.history", "channellist.make_hdlist", diff --git a/src/system/settings.h b/src/system/settings.h index 63c2933e4..2fc7739d0 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -410,7 +410,7 @@ struct SNeutrinoSettings int channellist_extended; int channellist_foot; int channellist_new_zap_mode; - + int channellist_sort_mode; char repeat_blocker[4]; char repeat_genericblocker[4]; int remote_control_hardware; diff --git a/src/zapit/src/scanpmt.cpp b/src/zapit/src/scanpmt.cpp index ad0af971c..c308091b9 100644 --- a/src/zapit/src/scanpmt.cpp +++ b/src/zapit/src/scanpmt.cpp @@ -290,7 +290,8 @@ bool CPmt::ParseEsInfo(ElementaryStreamInfo *esinfo, CZapitChannel * const chann if(audio) { if(description.empty()) { char str[DESC_MAX_LEN]; - snprintf(str, DESC_MAX_LEN, "Unknown 0x%04x", esinfo->getPid()); +// snprintf(str, DESC_MAX_LEN, "Unknown 0x%04x", esinfo->getPid()); + snprintf(str, DESC_MAX_LEN, "Unknown"); description = str; } printf("[pmt] apid %04x stream %02x type %d [%s]\n", esinfo->getPid(), stream_type,