show event logos only in infoviewer

This commit is contained in:
TangoCash
2018-12-25 01:12:16 +01:00
committed by Thilo Graf
parent 1d0d8ade9c
commit 93f74ef829
5 changed files with 15 additions and 7 deletions

View File

@@ -529,7 +529,7 @@ void CPictureViewer::getSize(const char* name, int* width, int *height)
} }
} }
bool CPictureViewer::GetLogoName(const uint64_t &ChannelID, const std::string &ChannelName, std::string &name, int *width, int *height, bool lcd4l_mode) bool CPictureViewer::GetLogoName(const uint64_t &ChannelID, const std::string &ChannelName, std::string &name, int *width, int *height, bool lcd4l_mode, bool enable_event_logo)
{ {
std::string fileType[] = { ".png", ".jpg", ".gif" }; std::string fileType[] = { ".png", ".jpg", ".gif" };
std::vector<std::string> v_path; std::vector<std::string> v_path;
@@ -538,7 +538,7 @@ bool CPictureViewer::GetLogoName(const uint64_t &ChannelID, const std::string &C
// create eventname for eventlogos; Note: We don't process channellogos if any eventlogo was found. // create eventname for eventlogos; Note: We don't process channellogos if any eventlogo was found.
std::string EventName = ""; std::string EventName = "";
int mode = CNeutrinoApp::getInstance()->getMode(); int mode = CNeutrinoApp::getInstance()->getMode();
if (ChannelID || mode == NeutrinoModes::mode_ts) if (enable_event_logo && (ChannelID || mode == NeutrinoModes::mode_ts))
{ {
// TODO: fix eventlogo in moviebrowser // TODO: fix eventlogo in moviebrowser

View File

@@ -67,7 +67,7 @@ class CPictureViewer
static double m_aspect_ratio_correction; static double m_aspect_ratio_correction;
bool DisplayImage (const std::string & name, int posx, int posy, int width, int height, int transp=0 /*CFrameBuffer::TM_EMPTY*/); bool DisplayImage (const std::string & name, int posx, int posy, int width, int height, int transp=0 /*CFrameBuffer::TM_EMPTY*/);
// bool DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height); // bool DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height);
bool GetLogoName(const uint64_t &ChannelID, const std::string &ChannelName, std::string &name, int *width = NULL, int *height = NULL, bool lcd4l_mode = false); bool GetLogoName(const uint64_t &ChannelID, const std::string &ChannelName, std::string &name, int *width = NULL, int *height = NULL, bool lcd4l_mode = false, bool enable_event_logo = false);
fb_pixel_t * getImage (const std::string & name, int width, int height); fb_pixel_t * getImage (const std::string & name, int width, int height);
fb_pixel_t * getIcon (const std::string & name, int *width, int *height); fb_pixel_t * getIcon (const std::string & name, int *width, int *height);
void getSize(const char *name, int* width, int *height); void getSize(const char *name, int* width, int *height);

View File

@@ -407,6 +407,7 @@ void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string&
alt_pic_name = ""; alt_pic_name = "";
setChannel(channelId, channelName); setChannel(channelId, channelName);
do_scale = allow_scale; do_scale = allow_scale;
enable_event_logo = false;
} }
void CComponentsChannelLogo::setAltLogo(const std::string& picture_name) void CComponentsChannelLogo::setAltLogo(const std::string& picture_name)
{ {
@@ -444,7 +445,7 @@ void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::st
int dummy; int dummy;
has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy); has_logo = g_PicViewer->GetLogoName(channel_id, channel_name, image, &dummy, &dummy, false, enable_event_logo);
if (!has_logo)//no logo was found, use altrenate icon or logo if (!has_logo)//no logo was found, use altrenate icon or logo
image = alt_pic_name; image = alt_pic_name;

View File

@@ -200,7 +200,10 @@ class CComponentsChannelLogo : public CComponentsPicture
uint64_t channel_id; uint64_t channel_id;
///channel name ///channel name
std::string channel_name; std::string channel_name;
///mode of event logo
bool enable_event_logo;
///alternate image file, if no channel logo is available ///alternate image file, if no channel logo is available
std::string alt_pic_name; std::string alt_pic_name;
@@ -250,7 +253,11 @@ class CComponentsChannelLogo : public CComponentsPicture
void setAltLogo(const std::string& picture_name); void setAltLogo(const std::string& picture_name);
///set an alternate logo if no logo is available, NOTE: value of has_logo will set to true ///set an alternate logo if no logo is available, NOTE: value of has_logo will set to true
void setAltLogo(const char* picture_name); void setAltLogo(const char* picture_name);
///enable/disable eventlogo
void enableEventLogo(bool enable = true){enable_event_logo = enable;}
void disableEventLogo(){enableEventLogo(false);}
///returns true, if any logo is available, also if an alternate logo was setted ///returns true, if any logo is available, also if an alternate logo was setted
bool hasLogo(){return has_logo;}; bool hasLogo(){return has_logo;};

View File

@@ -2146,7 +2146,7 @@ int CInfoViewer::showChannelLogo(const t_channel_id logo_channel_id, const int c
int start_x = ChanNameX; int start_x = ChanNameX;
int chan_w = BoxEndX - (start_x + 2*OFFSET_INNER_MID) - time_width - OFFSET_INNER_MID; int chan_w = BoxEndX - (start_x + 2*OFFSET_INNER_MID) - time_width - OFFSET_INNER_MID;
bool logo_available = g_PicViewer->GetLogoName(logo_channel_id, ChannelName, strAbsIconPath, &logo_w, &logo_h); bool logo_available = g_PicViewer->GetLogoName(logo_channel_id, ChannelName, strAbsIconPath, &logo_w, &logo_h, false, true);
//fprintf(stderr, "%s: logo_available: %d file: %s\n", __FUNCTION__, logo_available, strAbsIconPath.c_str()); //fprintf(stderr, "%s: logo_available: %d file: %s\n", __FUNCTION__, logo_available, strAbsIconPath.c_str());