mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-28 16:01:10 +02:00
Merge remote-tracking branch 'tuxbox/master'
* needs compile fixes
* needs additional tests, of course :-)
Origin commit data
------------------
Branch: ni/coolstream
Commit: 13ab1ebc8a
Author: Stefan Seyfried <seife@tuxbox-git.slipkontur.de>
Date: 2016-10-22 (Sat, 22 Oct 2016)
------------------
This commit was generated by Migit
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
#include <driver/radiotext.h>
|
||||
|
||||
#include <gui/color.h>
|
||||
#include <gui/color_custom.h>
|
||||
#include <gui/epgview.h>
|
||||
#include <gui/eventlist.h>
|
||||
#include <gui/infoviewer.h>
|
||||
@@ -63,7 +64,7 @@
|
||||
#include <gui/movieplayer.h>
|
||||
#include <gui/infoclock.h>
|
||||
#include <system/settings.h>
|
||||
#include <gui/customcolor.h>
|
||||
#include <system/set_threadname.h>
|
||||
|
||||
#include <gui/bouquetlist.h>
|
||||
#include <daemonc/remotecontrol.h>
|
||||
@@ -108,7 +109,7 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl
|
||||
vlist = _vlist;
|
||||
new_zap_mode = 0;
|
||||
selected_chid = 0;
|
||||
footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6; //initial height value for buttonbar
|
||||
footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+6; //initial height value for buttonbar
|
||||
theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight();
|
||||
fheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight();
|
||||
fdescrheight = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getHeight();
|
||||
@@ -126,6 +127,8 @@ CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vl
|
||||
move_state = beDefault;
|
||||
edit_state = false;
|
||||
channelsChanged = false;
|
||||
|
||||
paint_events_index = -2;
|
||||
}
|
||||
|
||||
CChannelList::~CChannelList()
|
||||
@@ -157,6 +160,8 @@ void CChannelList::updateEvents(unsigned int from, unsigned int to)
|
||||
return;
|
||||
|
||||
size_t chanlist_size = to - from;
|
||||
if (chanlist_size <= 0) // WTF???
|
||||
return;
|
||||
|
||||
CChannelEventList events;
|
||||
if (displayNext) {
|
||||
@@ -184,16 +189,18 @@ void CChannelList::updateEvents(unsigned int from, unsigned int to)
|
||||
for (uint32_t count = 0; count < chanlist_size; count++)
|
||||
p_requested_channels[count] = (*chanlist)[count + from]->getEpgID();
|
||||
|
||||
CEitManager::getInstance()->getChannelEvents(events, p_requested_channels, chanlist_size);
|
||||
CChannelEventList levents;
|
||||
CEitManager::getInstance()->getChannelEvents(levents, p_requested_channels, chanlist_size);
|
||||
for (uint32_t count=0; count < chanlist_size; count++) {
|
||||
(*chanlist)[count + from]->currentEvent = CChannelEvent();
|
||||
for (CChannelEventList::iterator e = events.begin(); e != events.end(); ++e) {
|
||||
for (CChannelEventList::iterator e = levents.begin(); e != levents.end(); ++e) {
|
||||
if (((*chanlist)[count + from]->getEpgID()&0xFFFFFFFFFFFFULL) == e->get_channel_id()) {
|
||||
(*chanlist)[count + from]->currentEvent = *e;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
levents.clear();
|
||||
delete[] p_requested_channels;
|
||||
}
|
||||
}
|
||||
@@ -311,6 +318,7 @@ int CChannelList::doChannelMenu(void)
|
||||
|
||||
bool empty = (*chanlist).empty();
|
||||
bool allow_edit = (bouquet && bouquet->zapitBouquet && !bouquet->zapitBouquet->bOther && !bouquet->zapitBouquet->bWebtv);
|
||||
bool got_history = (CNeutrinoApp::getInstance()->channelList->getLastChannels().size() > 1);
|
||||
|
||||
int i = 0;
|
||||
snprintf(cnt, sizeof(cnt), "%d", i);
|
||||
@@ -328,6 +336,10 @@ int CChannelList::doChannelMenu(void)
|
||||
snprintf(cnt, sizeof(cnt), "%d", i);
|
||||
menu->addItem(new CMenuForwarder(LOCALE_CHANNELLIST_RESET_ALL, reset_all, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++);
|
||||
|
||||
menu->addItem(GenericMenuSeparator);
|
||||
snprintf(cnt, sizeof(cnt), "%d", i);
|
||||
menu->addItem(new CMenuForwarder(LOCALE_CHANNELLIST_HISTORY_CLEAR, got_history, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++);
|
||||
|
||||
menu->addItem(new CMenuSeparator(CMenuSeparator::LINE));
|
||||
snprintf(cnt, sizeof(cnt), "%d", i);
|
||||
menu->addItem(new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, selector, cnt, CRCInput::convertDigitToKey(shortcut++)), old_selected == i++);
|
||||
@@ -411,7 +423,14 @@ int CChannelList::doChannelMenu(void)
|
||||
if(g_settings.make_new_list)
|
||||
CNeutrinoApp::getInstance()->MarkChannelsInit();
|
||||
break;
|
||||
case 5: // settings
|
||||
case 5: // clear channel history
|
||||
{
|
||||
CNeutrinoApp::getInstance()->channelList->getLastChannels().clear();
|
||||
printf("%s:%d lastChList cleared\n", __FUNCTION__, __LINE__);
|
||||
ret = -2; // exit channellist
|
||||
}
|
||||
break;
|
||||
case 6: // settings
|
||||
{
|
||||
previous_channellist_additional = g_settings.channellist_additional;
|
||||
COsdSetup osd_setup;
|
||||
@@ -457,7 +476,7 @@ void CChannelList::calcSize()
|
||||
|
||||
if (fheight == 0)
|
||||
fheight = 1; /* avoid div-by-zero crash on invalid font */
|
||||
footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight()+6;
|
||||
footerHeight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]->getHeight()+6;
|
||||
|
||||
pig_on_win = ( (g_settings.channellist_additional == 2) /* with miniTV */ && (CNeutrinoApp::getInstance()->getMode() != NeutrinoMessages::mode_ts) );
|
||||
// calculate width
|
||||
@@ -478,7 +497,7 @@ void CChannelList::calcSize()
|
||||
else
|
||||
info_height = 0;
|
||||
height = pig_on_win ? frameBuffer->getScreenHeight(): frameBuffer->getScreenHeightRel();
|
||||
height = height - info_height;
|
||||
height = height - OFFSET_INTER - info_height;
|
||||
|
||||
// calculate x position
|
||||
x = getScreenStartX(full_width);
|
||||
@@ -496,7 +515,7 @@ void CChannelList::calcSize()
|
||||
height = theight + listmaxshow*fheight + footerHeight;
|
||||
|
||||
// calculate y position
|
||||
y = getScreenStartY(height + info_height);
|
||||
y = getScreenStartY(height + OFFSET_INTER + info_height);
|
||||
|
||||
// calculate width/height of right info_zone and pip-box
|
||||
infozone_width = full_width - width;
|
||||
@@ -701,8 +720,9 @@ int CChannelList::show()
|
||||
loop = false;
|
||||
}
|
||||
}
|
||||
else if (msg == CRCInput::RC_sat || msg == CRCInput::RC_favorites) {
|
||||
else if (CNeutrinoApp::getInstance()->listModeKey(msg)) {
|
||||
if (!edit_state) {
|
||||
//FIXME: what about LIST_MODE_WEBTV?
|
||||
int newmode = msg == CRCInput::RC_sat ? LIST_MODE_SAT : LIST_MODE_FAV;
|
||||
CNeutrinoApp::getInstance()->SetChannelMode(newmode);
|
||||
res = CHANLIST_CHANGE_MODE;
|
||||
@@ -717,10 +737,13 @@ int CChannelList::show()
|
||||
if (selected + 1 < (*chanlist).size())
|
||||
selected++;
|
||||
}
|
||||
if (ret != 0) {
|
||||
paint();
|
||||
if (ret == -2) // exit channellist
|
||||
loop = false;
|
||||
else {
|
||||
if (ret != 0)
|
||||
paint();
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]);
|
||||
}
|
||||
timeoutEnd = CRCInput::calcTimeoutEnd(g_settings.timing[SNeutrinoSettings::TIMING_CHANLIST]);
|
||||
}
|
||||
else if (!empty && msg == (neutrino_msg_t) g_settings.key_list_start) {
|
||||
actzap = updateSelection(0);
|
||||
@@ -907,6 +930,8 @@ int CChannelList::show()
|
||||
}
|
||||
}
|
||||
|
||||
paint_events(-2); // cancel paint_events thread
|
||||
|
||||
if (move_state == beMoving)
|
||||
cancelMoveChannel();
|
||||
if (edit_state)
|
||||
@@ -953,7 +978,7 @@ void CChannelList::hide()
|
||||
CChannelLogo = NULL;
|
||||
}
|
||||
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, full_width, height + info_height);
|
||||
frameBuffer->paintBackgroundBoxRel(x, y, full_width, height + OFFSET_INTER + info_height);
|
||||
clearItem2DetailsLine();
|
||||
CInfoClock::getInstance()->enableInfoClock(!CInfoClock::getInstance()->isBlocked());
|
||||
}
|
||||
@@ -1284,6 +1309,7 @@ int CChannelList::numericZap(int key)
|
||||
bool showEPG = false;
|
||||
neutrino_msg_t msg;
|
||||
neutrino_msg_data_t data;
|
||||
g_InfoViewer->setSwitchMode(CInfoViewer::IV_MODE_NUMBER_ZAP);
|
||||
|
||||
while(1) {
|
||||
if (lastchan != chn) {
|
||||
@@ -1308,7 +1334,8 @@ int CChannelList::numericZap(int key)
|
||||
doZap = true;
|
||||
break;
|
||||
}
|
||||
else if (msg == CRCInput::RC_favorites || msg == CRCInput::RC_sat || msg == CRCInput::RC_right) {
|
||||
else if (CNeutrinoApp::getInstance()->listModeKey(msg) || msg == CRCInput::RC_right) {
|
||||
// do nothing
|
||||
}
|
||||
else if (CRCInput::isNumeric(msg)) {
|
||||
if (pos == 4) {
|
||||
@@ -1367,6 +1394,7 @@ int CChannelList::numericZap(int key)
|
||||
if (chan && showEPG)
|
||||
g_EventList->exec(chan->getChannelID(), chan->getName());
|
||||
}
|
||||
g_InfoViewer->resetSwitchMode();
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1375,7 +1403,7 @@ CZapitChannel* CChannelList::getPrevNextChannel(int key, unsigned int &sl)
|
||||
if(sl >= (*chanlist).size())
|
||||
sl = (*chanlist).size()-1;
|
||||
|
||||
CZapitChannel* channel = (*chanlist)[sl];
|
||||
CZapitChannel* channel = NULL;
|
||||
int bsize = bouquetList->Bouquets.size();
|
||||
int bactive = bouquetList->getActiveBouquetNumber();
|
||||
|
||||
@@ -1508,14 +1536,17 @@ void CChannelList::paintDetails(int index)
|
||||
if (!g_settings.channellist_show_infobox)
|
||||
return;
|
||||
|
||||
int ypos = y + height + OFFSET_INTER;
|
||||
int ypos_a = ypos + OFFSET_INNER_SMALL;
|
||||
|
||||
CChannelEvent *p_event = NULL;
|
||||
|
||||
//colored_events init
|
||||
bool colored_event_C = (g_settings.theme.colored_events_channellist == 1);
|
||||
bool colored_event_N = (g_settings.theme.colored_events_channellist == 2);
|
||||
|
||||
frameBuffer->paintBoxRel(x+1, y + height + 1, full_width-2, info_height - 2, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE);//round
|
||||
frameBuffer->paintBoxFrame(x, y + height, full_width, info_height, 2, COL_MENUCONTENT_PLUS_6, RADIUS_LARGE);
|
||||
frameBuffer->paintBoxRel(x, ypos, full_width, info_height, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE);
|
||||
frameBuffer->paintBoxFrame(x, ypos, full_width, info_height, 2, COL_FRAME_PLUS_0, RADIUS_LARGE);
|
||||
|
||||
if ((*chanlist).empty())
|
||||
return;
|
||||
@@ -1565,7 +1596,7 @@ void CChannelList::paintDetails(int index)
|
||||
text3= text3+ " - ";
|
||||
|
||||
xstart += g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(text3);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2* fheight, full_width - 30- noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight, full_width - 30- noch_len, text3, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
}
|
||||
|
||||
if (!(text2.empty())) {
|
||||
@@ -1582,18 +1613,18 @@ void CChannelList::paintDetails(int index)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ xstart, y+ height+ 5+ fdescrheight+ fheight, full_width- xstart- 30- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ xstart, ypos_a + fdescrheight+ fheight, full_width- xstart- 30- noch_len, text2, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
}
|
||||
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, full_width - 30 - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- seit_len, y+ height+ 5+ fheight, seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, y+ height+ 5+ fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30 - seit_len, text1, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- seit_len, ypos_a + fheight , seit_len, cSeit, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- noch_len, ypos_a + fdescrheight+ fheight, noch_len, cNoch, colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
}
|
||||
else if (IS_WEBTV((*chanlist)[index]->getChannelID())) {
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ fheight, full_width - 30, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + fheight, full_width - 30, (*chanlist)[index]->getDesc(), colored_event_C ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT, 0, true);
|
||||
}
|
||||
if (IS_WEBTV((*chanlist)[index]->getChannelID())) {
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight + fdescrheight, full_width - 30, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight + fdescrheight, full_width - 30, (*chanlist)[index]->getUrl(), COL_MENUCONTENTDARK_TEXT, 0, true);
|
||||
} else if(g_settings.channellist_foot == 0) {
|
||||
transponder t;
|
||||
CServiceManager::getInstance()->GetTransponder((*chanlist)[index]->getTransponderId(), t);
|
||||
@@ -1604,7 +1635,7 @@ void CChannelList::paintDetails(int index)
|
||||
else
|
||||
desc = desc + " (" + CServiceManager::getInstance()->GetSatelliteName((*chanlist)[index]->getSatellitePosition()) + ")";
|
||||
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight +fdescrheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight +fdescrheight, full_width - 30, desc.c_str(), COL_MENUCONTENTDARK_TEXT);
|
||||
}
|
||||
else if( !displayNext && g_settings.channellist_foot == 1) { // next Event
|
||||
|
||||
@@ -1618,8 +1649,8 @@ void CChannelList::paintDetails(int index)
|
||||
snprintf(buf, sizeof(buf), "%s", CurrentNext.next_name.c_str());
|
||||
int from_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(cFrom);
|
||||
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, y+ height+ 5+ 2*fheight+ fdescrheight, full_width - 30 - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- from_len, y+ height+ 5+ 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 10, ypos_a + 2*fheight+ fdescrheight, full_width - 30 - from_len, buf, colored_event_N ? COL_COLORED_EVENTS_TEXT :COL_MENUCONTENTDARK_TEXT);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ full_width- 10- from_len, ypos_a + 2*fheight+ fdescrheight, from_len, cFrom, colored_event_N ? COL_COLORED_EVENTS_TEXT : COL_MENUCONTENTDARK_TEXT);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1641,13 +1672,13 @@ void CChannelList::paintItem2DetailsLine (int pos)
|
||||
return;
|
||||
|
||||
int xpos = x - ConnectLineBox_Width;
|
||||
int ypos1 = y + theight + pos*fheight + (fheight/2)-2;
|
||||
int ypos2 = y + height + (info_height/2)-2;
|
||||
int ypos1 = y + theight + pos*fheight + (fheight/2);
|
||||
int ypos2 = y + height + OFFSET_INTER + (info_height/2);
|
||||
|
||||
// paint Line if detail info (and not valid list pos)
|
||||
if (pos >= 0) {
|
||||
if (dline == NULL)
|
||||
dline = new CComponentsDetailLine(xpos, ypos1, ypos2, fheight/2+1, info_height-RADIUS_LARGE*2);
|
||||
dline = new CComponentsDetailLine(xpos, ypos1, ypos2, fheight/2, info_height-RADIUS_LARGE*2);
|
||||
dline->paint(false);
|
||||
}
|
||||
}
|
||||
@@ -1824,44 +1855,60 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
|
||||
return;
|
||||
}
|
||||
int ypos = y+ theight + pos*fheight;
|
||||
fb_pixel_t color;
|
||||
fb_pixel_t bgcolor;
|
||||
bool iscurrent = true;
|
||||
bool is_available = true;
|
||||
bool paintbuttons = false;
|
||||
unsigned int curr = liststart + pos;
|
||||
fb_pixel_t c_rad_small = 0;
|
||||
|
||||
if(curr < (*chanlist).size()) {
|
||||
if (curr < (*chanlist).size())
|
||||
{
|
||||
if (edit_state)
|
||||
iscurrent = !((*chanlist)[curr]->flags & CZapitChannel::NOT_PRESENT);
|
||||
is_available = !((*chanlist)[curr]->flags & CZapitChannel::NOT_PRESENT);
|
||||
else
|
||||
iscurrent = SameTP((*chanlist)[curr]);
|
||||
is_available = SameTP((*chanlist)[curr]);
|
||||
}
|
||||
|
||||
if(selected >= (*chanlist).size())
|
||||
if (selected >= (*chanlist).size())
|
||||
selected = (*chanlist).size()-1;
|
||||
|
||||
if (curr == selected) {
|
||||
color = COL_MENUCONTENTSELECTED_TEXT;
|
||||
bgcolor = COL_MENUCONTENTSELECTED_PLUS_0;
|
||||
bool i_selected = curr == selected;
|
||||
bool i_marked = getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber() && new_zap_mode != 2 /*active*/;
|
||||
int i_radius = RADIUS_NONE;
|
||||
|
||||
fb_pixel_t color;
|
||||
fb_pixel_t ecolor; // we need one more color for displayNext
|
||||
fb_pixel_t bgcolor;
|
||||
|
||||
getItemColors(color, bgcolor, i_selected, i_marked);
|
||||
ecolor = color;
|
||||
|
||||
if (i_selected || i_marked)
|
||||
i_radius = RADIUS_LARGE;
|
||||
|
||||
if (i_selected)
|
||||
{
|
||||
paintItem2DetailsLine (pos);
|
||||
paintDetails(curr);
|
||||
paintAdditionals(curr);
|
||||
c_rad_small = RADIUS_LARGE;
|
||||
paintbuttons = true;
|
||||
}
|
||||
else if (getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber() && new_zap_mode != 2/*active*/)
|
||||
|
||||
if (displayNext)
|
||||
{
|
||||
color = !displayNext ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT;
|
||||
bgcolor = !displayNext ? COL_MENUCONTENT_PLUS_1 : COL_MENUCONTENTINACTIVE_PLUS_0;
|
||||
c_rad_small = RADIUS_LARGE;
|
||||
} else {
|
||||
color = iscurrent ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT;
|
||||
bgcolor = iscurrent ? COL_MENUCONTENT_PLUS_0 : COL_MENUCONTENTINACTIVE_PLUS_0;
|
||||
/*
|
||||
I think it's unnecessary to change colors in this case.
|
||||
The user should know when he has pressed the blue button.
|
||||
*/
|
||||
if (g_settings.theme.colored_events_channellist == 2 /* next */)
|
||||
ecolor = COL_COLORED_EVENTS_TEXT;
|
||||
else
|
||||
ecolor = COL_MENUCONTENTINACTIVE_TEXT;
|
||||
}
|
||||
|
||||
if(!firstpaint || (curr == selected) || getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber())
|
||||
frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, c_rad_small);
|
||||
if (!is_available)
|
||||
color = COL_MENUCONTENTINACTIVE_TEXT;
|
||||
|
||||
if (!firstpaint || i_selected || getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber())
|
||||
frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius);
|
||||
|
||||
if(curr < (*chanlist).size()) {
|
||||
char nameAndDescription[255];
|
||||
@@ -1869,8 +1916,6 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
|
||||
CZapitChannel* chan = (*chanlist)[curr];
|
||||
int prg_offset=0;
|
||||
int title_offset=0;
|
||||
fb_pixel_t tcolor=(liststart + pos == selected) ? color : COL_MENUCONTENTINACTIVE_TEXT;
|
||||
int xtheight=fheight-2;
|
||||
int rec_mode;
|
||||
if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF)
|
||||
{
|
||||
@@ -1919,7 +1964,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
|
||||
|
||||
//paint buttons
|
||||
if (paintbuttons)
|
||||
paintButtonBar(iscurrent);
|
||||
paintButtonBar(is_available);
|
||||
|
||||
int icon_space = r_icon_w+s_icon_w;
|
||||
|
||||
@@ -1944,32 +1989,21 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
|
||||
l = snprintf(nameAndDescription, sizeof(nameAndDescription), "%s", chan->getName().c_str());
|
||||
|
||||
int pb_space = prg_offset - title_offset;
|
||||
CProgressBar pb(x+5+numwidth + title_offset, ypos + fheight/4 + 2, pb_space + 2, fheight/2 - 4,
|
||||
0, COL_MENUCONTENT_PLUS_0, COL_MENUCONTENTDARK_PLUS_0, COL_INFOBAR_PLUS_7, COL_INFOBAR_PLUS_3);
|
||||
int pb_height = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getDigitHeight();
|
||||
CProgressBar pb(x+5+numwidth + title_offset, ypos + (fheight-pb_height)/2, pb_space + 2, pb_height, COL_MENUCONTENT_PLUS_0);
|
||||
pb.setType(CProgressBar::PB_TIMESCALE);
|
||||
pb.setDesign(g_settings.channellist_progressbar_design);
|
||||
pb.setCornerType(0);
|
||||
pb.setFrameThickness(0); // no frame
|
||||
pb.doPaintBg(false); // no background
|
||||
int pb_max = pb_space - 4;
|
||||
if (g_settings.progressbar_design != CProgressBar::PB_MONO) {
|
||||
if (liststart + pos != selected) {
|
||||
fb_pixel_t pbgcol = COL_MENUCONTENT_PLUS_1;
|
||||
if (pbgcol == bgcolor)
|
||||
pbgcol = COL_MENUCONTENT_PLUS_0;
|
||||
pb.setStatusColors(COL_MENUCONTENT_PLUS_3, pbgcol);
|
||||
} else {
|
||||
fb_pixel_t pbgcol = COL_MENUCONTENTSELECTED_PLUS_0;
|
||||
if (pbgcol == bgcolor)
|
||||
pbgcol = COL_MENUCONTENT_PLUS_0;
|
||||
pb.setStatusColors(COL_MENUCONTENTSELECTED_PLUS_2, pbgcol);
|
||||
}
|
||||
} else {
|
||||
if (liststart + pos != selected)
|
||||
pb.setStatusColors(COL_MENUCONTENT_PLUS_3, COL_MENUCONTENT_PLUS_1);
|
||||
else
|
||||
pb.setStatusColors(COL_MENUCONTENTSELECTED_PLUS_2, COL_MENUCONTENTSELECTED_PLUS_0);
|
||||
pb.setStatusColors(COL_MENUCONTENT_PLUS_3, COL_MENUCONTENT_PLUS_1);
|
||||
int pb_frame = 0;
|
||||
if (g_settings.channellist_progressbar_design == CProgressBar::PB_MONO && !g_settings.progressbar_gradient)
|
||||
{
|
||||
// add small frame to mono progressbars w/o gradient for a better visibility
|
||||
pb_frame = 1;
|
||||
}
|
||||
pb.setFrameThickness(pb_frame);
|
||||
pb.doPaintBg(false);
|
||||
int pb_max = pb_space - 4;
|
||||
|
||||
if (!(p_event->description.empty())) {
|
||||
snprintf(nameAndDescription+l, sizeof(nameAndDescription)-l,g_settings.channellist_epgtext_align_right ? " ":" - ");
|
||||
@@ -1988,10 +2022,10 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
|
||||
if(g_settings.channellist_progressbar_design != CProgressBar::PB_OFF) {
|
||||
if(displayNext)
|
||||
{
|
||||
struct tm *pStartZeit = localtime(&p_event->startTime);
|
||||
struct tm *pStartZeit = localtime(&p_event->startTime);
|
||||
|
||||
snprintf(tmp, sizeof(tmp), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x+ 5+ numwidth+ 6, ypos+ xtheight, width- numwidth- 20- 15 -prg_offset, tmp, tcolor);
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x+ 5+ numwidth+ 6, ypos + fheight, width- numwidth- 20- 15 -prg_offset, tmp, ecolor, fheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2011,11 +2045,11 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10+prg_offset, ypos+ fheight, width- numwidth- 40- 15-prg_offset, nameAndDescription, color);
|
||||
if (g_settings.channellist_epgtext_align_right) {
|
||||
// align right
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 20 - ch_desc_len - icon_space - 4, ypos + fheight, ch_desc_len, p_event->description, (curr == selected)?COL_MENUCONTENTSELECTED_TEXT:(!displayNext ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT));
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 20 - ch_desc_len - icon_space - 4, ypos + fheight, ch_desc_len, p_event->description, ecolor);
|
||||
}
|
||||
else {
|
||||
// align left
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ 5+ numwidth+ 10+ ch_name_len+ 5+prg_offset, ypos+ fheight, ch_desc_len, p_event->description, (curr == selected)?COL_MENUCONTENTSELECTED_TEXT:(!displayNext ? COL_MENUCONTENT_TEXT : COL_MENUCONTENTINACTIVE_TEXT));
|
||||
g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x+ 5+ numwidth+ 10+ ch_name_len+ 5+prg_offset, ypos+ fheight, ch_desc_len, p_event->description, ecolor);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2164,14 +2198,14 @@ void CChannelList::paintBody()
|
||||
|
||||
const int ypos = y+ theight;
|
||||
const int sb = height - theight - footerHeight; // paint scrollbar over full height of main box
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_MENUCONTENT_PLUS_1);
|
||||
|
||||
int sbc= (((*chanlist).size()- 1)/ listmaxshow)+ 1;
|
||||
const int sbs= (selected/listmaxshow);
|
||||
frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PASSIVE_PLUS_0);
|
||||
unsigned int listmaxshow_tmp = listmaxshow ? listmaxshow : 1;//avoid division by zero
|
||||
int sbc= (((*chanlist).size()- 1)/ listmaxshow_tmp)+ 1;
|
||||
const int sbs= (selected/listmaxshow_tmp);
|
||||
if (sbc < 1)
|
||||
sbc = 1;
|
||||
|
||||
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_MENUCONTENT_PLUS_3);
|
||||
frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0);
|
||||
showChannelLogo();
|
||||
if ((*chanlist).empty())
|
||||
paintButtonBar(false);
|
||||
@@ -2256,9 +2290,70 @@ void CChannelList::paintPig (int _x, int _y, int w, int h)
|
||||
}
|
||||
|
||||
void CChannelList::paint_events(int index)
|
||||
{
|
||||
if (index == -2 && paint_events_index > -2) {
|
||||
pthread_mutex_lock(&paint_events_mutex);
|
||||
paint_events_index = index;
|
||||
sem_post(&paint_events_sem);
|
||||
pthread_join(paint_events_thr, NULL);
|
||||
sem_destroy(&paint_events_sem);
|
||||
pthread_mutex_unlock(&paint_events_mutex);
|
||||
} else if (paint_events_index == -2) {
|
||||
if (index == -2)
|
||||
return;
|
||||
// First paint_event. No need to lock.
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ERRORCHECK_NP);
|
||||
pthread_mutex_init(&paint_events_mutex, &attr);
|
||||
|
||||
sem_init(&paint_events_sem, 0, 0);
|
||||
paint_events_index = index;
|
||||
if (!pthread_create(&paint_events_thr, NULL, paint_events, (void *) this))
|
||||
sem_post(&paint_events_sem);
|
||||
else
|
||||
paint_events_index = -2;
|
||||
} else {
|
||||
pthread_mutex_lock(&paint_events_mutex);
|
||||
paint_events_index = index;
|
||||
pthread_mutex_unlock(&paint_events_mutex);
|
||||
sem_post(&paint_events_sem);
|
||||
}
|
||||
}
|
||||
|
||||
void *CChannelList::paint_events(void *arg)
|
||||
{
|
||||
CChannelList *me = (CChannelList *) arg;
|
||||
me->paint_events();
|
||||
pthread_exit(NULL);
|
||||
}
|
||||
|
||||
void CChannelList::paint_events()
|
||||
{
|
||||
set_threadname(__func__);
|
||||
|
||||
while (paint_events_index != -2) {
|
||||
sem_wait(&paint_events_sem);
|
||||
if (paint_events_index < 0)
|
||||
continue;
|
||||
while(!sem_trywait(&paint_events_sem));
|
||||
int current_index = paint_events_index;
|
||||
|
||||
CChannelEventList evtlist;
|
||||
readEvents((*chanlist)[current_index]->getChannelID(), evtlist);
|
||||
if (current_index == paint_events_index) {
|
||||
pthread_mutex_lock(&paint_events_mutex);
|
||||
if (current_index == paint_events_index)
|
||||
paint_events_index = -1;
|
||||
pthread_mutex_unlock(&paint_events_mutex);
|
||||
paint_events(evtlist);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CChannelList::paint_events(CChannelEventList &evtlist)
|
||||
{
|
||||
ffheight = g_Font[eventFont]->getHeight();
|
||||
readEvents((*chanlist)[index]->getEpgID());
|
||||
frameBuffer->paintBoxRel(x+ width,y+ theight+pig_height, infozone_width, infozone_height,COL_MENUCONTENT_PLUS_0);
|
||||
|
||||
char startTime[10];
|
||||
@@ -2320,8 +2415,6 @@ void CChannelList::paint_events(int index)
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if ( !evtlist.empty() )
|
||||
evtlist.clear();
|
||||
}
|
||||
|
||||
static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b)
|
||||
@@ -2329,7 +2422,7 @@ static bool sortByDateTime (const CChannelEvent& a, const CChannelEvent& b)
|
||||
return a.startTime < b.startTime;
|
||||
}
|
||||
|
||||
void CChannelList::readEvents(const t_channel_id channel_id)
|
||||
void CChannelList::readEvents(const t_channel_id channel_id, CChannelEventList &evtlist)
|
||||
{
|
||||
CEitManager::getInstance()->getEventsServiceKey(channel_id , evtlist);
|
||||
|
||||
|
Reference in New Issue
Block a user