From 34952348f552c2050227f5ff67737fab05663ef3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 27 Jan 2017 15:49:59 +0100 Subject: [PATCH 1/9] CComponentsText: add missing parameters to kill() methode Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f93a321c92315beb4108861812fc3634c9e279c7 Author: Thilo Graf Date: 2017-01-27 (Fri, 27 Jan 2017) --- src/gui/components/cc_item_text.cpp | 5 +++-- src/gui/components/cc_item_text.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index bd37e0d37..3c1b61e13 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -298,13 +298,14 @@ void CComponentsText::hide() ct_force_text_paint = true; } -void CComponentsText::kill() +void CComponentsText::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type) { if (ct_textbox) ct_textbox->hide(); ct_old_text.clear(); - CCDraw::kill(); + force_paint_bg = true; + CCDraw::kill(bg_color, corner_radius, fblayer_type); ct_force_text_paint = true; } diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index f744efba2..1de07d08c 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -139,7 +139,7 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///hide textbox void hide(); ///remove textbox from screen - void kill(); + void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES); ///paint text box, parameter do_save_bg: default = true, causes fill of backckrond pixel buffer void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); From 7f910e91a2b0bf07755a637876542932c38cc0c1 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 27 Jan 2017 14:50:22 +0100 Subject: [PATCH 2/9] CComponentsText: add signal OnBeforePaint into text paint() methode Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7395cd2685e5001e52916c366fa67799f53ec309 Author: Thilo Graf Date: 2017-01-27 (Fri, 27 Jan 2017) --- src/gui/components/cc_item_text.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 3c1b61e13..67ee50401 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -285,6 +285,7 @@ void CComponentsText::paintText(bool do_save_bg) void CComponentsText::paint(bool do_save_bg) { + OnBeforePaint(); paintText(do_save_bg); } From 06b5acf1a7fe316b726cd7448538e984ec6e245d Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 27 Jan 2017 20:30:05 +0100 Subject: [PATCH 3/9] CMenuWidget: add missing hide() for details line Details_line was not removed in all constellations when menu was closed. Sample: open main menue and select an entry with connect-line, eg. plugins, press key to come into submenu, then go back to main menue and close menu with home key, result: it's possible that line is still on screen. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a3ee3351b55fdded9eb28bf99d182364f4c1ef6f Author: Thilo Graf Date: 2017-01-27 (Fri, 27 Jan 2017) --- src/gui/widget/menue.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 5bf5010c3..843e39481 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1075,6 +1075,8 @@ void CMenuWidget::hide() header->kill(); if (info_box) info_box->kill(); + if (details_line) + details_line->hide(); frameBuffer->paintBackgroundBoxRel(x, y, full_width, full_height + fbutton_height); //paintHint(-1); } From d37290eb960bd5ad1a4cfe66e44ec5fd88332cff Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 28 Jan 2017 21:16:34 +0100 Subject: [PATCH 4/9] CVolumeBar: don't use digit height height is wrong and calculations for digit positions could be confused Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/c2c592a9917d07a5511288e985d89564589a81d9 Author: Thilo Graf Date: 2017-01-28 (Sat, 28 Jan 2017) --- src/gui/volumebar.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index a7fa30a75..85fc122b9 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -221,11 +221,6 @@ void CVolumeBar::initVolumeBarDigit() //refresh and paint digit void CVolumeBar::paintVolumeBarDigit() { - // digits - CTextBox* ctb = vb_digit->getCTextBoxObject(); - if (ctb) - ctb->setFontUseDigitHeight(); - // paint digit vb_digit->paint(CC_SAVE_SCREEN_NO); } From f21e21d7d2eaa155319e4292ec4fd3cfc69345a7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sat, 28 Jan 2017 23:06:47 +0100 Subject: [PATCH 5/9] CVolumeBar: use CORNER_RADIUS_MID cornerRad() is not really the best solution. Inner items are fit with full height and should use the same value. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/e1d5eb7aeaeac5082228639dede261d16cdbf821 Author: Thilo Graf Date: 2017-01-28 (Sat, 28 Jan 2017) --- src/gui/volumebar.cpp | 8 ++++---- src/gui/volumebar.h | 3 --- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 85fc122b9..99c971c81 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -47,7 +47,7 @@ CVolumeBar::CVolumeBar() void CVolumeBar::initVarVolumeBar() { col_body = COL_MENUCONTENT_PLUS_0; - + corner_rad = CORNER_RADIUS_MID; vb_item_offset = 4; height = g_settings.volume_size; //default height @@ -84,7 +84,7 @@ void CVolumeBar::initVolumeBarSize() cvh->getDimensions(&x, &y, &sw, &sh, &vb_icon_w, &vb_digit_w); cvh->getVolBarDimensions(&y, &height); - vb_digit_w += cornerRad()/2; + //vb_digit_w += corner_rad/2; //scale vb_pbw = 200; @@ -177,7 +177,7 @@ void CVolumeBar::initVolumeBarIcon() vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); vb_icon->setColorBody(col_body); - vb_icon->setCorner(cornerRad(), CORNER_LEFT); + vb_icon->setCorner(corner_rad, CORNER_LEFT); //add icon to container addCCItem(vb_icon); @@ -210,7 +210,7 @@ void CVolumeBar::initVolumeBarDigit() vb_digit->setDimensionsAll(vb_digit_x, 0, vb_digit_w, height); vb_digit->setTextColor(COL_MENUCONTENT_TEXT); - vb_digit->setCorner(cornerRad(), CORNER_RIGHT); + vb_digit->setCorner(corner_rad, CORNER_RIGHT); vb_digit->doPaintTextBoxBg(true); initVolumeBarDigitValue(); diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index 62ce4d90c..9989eded3 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -72,9 +72,6 @@ class CVolumeBar : public CComponentsForm void paintVolScale(); void paintVolumeBarDigit(); -// inline int cornerRad() { return (g_settings.rounded_corners) ? height/2 : 0; } - inline int cornerRad() { return (g_settings.rounded_corners) ? CORNER_RADIUS_SMALL : 0; } - public: enum From 0f221bb46f8b129a014e5764d7090526073b3624 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 29 Jan 2017 19:43:14 +0100 Subject: [PATCH 6/9] CVolumeBar: use OFFSET_INNER_SMALL instead static value for item offset Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/8e9be4ab6030a6c962a72fb8cd5d69261d698019 Author: Thilo Graf Date: 2017-01-29 (Sun, 29 Jan 2017) --- src/gui/volumebar.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 99c971c81..b9a25ca16 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -48,7 +48,7 @@ void CVolumeBar::initVarVolumeBar() { col_body = COL_MENUCONTENT_PLUS_0; corner_rad = CORNER_RADIUS_MID; - vb_item_offset = 4; + vb_item_offset = OFFSET_INNER_SMALL; height = g_settings.volume_size; //default height //assume volume value as pointer to global setting @@ -91,7 +91,7 @@ void CVolumeBar::initVolumeBarSize() vb_pbh = height-4*vb_item_offset; //result for width - width = (vb_icon_w + vb_pbw + vb_digit_w) + 4*vb_item_offset; + width = (vb_icon_w + vb_pbw + vb_digit_w) + 4*vb_item_offset + corner_rad/2; //adapt x-pos vb_pbx = vb_item_offset + vb_icon_w + vb_item_offset; From b6ca81bb97cab8e2d6a3b99ba053dbfbe9311576 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 29 Jan 2017 20:24:50 +0100 Subject: [PATCH 7/9] CVolumeBar: add missing paint() methode, avoid multiple iitem instances Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/54e88023977eb70656f9da07077173d084acd08f Author: Thilo Graf Date: 2017-01-29 (Sun, 29 Jan 2017) --- src/gui/volumebar.cpp | 39 ++++++++++++++++++++++++++------------- src/gui/volumebar.h | 1 + 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index b9a25ca16..4d58d027f 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -174,48 +174,49 @@ void CVolumeBar::initVolumeBarItems() //init current icon object void CVolumeBar::initVolumeBarIcon() { - vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); + if (!vb_icon){ + vb_icon = new CComponentsPicture(vb_icon_x, CC_CENTERED, vb_icon_w, height, NEUTRINO_ICON_VOLUME); + //add icon to container + addCCItem(vb_icon); + } + vb_icon->setDimensionsAll(vb_icon_x, CC_CENTERED, vb_icon_w, height); vb_icon->setColorBody(col_body); vb_icon->setCorner(corner_rad, CORNER_LEFT); - - //add icon to container - addCCItem(vb_icon); } //create new scale void CVolumeBar::initVolumeBarScale() { - vb_pb = new CProgressBar(); + if (!vb_pb){ + vb_pb = new CProgressBar(); + //add progressbar to container + addCCItem(vb_pb); + } vb_pb->setType(CProgressBar::PB_REDRIGHT); vb_pb->setRgb(85, 75, 100); vb_pb->setFrameThickness(2); vb_pb->setProgress(vb_pbx, vb_pby, vb_pbw, vb_pbh, *vb_vol, 100); - - //add progressbar to container - addCCItem(vb_pb); } //set digit text with current volume value void CVolumeBar::initVolumeBarDigitValue() { + vb_digit->kill(col_body); vb_digit->setText(*vb_vol ,vb_digit_mode, *(CVolumeHelper::getInstance()->vb_font)); } //create digit void CVolumeBar::initVolumeBarDigit() { - vb_digit = new CComponentsLabel(); + if (!vb_digit) + vb_digit = new CComponentsLabel(this); vb_digit->setDimensionsAll(vb_digit_x, 0, vb_digit_w, height); vb_digit->setTextColor(COL_MENUCONTENT_TEXT); vb_digit->setCorner(corner_rad, CORNER_RIGHT); - vb_digit->doPaintTextBoxBg(true); initVolumeBarDigitValue(); - - //add digit label to container - addCCItem(vb_digit); } //refresh and paint digit @@ -244,6 +245,18 @@ void CVolumeBar::paintVolScale() vb_pb->paint(CC_SAVE_SCREEN_NO); } +void CVolumeBar::paint(bool do_save_bg) +{ + //prepare items + initVolumeBarItems(); + + //paint form contents + if (!is_painted) + CComponentsForm::paint(do_save_bg); + else + repaintVolScale(); +} + // CVolumeHelper #################################################################################################### diff --git a/src/gui/volumebar.h b/src/gui/volumebar.h index 9989eded3..cfc201305 100644 --- a/src/gui/volumebar.h +++ b/src/gui/volumebar.h @@ -89,6 +89,7 @@ class CVolumeBar : public CComponentsForm // ~CVolumeBar(); inherited from CComponentsForm void repaintVolScale(); + void paint(bool do_save_bg = CC_SAVE_SCREEN_YES); }; From 07e46bcfa728ddc29e08c4eaa1b9b79abcb4015a Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 29 Jan 2017 20:44:53 +0100 Subject: [PATCH 8/9] CVolume: replace repaintVolScale() with paint() paint() contains repaintVolScale() Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/a163d5b17b8ca8dcc65e620d7c8578d5cc5b3887 Author: Thilo Graf Date: 2017-01-29 (Sun, 29 Jan 2017) Origin message was: ------------------ CVolume: replace repaintVolScale() with paint() paint() contains repaintVolScale() --- src/driver/volume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/volume.cpp b/src/driver/volume.cpp index 4a3112c52..9b66449fd 100644 --- a/src/driver/volume.cpp +++ b/src/driver/volume.cpp @@ -159,7 +159,7 @@ void CVolume::setVolume(const neutrino_msg_t key) if (volscale) { if(vol != g_settings.current_volume) { vol = g_settings.current_volume; - volscale->repaintVolScale(); + volscale->paint(); } } From 9c4cba3a57b18aec9c4ec2c40b79bcdf3a02ad35 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Sun, 29 Jan 2017 22:31:21 +0100 Subject: [PATCH 9/9] streaminfo2: add comment because of broken libcoolstream2 output Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/891bc71f9d834fa72427fbcb10a8dec153d49653 Author: vanhofen Date: 2017-01-29 (Sun, 29 Jan 2017) Origin message was: ------------------ - streaminfo2: add comment because of broken libcoolstream2 output --- src/gui/streaminfo2.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 7d9d6e93c..d99ab6818 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -620,12 +620,17 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) average_bitrate_pos = ypos += iheight; //AUDIOTYPE ypos += iheight; - int type, layer, freq, mode, lbitrate; - audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); snprintf(buf, sizeof(buf), "%s:", g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT); + int type, layer, freq, mode, lbitrate; + /* + audioDecoder->getAudioInfo() seems broken in libcoolstream2. + ddmode is always 1 ("CH1/CH2"). + */ + audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); + if (type == AUDIO_FMT_MPEG) { const char *mpegmodes[] =