From bc564080839aad0f660f9b26723812e4178f91f5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Sep 2016 01:08:08 +0200 Subject: [PATCH 1/5] CComponentsFooter: remove defined font from footer cch_font has nothing to do with button font and is already inherited and defined from header class and can be redefined with setCaptionFont() methode if required. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3af698701ba59705a045e43fe851958bf7f32863 Author: Thilo Graf Date: 2016-09-24 (Sat, 24 Sep 2016) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_footer.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index a30fd2579..c895c45da 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -68,7 +68,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const width = w == 0 ? frameBuffer->getScreenWidth(true) : w; //init footer height - cch_font = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_FOOT]; height = max(h, cch_font->getHeight()); shadow = shadow_mode; From ee0ba6eb46b384b3b830ff38116b7a6e41363cb0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Sep 2016 00:14:35 +0200 Subject: [PATCH 2/5] CComponentsHeader: ensure clean object on reinit Items were destroyed with simple call of delete but not removed from item collection. removeCCItem() does this and destroys item objects too. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b205b0c8d02f85c9caf3151690cc93c438f57886 Author: Thilo Graf Date: 2016-09-24 (Sat, 24 Sep 2016) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_header.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index c1613516d..aad2e97d8 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -86,6 +86,7 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const fb_pixel_t color_shadow) { cc_item_type = CC_ITEMTYPE_FRM_HEADER; + clear(); cc_txt_save_screen = false; x = x_old = x_pos; y = y_old = y_pos; @@ -194,7 +195,7 @@ void CComponentsHeader::setIcon(const char* icon_name) void CComponentsHeader::setIcon(const std::string& icon_name) { - cch_icon_name = icon_name; + cch_icon_name = icon_name; initIcon(); } @@ -203,10 +204,8 @@ void CComponentsHeader::initIcon() //init cch_icon_obj only if an icon available if (cch_icon_name.empty()) { cch_icon_w = 0; - if (cch_icon_obj){ - delete cch_icon_obj; - cch_icon_obj = NULL; - } + if (cch_icon_obj) + removeCCItem(cch_icon_obj); return; } From dda8a0b099c3f8b38dcb4cf97aa478e2d4ab04c0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Sep 2016 00:16:56 +0200 Subject: [PATCH 3/5] CComponentsButton: use passed shadow parameter Shadow was always enabled. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/7c4e1c20b80514434a12d884019bef29f05aadf7 Author: Thilo Graf Date: 2016-09-24 (Sat, 24 Sep 2016) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_button.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_button.cpp b/src/gui/components/cc_frm_button.cpp index 24b2d8917..e67bd73b6 100644 --- a/src/gui/components/cc_frm_button.cpp +++ b/src/gui/components/cc_frm_button.cpp @@ -100,7 +100,7 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const width = w; height = h; shadow = shadow_mode; - shadow_w = SHADOW_OFFSET/2; //buttons are mostly small elements, so these elements should have a reasonable shadow width + shadow_w = shadow ? SHADOW_OFFSET/2 : 0; //buttons are mostly small elements, so these elements should have a reasonable shadow width cc_body_gradient_enable = CC_COLGRAD_OFF/*g_settings.gradiant*/; //TODO: gradient is prepared for use but disabled at the moment till some other parts of gui parts are provide gradient setColBodyGradient(cc_body_gradient_enable/*CColorGradient::gradientLight2Dark*/, CFrameBuffer::gradientVertical, CColorGradient::light); @@ -127,8 +127,8 @@ void CComponentsButton::initVarButton( const int& x_pos, const int& y_pos, const cc_btn_result = -1; cc_btn_alias = -1; - initParent(parent); initCCBtnItems(); + initParent(parent); } void CComponentsButton::initIcon() From 862fb8107e068766f440e6c3a26f1f43f2b64a19 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 24 Sep 2016 20:58:22 +0200 Subject: [PATCH 4/5] CMenuItem: use reasonable radius In some views the large radius looks too chunky. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/264366c792b0b494dceedbcc7a465802a9cd439f Author: Thilo Graf Date: 2016-09-24 (Sat, 24 Sep 2016) ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 412ccde7b..ef47e2f33 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -261,7 +261,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text } CComponentsShapeSquare col(stringstartposOption, y + 2, dx - stringstartposOption + x - 2, item_height - 4, NULL, false, right_frame_col, right_bg_col); col.setFrameThickness(3); - col.setCorner(RADIUS_LARGE); + col.setCorner(RADIUS_SMALL); col.paint(false); } if (*right_text) { From d35f8b74df6564514d05c4cc11e5176ae3cc1b5d Mon Sep 17 00:00:00 2001 From: Michael Liebmann Date: Sat, 24 Sep 2016 19:48:58 +0200 Subject: [PATCH 5/5] imageinfo_ni: Fix memory error Reported from AddressSanitizer (heap-use-after-free) Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/517e5e7ceed9ea6e7ba3e31835465463f2608a91 Author: Michael Liebmann Date: 2016-09-24 (Sat, 24 Sep 2016) Origin message was: ------------------ imageinfo_ni: Fix memory error Reported from AddressSanitizer (heap-use-after-free) ------------------ This commit was generated by Migit --- src/gui/imageinfo_ni.cpp | 26 +++++++++++++------------- src/gui/imageinfo_ni.h | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/gui/imageinfo_ni.cpp b/src/gui/imageinfo_ni.cpp index f6c6ccb55..eb8da53ae 100644 --- a/src/gui/imageinfo_ni.cpp +++ b/src/gui/imageinfo_ni.cpp @@ -206,7 +206,7 @@ void CImageInfoNI::paint_pig(int px, int py, int w, int h) g_PicViewer->DisplayImage(ICONSDIR "/start.jpg", px, py, w, h, frameBuffer->TM_NONE); } -void CImageInfoNI::paintLine(int xpos, int font, const char* text) +void CImageInfoNI::paintLine(int xpos, int font, std::string text) { g_Font[font]->RenderString(xpos, ypos, max_text_width, text, COL_INFOBAR_TEXT); } @@ -241,15 +241,15 @@ void CImageInfoNI::paint() CConfigFile config('\t'); config.loadConfig("/.version"); - const char * imagename = config.getString("imagename", "NI-Neutrino-HD").c_str(); - const char * homepage = config.getString("homepage", "www.neutrino-images.de").c_str(); - const char * creator = config.getString("creator", "NI-Team").c_str(); - const char * version = config.getString("version", "no version").c_str(); - const char * origin_commit = config.getString("origin-commit", "no commit").c_str(); - const char * builddate = config.getString("builddate", "no builddate").c_str(); + std::string imagename = config.getString("imagename", "NI-Neutrino-HD"); + std::string homepage = config.getString("homepage", "www.neutrino-images.de"); + std::string creator = config.getString("creator", "NI-Team"); + std::string version = config.getString("version", "no version"); + std::string origin_commit = config.getString("origin-commit", "no commit"); + std::string builddate = config.getString("builddate", "no builddate"); static CFlashVersionInfo versionInfo(version); - const char * releaseCycle = versionInfo.getReleaseCycle(); + std::string releaseCycle = versionInfo.getReleaseCycle(); struct utsname uts_info; @@ -262,11 +262,11 @@ void CImageInfoNI::paint() ypos += iheight; paintLine(xpos , font_info, g_Locale->getText(LOCALE_IMAGEINFO_VERSION)); - paintLine(xpos+offset, font_info, imageversion.str().c_str()); + paintLine(xpos+offset, font_info, imageversion.str()); ypos += iheight; paintLine(xpos , font_info, "Commit:"); - paintLine(xpos+offset, font_info, commits.str().c_str()); + paintLine(xpos+offset, font_info, commits.str()); ypos += iheight; paintLine(xpos , font_info, "Kernel:"); @@ -566,7 +566,7 @@ void CImageInfoNI::paint_DF_Info(int posx) get_DF_Info(); buf << "Imagesize (" << image_size.percent << " Percent):"; - paintLine(posx, font_small, buf.str().c_str()); + paintLine(posx, font_small, buf.str()); CProgressBar pb(boxX, boxY, boxW, boxH); pb.setFrameThickness(0); @@ -595,7 +595,7 @@ void CImageInfoNI::paint_DF_Info(int posx) } ypos+= sheight; - paintLine(posx, font_small, buf.str().c_str()); + paintLine(posx, font_small, buf.str()); buf.str(""); if (image_size.available > 1024) @@ -604,7 +604,7 @@ void CImageInfoNI::paint_DF_Info(int posx) buf << "Free: " << image_size.available << " KB"; ypos += sheight; - paintLine(posx, font_small, buf.str().c_str()); + paintLine(posx, font_small, buf.str()); } int CImageInfoNI::get_MEM_Info() diff --git a/src/gui/imageinfo_ni.h b/src/gui/imageinfo_ni.h index 025e19230..209a43a34 100644 --- a/src/gui/imageinfo_ni.h +++ b/src/gui/imageinfo_ni.h @@ -60,7 +60,7 @@ class CImageInfoNI : public CMenuTarget void paint(); void paint_pig(int x, int y, int w, int h); - void paintLine(int xpos, int font, const char* text); + void paintLine(int xpos, int font, std::string text); void clearLine(int xpos, int font); typedef struct {