Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++

This commit is contained in:
[CST] Focus
2012-04-25 11:27:58 +04:00
12 changed files with 162 additions and 22 deletions

View File

@@ -32,6 +32,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <sstream>
#include <gui/channellist.h>
@@ -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<neutrino_locale_t> buttonID_rest (button_ids, button_ids + sizeof(button_ids) / sizeof(neutrino_locale_t) );
for (int i = 0;i<num_buttons;i++)
{
if(smode)
Button[i] = SChannelListButtons_SMode[i];
else
Button[i] = SChannelListButtons[i];
}
int Bindex = 2 + (smode ? 1:0);
//manage now/next button
if (displayNext)
SChannelListButtons[2].locale = LOCALE_INFOVIEWER_NOW;
Button[Bindex].locale = LOCALE_INFOVIEWER_NOW;
else
SChannelListButtons[2].locale = LOCALE_INFOVIEWER_NEXT;
Button[Bindex].locale = LOCALE_INFOVIEWER_NEXT;
Bindex++;
//manage record button
bool do_record = CRecordManager::getInstance()->RecordingStatus(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);

View File

@@ -42,6 +42,7 @@
#include <dlfcn.h>
#include <unistd.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
@@ -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
{

View File

@@ -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;
}

View File

@@ -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])
{

View File

@@ -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,

View File

@@ -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",

View File

@@ -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;

View File

@@ -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,