From 379d1ffa7667e0003a80bebf16e23f461d43f200 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 9 Aug 2017 19:11:27 +0200 Subject: [PATCH 1/5] CComponentsScrollBar: fix possible too small type size Possible segment count could be more than 265. Was a remnant from scrollbar test phase. --- src/gui/components/cc_frm_scrollbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_scrollbar.cpp b/src/gui/components/cc_frm_scrollbar.cpp index 2e59a630f..769733cf1 100644 --- a/src/gui/components/cc_frm_scrollbar.cpp +++ b/src/gui/components/cc_frm_scrollbar.cpp @@ -178,7 +178,7 @@ void CComponentsScrollBar::initSegments() fb_pixel_t passive_col = sb_visual_enable ? sb_segment_col : col_body; //create and add segments to segment container - for(u_int8_t i=0; i Date: Wed, 9 Aug 2017 20:28:08 +0200 Subject: [PATCH 2/5] CComponentsScrollBar: fix possible build error with -Werror=sign-compare --- src/gui/components/cc_frm_scrollbar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_scrollbar.h b/src/gui/components/cc_frm_scrollbar.h index 8bd1c0568..75746371f 100644 --- a/src/gui/components/cc_frm_scrollbar.h +++ b/src/gui/components/cc_frm_scrollbar.h @@ -49,7 +49,7 @@ class CComponentsScrollBar : public CComponentsFrmChain fb_pixel_t sb_segment_col, sb_segment_col_sel; ///count of segments - int sb_segments_count; + u_int32_t sb_segments_count; ///mark id int sb_mark_id; From b863f874b0cde8eb24bffc4bc8826e3c72d2f7d6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Wed, 9 Aug 2017 21:34:20 +0200 Subject: [PATCH 3/5] CComponentsScrollBar: use matching type names --- src/gui/components/cc_frm_scrollbar.cpp | 2 +- src/gui/components/cc_frm_scrollbar.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_scrollbar.cpp b/src/gui/components/cc_frm_scrollbar.cpp index 769733cf1..44c820311 100644 --- a/src/gui/components/cc_frm_scrollbar.cpp +++ b/src/gui/components/cc_frm_scrollbar.cpp @@ -178,7 +178,7 @@ void CComponentsScrollBar::initSegments() fb_pixel_t passive_col = sb_visual_enable ? sb_segment_col : col_body; //create and add segments to segment container - for(u_int32_t i=0; i Date: Fri, 11 Aug 2017 19:29:10 +0200 Subject: [PATCH 4/5] infoviewer.cpp: handle timeout of mode upnp like mode ts Signed-off-by: Thilo Graf Infobar timeout in the upnp mode is fixed to 6 sec. Because it's acting about streams, so we should use the same timeout such as with playing a movie file. --- src/gui/infoviewer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/infoviewer.cpp b/src/gui/infoviewer.cpp index 693f543c4..1629d4451 100644 --- a/src/gui/infoviewer.cpp +++ b/src/gui/infoviewer.cpp @@ -932,6 +932,7 @@ void CInfoViewer::setInfobarTimeout(int timeout_ext) timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_RADIO] + timeout_ext); break; case NeutrinoMessages::mode_ts: + case NeutrinoMessages::mode_upnp: timeoutEnd = CRCInput::calcTimeoutEnd (g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_MOVIE] == 0 ? 0xFFFF : g_settings.timing[SNeutrinoSettings::TIMING_INFOBAR_MOVIE] + timeout_ext); break; default: From 71f5779a40ce9ee9165bb31094344b1b19bf279e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Fri, 11 Aug 2017 18:36:15 +0200 Subject: [PATCH 5/5] CComponentsScrollBar: try to fix handling with very much segment count In some cases, eg. with very much pages in channellist, the effort to handle with all count of scrollbar segments was too much. Result: long waiting times during page scrolling and slider was not visible. This should be fixed now. --- src/gui/components/cc_frm_scrollbar.cpp | 41 +++++++++++++++---------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/gui/components/cc_frm_scrollbar.cpp b/src/gui/components/cc_frm_scrollbar.cpp index 44c820311..13006e722 100644 --- a/src/gui/components/cc_frm_scrollbar.cpp +++ b/src/gui/components/cc_frm_scrollbar.cpp @@ -147,14 +147,10 @@ void CComponentsScrollBar::initBottomNaviIcon() void CComponentsScrollBar::initSegments() { //init dimensions for segments - int w_seg = width - 2*fr_thickness - 2*append_x_offset; - if (w_seg < 0) - w_seg = 0; + int w_seg = max(0, width - 2*fr_thickness - 2*append_x_offset); //calculate height of segment container - int h_seg_obj = height - 2*fr_thickness - 2*sb_up_obj->getHeight() - 2*append_y_offset; - if (h_seg_obj < 0) - h_seg_obj = 0; + int h_seg_obj = max(0, height - 2*fr_thickness - 2*sb_up_obj->getHeight() - 2*append_y_offset); //init segment container if (sb_segments_obj == NULL){ @@ -169,30 +165,41 @@ void CComponentsScrollBar::initSegments() //clean up segment container before add new segments sb_segments_obj->clear(); + //hold segment count in this scope + uint32_t tmp_segments = sb_segments_count; + //set y position of 1st segment and set height of segments int y_seg = append_y_offset; - int h_seg = sb_segments_obj->getHeight()/sb_segments_count - append_y_offset; - if (h_seg < 0) - h_seg = 0; + int h_seg = max(0, int(sb_segments_obj->getHeight()/tmp_segments - append_y_offset)); + + //reduce required segment count and create a moderate segment height for better visibility of slider if we have very much segments. + uint32_t tmp_quot = 1; + if (h_seg == 0){ + h_seg = w_seg - append_y_offset; + tmp_segments = max(1, sb_segments_obj->getHeight() / (h_seg+append_y_offset)); + tmp_quot = uint32_t((float)sb_segments_count/(float)tmp_segments + 0.5); + } fb_pixel_t passive_col = sb_visual_enable ? sb_segment_col : col_body; //create and add segments to segment container - for(uint32_t i=0; igetCCItemId(item); //set color for marked id - if (sb_mark_id == id){ + if ((tmp_segments == sb_segments_count && sb_mark_id == id) || (tmp_segments != sb_segments_count && int(sb_mark_id/tmp_quot) == id)) + { item->setColorBody(sb_segment_col_sel); #if 0 item->enableColBodyGradient(CC_COLGRAD_COL_A_2_COL_B); item->setColBodyGradient(CColorGradient::gradientDark2Light2Dark, CFrameBuffer::gradientHorizontal); #endif } - else{ + else + { item->setColorBody(passive_col); #if 0 item->disableColBodyGradient(); @@ -203,19 +210,19 @@ void CComponentsScrollBar::initSegments() if (passive_col == col_body){ item->setCorner(RADIUS_MIN, CORNER_ALL); continue; - }else if (sb_segments_count == 1){ + }else if (tmp_segments == 1){ item->setCorner(RADIUS_MIN, CORNER_ALL); break; }else if(i == 0){ item->setCorner(RADIUS_MIN, CORNER_TOP); continue; - }else if(i == sb_segments_count - 1){ + }else if(i == tmp_segments - 1){ item->setCorner(RADIUS_MIN, CORNER_BOTTOM); break; - }else if((i > 0 && i < sb_segments_count - 1)){ - item->setCorner(RADIUS_MIN, CORNER_NONE); + }else if((i > 0 && i < tmp_segments - 1)){ + item->setCorner(RADIUS_NONE, CORNER_NONE); }else{ - item->setCorner(RADIUS_MIN, CORNER_NONE); + item->setCorner(RADIUS_NONE, CORNER_NONE); } } }