Epg-plus changes: show only current bouquet, bouquet switch fix, zapping fix. For testing

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@651 e54a6e83-5905-42d5-8d5c-058d10e6a962
This commit is contained in:
focus
2010-07-06 17:46:50 +00:00
parent e35cf780d8
commit 039c5104fe
2 changed files with 321 additions and 311 deletions

View File

@@ -92,6 +92,7 @@ static EpgPlus::SizeSetting sizeSettingTable[] = {
};
static bool bigfont = false;
static int current_bouquet;
Font *EpgPlus::Header::font = NULL;
@@ -112,11 +113,17 @@ void EpgPlus::Header::init ()
font = fonts[EPGPlus_header_font];
}
void EpgPlus::Header::paint ()
void EpgPlus::Header::paint(const char * Name)
{
std::string head = g_Locale->getText (LOCALE_EPGPLUS_HEAD);
if(Name) {
head += " ";
head += Name;
}
this->frameBuffer->paintBoxRel (this->x, this->y, this->width, this->font->getHeight(), COL_MENUHEAD_PLUS_0, RADIUS_LARGE, CORNER_TOP);
this->font->RenderString (this->x + 10, this->y + this->font->getHeight ()
, this->width - 20, g_Locale->getText (LOCALE_EPGPLUS_HEAD) , COL_MENUHEAD, 0, true);
this->font->RenderString (this->x + 10, this->y + this->font->getHeight(),
this->width - 20, head, COL_MENUHEAD, 0, true);
//this->width - 20, g_Locale->getText (LOCALE_EPGPLUS_HEAD) , COL_MENUHEAD, 0, true);
}
int EpgPlus::Header::getUsedHeight()
@@ -301,7 +308,6 @@ void EpgPlus::ChannelEventEntry::paint (bool pisSelected, bool toggleColor)
CShortEPGData shortEpgData;
//this->footer->paintEventDetails (this->channelEvent.description, g_Sectionsd->getEPGidShort (this->channelEvent.eventID, &shortEpgData) ? shortEpgData.info1 : "");
this->footer->paintEventDetails (this->channelEvent.description, sectionsd_getEPGidShort(this->channelEvent.eventID, &shortEpgData) ? shortEpgData.info1 : "");
this->timeLine->paintGrid();
@@ -322,7 +328,8 @@ EpgPlus::ChannelEntry::ChannelEntry (const CZapitChannel * pchannel, int pindex,
if (pchannel != NULL) {
std::stringstream pdisplayName;
pdisplayName << pindex + 1 << " " << pchannel->getName ();
//pdisplayName << pindex + 1 << " " << pchannel->getName();
pdisplayName << pchannel->number << " " << pchannel->getName();
this->displayName = pdisplayName.str();
}
@@ -355,18 +362,16 @@ EpgPlus::ChannelEntry::~ChannelEntry ()
void EpgPlus::ChannelEntry::paint (bool isSelected, time_t selectedTime)
{
this->frameBuffer->paintBoxRel (this->x, this->y, this->width, this->font->getHeight ()
, isSelected ? COL_MENUCONTENTSELECTED_PLUS_0 : COL_MENUCONTENT_PLUS_0);
this->frameBuffer->paintBoxRel (this->x, this->y, this->width, this->font->getHeight(),
isSelected ? COL_MENUCONTENTSELECTED_PLUS_0 : COL_MENUCONTENT_PLUS_0);
this->font->RenderString (this->x + 2, this->y + this->font->getHeight ()
, this->width - 4, this->displayName, isSelected ? COL_MENUCONTENTSELECTED : COL_MENUCONTENT, 0, true);
this->font->RenderString (this->x + 2, this->y + this->font->getHeight(),
this->width - 4, this->displayName, isSelected ? COL_MENUCONTENTSELECTED : COL_MENUCONTENT, 0, true);
if (isSelected) {
for (uint32_t i = 0; i < this->bouquetList->Bouquets.size ();
++i) {
for (uint32_t i = 0; i < this->bouquetList->Bouquets.size(); ++i) {
CBouquet *bouquet = this->bouquetList->Bouquets[i];
for (int j = 0; j < bouquet->channelList->getSize ();
++j) {
for (int j = 0; j < bouquet->channelList->getSize(); ++j) {
if ((*bouquet->channelList)[j]->number == this->channel->number) {
this->footer->setBouquetChannelName (bouquet->channelList->getName()
@@ -374,7 +379,6 @@ void EpgPlus::ChannelEntry::paint (bool isSelected, time_t selectedTime)
);
bouquet = NULL;
break;
}
}
@@ -384,8 +388,8 @@ void EpgPlus::ChannelEntry::paint (bool isSelected, time_t selectedTime)
}
// paint the separation line
if (separationLineHeight > 0) {
this->frameBuffer->paintBoxRel (this->x, this->y + this->font->getHeight ()
, this->width, this->separationLineHeight, COL_MENUCONTENT_PLUS_5);
this->frameBuffer->paintBoxRel (this->x, this->y + this->font->getHeight(),
this->width, this->separationLineHeight, COL_MENUCONTENT_PLUS_5);
}
bool toggleColor = false;
@@ -400,8 +404,7 @@ void EpgPlus::ChannelEntry::paint (bool isSelected, time_t selectedTime)
int EpgPlus::ChannelEntry::getUsedHeight()
{
return font->getHeight ()
+ separationLineHeight;
return font->getHeight() + separationLineHeight;
}
Font *EpgPlus::Footer::fontBouquetChannelName = NULL;
@@ -439,7 +442,6 @@ void EpgPlus::Footer::setBouquetChannelName (const std::string & newBouquetName,
int EpgPlus::Footer::getUsedHeight()
{
return fontBouquetChannelName->getHeight() + fontEventDescription->getHeight()
+ fontEventShortDescription->getHeight() /* + fontButtons->getHeight()*/;
}
@@ -481,8 +483,8 @@ void EpgPlus::Footer::paintEventDetails (const std::string & description, const
struct button_label buttonLabels[] = {
{NEUTRINO_ICON_BUTTON_RED, LOCALE_EPGPLUS_ACTIONS},
{NEUTRINO_ICON_BUTTON_GREEN, LOCALE_EPGPLUS_PAGE_UP},
{NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_EPGPLUS_PAGE_DOWN},
{NEUTRINO_ICON_BUTTON_GREEN, LOCALE_EPGPLUS_PREV_BOUQUET /*LOCALE_EPGPLUS_PAGE_UP*/},
{NEUTRINO_ICON_BUTTON_YELLOW, LOCALE_EPGPLUS_NEXT_BOUQUET /*LOCALE_EPGPLUS_PAGE_DOWN*/},
{NEUTRINO_ICON_BUTTON_BLUE, LOCALE_EPGPLUS_OPTIONS}
};
@@ -635,11 +637,12 @@ void EpgPlus::createChannelEntries (int selectedChannelEntryIndex)
void EpgPlus::init()
{
frameBuffer = CFrameBuffer::getInstance();
#if 0
currentViewMode = ViewMode_Scroll;
currentSwapMode = SwapMode_ByPage;
#endif
usableScreenWidth = w_max (g_settings.screen_EndX, 4);
usableScreenHeight = h_max (g_settings.screen_EndY, 4);
std::string FileName = std::string (g_settings.font_file);
for (size_t i = 0; i < NumberOfFontSettings; ++i) {
int size = fontSettingTable[i].size;
@@ -745,7 +748,7 @@ void EpgPlus::init ()
this->refreshAll = false;
this->currentViewMode = ViewMode_Scroll;
this->currentSwapMode = SwapMode_ByPage;
this->currentSwapMode = SwapMode_ByBouquet; //SwapMode_ByPage;
this->header = new Header (this->frameBuffer, this->headerX, this->headerY, this->headerWidth);
@@ -806,7 +809,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
fadeTimer = g_RCInput->addTimer( FADE_TIME, false );
}
this->header->paint ();
this->header->paint(this->channelList->getName());
this->footer->paintButtons (buttonLabels, sizeof (buttonLabels) / sizeof (button_label));
@@ -857,7 +860,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
} else
loop = false;
}
if (msg == CRCInput::RC_epg) {
else if (msg == CRCInput::RC_epg) {
//fprintf(stderr, "RC_Epg, bigfont = %d\n", bigfont);
hide();
bigfont = !bigfont;
@@ -866,11 +869,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
refreshAll = true;
break;
}
if ((msg == CRCInput::RC_page_down) || (msg == CRCInput::RC_yellow)) {
switch (this->currentSwapMode) {
case SwapMode_ByPage:
{
else if ((msg == CRCInput::RC_page_down)) {
int selected = this->selectedChannelEntry->index;
int prev_selected = selected;
int step = this->maxNumberOfDisplayableEntries;
@@ -889,37 +888,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
this->createChannelEntries (selected);
this->paint();
}
break;
case SwapMode_ByBouquet:
{
unsigned int currentBouquetNumber = pbouquetList->getActiveBouquetNumber ();
++currentBouquetNumber;
if (currentBouquetNumber == pbouquetList->Bouquets.size ())
currentBouquetNumber = 0;
CBouquet *bouquet = pbouquetList->Bouquets[currentBouquetNumber];
if (bouquet->channelList->getSize () > 0) {
// select first channel of bouquet
pbouquetList->activateBouquet (currentBouquetNumber, false);
this->channelListStartIndex = (*bouquet->channelList)[0]->number - 1;
this->createChannelEntries (this->channelListStartIndex);
this->paint ();
}
}
break;
}
}
//else if ( (msg == (neutrino_msg_t)g_settings.key_channelList_pageup)
else if ((msg == CRCInput::RC_page_up) || (msg == CRCInput::RC_green)) {
switch (this->currentSwapMode) {
case SwapMode_ByPage:
{
else if (msg == CRCInput::RC_page_up) {
int selected = this->selectedChannelEntry->index;
int prev_selected = selected;
int step = this->maxNumberOfDisplayableEntries;
@@ -935,70 +904,83 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
this->createChannelEntries (selected);
this->paint();
}
if (msg == CRCInput::RC_yellow) {
if (bouquetList->Bouquets.size() > 0) {
bool found = true;
uint32_t nNext = (bouquetList->getActiveBouquetNumber()+1) % bouquetList->Bouquets.size();
//printf("**************************** EpgPlus::exec current bouquet %d new %d\n", bouquetList->getActiveBouquetNumber(), nNext);
if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) {
found = false;
nNext = nNext < bouquetList->Bouquets.size()-1 ? nNext+1 : 0;
for(uint32_t i = nNext; i < bouquetList->Bouquets.size(); i++) {
if(bouquetList->Bouquets[i]->channelList->getSize() > 0) {
found = true;
nNext = i;
break;
case SwapMode_ByBouquet:
{
unsigned int currentBouquetNumber = pbouquetList->getActiveBouquetNumber ();
--currentBouquetNumber;
if (currentBouquetNumber == unsigned (-1))
currentBouquetNumber = pbouquetList->Bouquets.size () - 1;
CBouquet *bouquet = pbouquetList->Bouquets[currentBouquetNumber];
if (bouquet->channelList->getSize () > 0) {
// select first channel of bouquet
pbouquetList->activateBouquet (currentBouquetNumber, false);
this->channelListStartIndex = (*bouquet->channelList)[0]->number - 1;
this->createChannelEntries (this->channelListStartIndex);
}
}
}
//printf("**************************** EpgPlus::exec found %d new %d\n", found, nNext);
if(found) {
pbouquetList->activateBouquet (nNext, false);
this->channelList = bouquetList->Bouquets[nNext]->channelList;
this->channelListStartIndex = int (channelList->getSelectedChannelIndex() / maxNumberOfDisplayableEntries) * maxNumberOfDisplayableEntries;
this->createChannelEntries (channelList->getSelectedChannelIndex());
this->header->paint(this->channelList->getName());
this->paint();
}
}
}
else if (msg == CRCInput::RC_green) {
if (bouquetList->Bouquets.size() > 0) {
bool found = true;
int nNext = (bouquetList->getActiveBouquetNumber()+bouquetList->Bouquets.size()-1) % bouquetList->Bouquets.size();
if(bouquetList->Bouquets[nNext]->channelList->getSize() <= 0) {
found = false;
nNext = nNext > 0 ? nNext-1 : bouquetList->Bouquets.size()-1;
for(int i = nNext; i > 0; i--) {
if(bouquetList->Bouquets[i]->channelList->getSize() > 0) {
found = true;
nNext = i;
break;
}
} else if (msg == (neutrino_msg_t) CRCInput::RC_red) {
CMenuWidget menuWidgetActions(LOCALE_EPGPLUS_ACTIONS, NEUTRINO_ICON_FEATURES);
menuWidgetActions.enableFade(false);
if (!g_settings.minimode)
menuWidgetActions.addItem (new CMenuForwarder (LOCALE_EPGPLUS_RECORD, true, NULL, new MenuTargetAddRecordTimer (this), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED), false);
menuWidgetActions.addItem (new CMenuForwarder (LOCALE_EPGPLUS_REFRESH_EPG, true, NULL, new MenuTargetRefreshEpg (this), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN), false);
menuWidgetActions.addItem (new CMenuForwarder (LOCALE_EPGPLUS_REMIND, true, NULL, new MenuTargetAddReminder (this), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), false);
menuWidgetActions.exec (NULL, "");
this->refreshAll = true;
} else if (msg == (neutrino_msg_t) CRCInput::RC_blue) {
CMenuWidget menuWidgetOptions(LOCALE_EPGPLUS_OPTIONS, NEUTRINO_ICON_FEATURES);
menuWidgetOptions.enableFade(false);
menuWidgetOptions.addItem (new MenuOptionChooserSwitchSwapMode (this));
menuWidgetOptions.addItem (new MenuOptionChooserSwitchViewMode (this));
int result = menuWidgetOptions.exec (NULL, "");
if (result == menu_return::RETURN_REPAINT) {
this->refreshAll = true;
} else if (result == menu_return::RETURN_EXIT_ALL) {
this->refreshAll = true;
}
} else if (CRCInput::isNumeric (msg)) { //numeric zap
}
if(found) {
pbouquetList->activateBouquet (nNext, false);
this->channelList = bouquetList->Bouquets[nNext]->channelList;
this->channelListStartIndex = int (channelList->getSelectedChannelIndex() / maxNumberOfDisplayableEntries) * maxNumberOfDisplayableEntries;
this->createChannelEntries (channelList->getSelectedChannelIndex());
this->header->paint(this->channelList->getName());
this->paint();
}
}
}
else if (msg == CRCInput::RC_ok) {
CNeutrinoApp::getInstance()->channelList->zapTo_ChannelID(this->selectedChannelEntry->channel->channel_id);
current_bouquet = bouquetList->getActiveBouquetNumber();
}
else if (CRCInput::isNumeric (msg)) {
this->hide();
this->channelList->numericZap (msg);
CNeutrinoApp::getInstance()->channelList->numericZap (msg);
//printf("numericZap: prev bouquet %d new %d\n", current_bouquet, bouquetList->getActiveBouquetNumber());
current_bouquet = bouquetList->getActiveBouquetNumber();
this->channelList = bouquetList->Bouquets[current_bouquet]->channelList;
this->channelListStartIndex = int (channelList->getSelectedChannelIndex() / maxNumberOfDisplayableEntries) * maxNumberOfDisplayableEntries;
g_InfoViewer->killTitle();
int selectedChannelEntryIndex = this->channelList->getSelectedChannelIndex();
if (selectedChannelEntryIndex < this->channelList->getSize()) {
this->hide();
this->createChannelEntries (selectedChannelEntryIndex);
this->header->paint ();
this->header->paint(this->channelList->getName());
this->footer->paintButtons (buttonLabels, sizeof (buttonLabels) / sizeof (button_label));
this->paint();
}
} else if (msg == CRCInput::RC_up) {
}
else if (msg == CRCInput::RC_up) {
int selectedChannelEntryIndex = this->selectedChannelEntry->index;
int prevSelectedChannelEntryIndex = selectedChannelEntryIndex;
@@ -1013,17 +995,15 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
this->channelListStartIndex = (selectedChannelEntryIndex / this->maxNumberOfDisplayableEntries) * this->maxNumberOfDisplayableEntries;
if (oldChannelListStartIndex != this->channelListStartIndex) {
this->createChannelEntries (selectedChannelEntryIndex);
this->paint();
} else {
this->selectedChannelEntry = this->displayedChannelEntries[selectedChannelEntryIndex - this->channelListStartIndex];
this->paintChannelEntry (prevSelectedChannelEntryIndex - this->channelListStartIndex);
this->paintChannelEntry (selectedChannelEntryIndex - this->channelListStartIndex);
}
} else if (msg == CRCInput::RC_down) {
}
else if (msg == CRCInput::RC_down) {
int selectedChannelEntryIndex = this->selectedChannelEntry->index;
int prevSelectedChannelEntryIndex = this->selectedChannelEntry->index;
@@ -1035,15 +1015,38 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
if (oldChannelListStartIndex != this->channelListStartIndex) {
this->createChannelEntries (selectedChannelEntryIndex);
this->paint();
} else {
this->selectedChannelEntry = this->displayedChannelEntries[selectedChannelEntryIndex - this->channelListStartIndex];
this->paintChannelEntry (prevSelectedChannelEntryIndex - this->channelListStartIndex);
this->paintChannelEntry (this->selectedChannelEntry->index - this->channelListStartIndex);
}
}
else if (msg == (neutrino_msg_t) CRCInput::RC_red) {
CMenuWidget menuWidgetActions(LOCALE_EPGPLUS_ACTIONS, NEUTRINO_ICON_FEATURES);
menuWidgetActions.enableFade(false);
if (!g_settings.minimode)
menuWidgetActions.addItem (new CMenuForwarder (LOCALE_EPGPLUS_RECORD, true, NULL, new MenuTargetAddRecordTimer (this), NULL, CRCInput::RC_red, NEUTRINO_ICON_BUTTON_RED), false);
menuWidgetActions.addItem (new CMenuForwarder (LOCALE_EPGPLUS_REFRESH_EPG, true, NULL, new MenuTargetRefreshEpg (this), NULL, CRCInput::RC_green, NEUTRINO_ICON_BUTTON_GREEN), false);
menuWidgetActions.addItem (new CMenuForwarder (LOCALE_EPGPLUS_REMIND, true, NULL, new MenuTargetAddReminder (this), NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW), false);
menuWidgetActions.exec (NULL, "");
this->refreshAll = true;
}
else if (msg == (neutrino_msg_t) CRCInput::RC_blue) {
CMenuWidget menuWidgetOptions(LOCALE_EPGPLUS_OPTIONS, NEUTRINO_ICON_FEATURES);
menuWidgetOptions.enableFade(false);
//menuWidgetOptions.addItem (new MenuOptionChooserSwitchSwapMode (this));
menuWidgetOptions.addItem (new MenuOptionChooserSwitchViewMode (this));
int result = menuWidgetOptions.exec (NULL, "");
if (result == menu_return::RETURN_REPAINT) {
this->refreshAll = true;
} else if (result == menu_return::RETURN_EXIT_ALL) {
this->refreshAll = true;
}
}
else if (msg == CRCInput::RC_left) {
switch (this->currentViewMode) {
@@ -1087,7 +1090,8 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
}
break;
}
} else if (msg == CRCInput::RC_right) {
}
else if (msg == CRCInput::RC_right) {
switch (this->currentViewMode) {
case ViewMode_Stretch:
{
@@ -1115,8 +1119,6 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
this->selectedChannelEntry->paint (true, this->selectedTime);
} else {
this->startTime += this->duration;
/*this->createChannelEntries (this->selectedChannelEntry->index);*/
this->selectedTime = this->startTime;
this->createChannelEntries (this->selectedChannelEntry->index);
@@ -1125,9 +1127,8 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
}
break;
}
} else if (msg == CRCInput::RC_ok) {
this->channelList->zapTo (this->selectedChannelEntry->index);
} else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) {
}
else if (msg == CRCInput::RC_help || msg == CRCInput::RC_info) {
TCChannelEventEntries::const_iterator It = this->getSelectedEvent();
if (It != this->selectedChannelEntry->channelEventEntries.end()) {
@@ -1148,7 +1149,7 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
g_RCInput->postMsg (msg, data);
}
this->header->paint ();
this->header->paint(this->channelList->getName());
this->footer->paintButtons (buttonLabels, sizeof (buttonLabels) / sizeof (button_label));
this->paint();
}
@@ -1171,7 +1172,6 @@ int EpgPlus::exec (CChannelList * pchannelList, int selectedChannelIndex, CBouqu
loop = false;
else if (this->refreshFooterButtons)
this->footer->paintButtons (buttonLabels, sizeof (buttonLabels) / sizeof (button_label));
}
this->hide();
@@ -1284,9 +1284,19 @@ int CEPGplusHandler::exec (CMenuTarget * parent, const std::string & /*actionKey
e = new EpgPlus;
//channelList = CNeutrinoApp::getInstance()->channelList;
int bnum = bouquetList->getActiveBouquetNumber();
current_bouquet = bnum;
if(bouquetList->Bouquets.size() && bouquetList->Bouquets[bnum]->channelList->getSize() > 0)
channelList = bouquetList->Bouquets[bnum]->channelList;
else
channelList = CNeutrinoApp::getInstance()->channelList;
e->exec (channelList, channelList->getSelectedChannelIndex(), bouquetList);
delete e;
//FIXME
//printf("CEPGplusHandler::exec old bouquet %d new %d current %d\n", bnum, bouquetList->getActiveBouquetNumber(), current_bouquet);
bouquetList->activateBouquet(current_bouquet, false);
return res;
}

View File

@@ -121,7 +121,7 @@ public:
public:
static void init();
void paint();
void paint(const char * Name = NULL);
static int getUsedHeight();