add: sort channels in allchannel mode

This commit is contained in:
satbaby
2012-04-24 14:14:42 +02:00
parent 1fdb76af51
commit 71832331d0
7 changed files with 92 additions and 13 deletions

View File

@@ -209,6 +209,9 @@ 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 Bouquet mit HD-Kanälen

View File

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

View File

@@ -798,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;
@@ -1604,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)

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

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