mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-28 07:51:19 +02:00
* CComponentsText: Use 'std::string' instead of 'const char*' for ct_text
This commit is contained in:
@@ -185,7 +185,7 @@ class CComponentsText : public CComponentsItem
|
|||||||
|
|
||||||
fb_pixel_t ct_col_text;
|
fb_pixel_t ct_col_text;
|
||||||
int ct_text_mode; //see textbox.h for possible modes
|
int ct_text_mode; //see textbox.h for possible modes
|
||||||
const char* ct_text;
|
std::string ct_text;
|
||||||
bool ct_text_sent, ct_paint_textbg;
|
bool ct_text_sent, ct_paint_textbg;
|
||||||
|
|
||||||
std::string iToString(int int_val); //helper to convert int to string
|
std::string iToString(int int_val); //helper to convert int to string
|
||||||
@@ -197,7 +197,7 @@ class CComponentsText : public CComponentsItem
|
|||||||
public:
|
public:
|
||||||
CComponentsText();
|
CComponentsText();
|
||||||
CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
|
||||||
const char* text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
|
std::string text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
|
||||||
bool has_shadow = CC_SHADOW_OFF,
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
virtual ~CComponentsText();
|
virtual ~CComponentsText();
|
||||||
@@ -255,7 +255,7 @@ class CComponentsInfoBox : public CComponentsText
|
|||||||
|
|
||||||
CComponentsInfoBox();
|
CComponentsInfoBox();
|
||||||
CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsInfoBox( const int x_pos, const int y_pos, const int w, const int h,
|
||||||
const char* info_text = NULL, const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
|
std::string info_text = "", const int mode = CTextBox::AUTO_WIDTH, Font* font_text = NULL,
|
||||||
bool has_shadow = CC_SHADOW_OFF,
|
bool has_shadow = CC_SHADOW_OFF,
|
||||||
fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
fb_pixel_t color_text = COL_MENUCONTENT, fb_pixel_t color_frame = COL_MENUCONTENT_PLUS_6, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ CComponentsInfoBox::CComponentsInfoBox()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsInfoBox::CComponentsInfoBox(const int x_pos, const int y_pos, const int w, const int h,
|
||||||
const char* info_text, const int mode, Font* font_text,
|
std::string info_text, const int mode, Font* font_text,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
@@ -128,7 +128,7 @@ void CComponentsInfoBox::paint(bool do_save_bg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//set text and paint text lines
|
//set text and paint text lines
|
||||||
if (ct_text){
|
if (!ct_text.empty()){
|
||||||
if (cctext)
|
if (cctext)
|
||||||
delete cctext;
|
delete cctext;
|
||||||
|
|
||||||
|
@@ -43,7 +43,7 @@ CComponentsText::CComponentsText()
|
|||||||
}
|
}
|
||||||
|
|
||||||
CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
|
CComponentsText::CComponentsText( const int x_pos, const int y_pos, const int w, const int h,
|
||||||
const char* text, const int mode, Font* font_text,
|
std::string text, const int mode, Font* font_text,
|
||||||
bool has_shadow,
|
bool has_shadow,
|
||||||
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
fb_pixel_t color_text, fb_pixel_t color_frame, fb_pixel_t color_body, fb_pixel_t color_shadow)
|
||||||
{
|
{
|
||||||
@@ -88,7 +88,7 @@ void CComponentsText::initVarText()
|
|||||||
ct_font = NULL;
|
ct_font = NULL;
|
||||||
ct_box = NULL;
|
ct_box = NULL;
|
||||||
ct_textbox = NULL;
|
ct_textbox = NULL;
|
||||||
ct_text = NULL;
|
ct_text = "";
|
||||||
ct_text_mode = CTextBox::AUTO_WIDTH;
|
ct_text_mode = CTextBox::AUTO_WIDTH;
|
||||||
ct_col_text = COL_MENUCONTENT;
|
ct_col_text = COL_MENUCONTENT;
|
||||||
ct_text_sent = false;
|
ct_text_sent = false;
|
||||||
@@ -164,9 +164,7 @@ void CComponentsText::setText(neutrino_locale_t locale_text, int mode, Font* fon
|
|||||||
|
|
||||||
void CComponentsText::setText(const char* ctext, const int mode, Font* font_text)
|
void CComponentsText::setText(const char* ctext, const int mode, Font* font_text)
|
||||||
{
|
{
|
||||||
ct_text = ctext;
|
setText((string)ctext, mode, font_text);
|
||||||
ct_text_mode = mode;
|
|
||||||
ct_font = font_text;
|
|
||||||
#ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
printf(" [CComponentsText] [%s - %d] text: %s \n", __FUNCTION__, __LINE__, ctext);
|
printf(" [CComponentsText] [%s - %d] text: %s \n", __FUNCTION__, __LINE__, ctext);
|
||||||
#endif
|
#endif
|
||||||
@@ -174,9 +172,11 @@ void CComponentsText::setText(const char* ctext, const int mode, Font* font_text
|
|||||||
|
|
||||||
void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text)
|
void CComponentsText::setText(const std::string& stext, const int mode, Font* font_text)
|
||||||
{
|
{
|
||||||
setText(stext.c_str(), mode, font_text);
|
ct_text = stext;
|
||||||
|
ct_text_mode = mode;
|
||||||
|
ct_font = font_text;
|
||||||
#ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __FUNCTION__, __LINE__, ct_text);
|
printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __FUNCTION__, __LINE__, ct_text.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,7 +185,7 @@ void CComponentsText::setText(const int digit, const int mode, Font* font_text)
|
|||||||
string s_digit = iToString(digit);
|
string s_digit = iToString(digit);
|
||||||
setText(s_digit, mode, font_text);
|
setText(s_digit, mode, font_text);
|
||||||
#ifdef DEBUG_CC
|
#ifdef DEBUG_CC
|
||||||
printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __FUNCTION__, __LINE__, ct_text);
|
printf(" [CComponentsText] [%s - %d] ct_text: %s \n", __FUNCTION__, __LINE__, ct_text.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user