src/gui/channellist.cpp:-add sort by channel number

This commit is contained in:
satbaby
2012-11-09 17:32:15 +01:00
parent fdb1fa6352
commit c47aebdb64
7 changed files with 36 additions and 10 deletions

View File

@@ -211,6 +211,7 @@ channellist.foot_freq Tuning-Parameter
channellist.foot_next Nachfolgesendung
channellist.foot_off aus
channellist.foot_sort_alpha Sortiert[alpha]
channellist.foot_sort_chnum Sortiert[nummer]
channellist.foot_sort_freq Sortiert[freq]
channellist.foot_sort_sat Sortiert[sat]
channellist.head Alle Kanäle

View File

@@ -211,6 +211,7 @@ channellist.foot_freq Sat/Freq Info
channellist.foot_next next Event
channellist.foot_off off
channellist.foot_sort_alpha sorted[alpha]
channellist.foot_sort_chnum Sortiert[number]
channellist.foot_sort_freq sorted[freq]
channellist.foot_sort_sat sorted[sat]
channellist.head All Services

View File

@@ -223,6 +223,11 @@ void CChannelList::SortTP(void)
sort(chanlist.begin(), chanlist.end(), CmpChannelByFreq());
}
void CChannelList::SortChNumber(void)
{
sort(chanlist.begin(), chanlist.end(), CmpChannelByChNum());
}
CZapitChannel* CChannelList::getChannel(int number)
{
for (uint32_t i=0; i< chanlist.size(); i++) {
@@ -814,8 +819,8 @@ int CChannelList::show()
int mode = CNeutrinoApp::getInstance()->GetChannelMode();
if(mode != LIST_MODE_FAV) {
g_settings.channellist_sort_mode++;
if(g_settings.channellist_sort_mode > 2)
g_settings.channellist_sort_mode = 0;
if(g_settings.channellist_sort_mode > SORT_MAX-1)
g_settings.channellist_sort_mode = SORT_ALPHA;
CNeutrinoApp::getInstance()->SetChannelMode(mode);
paintHead(); // update button bar
paint();
@@ -1631,7 +1636,7 @@ void CChannelList::paintButtonBar(bool is_current)
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};
LOCALE_CHANNELLIST_FOOT_SORT_ALPHA,LOCALE_CHANNELLIST_FOOT_SORT_FREQ,LOCALE_CHANNELLIST_FOOT_SORT_SAT,LOCALE_CHANNELLIST_FOOT_SORT_CHNUM};
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++)
@@ -1670,15 +1675,20 @@ void CChannelList::paintButtonBar(bool is_current)
{
switch (g_settings.channellist_sort_mode)
{
case 0:
case SORT_ALPHA:
Button[1].locale = LOCALE_CHANNELLIST_FOOT_SORT_ALPHA;
break;
case 1:
case SORT_TP:
Button[1].locale = LOCALE_CHANNELLIST_FOOT_SORT_FREQ;
break;
case 2:
case SORT_SAT:
Button[1].locale = LOCALE_CHANNELLIST_FOOT_SORT_SAT;
break;
case SORT_CH_NUMBER:
Button[1].locale = LOCALE_CHANNELLIST_FOOT_SORT_CHNUM;
break;
default:
break;
}
}

View File

@@ -153,6 +153,7 @@ public:
void SortAlpha(void);
void SortSat(void);
void SortTP(void);
void SortChNumber(void);
void ClearList(void);
bool SameTP(t_channel_id channel_id);
bool SameTP(CZapitChannel * channel = NULL);
@@ -161,5 +162,14 @@ public:
int getSelected() { return selected; }
CZapitChannel* getPrevNextChannel(int key, unsigned int &sl);
//friend class CZapitChannel;
enum
{
SORT_ALPHA = 0,
SORT_TP,
SORT_SAT,
SORT_CH_NUMBER,
SORT_MAX
};
};
#endif

View File

@@ -1395,16 +1395,18 @@ void CNeutrinoApp::SetChannelMode(int newmode)
break;
}
INFO("newmode %d sort old %d new %d", newmode, sortmode[newmode], g_settings.channellist_sort_mode);
if(newmode != LIST_MODE_FAV && sortmode[newmode] != g_settings.channellist_sort_mode && g_settings.channellist_sort_mode < 3) {
if(newmode != LIST_MODE_FAV && sortmode[newmode] != g_settings.channellist_sort_mode && g_settings.channellist_sort_mode < CChannelList::SORT_MAX) {
sortmode[newmode] = g_settings.channellist_sort_mode;
INFO("sorting, mode %d, %d bouquets\n", g_settings.channellist_sort_mode, bouquetList->Bouquets.size());
for (uint32_t i = 0; i < bouquetList->Bouquets.size(); i++) {
if(g_settings.channellist_sort_mode == 0)
if(g_settings.channellist_sort_mode == CChannelList::SORT_ALPHA)
bouquetList->Bouquets[i]->channelList->SortAlpha();
if(g_settings.channellist_sort_mode == 1)
if(g_settings.channellist_sort_mode == CChannelList::SORT_TP)
bouquetList->Bouquets[i]->channelList->SortTP();
if(g_settings.channellist_sort_mode == 2)
if(g_settings.channellist_sort_mode == CChannelList::SORT_SAT)
bouquetList->Bouquets[i]->channelList->SortSat();
if(g_settings.channellist_sort_mode == CChannelList::SORT_CH_NUMBER)
bouquetList->Bouquets[i]->channelList->SortChNumber();
}
channelList->adjustToChannelID(channelList->getActiveChannel_ChannelID());
}

View File

@@ -238,6 +238,7 @@ typedef enum
LOCALE_CHANNELLIST_FOOT_NEXT,
LOCALE_CHANNELLIST_FOOT_OFF,
LOCALE_CHANNELLIST_FOOT_SORT_ALPHA,
LOCALE_CHANNELLIST_FOOT_SORT_CHNUM,
LOCALE_CHANNELLIST_FOOT_SORT_FREQ,
LOCALE_CHANNELLIST_FOOT_SORT_SAT,
LOCALE_CHANNELLIST_HEAD,

View File

@@ -238,6 +238,7 @@ const char * locale_real_names[] =
"channellist.foot_next",
"channellist.foot_off",
"channellist.foot_sort_alpha",
"channellist.foot_sort_chnum",
"channellist.foot_sort_freq",
"channellist.foot_sort_sat",
"channellist.head",