gui/bedit/bouqueteditor_chanselect.cpp: mark inactive channels,

pass CZapitBouquet in place of bouquet number,
cleanup
This commit is contained in:
[CST] Focus
2014-10-10 14:59:11 +04:00
parent c605141b98
commit ebd0259cfc
2 changed files with 20 additions and 31 deletions

View File

@@ -33,6 +33,7 @@
#include <config.h>
#endif
#include <unistd.h>
#include <global.h>
#include <neutrino.h>
#include "bouqueteditor_chanselect.h"
@@ -47,7 +48,7 @@
extern CBouquetManager *g_bouquetManager;
CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, unsigned int Bouquet, CZapitClient::channelsMode Mode)
CBEChannelSelectWidget::CBEChannelSelectWidget(const std::string & Caption, CZapitBouquet* Bouquet, CZapitClient::channelsMode Mode)
:CListBox(Caption.c_str())
{
int icol_w, icol_h;
@@ -123,7 +124,11 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
}
else
{
color = COL_MENUCONTENT_TEXT;
if (Channels[itemNr]->flags & CZapitChannel::NOT_PRESENT)
color = COL_MENUCONTENTINACTIVE_TEXT;
else
color = COL_MENUCONTENT_TEXT;
bgcolor = COL_MENUCONTENT_PLUS_0;
frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor);
}
@@ -131,15 +136,10 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec
if(itemNr < getItemCount())
{
if( isChannelInBouquet(itemNr))
{
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x+10, ypos, iheight);
}
else
{
//frameBuffer->paintBoxRel(x+8, ypos+4, NEUTRINO_ICON_BUTTON_GREEN_WIDTH, fheight-4, bgcolor);
frameBuffer->paintBoxRel(x+10, ypos, iconoffset, iheight, bgcolor);
}
//g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 8 + NEUTRINO_ICON_BUTTON_GREEN_WIDTH + 8, ypos+ fheight, width - (8 + NEUTRINO_ICON_BUTTON_GREEN_WIDTH + 8 + 8), Channels[itemNr]->getName(), color);
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 20 + iconoffset, ypos + iheight - (iheight-fheight)/2, width - 20 - iconoffset, Channels[itemNr]->getName(), color);
if(Channels[itemNr]->scrambled)
frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight);
@@ -154,20 +154,20 @@ void CBEChannelSelectWidget::onOkKeyPressed()
return;
setModified();
if (isChannelInBouquet(selected))
g_bouquetManager->Bouquets[bouquet]->removeService(Channels[selected]->channel_id);
bouquet->removeService(Channels[selected]);
else
CZapit::getInstance()->addChannelToBouquet( bouquet, Channels[selected]->channel_id);
bouquet->addService(Channels[selected]);
bouquetChannels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels);
paintItem( selected, selected - liststart, false);
g_RCInput->postMsg( CRCInput::RC_down, 0 );
}
void CBEChannelSelectWidget::onRedKeyPressed()
{
if (selected >= Channels.size())
return;
setModified();
channellist_sort_mode++;
if(channellist_sort_mode > SORT_END)
@@ -193,7 +193,6 @@ void CBEChannelSelectWidget::onRedKeyPressed()
paintFoot();
paint();
}
#include <unistd.h>
int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & actionKey)
{
@@ -208,14 +207,14 @@ int CBEChannelSelectWidget::exec(CMenuTarget* parent, const std::string & action
x = ConnectLineBox_Width;
y = getScreenStartY(height + info_height);
bouquetChannels = mode == CZapitClient::MODE_TV ? &(g_bouquetManager->Bouquets[bouquet]->tvChannels) : &(g_bouquetManager->Bouquets[bouquet]->radioChannels);
bouquetChannels = mode == CZapitClient::MODE_TV ? &(bouquet->tvChannels) : &(bouquet->radioChannels);
Channels.clear();
if (mode == CZapitClient::MODE_RADIO) {
if (mode == CZapitClient::MODE_RADIO)
CServiceManager::getInstance()->GetAllRadioChannels(Channels);
} else {
else
CServiceManager::getInstance()->GetAllTvChannels(Channels);
}
sort(Channels.begin(), Channels.end(), CmpChannelByChName());
return CListBox::exec(parent, actionKey);
@@ -232,9 +231,9 @@ void CBEChannelSelectWidget::paintFoot()
{
const short numbuttons = sizeof(CBEChannelSelectButtons)/sizeof(CBEChannelSelectButtons[0]);
struct button_label Button[numbuttons];
for (int i = 0; i < numbuttons; i++) {
for (int i = 0; i < numbuttons; i++)
Button[i] = CBEChannelSelectButtons[i];
}
switch (channellist_sort_mode) {
case SORT_ALPHA:
Button[0].locale = LOCALE_CHANNELLIST_FOOT_SORT_ALPHA;
@@ -253,13 +252,6 @@ void CBEChannelSelectWidget::paintFoot()
break;
}
::paintButtons(x, y + (height-footerHeight), width, numbuttons, Button, width, footerHeight);
#if 0
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_OKAY, x+width- 3* ButtonWidth+ 8, y+height+1);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width- 3* ButtonWidth+ 38, y+height+24 - 2, width, g_Locale->getText(LOCALE_BOUQUETEDITOR_SWITCH), COL_INFOBAR_TEXT);
frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_HOME, x+width - ButtonWidth+ 8, y+height+1);
g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(x+width - ButtonWidth+ 38, y+height+24 - 2, width, g_Locale->getText(LOCALE_BOUQUETEDITOR_RETURN), COL_INFOBAR_TEXT);
#endif
}
std::string CBEChannelSelectWidget::getInfoText(int index)

View File

@@ -45,7 +45,7 @@ class CBEChannelSelectWidget : public CListBox
{
private:
unsigned int bouquet;
CZapitBouquet * bouquet;
short int channellist_sort_mode;
enum{SORT_ALPHA,SORT_FREQ,SORT_SAT,SORT_CH_NUMBER, SORT_END};
CZapitClient::channelsMode mode;
@@ -62,7 +62,6 @@ class CBEChannelSelectWidget : public CListBox
void onRedKeyPressed();
void hide();
int footerHeight;
int info_height;
@@ -71,12 +70,10 @@ class CBEChannelSelectWidget : public CListBox
ZapitChannelList Channels;
ZapitChannelList * bouquetChannels;
CBEChannelSelectWidget(const std::string & Caption, unsigned int Bouquet, CZapitClient::channelsMode Mode);
CBEChannelSelectWidget(const std::string & Caption, CZapitBouquet* Bouquet, CZapitClient::channelsMode Mode);
~CBEChannelSelectWidget();
int exec(CMenuTarget* parent, const std::string & actionKey);
bool hasChanged();
};
#endif