mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
CComponentsPicture: add class CComponentsChannelLogo
This commit is contained in:
@@ -533,7 +533,7 @@ bool CPictureViewer::GetLogoName(const uint64_t& channel_id, const std::string&
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#if 0
|
||||||
bool CPictureViewer::DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height)
|
bool CPictureViewer::DisplayLogo (uint64_t channel_id, int posx, int posy, int width, int height)
|
||||||
{
|
{
|
||||||
char fname[255];
|
char fname[255];
|
||||||
@@ -558,7 +558,7 @@ bool CPictureViewer::DisplayLogo (uint64_t channel_id, int posx, int posy, int w
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
void CPictureViewer::rescaleImageDimensions(int *width, int *height, const int max_width, const int max_height, bool upscale)
|
void CPictureViewer::rescaleImageDimensions(int *width, int *height, const int max_width, const int max_height, bool upscale)
|
||||||
{
|
{
|
||||||
float aspect;
|
float aspect;
|
||||||
|
@@ -64,8 +64,8 @@ class CPictureViewer
|
|||||||
void SetVisible(int startx, int endx, int starty, int endy);
|
void SetVisible(int startx, int endx, int starty, int endy);
|
||||||
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=CFrameBuffer::TM_EMPTY);
|
bool DisplayImage (const std::string & name, int posx, int posy, int width, int height, int transp=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& channel_id, const std::string& ChanName, std::string & name, int *width = NULL, int *height = NULL);
|
virtual bool GetLogoName(const uint64_t& channel_id, const std::string& ChanName, std::string & name, int *width = NULL, int *height = NULL);
|
||||||
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);
|
||||||
|
@@ -206,3 +206,58 @@ void CComponentsPicture::hide(bool no_restore)
|
|||||||
hideCCItem(no_restore);
|
hideCCItem(no_restore);
|
||||||
pic_painted = false;
|
pic_painted = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CComponentsChannelLogo::CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
|
||||||
|
const uint64_t& channelId, const std::string& channelName,
|
||||||
|
const int alignment, bool has_shadow,
|
||||||
|
fb_pixel_t color_frame, fb_pixel_t color_background, fb_pixel_t color_shadow)
|
||||||
|
:CComponentsPicture(x_pos, y_pos, w, h,
|
||||||
|
"", alignment, has_shadow,
|
||||||
|
color_frame, color_background, color_shadow)
|
||||||
|
{
|
||||||
|
channel_id = channelId;
|
||||||
|
channel_name = channelName;
|
||||||
|
initVarPictureChannellLogo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsChannelLogo::setPicture(const std::string& picture_name)
|
||||||
|
{
|
||||||
|
pic_name = picture_name;
|
||||||
|
channel_id = 0;
|
||||||
|
channel_name = "";
|
||||||
|
initVarPictureChannellLogo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsChannelLogo::setChannel(const uint64_t& channelId, const std::string& channelName)
|
||||||
|
{
|
||||||
|
channel_id = channelId;
|
||||||
|
channel_name = channelName;
|
||||||
|
initVarPictureChannellLogo();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsChannelLogo::initVarPictureChannellLogo()
|
||||||
|
{
|
||||||
|
string tmp_logo = pic_name;
|
||||||
|
has_logo = false;
|
||||||
|
|
||||||
|
if (!(channel_id == 0 && channel_name.empty() && pic_name.empty()))
|
||||||
|
has_logo = GetLogoName(channel_id, channel_name, pic_name, &pic_width, &pic_height);
|
||||||
|
|
||||||
|
if (!has_logo)
|
||||||
|
pic_name = tmp_logo;
|
||||||
|
|
||||||
|
// #ifdef DEBUG_CC
|
||||||
|
printf(" [CComponentsChannelLogo] %s: init image: %s (has_logo=%d, channel_id=%lld)\n", __FUNCTION__, pic_name.c_str(), has_logo, channel_id);
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
initVarPicture();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CComponentsChannelLogo::paint(bool do_save_bg)
|
||||||
|
{
|
||||||
|
initVarPictureChannellLogo();
|
||||||
|
paintInit(do_save_bg);
|
||||||
|
paintPicture();
|
||||||
|
has_logo = false; //reset
|
||||||
|
}
|
||||||
|
@@ -89,4 +89,27 @@ class CComponentsPicture : public CComponentsItem
|
|||||||
virtual void setMaxHeight(const int h_max){pic_max_h = h_max;};
|
virtual void setMaxHeight(const int h_max){pic_max_h = h_max;};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CComponentsChannelLogo : public CComponentsPicture, CPictureViewer
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
///initialize all required attributes
|
||||||
|
void initVarPictureChannellLogo();
|
||||||
|
|
||||||
|
private:
|
||||||
|
uint64_t channel_id;
|
||||||
|
std::string channel_name;
|
||||||
|
bool has_logo;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CComponentsChannelLogo( const int x_pos, const int y_pos, const int w, const int h,
|
||||||
|
const uint64_t& channelId =0, const std::string& channelName = "",
|
||||||
|
const int alignment = CC_ALIGN_HOR_CENTER | CC_ALIGN_VER_CENTER, bool has_shadow = CC_SHADOW_OFF,
|
||||||
|
fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_background = 0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
|
|
||||||
|
void setChannel(const uint64_t& channelId, const std::string& channelName);
|
||||||
|
void setPicture(const std::string& picture_name);
|
||||||
|
bool hasLogo(){return has_logo;};
|
||||||
|
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user