From d9224e10509ef141ad96b62fb96ee64aab5e14e7 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 11 Jun 2017 20:00:33 +0200 Subject: [PATCH 01/45] src/gui/movieplayer.cpp fix possible segfault Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cca6526b2f2f7415841c6aa698a8c221a26962bd Author: Jacek Jendrzej Date: 2017-06-11 (Sun, 11 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/movieplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index d108e5473..5ecc32a27 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -923,7 +923,7 @@ bool CMoviePlayerGui::selectLivestream(std::vector &streamLis #endif bool resIO = false; - while (1) { + while (!streamList.empty()) { size_t i; for (i = 0; i < streamList.size(); ++i) { _info = &(streamList[i]); From e4f4307eb6728878d6f179e233e526e044c6d830 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Mon, 12 Jun 2017 13:14:32 +0200 Subject: [PATCH 02/45] vfd-setup: fix brightness setup for CST's boxmodel "Link" ... and hide the brightness menu for all "Trinity" models. There's no display. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c0d367dca93754c9691806fc50abb66b7d855a99 Author: vanhofen Date: 2017-06-12 (Mon, 12 Jun 2017) Origin message was: ------------------ - vfd-setup: fix brightness setup for CST's boxmodel "Link" ... and hide the brightness menu for all "Trinity" models. There's no display. ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 2 +- data/locale/english.locale | 6 +++--- lib/hardware/coolstream/hardware_caps.cpp | 2 ++ src/gui/vfd_setup.cpp | 6 +++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index ba4cc593b..c4dbd195b 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -1007,7 +1007,7 @@ lcd4l_weather Wetter im Standby-Modus lcd_info_line Zeige in Infozeile lcd_info_line_channel Kanalname lcd_info_line_clock Uhrzeit -lcdcontroler.brightness normale +lcdcontroler.brightness Normalbetrieb lcdcontroler.brightnessdeepstandby Deep-Standby lcdcontroler.brightnessstandby Standby lcdmenu.dim_brightness nach Dimm-Timeout diff --git a/data/locale/english.locale b/data/locale/english.locale index b5f543b09..61dba810e 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -1007,9 +1007,9 @@ lcd4l_weather Weather in Standby-Mode lcd_info_line show in infoline lcd_info_line_channel Channelname lcd_info_line_clock clock -lcdcontroler.brightness normal Brightness -lcdcontroler.brightnessdeepstandby DeepStandby Brightness -lcdcontroler.brightnessstandby Standby Brightness +lcdcontroler.brightness Normal mode +lcdcontroler.brightnessdeepstandby Deep standby +lcdcontroler.brightnessstandby Standby lcdmenu.dim_brightness Brightness after dim timeout lcdmenu.dim_time Dim timeout lcdmenu.head VFD/LED Settings diff --git a/lib/hardware/coolstream/hardware_caps.cpp b/lib/hardware/coolstream/hardware_caps.cpp index b4d4c0a46..139825c32 100644 --- a/lib/hardware/coolstream/hardware_caps.cpp +++ b/lib/hardware/coolstream/hardware_caps.cpp @@ -75,6 +75,7 @@ hw_caps_t *get_hwcaps(void) { strcpy(caps.boxname, "Trinity V2"); strcpy(caps.boxarch, "Kronos"); } + caps.can_set_display_brightness = 0; break; case 12: strcpy(caps.boxname, "Zee2"); @@ -87,6 +88,7 @@ hw_caps_t *get_hwcaps(void) { case 14: strcpy(caps.boxname, "Trinity Duo"); strcpy(caps.boxarch, "Kronos"); + caps.can_set_display_brightness = 0; break; default: strcpy(caps.boxname, "UNKNOWN_BOX"); diff --git a/src/gui/vfd_setup.cpp b/src/gui/vfd_setup.cpp index 4de1c2414..05ca2ac49 100644 --- a/src/gui/vfd_setup.cpp +++ b/src/gui/vfd_setup.cpp @@ -129,12 +129,16 @@ int CVfdSetup::showSetup() vfds->addItem(mf); } - if (CVFD::getInstance()->has_lcd) { + if (g_info.hw_caps->can_set_display_brightness) + { //vfd brightness menu mf = new CMenuForwarder(LOCALE_LCDMENU_LCDCONTROLER, vfd_enabled, NULL, this, "brightness", CRCInput::RC_green); mf->setHint("", LOCALE_MENU_HINT_VFD_BRIGHTNESS_SETUP); vfds->addItem(mf); + } + if (CVFD::getInstance()->has_lcd) + { if (cs_get_revision() == 9) // Tank only { //backlight menu From 28762e931a74090b8c2d9d68576b416f09013cd6 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Tue, 13 Jun 2017 12:44:26 +0200 Subject: [PATCH 03/45] volumebar: use OFFSET defines; fix height of progressbar Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1c4fb116dbf56c91e5b6eacb09152c36c0b2989e Author: vanhofen Date: 2017-06-13 (Tue, 13 Jun 2017) Origin message was: ------------------ - volumebar: use OFFSET defines; fix height of progressbar ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/volumebar.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 8322aea65..d4eada083 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -92,7 +92,7 @@ void CVolumeBar::initVolumeBarSize() //scale vb_pbw = CFrameBuffer::getInstance()->scale2Res(200); - vb_pbh = height-4*vb_item_offset; + vb_pbh = height-2*vb_item_offset; //result for width width = (vb_icon_w + vb_pbw + vb_digit_w) + 4*vb_item_offset + corner_rad/2; @@ -112,8 +112,6 @@ void CVolumeBar::initVolumeBarSize() mute_corrY = (height - mute_dy) / 2; cvh->setMuteIconCorrY(mute_corrY); - vb_pbh = height-8; - vb_pby = height/2-vb_pbh/2; } @@ -267,8 +265,8 @@ void CVolumeBar::paint(bool do_save_bg) CVolumeHelper::CVolumeHelper() { - h_spacer = 11; - v_spacer = 6; + h_spacer = OFFSET_INNER_MID; + v_spacer = OFFSET_INNER_SMALL; vb_font = NULL; clock_font = NULL; @@ -359,8 +357,8 @@ void CVolumeHelper::initVolBarSize() digit_width = 0; frameBuffer->getIconSize(NEUTRINO_ICON_VOLUME, &icon_width, &icon_height); icon_height = max(icon_height, 16); // if no icon available - icon_height += 2; - icon_width += 8; + icon_height += OFFSET_INNER_MIN; + icon_width += OFFSET_INNER_MID; g_settings.volume_size = max(g_settings.volume_size, icon_height); vol_height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size); @@ -370,7 +368,7 @@ void CVolumeHelper::initVolBarSize() int tmp_h = vol_height; digit_width = 0; vb_font = cnf->getDynFont(digit_width, tmp_h, "100", CNeutrinoFonts::FONT_STYLE_REGULAR, CNeutrinoFonts::FONT_ID_VOLBAR); - digit_width += 6; + digit_width += OFFSET_INNER_SMALL; vol_height = max(vol_height, tmp_h); } } From cb942044f34cce8846fc86c868e8b535843a6f0f Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 13 Jun 2017 13:34:17 +0200 Subject: [PATCH 04/45] src/driver/pictureviewer/pictureviewer.cpp add bufferram and cached to calc freemem Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1f0a1bfdf25ba4f489d5e738940fab66ec1a5d61 Author: Jacek Jendrzej Date: 2017-06-13 (Tue, 13 Jun 2017) Origin message was: ------------------ src/driver/pictureviewer/pictureviewer.cpp add bufferram and cached to calc freemem ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/pictureviewer/pictureviewer.cpp | 30 ++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index f93779996..6c4ed8f42 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -854,12 +854,38 @@ unsigned char * CPictureViewer::ResizeA(unsigned char *orgin, int ox, int oy, in return int_Resize(orgin, ox, oy, dx, dy, COLOR, NULL, true); } +static size_t getCachedMemSize(void) +{ + FILE *procmeminfo = fopen("/proc/meminfo", "r"); + size_t cached = 0; + if (procmeminfo) { + char buf[80] = {0}, a[80] = {0}; + size_t v = 0; + while (fgets(buf, sizeof(buf), procmeminfo)) { + char unit[10]; + *unit = 0; + if ((3 == sscanf(buf, "%[^:]: %llu %s", a, &v, unit)) + || (2 == sscanf(buf, "%[^:]: %llu", a, &v))) { + if (*unit == 'k') + v <<= 10; + if (!strcasecmp(a, "Cached")){ + cached = v; + break; + } + } + } + fclose(procmeminfo); + } + return cached; +} + bool CPictureViewer::checkfreemem(size_t bufsize) { struct sysinfo info; sysinfo( &info ); - if(bufsize + 4096 > (size_t)info.freeram + (size_t)info.freeswap){ - dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: Out of memory: need %zu > free %zu\n", __func__, __LINE__,bufsize,(size_t)info.freeram + (size_t)info.freeswap); + size_t cached = getCachedMemSize(); + if(bufsize + sysconf(_SC_PAGESIZE) > (size_t)info.freeram + (size_t)info.freeswap + (size_t)info.bufferram + cached){ + dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: Out of memory: need %zu > free %zu\n", __func__, __LINE__,bufsize,(size_t)info.freeram + (size_t)info.freeswap + (size_t)info.bufferram + cached); return false; } return true; From b740521d7fac40cc5cd6d62f7ebb91cbf69f2089 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 13 Jun 2017 14:23:56 +0200 Subject: [PATCH 05/45] supplement to cb942044f34cce8846fc86c868e8b535843a6f0f Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/30b1c3f286e7b634f6f17b79838285ca24a94b31 Author: Jacek Jendrzej Date: 2017-06-13 (Tue, 13 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/pictureviewer/pictureviewer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index 6c4ed8f42..f3a1a03a0 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -860,7 +860,7 @@ static size_t getCachedMemSize(void) size_t cached = 0; if (procmeminfo) { char buf[80] = {0}, a[80] = {0}; - size_t v = 0; + long long unsigned int v = 0; while (fgets(buf, sizeof(buf), procmeminfo)) { char unit[10]; *unit = 0; From b31221c2097529dd371c5148022fa2d621643094 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Tue, 13 Jun 2017 14:30:37 +0200 Subject: [PATCH 06/45] 2 supplement to cb942044f34cce8846fc86c868e8b535843a6f0f Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/85cff28f07a7e7e36db210f80b3b63a585577ca6 Author: Jacek Jendrzej Date: 2017-06-13 (Tue, 13 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/driver/pictureviewer/pictureviewer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index f3a1a03a0..90947fe39 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -860,12 +860,12 @@ static size_t getCachedMemSize(void) size_t cached = 0; if (procmeminfo) { char buf[80] = {0}, a[80] = {0}; - long long unsigned int v = 0; + size_t v = 0; while (fgets(buf, sizeof(buf), procmeminfo)) { char unit[10]; *unit = 0; - if ((3 == sscanf(buf, "%[^:]: %llu %s", a, &v, unit)) - || (2 == sscanf(buf, "%[^:]: %llu", a, &v))) { + if ((3 == sscanf(buf, "%[^:]: %zu %s", a, &v, unit)) + || (2 == sscanf(buf, "%[^:]: %zu", a, &v))) { if (*unit == 'k') v <<= 10; if (!strcasecmp(a, "Cached")){ From c7dfb219706d3353ca997eae32f32af31b6ed45d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Jun 2017 14:57:09 +0200 Subject: [PATCH 07/45] pictureviewer: small design reworks ... * use OFFSET defines * use CComponentsScrollbar * rename some variables Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cc19ae565cbe265c2decfc816ece6d0cfebdf709 Author: vanhofen Date: 2017-06-14 (Wed, 14 Jun 2017) Origin message was: ------------------ - pictureviewer: small design reworks ... * use OFFSET defines * use CComponentsScrollbar * rename some variables ------------------ This commit was generated by Migit --- src/gui/pictureviewer.cpp | 57 +++++++++++++++++---------------------- src/gui/pictureviewer.h | 10 +++---- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index b60e8efbb..5c7ce37c5 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -167,19 +167,19 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) width = frameBuffer->getScreenWidthRel(); height = frameBuffer->getScreenHeightRel(); - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); + header_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + item_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - //get footerHeight from paintButtons - buttons1Height = ::paintButtons(0, 0, 0, PictureViewerButtons1Count, PictureViewerButtons1, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); - buttons2Height = ::paintButtons(0, 0, 0, PictureViewerButtons2Count, PictureViewerButtons2, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); - footerHeight = buttons1Height + buttons2Height; + //get footer_height from paintButtons + buttons1_height = ::paintButtons(0, 0, 0, PictureViewerButtons1Count, PictureViewerButtons1, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); + buttons2_height = ::paintButtons(0, 0, 0, PictureViewerButtons2Count, PictureViewerButtons2, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); + footer_height = buttons1_height + buttons2_height; - listmaxshow = (height-theight-footerHeight)/(fheight); - height = theight+listmaxshow*fheight+footerHeight; // recalc height + listmaxshow = (height - header_height - footer_height)/item_height; + height = header_height + listmaxshow*item_height + footer_height; // recalc height - x=getScreenStartX( width ); - y=getScreenStartY( height ); + x=getScreenStartX(width); + y=getScreenStartY(height); m_viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling); m_viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); @@ -671,7 +671,7 @@ void CPictureViewerGui::hide() void CPictureViewerGui::paintItem(int pos) { // printf("paintItem{\n"); - int ypos = y+ theight + 0 + pos*fheight; + int ypos = y + header_height + pos*item_height; unsigned int currpos = liststart + pos; @@ -689,8 +689,8 @@ void CPictureViewerGui::paintItem(int pos) i_radius = RADIUS_LARGE; if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width - 15, fheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width - 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); if (currpos < playlist.size()) { @@ -701,8 +701,8 @@ void CPictureViewerGui::paintItem(int pos) char timestring[18]; strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[currpos].Date)); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(timestring); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, width-30 - w, tmp, color, fheight); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+width-20-w,ypos+fheight, w, timestring, color, fheight); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + OFFSET_INNER_MID, ypos + item_height, width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - w, tmp, color, item_height); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, ypos + item_height, w, timestring, color, item_height); } // printf("paintItem}\n"); @@ -712,7 +712,7 @@ void CPictureViewerGui::paintItem(int pos) void CPictureViewerGui::paintHead() { - CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_PICTUREVIEWER, CComponentsHeaderLocalized::CC_BTN_HELP); //NI + CComponentsHeaderLocalized header(x, y, width, header_height, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_PICTUREVIEWER, CComponentsHeaderLocalized::CC_BTN_HELP); //NI #ifdef ENABLE_GUI_MOUNT header.setContextButton(NEUTRINO_ICON_BUTTON_MENU); @@ -730,15 +730,15 @@ void CPictureViewerGui::paintFoot() else PictureViewerButtons2[0].locale = LOCALE_PICTUREVIEWER_SORTORDER_DATE; - frameBuffer->paintBoxRel(x, y + (height - footerHeight), width, footerHeight, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); + frameBuffer->paintBoxRel(x, y + (height - footer_height), width, footer_height, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); if (!playlist.empty()) { - ::paintButtons(x, y + (height - footerHeight), 0, PictureViewerButtons1Count, PictureViewerButtons1, width); - ::paintButtons(x, y + (height - buttons2Height), 0, PictureViewerButtons2Count, PictureViewerButtons2, width); + ::paintButtons(x, y + (height - footer_height), 0, PictureViewerButtons1Count, PictureViewerButtons1, width); + ::paintButtons(x, y + (height - buttons2_height), 0, PictureViewerButtons2Count, PictureViewerButtons2, width); } else - ::paintButtons(x, y + (height - footerHeight), 0, 1, &(PictureViewerButtons1[1]), width); + ::paintButtons(x, y + (height - footer_height), 0, 1, &(PictureViewerButtons1[1]), width); } //------------------------------------------------------------------------ @@ -759,19 +759,12 @@ void CPictureViewerGui::paint() paintItem(count); } - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); + //scrollbar + int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero + int total_pages = playlist.size() == 0 ? 1 : ((playlist.size() - 1) / _listmaxshow) + 1; + int current_page = selected / _listmaxshow; - unsigned int tmp_max = listmaxshow; - if(!tmp_max) - tmp_max = 1; - int sbc= ((playlist.size()- 1)/ tmp_max)+ 1; - int sbs= (selected/tmp_max); - if (sbc < 1) - sbc = 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); paintFoot(); paintInfo(); diff --git a/src/gui/pictureviewer.h b/src/gui/pictureviewer.h index 6e89ccbcd..70b38fd16 100644 --- a/src/gui/pictureviewer.h +++ b/src/gui/pictureviewer.h @@ -74,11 +74,11 @@ class CPictureViewerGui : public CMenuTarget unsigned int selected; unsigned int liststart; unsigned int listmaxshow; - int fheight; // Fonthoehe Playlist-Inhalt - int theight; // Fonthoehe Playlist-Titel - int footerHeight; - int buttons1Height; - int buttons2Height; + int item_height; + int header_height; + int footer_height; + int buttons1_height; + int buttons2_height; bool visible; State m_state; SortOrder m_sort; From c20952dba21b2556b3c00db702a19f4e9d776b13 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Jun 2017 14:57:09 +0200 Subject: [PATCH 08/45] locale: minor changes in audioplayer's and pictureviewer's locales Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/2a63c3f58bc316010c5d0fe78d709dd87153f17e Author: vanhofen Date: 2017-06-14 (Wed, 14 Jun 2017) Origin message was: ------------------ - locale: minor changes in audioplayer's and pictureviewer's locales ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 10 +++--- data/locale/english.locale | 68 +++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index c4dbd195b..1a0574724 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -162,8 +162,8 @@ audioplayer.artist_title Interpret, Titel audioplayer.building_search_index Erstelle Suchindex audioplayer.button_select_title_by_id Suche n. ID audioplayer.button_select_title_by_name Suche n. Name -audioplayer.defdir Start-Verz. -audioplayer.delete entfernen +audioplayer.defdir Start-Verzeichnis +audioplayer.delete Entfernen audioplayer.deleteall Alle entfernen audioplayer.display_order Anzeige audioplayer.enable_sc_metadata Aktiviere SHOUTcast Meta-Daten Parsing @@ -2234,7 +2234,7 @@ personalize.usermenu_plugin_types Anzuzeigende Plugin-Typen wählen personalize.usermenu_preferred_buttons Bevorzugte Tasten zuweisen personalize.usermenu_show_cancel Zeige Schalter "Abbrechen" personalize.visible sichtbar -pictureviewer.defdir Start-Verz. +pictureviewer.defdir Start-Verzeichnis pictureviewer.head Bildbetrachter pictureviewer.help1 Menü-Modus pictureviewer.help10 Bild neu einlesen @@ -2268,8 +2268,8 @@ pictureviewer.scaling Skalierung pictureviewer.show Anzeigen pictureviewer.slide_time Diaschau-Anzeigedauer pictureviewer.slideshow Diaschau -pictureviewer.sortorder.date Sortierreihenf. ändern (Datum) -pictureviewer.sortorder.filename Sortierreihenf. ändern (Dateiname) +pictureviewer.sortorder.date Sortierreihenfolge: Datum +pictureviewer.sortorder.filename Sortierreihenfolge: Dateiname ping.ok ist erreichbar (ping) ping.protocol ist nicht erreichbar (Host- oder Protokoll-Fehler) ping.socket ist nicht erreichbar (Socket-Fehler) diff --git a/data/locale/english.locale b/data/locale/english.locale index 61dba810e..6f697d541 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -159,46 +159,46 @@ audioplayer.add_ic Icecast audioplayer.add_loc Local radio list audioplayer.add_sc SHOUTcast audioplayer.artist_title Artist, Title -audioplayer.building_search_index building search index -audioplayer.button_select_title_by_id search by ID -audioplayer.button_select_title_by_name search by name -audioplayer.defdir start dir. +audioplayer.building_search_index Building search index +audioplayer.button_select_title_by_id Search by ID +audioplayer.button_select_title_by_name Search by name +audioplayer.defdir Start directory audioplayer.delete Remove -audioplayer.deleteall remove all -audioplayer.display_order display order -audioplayer.enable_sc_metadata enable SHOUTcast meta data parsing -audioplayer.fastforward fast forw. -audioplayer.follow auto select current +audioplayer.deleteall Remove all +audioplayer.display_order Display order +audioplayer.enable_sc_metadata Enable SHOUTcast meta data parsing +audioplayer.fastforward Fast forward +audioplayer.follow Auto select current audioplayer.head Audio Playlist audioplayer.highprio High decode priority -audioplayer.jump_backwards jump backwards +audioplayer.jump_backwards Jump backwards audioplayer.jump_dialog_hint1 Please enter jump target audioplayer.jump_dialog_hint2 (relative, in seconds) audioplayer.jump_dialog_title Enter jump target -audioplayer.jump_forwards jump forwards -audioplayer.keylevel key level +audioplayer.jump_forwards Jump forwards +audioplayer.keylevel Key level audioplayer.load_radio_stations Load internet radios audioplayer.name Audioplayer -audioplayer.pause pause +audioplayer.pause Pause audioplayer.play Play -audioplayer.playing Current Track +audioplayer.playing Current track audioplayer.playlist_fileerror_msg File could not be created: audioplayer.playlist_fileoverwrite_msg Do you want to overwrite this file: audioplayer.playlist_fileoverwrite_title Overwrite? -audioplayer.playlist_name filename of the play list +audioplayer.playlist_name Filename of the play list audioplayer.playlist_name_hint1 Please enter the filename of the playlist audioplayer.playlist_name_hint2 The extension .m3u will be added automatically -audioplayer.reading_files reading files -audioplayer.receiving_list Receiving list, please wait -audioplayer.repeat_on enable repeat mode -audioplayer.rewind rewind -audioplayer.save_playlist save play list -audioplayer.select_title_by_name search title by name (SMS) -audioplayer.show_playlist Show Playlist -audioplayer.shuffle shuffle -audioplayer.spectrum lcd a-spectrum +audioplayer.reading_files Reading files +audioplayer.receiving_list Receiving list, please wait ... +audioplayer.repeat_on Enable repeat mode +audioplayer.rewind Rewind +audioplayer.save_playlist Save play list +audioplayer.select_title_by_name Search title by name (SMS) +audioplayer.show_playlist Show playlist +audioplayer.shuffle Shuffle +audioplayer.spectrum LCD spectrum audioplayer.stop Stop -audioplayer.title_artist Title, Artist +audioplayer.title_artist Title, artist blank_screen Blank screen bookmarkmanager.delete delete bookmarkmanager.name bookmarks @@ -2234,14 +2234,14 @@ personalize.usermenu_plugin_types Choose Plugin types to show personalize.usermenu_preferred_buttons Assigning of preferred keys personalize.usermenu_show_cancel Show "Cancel"-Button personalize.visible Visible -pictureviewer.defdir start dir. +pictureviewer.defdir Start directory pictureviewer.head Picture viewer pictureviewer.help1 menu mode pictureviewer.help10 reread image pictureviewer.help11 previous image pictureviewer.help12 next image -pictureviewer.help13 Zoom out -pictureviewer.help14 Zoom in +pictureviewer.help13 zoom out +pictureviewer.help14 zoom in pictureviewer.help15 scroll up pictureviewer.help16 scroll left pictureviewer.help17 scroll right @@ -2264,12 +2264,12 @@ pictureviewer.help9 show mode pictureviewer.resize.color_average advanced pictureviewer.resize.none none pictureviewer.resize.simple simple -pictureviewer.scaling scaling -pictureviewer.show show -pictureviewer.slide_time slideshow display time -pictureviewer.slideshow slideshow -pictureviewer.sortorder.date change sort order (date) -pictureviewer.sortorder.filename change sort order (filename) +pictureviewer.scaling Scaling +pictureviewer.show Show +pictureviewer.slide_time Slideshow display time +pictureviewer.slideshow Slideshow +pictureviewer.sortorder.date Sort order: Date +pictureviewer.sortorder.filename Sort order: Filename ping.ok is reachable (ping) ping.protocol is unreachable (host or protocol error) ping.socket is unreachable (socket error) From 541ca6a51597ecce506f20fad9f2704dd21f4a6a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Jun 2017 14:57:09 +0200 Subject: [PATCH 09/45] cc_frm_scrollbar: add getScrollBarData() function ... to calculate total pages and current page for CComponentsScrollBar Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/adb71c756cf203c72182ac2607082604a3b87b8f Author: vanhofen Date: 2017-06-14 (Wed, 14 Jun 2017) Origin message was: ------------------ - cc_frm_scrollbar: add getScrollBarData() function ... to calculate total pages and current page for CComponentsScrollBar ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_scrollbar.cpp | 10 ++++++++++ src/gui/components/cc_frm_scrollbar.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/gui/components/cc_frm_scrollbar.cpp b/src/gui/components/cc_frm_scrollbar.cpp index 2a553950e..a2ea040a2 100644 --- a/src/gui/components/cc_frm_scrollbar.cpp +++ b/src/gui/components/cc_frm_scrollbar.cpp @@ -220,6 +220,16 @@ void CComponentsScrollBar::initSegments() } } +void getScrollBarData(int *total_pages, int *current_page, int total_items, int items_per_page, int selected_item) +{ + // avoid divison by zero and fix wrong values + total_items = std::max(total_items, 1); + items_per_page = std::max(items_per_page, 1); + selected_item = std::max(selected_item, 0); + + *total_pages = ((total_items - 1) / items_per_page) + 1; + *current_page = selected_item / items_per_page; +} void paintScrollBar( const int &x_pos, const int &y_pos, diff --git a/src/gui/components/cc_frm_scrollbar.h b/src/gui/components/cc_frm_scrollbar.h index 8658d5428..8bd1c0568 100644 --- a/src/gui/components/cc_frm_scrollbar.h +++ b/src/gui/components/cc_frm_scrollbar.h @@ -145,6 +145,8 @@ class CComponentsScrollBar : public CComponentsFrmChain void disableVisualize(){enableVisualize(false);} }; +void getScrollBarData(int *total_pages, int *current_page, int total_items, int items_per_page, int selected_item); + /**Small and easy to apply scrollbar paint methode without expilcit object declaration * @return void * From 3d4dc22d50543f82098cb12df270efd9cb838a4d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Jun 2017 14:57:09 +0200 Subject: [PATCH 10/45] filebrowser: use getScrollBarData() function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/33bf19278d467fad1b240342b44e2f6ba4ecd213 Author: vanhofen Date: 2017-06-14 (Wed, 14 Jun 2017) Origin message was: ------------------ - filebrowser: use getScrollBarData() function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 6e877060d..5c4fa4e23 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1472,8 +1472,9 @@ void CFileBrowser::paint() paintItem(count); //scrollbar - int total_pages = filelist.size() == 0 ? 1 : ((filelist.size() - 1) / listmaxshow) + 1; - int current_page = (selected / listmaxshow); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, filelist.size(), listmaxshow, selected); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); } From ba50008ddf73cc8f6c01ee8f44c27b11a482b103 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Jun 2017 14:57:09 +0200 Subject: [PATCH 11/45] bouquetlist: use getScrollBarData() function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/b0c630607f3399af8f149e4e538acadfe2dd7859 Author: vanhofen Date: 2017-06-14 (Wed, 14 Jun 2017) Origin message was: ------------------ - bouquetlist: use getScrollBarData() function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/bouquetlist.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index e6bb139ad..2d0bfe5c9 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -720,7 +720,6 @@ void CBouquetList::paint() CInfoClock::getInstance()->disableInfoClock(); liststart = (selected/listmaxshow)*listmaxshow; int lastnum = liststart + listmaxshow; - int bsize = Bouquets.empty() ? 1 : Bouquets.size(); numwidth = 0; int maxDigitWidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getMaxDigitWidth(); @@ -753,9 +752,9 @@ void CBouquetList::paint() } } - int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero - int total_pages = ((bsize - 1) / _listmaxshow) + 1; - int current_page = selected / _listmaxshow; + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, Bouquets.size(), listmaxshow, selected); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); } From 166258a54fd93388910b4debfeb96316cae7dd81 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Jun 2017 14:57:09 +0200 Subject: [PATCH 12/45] pictureviewer: use getScrollBarData() function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/126d60527bbb9851d98849f3c21ed1fceeb03ec8 Author: vanhofen Date: 2017-06-14 (Wed, 14 Jun 2017) Origin message was: ------------------ - pictureviewer: use getScrollBarData() function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/pictureviewer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 5c7ce37c5..8d2a3c186 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -760,9 +760,9 @@ void CPictureViewerGui::paint() } //scrollbar - int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero - int total_pages = playlist.size() == 0 ? 1 : ((playlist.size() - 1) / _listmaxshow) + 1; - int current_page = selected / _listmaxshow; + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, playlist.size(), listmaxshow, selected); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); From 386786c4a282ddd8a520f2fd1a7762b688d228e5 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 14 Jun 2017 14:57:09 +0200 Subject: [PATCH 13/45] epgplus: use getScrollBarData() function Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1e0378a877ef39eb0dbbcec9f80f54ac6443a543 Author: vanhofen Date: 2017-06-14 (Wed, 14 Jun 2017) Origin message was: ------------------ - epgplus: use getScrollBarData() function ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/epgplus.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index dafdbb1fb..d6795c407 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -1429,8 +1429,12 @@ void EpgPlus::paint() this->timeLine->paintGrid(); // paint slider - int total_pages = ((this->channelList->getSize() - 1) / this->maxNumberOfDisplayableEntries) + 1; - int current_page = this->selectedChannelEntry == NULL ? 0 : (this->selectedChannelEntry->index / this->maxNumberOfDisplayableEntries); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, + this->channelList->getSize(), + this->maxNumberOfDisplayableEntries, + this->selectedChannelEntry == NULL ? 0 : this->selectedChannelEntry->index); paintScrollBar(this->sliderX, this->sliderY, this->sliderWidth, this->sliderHeight, total_pages, current_page); } From 2e738f08030d38cf0eb3546d83b3923482b7663e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 14/45] CComponentsInfoBox: fix image y pos Image was not centered, because of frame was not considered. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/9e2c5cb939ab2f73e68db112ea7559163e2afc55 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_item_infobox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index bc41347b0..92835ade6 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -124,7 +124,7 @@ void CComponentsInfoBox::paintPicture() pic->doPaintBg(false); //fit icon into frame - pic->setYPos(y_pic+(height/2-pic->getHeight()/2)); + pic->setYPos(y_pic+(height-2*fr_thickness)/2-pic->getHeight()/2); //paint, but set visibility mode pic->allowPaint(cc_allow_paint); From 7e3920a42e04acdfc227298605c7751ce7bfe176 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 15/45] CCButtonSelect: outsource button select handling into own class Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4d753d7437f73c1a8b2e222fb85e729cef6850c8 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/Makefile.am | 1 + src/gui/components/cc_button_select.cpp | 74 ++++++++++++++++++++++ src/gui/components/cc_button_select.h | 81 +++++++++++++++++++++++++ src/gui/components/cc_frm.h | 2 +- src/gui/components/cc_frm_footer.cpp | 42 +------------ src/gui/components/cc_frm_footer.h | 47 ++------------ src/gui/components/cc_types.h | 1 + 7 files changed, 165 insertions(+), 83 deletions(-) create mode 100644 src/gui/components/cc_button_select.cpp create mode 100644 src/gui/components/cc_button_select.h diff --git a/src/gui/components/Makefile.am b/src/gui/components/Makefile.am index 0089ac8a1..e43158b13 100644 --- a/src/gui/components/Makefile.am +++ b/src/gui/components/Makefile.am @@ -18,6 +18,7 @@ noinst_LIBRARIES = libneutrino_gui_components.a libneutrino_gui_components_a_SOURCES = \ cc_base.cpp \ + cc_button_select.cpp \ cc_detailsline.cpp \ cc_draw.cpp \ cc_extra.cpp \ diff --git a/src/gui/components/cc_button_select.cpp b/src/gui/components/cc_button_select.cpp new file mode 100644 index 000000000..95dfcbefc --- /dev/null +++ b/src/gui/components/cc_button_select.cpp @@ -0,0 +1,74 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2017, Thilo Graf 'dbt' + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "config.h" +#include "cc_button_select.h" + +CCButtonSelect::CCButtonSelect(CComponentsFrmChain *chain_obj) +{ + chain = chain_obj; +} + +CComponentsFrmChain* CCButtonSelect::getButtonChainObject() +{ + return chain; +} + +CComponentsButton* CCButtonSelect::getSelectedButtonObject() +{ + CComponentsButton* ret = static_cast(chain->getSelectedItemObject()); + return ret; +} + +int CCButtonSelect::getSelectedButton() +{ + if (chain) + return chain->getSelectedItem(); + return -1; +} + +void CCButtonSelect::setSelectedButton(size_t item_id, + const fb_pixel_t& fr_col, + const fb_pixel_t& sel_fr_col, + const fb_pixel_t& bg_col, + const fb_pixel_t& sel_bg_col, + const fb_pixel_t& text_col, + const fb_pixel_t& sel_text_col, + const int& frame_width, + const int& sel_frame_width) +{ + if (chain){ + for (size_t i= 0; i< chain->size(); i++){ + CComponentsButton *btn = static_cast(chain->getCCItem(i)); + btn->setButtonTextColor(text_col); + } + fb_pixel_t sel_col = fr_col; + if (chain->size() > 1) + sel_col = sel_fr_col; //TODO: make it configurable + chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width); + + getSelectedButtonObject()->setButtonTextColor(sel_text_col); + } +} + + diff --git a/src/gui/components/cc_button_select.h b/src/gui/components/cc_button_select.h new file mode 100644 index 000000000..c122e1479 --- /dev/null +++ b/src/gui/components/cc_button_select.h @@ -0,0 +1,81 @@ +/* + Based up Neutrino-GUI - Tuxbox-Project + Copyright (C) 2001 by Steffen Hehn 'McClean' + + Classes for generic GUI-related components. + Copyright (C) 2017, Thilo Graf 'dbt' + + License: GPL + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef __CC_BTN_SEL_H__ +#define __CC_BTN_SEL_H__ + + +#include "cc_frm_button.h" + +/*! +Class for inheritation of button select handling inside other CComponentsForm objects and their derivations +*/ +class CCButtonSelect +{ + protected: + CComponentsFrmChain *chain; + + public: + CCButtonSelect(CComponentsFrmChain *chain_obj = NULL); + + ///returns selected button object, return value as pointer to object, NULL means nothing is selected + CComponentsButton* getSelectedButtonObject(); + + ///returns pointer to internal button container + CComponentsFrmChain* getButtonChainObject(); + + ///returns id of select button, return value as int, -1 = nothing is selected + int getSelectedButton(); + + /**Select a definied button inside button chain object + * @param[in] item_id + * @li optional: expects type size_t + * @param[in] fr_col + * @li optional: expects type fb_pixel_t, as default frame color + * @param[in] sel_fr_col + * @li optional: expects type fb_pixel_t, as selected frame color + * @param[in] bg_col + * @li optional: expects type fb_pixel_t, as default background color + * @param[in] sel_bg_col + * @li optional: expects type fb_pixel_t, as selected background color + * @param[in] text_col + * @li optional: expects type fb_pixel_t, as default text color + * @param[in] sel_text_col + * @li optional: expects type fb_pixel_t, as selected text color + * @param[in] frame_width + * @li optional: expects type int, default = 1 + * @param[in] sel_frame_width + * @li optional: expects type int, default = 1 + */ + void setSelectedButton(size_t item_id, + const fb_pixel_t& fr_col = COL_MENUCONTENTSELECTED_PLUS_2, + const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0, + const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0, + const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0, + const fb_pixel_t& text_col = COL_MENUCONTENT_TEXT, + const fb_pixel_t& sel_text_col = COL_MENUCONTENTSELECTED_TEXT, + const int& frame_width = 1, + const int& sel_frame_width = 1); +}; + +#endif //__CC_BTN_SEL_H__ diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index f1aba0a9c..0b7b74401 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -28,7 +28,7 @@ #include "config.h" #include "cc_base.h" #include "cc_item.h" -#include "cc_frm_scrollbar.h" + class CComponentsForm : public CComponentsItem { diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 3532e05f3..31fc2c5c9 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -35,7 +35,7 @@ using namespace std; //------------------------------------------------------------------------------------------------------- //sub class CComponentsFooter inherit from CComponentsHeader -CComponentsFooter::CComponentsFooter(CComponentsForm* parent) +CComponentsFooter::CComponentsFooter(CComponentsForm* parent):CCButtonSelect() { //CComponentsFooter initVarFooter(1, 1, 0, 0, 0, parent, CC_SHADOW_OFF, COL_FRAME_PLUS_0, COL_MENUFOOT_PLUS_0, COL_SHADOW_PLUS_0); @@ -47,7 +47,7 @@ CComponentsFooter::CComponentsFooter( const int& x_pos, const int& y_pos, const int shadow_mode, fb_pixel_t color_frame, fb_pixel_t color_body, - fb_pixel_t color_shadow ) + fb_pixel_t color_shadow ):CCButtonSelect() { //CComponentsFooter initVarFooter(x_pos, y_pos, w, h, buttons, parent, shadow_mode, color_frame, color_body, color_shadow); @@ -95,7 +95,6 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const corner_type = CORNER_BOTTOM; ccf_enable_button_bg = false /*g_settings.theme.Button_gradient*/; //TODO: not implemented at the moment - chain = NULL; addContextButton(buttons); initCCItems(); @@ -323,43 +322,6 @@ void CComponentsFooter::enableButtonBg(bool enable) } } -void CComponentsFooter::setSelectedButton(size_t item_id, - const fb_pixel_t& fr_col, const fb_pixel_t& sel_fr_col, - const fb_pixel_t& bg_col, const fb_pixel_t& sel_bg_col, - const fb_pixel_t& text_col, const fb_pixel_t& sel_text_col, - const int& frame_width, - const int& sel_frame_width) -{ - if (chain){ - for (size_t i= 0; i< chain->size(); i++){ - CComponentsButton *btn = static_cast(chain->getCCItem(i)); - btn->setButtonTextColor(text_col); - } - fb_pixel_t sel_col = fr_col; - if (chain->size() > 1) - sel_col = sel_fr_col; //TODO: make it configurable - chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width); - - getSelectedButtonObject()->setButtonTextColor(sel_text_col); - } -} - -int CComponentsFooter::getSelectedButton() -{ - int ret = -1; - if (chain) - ret = chain->getSelectedItem(); - - return ret; -} - -CComponentsButton* CComponentsFooter::getSelectedButtonObject() -{ - CComponentsButton* ret = static_cast(chain->getSelectedItemObject()); - return ret; -} - - void CComponentsFooter::paintButtons(const int& x_pos, const int& y_pos, const int& w, diff --git a/src/gui/components/cc_frm_footer.h b/src/gui/components/cc_frm_footer.h index 852faaae1..2586d1772 100644 --- a/src/gui/components/cc_frm_footer.h +++ b/src/gui/components/cc_frm_footer.h @@ -26,6 +26,8 @@ #include "cc_frm_header.h" #include "cc_frm_button.h" +#include "cc_button_select.h" + #include #include //for compatibility with 'button_label' type @@ -39,7 +41,7 @@ to add button labels known by older button handler, to find in gui/widget/button functionality. Why limited ?: old parameter 'struct button_label' doesn't provide newer parameters. Missing parameters are filled with default values and must be assigned afterward, if required. */ -class CComponentsFooter : public CComponentsHeader +class CComponentsFooter : public CComponentsHeader, public CCButtonSelect { private: void initVarFooter( const int& x_pos, const int& y_pos, const int& w, const int& h, @@ -67,9 +69,6 @@ class CComponentsFooter : public CComponentsHeader ///init default fonts for size modes virtual void initDefaultFonts(); - ///container for button objects - CComponentsFrmChain *chain; - public: CComponentsFooter(CComponentsForm *parent = NULL); CComponentsFooter( const int& x_pos, const int& y_pos, const int& w, const int& h = 0, @@ -114,40 +113,6 @@ class CComponentsFooter : public CComponentsHeader ///disables background of buttons void disableButtonBg(){enableButtonBg(false);} - /**Select a definied button inside button chain object - * @param[in] item_id - * @li optional: exepts type size_t - * @param[in] fr_col - * @li optional: exepts type fb_pixel_t, as default frame color - * @param[in] sel_fr_col - * @li optional: exepts type fb_pixel_t, as selected frame color - * @param[in] bg_col - * @li optional: exepts type fb_pixel_t, as default background color - * @param[in] sel_bg_col - * @li optional: exepts type fb_pixel_t, as selected background color - * @param[in] text_col - * @li optional: exepts type fb_pixel_t, as default text color - * @param[in] sel_text_col - * @li optional: exepts type fb_pixel_t, as selected text color - * @param[in] frame_width - * @li optional: exepts type int, default = 1 - * @param[in] sel_frame_width - * @li optional: exepts type int, default = 2 - */ - void setSelectedButton(size_t item_id, - const fb_pixel_t& fr_col = COL_MENUCONTENTSELECTED_PLUS_2, - const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0, - const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0, - const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0, - const fb_pixel_t& text_col = COL_MENUCONTENT_TEXT, - const fb_pixel_t& sel_text_col = COL_MENUCONTENTSELECTED_TEXT, - const int& frame_width = 1, - const int& sel_frame_width = 1); - ///returns id of select button, return value as int, -1 = nothing is selected - int getSelectedButton(); - ///returns selected button object, return value as pointer to object, NULL means nothing is selected - CComponentsButton* getSelectedButtonObject(); - /*! Sets a new text to an already predefined button. 1st parameter 'btn_id' accepts current id of an already defined button. 2nd parameter sets the new text as std::string @@ -164,10 +129,6 @@ class CComponentsFooter : public CComponentsHeader ///property: set font for label caption, parameter as font object, value NULL causes usage of dynamic font void setButtonFont(Font* font){ccf_btn_font = font;}; - ///returns pointer to internal button container - CComponentsFrmChain* getButtonChainObject(){return chain;}; - - ///this is a nearly methode similar with the older button handler find in gui/widget/buttons.h, some parameters are different, but require minimalized input ///this member sets some basic parameters and will paint concurrently on execute, explicit call of paint() is not required void paintButtons( const int& x_pos, @@ -196,4 +157,6 @@ class CComponentsFooter : public CComponentsHeader void disbaleButtonShadow(){enableButtonShadow(CC_SHADOW_OFF);} }; + + #endif diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index 1db5ed7aa..e24f5cc03 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -34,6 +34,7 @@ struct gradientData_t; class Font; class CComponentsForm; class CComponentsScrollBar; +class CCButtonSelect; ///cc item types typedef enum From f9d5aa4ee69720c919cb457d18fd7dd479ca8121 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 16/45] CCButtonSelect: rename chain to btn_container more plausible name Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4146a461c1d98c733a7a15ebf91f3fb586531577 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_button_select.cpp | 22 +++++----- src/gui/components/cc_button_select.h | 4 +- src/gui/components/cc_frm_footer.cpp | 58 ++++++++++++------------- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/gui/components/cc_button_select.cpp b/src/gui/components/cc_button_select.cpp index 95dfcbefc..ea373f3c7 100644 --- a/src/gui/components/cc_button_select.cpp +++ b/src/gui/components/cc_button_select.cpp @@ -24,26 +24,26 @@ #include "config.h" #include "cc_button_select.h" -CCButtonSelect::CCButtonSelect(CComponentsFrmChain *chain_obj) +CCButtonSelect::CCButtonSelect() { - chain = chain_obj; + btn_container = NULL; } CComponentsFrmChain* CCButtonSelect::getButtonChainObject() { - return chain; + return btn_container; } CComponentsButton* CCButtonSelect::getSelectedButtonObject() { - CComponentsButton* ret = static_cast(chain->getSelectedItemObject()); + CComponentsButton* ret = static_cast(btn_container->getSelectedItemObject()); return ret; } int CCButtonSelect::getSelectedButton() { - if (chain) - return chain->getSelectedItem(); + if (btn_container) + return btn_container->getSelectedItem(); return -1; } @@ -57,15 +57,15 @@ void CCButtonSelect::setSelectedButton(size_t item_id, const int& frame_width, const int& sel_frame_width) { - if (chain){ - for (size_t i= 0; i< chain->size(); i++){ - CComponentsButton *btn = static_cast(chain->getCCItem(i)); + if (btn_container){ + for (size_t i= 0; i< btn_container->size(); i++){ + CComponentsButton *btn = static_cast(btn_container->getCCItem(i)); btn->setButtonTextColor(text_col); } fb_pixel_t sel_col = fr_col; - if (chain->size() > 1) + if (btn_container->size() > 1) sel_col = sel_fr_col; //TODO: make it configurable - chain->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width); + btn_container->setSelectedItem(item_id, sel_col, fr_col, sel_bg_col, bg_col, frame_width, sel_frame_width); getSelectedButtonObject()->setButtonTextColor(sel_text_col); } diff --git a/src/gui/components/cc_button_select.h b/src/gui/components/cc_button_select.h index c122e1479..ecf35b8dc 100644 --- a/src/gui/components/cc_button_select.h +++ b/src/gui/components/cc_button_select.h @@ -33,10 +33,10 @@ Class for inheritation of button select handling inside other CComponentsForm ob class CCButtonSelect { protected: - CComponentsFrmChain *chain; + CComponentsFrmChain *btn_container; public: - CCButtonSelect(CComponentsFrmChain *chain_obj = NULL); + CCButtonSelect(); ///returns selected button object, return value as pointer to object, NULL means nothing is selected CComponentsButton* getSelectedButtonObject(); diff --git a/src/gui/components/cc_frm_footer.cpp b/src/gui/components/cc_frm_footer.cpp index 31fc2c5c9..74b48d754 100644 --- a/src/gui/components/cc_frm_footer.cpp +++ b/src/gui/components/cc_frm_footer.cpp @@ -107,8 +107,8 @@ void CComponentsFooter::initVarFooter( const int& x_pos, const int& y_pos, const void CComponentsFooter::setButtonLabels(const struct button_label_cc * const content, const size_t& label_count, const int& chain_width, const int& label_width) { /* clean up before init*/ - if (chain) - chain->clear(); + if (btn_container) + btn_container->clear(); if (label_count == 0) return; @@ -149,11 +149,11 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con int y_chain = height/2 - h_chain/2; if (cch_icon_obj) x_chain = cch_offset+cch_icon_obj->getWidth()+cch_offset; - if (chain == NULL){ - chain = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body); - chain->setAppendOffset(0, 0); - chain->setCorner(this->corner_rad, this->corner_type); - chain->doPaintBg(false); + if (btn_container == NULL){ + btn_container = new CComponentsFrmChain(x_chain, y_chain, w_chain, h_chain, 0, CC_DIR_X, this, CC_SHADOW_OFF, COL_MENUCONTENT_PLUS_6, col_body); + btn_container->setAppendOffset(0, 0); + btn_container->setCorner(this->corner_rad, this->corner_type); + btn_container->doPaintBg(false); } /* Calculate usable width of button labels inside button object container @@ -165,11 +165,11 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con * button objects itself. */ int w_offset = int((label_count-1)*cch_offset); - int w_btn = chain->getWidth()/label_count - w_offset; + int w_btn = btn_container->getWidth()/label_count - w_offset; if (label_width){ int w_label = label_width; int w_defined = int(label_width*label_count); - int w_max = chain->getWidth() - w_offset; + int w_max = btn_container->getWidth() - w_offset; while (w_defined > w_max){ w_label--; w_defined = int(w_label*label_count) - w_offset; @@ -181,7 +181,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con * with default width to chain object. */ vector v_btns; - int h_btn = /*(ccf_enable_button_bg ? */chain->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width; + int h_btn = /*(ccf_enable_button_bg ? */btn_container->getHeight()-2*fr_thickness/*-OFFSET_INNER_SMALL*//* : height)*/-ccf_button_shadow_width; for (size_t i= 0; i< label_count; i++){ string txt = content[i].locale == NONEXISTANT_LOCALE ? content[i].text : g_Locale->getText(content[i].locale); string icon_name = string(content[i].button); @@ -192,7 +192,7 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con continue; } - int y_btn = chain->getHeight()/2 - h_btn/2; + int y_btn = btn_container->getHeight()/2 - h_btn/2; dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] y_btn [%d] ccf_button_shadow_width [%d]\n", __func__, __LINE__, y_btn, ccf_button_shadow_width); CComponentsButton *btn = new CComponentsButton(0, y_btn, w_btn, h_btn, txt, icon_name, NULL, false, true, ccf_enable_button_shadow); @@ -223,27 +223,27 @@ void CComponentsFooter::setButtonLabels(const struct button_label_cc * const con btn->setButtonFont(NULL); } - dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%u] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), i, btn->getWidth(), w_btn, chain->getWidth()); + dprintf(DEBUG_INFO, "[CComponentsFooter] [%s - %d] button %s [%u] btn->getWidth() = %d w_btn = %d, (chain->getWidth() = %d)\n", __func__, __LINE__, txt.c_str(), i, btn->getWidth(), w_btn, btn_container->getWidth()); } /* add generated button objects to chain object. */ if (!v_btns.empty()){ /*add all buttons into button container*/ - chain->addCCItem(v_btns); + btn_container->addCCItem(v_btns); /* set position of labels, as centered inside button container*/ int w_chain_used = 0; - for (size_t a= 0; a< chain->size(); a++) - w_chain_used += chain->getCCItem(a)->getWidth(); - w_chain_used += (chain->size()-1)*cch_offset; + for (size_t a= 0; a< btn_container->size(); a++) + w_chain_used += btn_container->getCCItem(a)->getWidth(); + w_chain_used += (btn_container->size()-1)*cch_offset; - int x_btn = chain->getWidth()/2 - w_chain_used/2; - chain->getCCItem(0)->setXPos(x_btn); + int x_btn = btn_container->getWidth()/2 - w_chain_used/2; + btn_container->getCCItem(0)->setXPos(x_btn); - for (size_t c= 1; c< chain->size(); c++){ - x_btn += chain->getCCItem(c-1)->getWidth()+ cch_offset; - chain->getCCItem(c)->setXPos(x_btn); + for (size_t c= 1; c< btn_container->size(); c++){ + x_btn += btn_container->getCCItem(c-1)->getWidth()+ cch_offset; + btn_container->getCCItem(c)->setXPos(x_btn); } } } @@ -316,9 +316,9 @@ void CComponentsFooter::setButtonLabel( const char *button_icon, void CComponentsFooter::enableButtonBg(bool enable) { ccf_enable_button_bg = enable; - if (chain) { - for (size_t i= 0; i< chain->size(); i++) - chain->getCCItem(i)->doPaintBg(ccf_enable_button_bg); + if (btn_container) { + for (size_t i= 0; i< btn_container->size(); i++) + btn_container->getCCItem(i)->doPaintBg(ccf_enable_button_bg); } } @@ -357,12 +357,12 @@ void CComponentsFooter::enableButtonShadow(int mode, const int& shadow_width, bo ccf_enable_button_shadow = mode; ccf_button_shadow_width = shadow_width; ccf_button_shadow_force_paint = force_paint; - if (chain){ - for(size_t i=0; isize(); i++){ - chain->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint); + if (btn_container){ + for(size_t i=0; isize(); i++){ + btn_container->getCCItem(i)->enableShadow(ccf_enable_button_shadow, ccf_button_shadow_width, ccf_button_shadow_force_paint); //int y_btn = ccf_enable_button_shadow == CC_SHADOW_OFF ? CC_CENTERED : chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2 - ccf_button_shadow_width; - int y_btn = chain->getHeight()/2 - chain->getCCItem(i)->getHeight()/2; - chain->getCCItem(i)->setYPos(y_btn); + int y_btn = btn_container->getHeight()/2 - btn_container->getCCItem(i)->getHeight()/2; + btn_container->getCCItem(i)->setYPos(y_btn); } } } From 37a15282dcc930c8517342ab5584397a20d05645 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 17/45] CCButtonSelect: select button objects only Other types are not required. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/c4976bb132ec791dc0d69ffb63023a0347ea60d8 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_button_select.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_button_select.cpp b/src/gui/components/cc_button_select.cpp index ea373f3c7..cb396d7cb 100644 --- a/src/gui/components/cc_button_select.cpp +++ b/src/gui/components/cc_button_select.cpp @@ -23,6 +23,7 @@ #include "config.h" #include "cc_button_select.h" +#include CCButtonSelect::CCButtonSelect() { @@ -57,11 +58,18 @@ void CCButtonSelect::setSelectedButton(size_t item_id, const int& frame_width, const int& sel_frame_width) { + CComponentsButton *btn = NULL; if (btn_container){ for (size_t i= 0; i< btn_container->size(); i++){ - CComponentsButton *btn = static_cast(btn_container->getCCItem(i)); - btn->setButtonTextColor(text_col); + CComponentsItem *item = btn_container->getCCItem(i); + if (item->getItemType() >= CC_ITEMTYPE_BUTTON && item->getItemType() <= CC_ITEMTYPE_BUTTON_BLUE){ + btn = static_cast(item); + btn->setButtonTextColor(text_col); + } } + if (!btn) + dprintf(DEBUG_NORMAL, "\033[33m[CCButtonSelect]\t[%s - %d], no button object found...\033[0m\n", __func__, __LINE__); + fb_pixel_t sel_col = fr_col; if (btn_container->size() > 1) sel_col = sel_fr_col; //TODO: make it configurable From e87854a95ff406bf44e0dfd257eeca30332fdf44 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 18/45] CChannelList: add instance check for header clock object Only for sure. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/340a6992a18349baa6816a3ccb1420bc346ca3fd Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/channellist.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 755e19707..5cb0eff49 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2143,7 +2143,8 @@ void CChannelList::paintHead() header->removeContextButtons(); header->enableClock(true, "%H:%M", "%H %M", true); - header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); + if (header->getClockObject()) + header->getClockObject()->setCorner(RADIUS_LARGE, CORNER_TOP_RIGHT); }else{ if (header->getClockObject()){ header->disableClock(); From 48e82d6dac3059d03c99f32cf9e4a41ba600dab7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 19/45] CComponentsHeader: remove virtual declararion from getClockObject() Not required. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/86af640fae3d82149c7970f5f2de97231ca70c5d Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ CComponentsHeader: remove virtual declararion from getClockObject() Not required. ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_header.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index e26d28ff2..29f8b8315 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -302,7 +302,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT } ///returns the clock object - virtual CComponentsFrmClock* getClockObject(){return cch_cl_obj;} + CComponentsFrmClock* getClockObject(){return cch_cl_obj;} ///enable display of clock, parameter bool enable, const char* format, bool run virtual void enableClock(bool enable = true, const char* format = "%H:%M", const char* sec_format_str = NULL, bool run = false); From 2aeab995a77c2af17f86eecf6fdd20b8779f2789 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 20/45] CComponentsForm: remove extra item declaration Remove instances from vector only for sure. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0066430b77644f0daab75abe4b76ad9961554c28 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 430423045..33dd15c94 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -185,11 +185,10 @@ void CComponentsForm::clear() return; for(size_t i=0; igetItemType(), item); - delete item; - item = NULL; + if (v_cc_items[i]){ + dprintf(DEBUG_DEBUG, "[CComponentsForm] %s... delete form cc-item %d of %d (type=%d)\taddress = %p\n", __func__, (int)i+1, (int)v_cc_items.size(), v_cc_items[i]->getItemType(), v_cc_items[i]); + delete v_cc_items[i]; + v_cc_items[i] = NULL; } } v_cc_items.clear(); From 038b4e36e40fb9473ab81b4bb56779c0bbb98d3e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 21/45] CProgressBar/CComponentsInfoBox: add missing value inits Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/0a7f7ab5a6ce029bcdd87a087dc69ec818862ad4 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_item_infobox.cpp | 8 ++++---- src/gui/components/cc_item_progressbar.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/components/cc_item_infobox.cpp b/src/gui/components/cc_item_infobox.cpp index 92835ade6..2dccb9820 100644 --- a/src/gui/components/cc_item_infobox.cpp +++ b/src/gui/components/cc_item_infobox.cpp @@ -51,10 +51,10 @@ CComponentsInfoBox::CComponentsInfoBox( const int& x_pos, { cc_item_type = CC_ITEMTYPE_TEXT_INFOBOX; - x = x_pos; - y = y_pos; - width = w; - height = h; + x = x_old = x_pos; + y = y_old = y_pos; + width = width_old = w; + height = height_old = h; shadow = shadow_mode; col_frame = color_frame; cc_enable_frame = true; diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 1613f4eb4..570bb0de9 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -57,10 +57,10 @@ CProgressBar::CProgressBar( const int x_pos, cc_item_type = CC_ITEMTYPE_PROGRESSBAR; //CComponents - x = x_pos; - y = y_pos; - width = w; - height = h; + x = x_old = x_pos; + y = y_old = y_pos; + width = width_old = w; + height = height_old = h; col_frame = color_frame; col_body = color_body; From a652c229aa941a2042d5357b092b8fa8844b32fe Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 22/45] CComponentsFrmClock: ensure clean timer instance For safety only. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/08e610859f6b73f1fb5b2db4b9079e025a2e3dcd Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_clock.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index 46d4781df..1beb3d70f 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -112,8 +112,9 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, CComponentsFrmClock::~CComponentsFrmClock() { - if (cl_timer) - delete cl_timer; + if (cl_timer){ + delete cl_timer; cl_timer = NULL; + } } void CComponentsFrmClock::initClockFont(int dx, int dy) From e3bd6e917dc7d76c1034dfa1a5d1e4f341ea4451 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 23/45] CProgressBarCache: ensure clean iterator inside pbcClear() For safety only. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5573d17cce9a9fbcc2952e6a0a5607ca5cdf5478 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_item_progressbar.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index 570bb0de9..d3ea4831f 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -198,6 +198,7 @@ void CProgressBarCache::pbcClear() if ((*it)->pbc_passive) free((*it)->pbc_passive); delete (*it); + (*it) = NULL; } pbCache.clear(); } From 1e49b4ab61860b8600687ee9b1668e170a2c06e8 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 24/45] FBFontRenderClass/CNeutrinoFonts: ensure reset of some instances Only for safety. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/71d0c42a477cba6e63cc6dd7dc793852096ab318 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/driver/fontrenderer.cpp | 2 +- src/driver/neutrinofonts.cpp | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/driver/fontrenderer.cpp b/src/driver/fontrenderer.cpp index 375be1570..3a5e1e5ff 100644 --- a/src/driver/fontrenderer.cpp +++ b/src/driver/fontrenderer.cpp @@ -99,7 +99,7 @@ FBFontRenderClass::~FBFontRenderClass() for (fontListEntry * f = font; f; f = g) { g = f->next; - delete f; + delete f; f = NULL; } FTC_Manager_Done(cacheManager); diff --git a/src/driver/neutrinofonts.cpp b/src/driver/neutrinofonts.cpp index 16fa1de89..64da5fe44 100644 --- a/src/driver/neutrinofonts.cpp +++ b/src/driver/neutrinofonts.cpp @@ -92,14 +92,18 @@ void CNeutrinoFonts::InitDynFonts() CNeutrinoFonts::~CNeutrinoFonts() { if (!v_share_fonts.empty()) { - for (unsigned int i = 0; i < v_share_fonts.size(); i++) + for (unsigned int i = 0; i < v_share_fonts.size(); i++){ delete v_share_fonts[i].font; + v_share_fonts[i].font = NULL; + } v_share_fonts.clear(); } if (!v_dyn_fonts.empty()) { - for (unsigned int i = 0; i < v_dyn_fonts.size(); i++) + for (unsigned int i = 0; i < v_dyn_fonts.size(); i++){ delete v_dyn_fonts[i].font; + v_dyn_fonts[i].font = NULL; + } v_dyn_fonts.clear(); } if (!vDynSize.empty()) { @@ -402,8 +406,10 @@ void CNeutrinoFonts::deleteDynFontExtAll() { if (!v_dyn_fonts_ext.empty()) { for (size_t i = 0; i < v_dyn_fonts_ext.size(); ++i) { - if (v_dyn_fonts_ext[i].font != NULL) + if (v_dyn_fonts_ext[i].font != NULL){ delete v_dyn_fonts_ext[i].font; + v_dyn_fonts_ext[i].font = NULL; + } } v_dyn_fonts_ext.clear(); } From 42d6c768fcfc43e4d6d20bbe09085658554f7ec0 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 25/45] CEventList: Move channel name to left side Center place is reserved for logo Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/14ea1c3a31bd349a18556d0bfabb0d225a7e641f Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/eventlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 02f56f04a..9f575f516 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -888,7 +888,7 @@ void CEventList::paintHead(t_channel_id _channel_id, std::string _channelname, s if (header->isPainted()) header->getChannelLogoObject()->hide(); header->setChannelLogo(_channel_id,_channelname); - header->setCaption(_channelname, CCHeaderTypes::CC_TITLE_CENTER); + header->setCaption(_channelname, CCHeaderTypes::CC_TITLE_LEFT); header->paint(CC_SAVE_SCREEN_NO); From 46c3f4d348556626eacae1e6180e70752fb7819e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 26/45] CComponentsText: make initCCText() Is more useful Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cdafe580bea1bfa1a78c60ae332d1834de1e6a3c Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/components/cc_item_text.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 5e5d53d48..8f716dc0b 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -95,8 +95,6 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///destroy current CTextBox and CBox objects void clearCCText(); - ///initialize all required attributes for text and send to the CTextBox object - void initCCText(); ///init internal CBox object required by CTextBox object void initCBox(); @@ -164,6 +162,9 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///send option to CTextBox object to paint background box behind text or not virtual inline void doPaintTextBoxBg(bool do_paintbox_bg){ ct_paint_textbg = do_paintbox_bg;}; + ///initialize all required attributes for text and send to the CTextBox object + void initCCText(); + ///set text as string also possible with overloades members for loacales, const char and text file, returns true if text was changed virtual bool setText(const std::string& stext, const int mode = ~CTextBox::AUTO_WIDTH, Font* font_text = NULL, const fb_pixel_t& color_text = 0, const int& style = FONT_STYLE_REGULAR); ///set text with const char*, returns true if text was changed From 73a84ad4fa377cdf7253fad5711d766b9c8bef62 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:54 +0200 Subject: [PATCH 27/45] CtextBox: Precise function getLines() Use refreshTextLineArray() for calculation of lines. Note: count of lines will be only returned if CTextBox object is initialized with a valid CBox instance, otherwise count of 0 lines will be returned! also remove inline declaration, not needed here Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ec83549e50c665dafe8fbc647d06182bf6ddb0f0 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/widget/textbox.cpp | 10 ++++++++++ src/gui/widget/textbox.h | 22 ++++++++++++---------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 23ed96132..7a9e326b1 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -900,6 +900,16 @@ int CTextBox::getLines(const std::string& text) return count; } +int CTextBox::getLines() +{ + if (m_cText.empty()) + return 0; + + refreshTextLineArray(); + + return m_nNrOfLines; +} + int CTextBox::getMaxLineWidth(const std::string& text, Font* font) { std::string txt = text; diff --git a/src/gui/widget/textbox.h b/src/gui/widget/textbox.h index 0c182eaa8..5980985e5 100644 --- a/src/gui/widget/textbox.h +++ b/src/gui/widget/textbox.h @@ -164,7 +164,7 @@ class CTextBox : public sigc::trackable int text_Hborder_width; int text_Vborder_width; bool m_FontUseDigitHeight; - + public: /* Constructor */ CTextBox(); @@ -199,28 +199,30 @@ class CTextBox : public sigc::trackable void enableUTF8(bool enable = true){m_utf8_encoded = enable;} void disableUTF8(bool enable = false){enableUTF8(enable);} - inline bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);}; - inline CBox getWindowsPos(void) {return(m_cFrame);}; + bool isPainted(void) {if( frameBuffer == NULL) return (false); else return (true);}; + CBox getWindowsPos(void) {return(m_cFrame);}; - inline int getLinesPerPage(void) {return m_nLinesPerPage;}; - inline int getPages(void) {return(m_nNrOfPages);}; - inline int getBackGroundRadius(void) {return(m_nBgRadius);}; + int getLinesPerPage(void) {return m_nLinesPerPage;}; + int getPages(void) {return(m_nNrOfPages);}; + int getBackGroundRadius(void) {return(m_nBgRadius);}; /** * Returns count of lines of a passed text. * @param[in] text - * @li exepts type std::string + * @li expects type std::string * @return count of lines as int * @see getLines() */ - static int getLines(const std::string& text); + static int getLines(const std::string& text); /** - * Returns count of evaluated lines from an existent CTextBox instance. + * Returns count of calculated lines from an existing CTextBox instance. * @return count of lines as int * @see static version getLines() + * @note Real count of lines will be only returned if CTextBox object is initialized with a valid CBox instance, \n + * otherwise count of 0 lines will be returned! */ - int getLines(){return(m_nNrOfLines);} + int getLines(); /** * Returns width of largest line from passed text From afcb78a5c4d1721d27dcaa915a4ddd18662bdd60 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 28/45] CLuaInstCCText: try to fix return value of CCTextGetLines() Init was missing. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5b12952d8b1f1f4198e7b027569831acba5fab7f Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/gui/lua/lua_api_version.h | 2 +- src/gui/lua/lua_cc_text.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/lua/lua_api_version.h b/src/gui/lua/lua_api_version.h index 4320eacbe..6f932f261 100644 --- a/src/gui/lua/lua_api_version.h +++ b/src/gui/lua/lua_api_version.h @@ -4,4 +4,4 @@ * to luainstance.h changes */ #define LUA_API_VERSION_MAJOR 1 -#define LUA_API_VERSION_MINOR 75 +#define LUA_API_VERSION_MINOR 76 diff --git a/src/gui/lua/lua_cc_text.cpp b/src/gui/lua/lua_cc_text.cpp index 2cbaa45d3..3e2158e52 100644 --- a/src/gui/lua/lua_cc_text.cpp +++ b/src/gui/lua/lua_cc_text.cpp @@ -229,6 +229,7 @@ int CLuaInstCCText::CCTextGetLines(lua_State *L) } else { CTextBox* ctb = D->ct->getCTextBoxObject(); + D->ct->initCCText(); if (ctb) lines = (lua_Integer)ctb->getLines(); } From 9d69ed31b056775b4a40d831817bf8c22aa2f33a Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 29/45] vfd-setup: fix brightness setup for CST's boxmodel "Link" ... and hide the brightness menu for all "Trinity" models. There's no display. Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/42958395267eab8523d37e85e279e1cc736decfb Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - vfd-setup: fix brightness setup for CST's boxmodel "Link" ... and hide the brightness menu for all "Trinity" models. There's no display. Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 2 +- data/locale/english.locale | 6 +++--- lib/hardware/coolstream/hardware_caps.cpp | 2 ++ src/gui/vfd_setup.cpp | 6 +++++- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 94852a2b8..8da57980e 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -884,7 +884,7 @@ languagesetup.select Sprache lcd_info_line Zeige in Infozeile lcd_info_line_channel Kanalname lcd_info_line_clock Uhrzeit -lcdcontroler.brightness normale +lcdcontroler.brightness Normalbetrieb lcdcontroler.brightnessdeepstandby Deep-Standby lcdcontroler.brightnessstandby Standby lcdmenu.dim_brightness nach Dimm-Timeout diff --git a/data/locale/english.locale b/data/locale/english.locale index 43ffeb429..d3e4788ea 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -884,9 +884,9 @@ languagesetup.select OSD Language lcd_info_line show in infoline lcd_info_line_channel Channelname lcd_info_line_clock clock -lcdcontroler.brightness normal Brightness -lcdcontroler.brightnessdeepstandby DeepStandby Brightness -lcdcontroler.brightnessstandby Standby Brightness +lcdcontroler.brightness Normal mode +lcdcontroler.brightnessdeepstandby Deep standby +lcdcontroler.brightnessstandby Standby lcdmenu.dim_brightness Brightness after dim timeout lcdmenu.dim_time Dim timeout lcdmenu.head VFD/LED Settings diff --git a/lib/hardware/coolstream/hardware_caps.cpp b/lib/hardware/coolstream/hardware_caps.cpp index 865e8ccf5..e5af0e255 100644 --- a/lib/hardware/coolstream/hardware_caps.cpp +++ b/lib/hardware/coolstream/hardware_caps.cpp @@ -79,6 +79,7 @@ hw_caps_t *get_hwcaps(void) { strcpy(caps.boxname, "Trinity V2"); strcpy(caps.boxarch, "Kronos"); } + caps.can_set_display_brightness = 0; break; case 12: strcpy(caps.boxname, "Zee2"); @@ -91,6 +92,7 @@ hw_caps_t *get_hwcaps(void) { case 14: strcpy(caps.boxname, "Trinity Duo"); strcpy(caps.boxarch, "Kronos"); + caps.can_set_display_brightness = 0; break; default: strcpy(caps.boxname, "UNKNOWN_BOX"); diff --git a/src/gui/vfd_setup.cpp b/src/gui/vfd_setup.cpp index b4e3a053f..f4c600a32 100644 --- a/src/gui/vfd_setup.cpp +++ b/src/gui/vfd_setup.cpp @@ -126,12 +126,16 @@ int CVfdSetup::showSetup() vfds->addItem(mf); } - if (CVFD::getInstance()->has_lcd) { + if (g_info.hw_caps->can_set_display_brightness) + { //vfd brightness menu mf = new CMenuForwarder(LOCALE_LCDMENU_LCDCONTROLER, vfd_enabled, NULL, this, "brightness", CRCInput::RC_green); mf->setHint("", LOCALE_MENU_HINT_VFD_BRIGHTNESS_SETUP); vfds->addItem(mf); + } + if (CVFD::getInstance()->has_lcd) + { if (cs_get_revision() == 9) // Tank only { //backlight menu From 48b11b6a8554a0f28e61f84394036123564f23f0 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 30/45] volumebar: use OFFSET defines; fix height of progressbar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4dffefcc21a31d7f78de4e79e3f23be43ebff21e Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - volumebar: use OFFSET defines; fix height of progressbar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/volumebar.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 1c79b22fa..6205ee322 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -92,7 +92,7 @@ void CVolumeBar::initVolumeBarSize() //scale vb_pbw = CFrameBuffer::getInstance()->scale2Res(200); - vb_pbh = height-4*vb_item_offset; + vb_pbh = height-2*vb_item_offset; //result for width width = (vb_icon_w + vb_pbw + vb_digit_w) + 4*vb_item_offset + corner_rad/2; @@ -112,8 +112,6 @@ void CVolumeBar::initVolumeBarSize() mute_corrY = (height - mute_dy) / 2; cvh->setMuteIconCorrY(mute_corrY); - vb_pbh = height-8; - vb_pby = height/2-vb_pbh/2; } @@ -267,8 +265,8 @@ void CVolumeBar::paint(bool do_save_bg) CVolumeHelper::CVolumeHelper() { - h_spacer = 11; - v_spacer = 6; + h_spacer = OFFSET_INNER_MID; + v_spacer = OFFSET_INNER_SMALL; vb_font = NULL; clock_font = NULL; @@ -359,8 +357,8 @@ void CVolumeHelper::initVolBarSize() digit_width = 0; frameBuffer->getIconSize(NEUTRINO_ICON_VOLUME, &icon_width, &icon_height); icon_height = max(icon_height, 16); // if no icon available - icon_height += 2; - icon_width += 8; + icon_height += OFFSET_INNER_MIN; + icon_width += OFFSET_INNER_MID; g_settings.volume_size = max(g_settings.volume_size, icon_height); vol_height = CFrameBuffer::getInstance()->scale2Res(g_settings.volume_size); @@ -370,7 +368,7 @@ void CVolumeHelper::initVolBarSize() int tmp_h = vol_height; digit_width = 0; vb_font = cnf->getDynFont(digit_width, tmp_h, "100", CNeutrinoFonts::FONT_STYLE_REGULAR, CNeutrinoFonts::FONT_ID_VOLBAR); - digit_width += 6; + digit_width += OFFSET_INNER_SMALL; vol_height = max(vol_height, tmp_h); } } From 90af43f37f61368fd006d6b9edea1b3165c568a2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 31/45] icon: add missing pictureviewer icon Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d78e132ba27a4f9066167268a868713e22d985b6 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/icons/headers/Makefile.am | 1 + data/icons/headers/pictureviewer.png | Bin 0 -> 1290 bytes src/gui/widget/icons.h | 1 + 3 files changed, 2 insertions(+) create mode 100755 data/icons/headers/pictureviewer.png diff --git a/data/icons/headers/Makefile.am b/data/icons/headers/Makefile.am index b56c38768..faf172967 100644 --- a/data/icons/headers/Makefile.am +++ b/data/icons/headers/Makefile.am @@ -20,6 +20,7 @@ install_DATA = \ multimedia.png \ network.png \ personalize.png \ + pictureviewer.png \ recording.png \ settings.png \ shell.png \ diff --git a/data/icons/headers/pictureviewer.png b/data/icons/headers/pictureviewer.png new file mode 100755 index 0000000000000000000000000000000000000000..9f4414adf4a26851b38a06d16d4ac90294f45af8 GIT binary patch literal 1290 zcmV+l1@-!gP)3$w6g~I7H~Z^s(9YI{(ozgeOq2pqUMR zi3GKTelyUe>E=W%o0znYKf}%DhK}Nyi>_VD0ZQ6?L<=Z{( zy)~S3r=0BM1xvlmCW-t37eejHEJz~7#K>^PI?!)wVRdXZ8Ppn<`V16LE>z1;@#!uL zDKLm4adUegO?+Y~4iy!wi4x>{+?6|zVe;KFKxhMO5?CdozsH3@!*Ga_2&>f!hdB=Z z;g?}ZX@D`LgUe=xsm+NhpA{A1bhPm+}(9nID4T+y0F@BN@h zAQ)z)o%H&m5vVA6>Ar)NpLwnqZD6~jnwt9zu$e;ahlYHucDQPjS*2D{yu%5}phBg~ z%WM{?aF&_V9i!;VsUxu5>fwDgx%7TxT%^DEhG+eP;V3U&5hci3RqU=TEr!i-0Jj@m zNOQH|Vy_9hyE4Yy7zT|_i$rHUh6qMzLv;pT01uZN4GDDI+$Jfx!ZlL0org49xp!vl`^A} zAVC*aM;dHV8k{)P3HcWlOkEn7)CTCUhj3y`8>Y|DV%^RZTxpaC{e!}6C(1rq6m>9X z?H3;Ri6$160nWI57#4303(C9&^&0$W?c=^=JvrOL$g3L(Ta1OZKBgp#ldqSAsQ8Q# z=WiMLfvpgUSI@NL&_{Vu2Xof#@p#HxSrJRI{yHR7x!F`Nl3v>aZ*P!&soCjVK=HLO#-(Q=dEQubc8EApKNfyL{KH+8Kh=!A z@6L<%AouNqp5kviA5ziVbOl#S^I6o%ls@BCXoh7%SvVXFM{p0}AB>kxGNN?z?5Kl< z?|kjqb*|?j5I0_c&Uc(Utj~~X#1!0HxP5_vWPeJq_-O-nZ_JJoEZTa+z57D%V2|M- zMtt`I#;2%IZ+Z@Av{kMo{Xqj>#{HIaL;=Ws<)b2ksN$$>sPS+Yfe5>L&2g+#q&;FkQI z62-}c1=-UJNu^R*0)c?@-(0P~dP?r5NB`*m3Q Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 32/45] test_menu: avoid usage of CORNER_RADIUS defines; use RADIUS instead ... because the RADIUS defines depends on user's corner settings Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/15257194721c33b6fb7c349b300b15fe550c5ed1 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - test_menu: avoid usage of CORNER_RADIUS defines; use RADIUS instead ... because the RADIUS defines depends on user's corner settings Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/test_menu.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index 9f6637d6b..f5edf226d 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -1031,7 +1031,7 @@ void CTestMenu::showRecords() recline->doPaintBg(true); recline->setColorBody(COL_INFOBAR_PLUS_0); recline->enableShadow(CC_SHADOW_ON, w_shadow); - recline->setCorner(CORNER_RADIUS_MID); + recline->setCorner(RADIUS_MID); recordsbox->addCCItem(recline); CComponentsPicture *iconf = new CComponentsPicture(OFFSET_INNER_MID, CC_CENTERED, NEUTRINO_ICON_REC, recline, CC_SHADOW_OFF, COL_RED, COL_INFOBAR_PLUS_0); From 750211ec999a1f1a404a28f2bdccb2e6aae15f34 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 33/45] settings.h: use CORNER_RADIUS_NONE defines ... to determinate RADIUS defines Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/d7ce3dbf4c2b2070a3b0e6864605a1621389c2a3 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - settings.h: use CORNER_RADIUS_NONE defines ... to determinate RADIUS defines Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/system/settings.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/system/settings.h b/src/system/settings.h index 352e45d33..34de4f54f 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -921,10 +921,10 @@ const time_settings_struct_t timing_setting[SNeutrinoSettings::TIMING_SETTING_CO #define CORNER_RADIUS_MIN CFrameBuffer::getInstance()->scale2Res(3) #define CORNER_RADIUS_NONE 0 -#define RADIUS_LARGE (g_settings.rounded_corners ? CORNER_RADIUS_LARGE : 0) -#define RADIUS_MID (g_settings.rounded_corners ? CORNER_RADIUS_MID : 0) -#define RADIUS_SMALL (g_settings.rounded_corners ? CORNER_RADIUS_SMALL : 0) -#define RADIUS_MIN (g_settings.rounded_corners ? CORNER_RADIUS_MIN : 0) +#define RADIUS_LARGE (g_settings.rounded_corners ? CORNER_RADIUS_LARGE : CORNER_RADIUS_NONE) +#define RADIUS_MID (g_settings.rounded_corners ? CORNER_RADIUS_MID : CORNER_RADIUS_NONE) +#define RADIUS_SMALL (g_settings.rounded_corners ? CORNER_RADIUS_SMALL : CORNER_RADIUS_NONE) +#define RADIUS_MIN (g_settings.rounded_corners ? CORNER_RADIUS_MIN : CORNER_RADIUS_NONE) #define RADIUS_NONE 0 // offsets From fd52e89afb1ec59262827d50061e8fce9cbe64cc Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 34/45] menue: replace last fixed values ... ... with OFFSET defines and scale2Res()-calculations Signed-off-by: Thilo Graf - removed TODO for height of hint calculation Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5c783a5c50a24ea02724667d14a9dc8dddd28a94 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - menue: replace last fixed values ... ... with OFFSET defines and scale2Res()-calculations Signed-off-by: Thilo Graf - removed TODO for height of hint calculation ------------------ This commit was generated by Migit --- src/gui/widget/menue.cpp | 75 ++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 807c26442..ef4905cf3 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -78,7 +78,7 @@ CMenuItem::CMenuItem(bool Active, neutrino_msg_t DirectKey, const char * const I x = -1; used = false; - icon_frame_w = 10; + icon_frame_w = OFFSET_INNER_MID; hint = NONEXISTANT_LOCALE; name = NONEXISTANT_LOCALE; nameString = ""; @@ -249,7 +249,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text stringstartposOption = name_start_x; if (right_bgcol) { if (!*right_text) - stringstartposOption -= 60; + stringstartposOption -= CFrameBuffer::getInstance()->scale2Res(60); fb_pixel_t right_frame_col, right_bg_col; if (active) { right_bg_col = right_bgcol; @@ -270,7 +270,7 @@ void CMenuItem::paintItemCaption(const bool select_mode, const char * right_text } } if (desc_text && *desc_text) - g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->RenderString(name_start_x + 10, y+ item_height, _dx- 10 - (name_start_x - x), desc_text, item_color); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->RenderString(name_start_x + OFFSET_INNER_MID, y+ item_height, _dx- OFFSET_INNER_MID - (name_start_x - x), desc_text, item_color); } void CMenuItem::prepareItem(const bool select_mode, const int &item_height) @@ -296,7 +296,7 @@ void CMenuItem::paintItemSlider( const bool select_mode, const int &item_height, } int stringwidth2 = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(left_text); - int maxspace = dx - stringwidth - icon_frame_w - stringwidth2 - 10; + int maxspace = dx - stringwidth - icon_frame_w - stringwidth2 - OFFSET_INNER_MID; if(maxspace < slider_lenght) return ; @@ -379,7 +379,7 @@ void CMenuItem::paintItemButton(const bool select_mode, int item_height, const c if (icon_w>0 && icon_h>0) { - frameBuffer->paintIcon(iconName_Info_right, dx + icon_start_x - (icon_w + 20), y+ ((item_height/2- icon_h/2)) ); + frameBuffer->paintIcon(iconName_Info_right, dx + icon_start_x - (icon_w + 2*OFFSET_INNER_MID), y+ ((item_height/2- icon_h/2)) ); } } } @@ -1122,14 +1122,13 @@ void CMenuWidget::calcSize() } hint_height = 0; if(g_settings.show_menu_hints && has_hints) { - hint_height = frameBuffer->scale2Res(60); //TODO: rework calculation of hint_height - int fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); - int h_tmp = OFFSET_INNER_LARGE + 2*fheight; + int lines = 2; + int text_height = 2*OFFSET_INNER_MID + lines*g_Font[SNeutrinoSettings::FONT_TYPE_MENU_HINT]->getHeight(); /* assuming all hint icons has the same size ! */ - int iw, ih; - frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &iw, &ih); - h_tmp = std::max(h_tmp, ih+OFFSET_INNER_MID); - hint_height = std::max(h_tmp, hint_height); + int icon_width, icon_height; + frameBuffer->getIconSize(NEUTRINO_ICON_HINT_TVMODE, &icon_width, &icon_height); + icon_height += 2*OFFSET_INNER_MID; + hint_height = std::max(icon_height, text_height); } /* set the max height to 9/10 of usable screen height debatable, if the callers need a possibility to set this */ @@ -1197,7 +1196,7 @@ void CMenuWidget::calcSize() * + center_offset for symmetry * + 20 for setMenuPos calculates 10 pixels border left and right */ int center_offset = (g_settings.menu_pos == MENU_POS_CENTER) ? DETAILSLINE_WIDTH : 0; - int max_possible = (int)frameBuffer->getScreenWidth() - DETAILSLINE_WIDTH - center_offset - 20; + int max_possible = (int)frameBuffer->getScreenWidth() - DETAILSLINE_WIDTH - center_offset - 2*OFFSET_INNER_MID; if (full_width > max_possible) { width = max_possible - sb_width - OFFSET_SHADOW; @@ -1241,7 +1240,7 @@ void CMenuWidget::paint() if (header == NULL){ header = new CComponentsHeader(x, y, width + sb_width, hheight, getName(), iconfile); header->enableShadow(CC_SHADOW_RIGHT | CC_SHADOW_CORNER_TOP_RIGHT | CC_SHADOW_CORNER_BOTTOM_RIGHT); - header->setOffset(10); + header->setOffset(OFFSET_INNER_MID); } header->setCaption(getName()); header->setColorAll(COL_FRAME_PLUS_0, COL_MENUHEAD_PLUS_0, COL_SHADOW_PLUS_0); @@ -1281,25 +1280,25 @@ void CMenuWidget::setMenuPos(const int& menu_width) break; case MENU_POS_TOP_LEFT: - y = offy + scr_y + 10; - x = offx + scr_x + 10; + y = offy + scr_y + OFFSET_INNER_MID; + x = offx + scr_x + OFFSET_INNER_MID; x += DETAILSLINE_WIDTH; break; case MENU_POS_TOP_RIGHT: - y = offy + scr_y + 10; - x = /*offx +*/ scr_x + scr_w - menu_width - 10; + y = offy + scr_y + OFFSET_INNER_MID; + x = /*offx +*/ scr_x + scr_w - menu_width - OFFSET_INNER_MID; break; case MENU_POS_BOTTOM_LEFT: - y = /*offy +*/ scr_y + scr_h - real_h - 10; - x = offx + scr_x + 10; + y = /*offy +*/ scr_y + scr_h - real_h - OFFSET_INNER_MID; + x = offx + scr_x + OFFSET_INNER_MID; x += DETAILSLINE_WIDTH; break; case MENU_POS_BOTTOM_RIGHT: - y = /*offy +*/ scr_y + scr_h - real_h - 10; - x = /*offx +*/ scr_x + scr_w - menu_width - 10; + y = /*offy +*/ scr_y + scr_h - real_h - OFFSET_INNER_MID; + x = /*offx +*/ scr_x + scr_w - menu_width - OFFSET_INNER_MID; break; } if (x_old != x || y_old != y) @@ -1696,11 +1695,11 @@ int CMenuOptionNumberChooser::getWidth(void) width += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(format) - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth("0"); } - width += 10; /* min 10 pixels between option name and value. enough? */ + width += OFFSET_INNER_MID; /* min 10 pixels between option name and value. enough? */ const char *desc_text = getDescription(); if (*desc_text) - width = std::max(width, 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(desc_text)); + width = std::max(width, OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(desc_text)); return width; } @@ -2022,10 +2021,10 @@ int CMenuOptionChooser::getWidth(void) width = tw + ow; } - width += 10; /* min 10 pixels between option name and value. enough? */ + width += OFFSET_INNER_MID; /* min 10 pixels between option name and value. enough? */ const char *desc_text = getDescription(); if (*desc_text) - width = std::max(width, 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(desc_text)); + width = std::max(width, OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(desc_text)); return width; } @@ -2215,13 +2214,13 @@ int CMenuForwarder::getWidth(void) bgcol = jumpTarget->getColor(); if (!option_name.empty()) - tw += 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_name); + tw += OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(option_name); else if (bgcol) - tw += 10 + 60; + tw += OFFSET_INNER_MID + CFrameBuffer::getInstance()->scale2Res(60); const char *desc_text = getDescription(); if (*desc_text) - tw = std::max(tw, 10 + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(desc_text)); + tw = std::max(tw, OFFSET_INNER_MID + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(desc_text)); return tw; } @@ -2280,7 +2279,7 @@ CMenuSeparator::CMenuSeparator(const int Type, const std::string &Text, bool IsS int CMenuSeparator::getHeight(void) { if (nameString.empty() && name == NONEXISTANT_LOCALE) - return 10; + return OFFSET_INNER_MID; return g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); } @@ -2288,7 +2287,7 @@ int CMenuSeparator::getWidth(void) { int w = 0; if (type & LINE) - w = 30; /* 15 pixel left and right */ + w = 2*OFFSET_INNER_MID; /* offset left and right */ const char *l_name = getName(); if ((type & STRING) && *l_name) w += g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_name); @@ -2315,7 +2314,7 @@ int CMenuSeparator::paint(bool selected) if ((type & LINE)) { int grad = g_settings.theme.menu_Separator_gradient_enable ? CC_COLGRAD_COL_DARK_LIGHT_DARK : CC_COLGRAD_OFF; - paintBoxRel(x+10, y+(height>>1), dx-20, 2, COL_MENUCONTENT_PLUS_3, 0, CORNER_NONE, grad, COL_MENUCONTENT_PLUS_0, CFrameBuffer::gradientHorizontal, CColorGradient::light); + paintBoxRel(x+OFFSET_INNER_MID, y+(height>>1), dx-2*OFFSET_INNER_MID, 1, COL_MENUCONTENT_PLUS_1, 0, CORNER_NONE, grad, COL_MENUCONTENT_PLUS_0, CFrameBuffer::gradientHorizontal, CColorGradient::light); } if ((type & STRING)) { @@ -2323,17 +2322,19 @@ int CMenuSeparator::paint(bool selected) if (*l_name) { - int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_name); // UTF-8 + int stringwidth = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(l_name); + int iconwidth, iconheight; + CFrameBuffer::getInstance()->getIconSize(NEUTRINO_ICON_BUTTON_HOME, &iconwidth, &iconheight); /* if no alignment is specified, align centered */ if (type & ALIGN_LEFT) - name_start_x = x + (!(type & SUB_HEAD) ? name_start_x : 20 + 24 /*std icon_width is 24px - this should be determinated from NEUTRINO_ICON_BUTTON_HOME or so*/); + name_start_x = x + (!(type & SUB_HEAD) ? name_start_x : 2*OFFSET_INNER_MID + iconwidth); else if (type & ALIGN_RIGHT) - name_start_x = x + dx - stringwidth - 20; + name_start_x = x + dx - stringwidth - 2*OFFSET_INNER_MID; else /* ALIGN_CENTER */ name_start_x = x + (dx >> 1) - (stringwidth >> 1); - frameBuffer->paintBoxRel(name_start_x-5, y, stringwidth+10, height, item_bgcolor); + frameBuffer->paintBoxRel(name_start_x-OFFSET_INNER_SMALL, y, stringwidth+2*OFFSET_INNER_SMALL, height, item_bgcolor); paintItemCaption(selected); } @@ -2458,7 +2459,7 @@ int CMenuProgressbar::getWidth(void) { int width = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(getName()); if (width) - width += 10; + width += OFFSET_INNER_MID; return width + scale.getWidth(); } From c708c24454ec346d659728926e012e88d877acf3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 35/45] pictureviewer: small design reworks ... * use OFFSET defines * use CComponentsScrollbar * rename some variables Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/1a2143c68b523bb9c8d84d4801ccd8425f26be98 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - pictureviewer: small design reworks ... * use OFFSET defines * use CComponentsScrollbar * rename some variables Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/pictureviewer.cpp | 57 +++++++++++++++++---------------------- src/gui/pictureviewer.h | 10 +++---- 2 files changed, 30 insertions(+), 37 deletions(-) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 1dc102dca..6fde49fb9 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -162,19 +162,19 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) width = frameBuffer->getScreenWidthRel(); height = frameBuffer->getScreenHeightRel(); - theight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); - fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); + header_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU_TITLE]->getHeight(); + item_height = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); - //get footerHeight from paintButtons - buttons1Height = ::paintButtons(0, 0, 0, PictureViewerButtons1Count, PictureViewerButtons1, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); - buttons2Height = ::paintButtons(0, 0, 0, PictureViewerButtons2Count, PictureViewerButtons2, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); - footerHeight = buttons1Height + buttons2Height; + //get footer_height from paintButtons + buttons1_height = ::paintButtons(0, 0, 0, PictureViewerButtons1Count, PictureViewerButtons1, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); + buttons2_height = ::paintButtons(0, 0, 0, PictureViewerButtons2Count, PictureViewerButtons2, 0, 0, "", false, COL_MENUFOOT_TEXT, NULL, 0, false); + footer_height = buttons1_height + buttons2_height; - listmaxshow = (height-theight-footerHeight)/(fheight); - height = theight+listmaxshow*fheight+footerHeight; // recalc height + listmaxshow = (height - header_height - footer_height)/item_height; + height = header_height + listmaxshow*item_height + footer_height; // recalc height - x=getScreenStartX( width ); - y=getScreenStartY( height ); + x=getScreenStartX(width); + y=getScreenStartY(height); m_viewer->SetScaling((CPictureViewer::ScalingMode)g_settings.picviewer_scaling); m_viewer->SetVisible(g_settings.screen_StartX, g_settings.screen_EndX, g_settings.screen_StartY, g_settings.screen_EndY); @@ -660,7 +660,7 @@ void CPictureViewerGui::hide() void CPictureViewerGui::paintItem(int pos) { // printf("paintItem{\n"); - int ypos = y+ theight + 0 + pos*fheight; + int ypos = y + header_height + pos*item_height; unsigned int currpos = liststart + pos; @@ -678,8 +678,8 @@ void CPictureViewerGui::paintItem(int pos) i_radius = RADIUS_LARGE; if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width - 15, fheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width - 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, item_height, bgcolor, i_radius); if (currpos < playlist.size()) { @@ -690,8 +690,8 @@ void CPictureViewerGui::paintItem(int pos) char timestring[18]; strftime(timestring, 18, "%d-%m-%Y %H:%M", gmtime(&playlist[currpos].Date)); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(timestring); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+10,ypos+fheight, width-30 - w, tmp, color, fheight); - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x+width-20-w,ypos+fheight, w, timestring, color, fheight); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + OFFSET_INNER_MID, ypos + item_height, width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - w, tmp, color, item_height); + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, ypos + item_height, w, timestring, color, item_height); } // printf("paintItem}\n"); @@ -701,7 +701,7 @@ void CPictureViewerGui::paintItem(int pos) void CPictureViewerGui::paintHead() { - CComponentsHeaderLocalized header(x, y, width, theight, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_MP3, CComponentsHeaderLocalized::CC_BTN_HELP); + CComponentsHeaderLocalized header(x, y, width, header_height, LOCALE_PICTUREVIEWER_HEAD, NEUTRINO_ICON_PICTUREVIEWER, CComponentsHeaderLocalized::CC_BTN_HELP); #ifdef ENABLE_GUI_MOUNT header.setContextButton(NEUTRINO_ICON_BUTTON_MENU); @@ -719,15 +719,15 @@ void CPictureViewerGui::paintFoot() else PictureViewerButtons2[0].locale = LOCALE_PICTUREVIEWER_SORTORDER_DATE; - frameBuffer->paintBoxRel(x, y + (height - footerHeight), width, footerHeight, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); + frameBuffer->paintBoxRel(x, y + (height - footer_height), width, footer_height, COL_MENUFOOT_PLUS_0, RADIUS_LARGE, CORNER_BOTTOM); if (!playlist.empty()) { - ::paintButtons(x, y + (height - footerHeight), 0, PictureViewerButtons1Count, PictureViewerButtons1, width); - ::paintButtons(x, y + (height - buttons2Height), 0, PictureViewerButtons2Count, PictureViewerButtons2, width); + ::paintButtons(x, y + (height - footer_height), 0, PictureViewerButtons1Count, PictureViewerButtons1, width); + ::paintButtons(x, y + (height - buttons2_height), 0, PictureViewerButtons2Count, PictureViewerButtons2, width); } else - ::paintButtons(x, y + (height - footerHeight), 0, 1, &(PictureViewerButtons1[1]), width); + ::paintButtons(x, y + (height - footer_height), 0, 1, &(PictureViewerButtons1[1]), width); } //------------------------------------------------------------------------ @@ -748,19 +748,12 @@ void CPictureViewerGui::paint() paintItem(count); } - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); + //scrollbar + int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero + int total_pages = playlist.size() == 0 ? 1 : ((playlist.size() - 1) / _listmaxshow) + 1; + int current_page = selected / _listmaxshow; - unsigned int tmp_max = listmaxshow; - if(!tmp_max) - tmp_max = 1; - int sbc= ((playlist.size()- 1)/ tmp_max)+ 1; - int sbs= (selected/tmp_max); - if (sbc < 1) - sbc = 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); paintFoot(); paintInfo(); diff --git a/src/gui/pictureviewer.h b/src/gui/pictureviewer.h index 6e89ccbcd..70b38fd16 100644 --- a/src/gui/pictureviewer.h +++ b/src/gui/pictureviewer.h @@ -74,11 +74,11 @@ class CPictureViewerGui : public CMenuTarget unsigned int selected; unsigned int liststart; unsigned int listmaxshow; - int fheight; // Fonthoehe Playlist-Inhalt - int theight; // Fonthoehe Playlist-Titel - int footerHeight; - int buttons1Height; - int buttons2Height; + int item_height; + int header_height; + int footer_height; + int buttons1_height; + int buttons2_height; bool visible; State m_state; SortOrder m_sort; From c7e763aa610abf80aedcd12cc936074c0b3db06b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 36/45] locale: minor changes in audioplayer's and pictureviewer's locales Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ddb027a0065ba3af5d8fb06dc931c9d04c256455 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - locale: minor changes in audioplayer's and pictureviewer's locales Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 10 +++--- data/locale/english.locale | 68 +++++++++++++++++++------------------- 2 files changed, 39 insertions(+), 39 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 8da57980e..d6fa786d8 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -162,8 +162,8 @@ audioplayer.artist_title Interpret, Titel audioplayer.building_search_index Erstelle Suchindex audioplayer.button_select_title_by_id Suche n. ID audioplayer.button_select_title_by_name Suche n. Name -audioplayer.defdir Start-Verz. -audioplayer.delete entfernen +audioplayer.defdir Start-Verzeichnis +audioplayer.delete Entfernen audioplayer.deleteall Alle entfernen audioplayer.display_order Anzeige audioplayer.enable_sc_metadata Aktiviere SHOUTcast Meta-Daten Parsing @@ -2021,7 +2021,7 @@ personalize.usermenu_plugin_types Anzuzeigende Plugin-Typen wählen personalize.usermenu_preferred_buttons Bevorzugte Tasten zuweisen personalize.usermenu_show_cancel Zeige Schalter "Abbrechen" personalize.visible sichtbar -pictureviewer.defdir Start-Verz. +pictureviewer.defdir Start-Verzeichnis pictureviewer.head Bildbetrachter pictureviewer.help1 Menü-Modus pictureviewer.help10 Bild neu einlesen @@ -2055,8 +2055,8 @@ pictureviewer.scaling Skalierung pictureviewer.show Anzeigen pictureviewer.slide_time Diaschau-Anzeigedauer pictureviewer.slideshow Diaschau -pictureviewer.sortorder.date Sortierreihenf. ändern (Datum) -pictureviewer.sortorder.filename Sortierreihenf. ändern (Dateiname) +pictureviewer.sortorder.date Sortierreihenfolge: Datum +pictureviewer.sortorder.filename Sortierreihenfolge: Dateiname ping.ok ist erreichbar (ping) ping.protocol ist nicht erreichbar (Host- oder Protokoll-Fehler) ping.socket ist nicht erreichbar (Socket-Fehler) diff --git a/data/locale/english.locale b/data/locale/english.locale index d3e4788ea..11e584539 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -159,46 +159,46 @@ audioplayer.add_ic Icecast audioplayer.add_loc Local radio list audioplayer.add_sc SHOUTcast audioplayer.artist_title Artist, Title -audioplayer.building_search_index building search index -audioplayer.button_select_title_by_id search by ID -audioplayer.button_select_title_by_name search by name -audioplayer.defdir start dir. +audioplayer.building_search_index Building search index +audioplayer.button_select_title_by_id Search by ID +audioplayer.button_select_title_by_name Search by name +audioplayer.defdir Start directory audioplayer.delete Remove -audioplayer.deleteall remove all -audioplayer.display_order display order -audioplayer.enable_sc_metadata enable SHOUTcast meta data parsing -audioplayer.fastforward fast forw. -audioplayer.follow auto select current +audioplayer.deleteall Remove all +audioplayer.display_order Display order +audioplayer.enable_sc_metadata Enable SHOUTcast meta data parsing +audioplayer.fastforward Fast forward +audioplayer.follow Auto select current audioplayer.head Audio Playlist audioplayer.highprio High decode priority -audioplayer.jump_backwards jump backwards +audioplayer.jump_backwards Jump backwards audioplayer.jump_dialog_hint1 Please enter jump target audioplayer.jump_dialog_hint2 (relative, in seconds) audioplayer.jump_dialog_title Enter jump target -audioplayer.jump_forwards jump forwards -audioplayer.keylevel key level +audioplayer.jump_forwards Jump forwards +audioplayer.keylevel Key level audioplayer.load_radio_stations Load internet radios audioplayer.name Audioplayer -audioplayer.pause pause +audioplayer.pause Pause audioplayer.play Play -audioplayer.playing Current Track +audioplayer.playing Current track audioplayer.playlist_fileerror_msg File could not be created: audioplayer.playlist_fileoverwrite_msg Do you want to overwrite this file: audioplayer.playlist_fileoverwrite_title Overwrite? -audioplayer.playlist_name filename of the play list +audioplayer.playlist_name Filename of the play list audioplayer.playlist_name_hint1 Please enter the filename of the playlist audioplayer.playlist_name_hint2 The extension .m3u will be added automatically -audioplayer.reading_files reading files -audioplayer.receiving_list Receiving list, please wait -audioplayer.repeat_on enable repeat mode -audioplayer.rewind rewind -audioplayer.save_playlist save play list -audioplayer.select_title_by_name search title by name (SMS) -audioplayer.show_playlist Show Playlist -audioplayer.shuffle shuffle -audioplayer.spectrum lcd a-spectrum +audioplayer.reading_files Reading files +audioplayer.receiving_list Receiving list, please wait ... +audioplayer.repeat_on Enable repeat mode +audioplayer.rewind Rewind +audioplayer.save_playlist Save play list +audioplayer.select_title_by_name Search title by name (SMS) +audioplayer.show_playlist Show playlist +audioplayer.shuffle Shuffle +audioplayer.spectrum LCD spectrum audioplayer.stop Stop -audioplayer.title_artist Title, Artist +audioplayer.title_artist Title, artist bookmarkmanager.delete delete bookmarkmanager.name bookmarks bookmarkmanager.rename rename @@ -2021,14 +2021,14 @@ personalize.usermenu_plugin_types Choose Plugin types to show personalize.usermenu_preferred_buttons Assigning of preferred keys personalize.usermenu_show_cancel Show "Cancel"-Button personalize.visible Visible -pictureviewer.defdir start dir. +pictureviewer.defdir Start directory pictureviewer.head Picture viewer pictureviewer.help1 menu mode pictureviewer.help10 reread image pictureviewer.help11 previous image pictureviewer.help12 next image -pictureviewer.help13 Zoom out -pictureviewer.help14 Zoom in +pictureviewer.help13 zoom out +pictureviewer.help14 zoom in pictureviewer.help15 scroll up pictureviewer.help16 scroll left pictureviewer.help17 scroll right @@ -2051,12 +2051,12 @@ pictureviewer.help9 show mode pictureviewer.resize.color_average advanced pictureviewer.resize.none none pictureviewer.resize.simple simple -pictureviewer.scaling scaling -pictureviewer.show show -pictureviewer.slide_time slideshow display time -pictureviewer.slideshow slideshow -pictureviewer.sortorder.date change sort order (date) -pictureviewer.sortorder.filename change sort order (filename) +pictureviewer.scaling Scaling +pictureviewer.show Show +pictureviewer.slide_time Slideshow display time +pictureviewer.slideshow Slideshow +pictureviewer.sortorder.date Sort order: Date +pictureviewer.sortorder.filename Sort order: Filename ping.ok is reachable (ping) ping.protocol is unreachable (host or protocol error) ping.socket is unreachable (socket error) From 578791847eba1fd5651ab9a52e9d5ba76d2f96c5 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 37/45] cc_frm_scrollbar: add getScrollBarData() function ... to calculate total pages and current page for CComponentsScrollBar Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/3e9e73cb3cd2c48712335761afb405a54a8df432 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - cc_frm_scrollbar: add getScrollBarData() function ... to calculate total pages and current page for CComponentsScrollBar Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/components/cc_frm_scrollbar.cpp | 10 ++++++++++ src/gui/components/cc_frm_scrollbar.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/gui/components/cc_frm_scrollbar.cpp b/src/gui/components/cc_frm_scrollbar.cpp index 73fa733be..5e4c046f3 100644 --- a/src/gui/components/cc_frm_scrollbar.cpp +++ b/src/gui/components/cc_frm_scrollbar.cpp @@ -220,6 +220,16 @@ void CComponentsScrollBar::initSegments() } } +void getScrollBarData(int *total_pages, int *current_page, int total_items, int items_per_page, int selected_item) +{ + // avoid divison by zero and fix wrong values + total_items = std::max(total_items, 1); + items_per_page = std::max(items_per_page, 1); + selected_item = std::max(selected_item, 0); + + *total_pages = ((total_items - 1) / items_per_page) + 1; + *current_page = selected_item / items_per_page; +} void paintScrollBar( const int &x_pos, const int &y_pos, diff --git a/src/gui/components/cc_frm_scrollbar.h b/src/gui/components/cc_frm_scrollbar.h index 8658d5428..8bd1c0568 100644 --- a/src/gui/components/cc_frm_scrollbar.h +++ b/src/gui/components/cc_frm_scrollbar.h @@ -145,6 +145,8 @@ class CComponentsScrollBar : public CComponentsFrmChain void disableVisualize(){enableVisualize(false);} }; +void getScrollBarData(int *total_pages, int *current_page, int total_items, int items_per_page, int selected_item); + /**Small and easy to apply scrollbar paint methode without expilcit object declaration * @return void * From 59435af21a9e1c8914d91e4678a6c73245fcea46 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 38/45] filebrowser: use getScrollBarData() function Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/28b3cc80df2e04edbfb81ac9bbdc4ba8d2eb8afe Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - filebrowser: use getScrollBarData() function Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 6e877060d..5c4fa4e23 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -1472,8 +1472,9 @@ void CFileBrowser::paint() paintItem(count); //scrollbar - int total_pages = filelist.size() == 0 ? 1 : ((filelist.size() - 1) / listmaxshow) + 1; - int current_page = (selected / listmaxshow); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, filelist.size(), listmaxshow, selected); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); } From 995061d7f91c7856acc1137a7e7ef46f29de5a58 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 39/45] bouquetlist: use getScrollBarData() function Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/4f32cf25e4b7f633b068e3d4e9ca5331e615db87 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - bouquetlist: use getScrollBarData() function Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/bouquetlist.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/gui/bouquetlist.cpp b/src/gui/bouquetlist.cpp index 3ad6b4038..024ea7ce0 100644 --- a/src/gui/bouquetlist.cpp +++ b/src/gui/bouquetlist.cpp @@ -710,7 +710,6 @@ void CBouquetList::paint() CInfoClock::getInstance()->disableInfoClock(); liststart = (selected/listmaxshow)*listmaxshow; int lastnum = liststart + listmaxshow; - int bsize = Bouquets.empty() ? 1 : Bouquets.size(); numwidth = 0; int maxDigitWidth = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getMaxDigitWidth(); @@ -743,9 +742,9 @@ void CBouquetList::paint() } } - int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero - int total_pages = ((bsize - 1) / _listmaxshow) + 1; - int current_page = selected / _listmaxshow; + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, Bouquets.size(), listmaxshow, selected); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); } From 7fdeb09671ce5f6aa6fb50e8ee1130c07ac8d87b Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 40/45] pictureviewer: use getScrollBarData() function Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/cf44e1a97438c347137b17e90b6eb898c5423781 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - pictureviewer: use getScrollBarData() function Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/pictureviewer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 6fde49fb9..50d9a7086 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -749,9 +749,9 @@ void CPictureViewerGui::paint() } //scrollbar - int _listmaxshow = listmaxshow ? listmaxshow : 1; //avoid division by zero - int total_pages = playlist.size() == 0 ? 1 : ((playlist.size() - 1) / _listmaxshow) + 1; - int current_page = selected / _listmaxshow; + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, playlist.size(), listmaxshow, selected); paintScrollBar(x + width - SCROLLBAR_WIDTH, y + header_height, SCROLLBAR_WIDTH, item_height*listmaxshow, total_pages, current_page); From a2871335769e6fe7c7a7611c475305ffb8945739 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 41/45] epgplus: use getScrollBarData() function Signed-off-by: Thilo Graf Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/aa4723173b9c295d18512e05155022621f7fd6b5 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - epgplus: use getScrollBarData() function Signed-off-by: Thilo Graf ------------------ This commit was generated by Migit --- src/gui/epgplus.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/gui/epgplus.cpp b/src/gui/epgplus.cpp index f740daafc..b5d209dd3 100644 --- a/src/gui/epgplus.cpp +++ b/src/gui/epgplus.cpp @@ -1429,8 +1429,12 @@ void EpgPlus::paint() this->timeLine->paintGrid(); // paint slider - int total_pages = ((this->channelList->getSize() - 1) / this->maxNumberOfDisplayableEntries) + 1; - int current_page = this->selectedChannelEntry == NULL ? 0 : (this->selectedChannelEntry->index / this->maxNumberOfDisplayableEntries); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, + this->channelList->getSize(), + this->maxNumberOfDisplayableEntries, + this->selectedChannelEntry == NULL ? 0 : this->selectedChannelEntry->index); paintScrollBar(this->sliderX, this->sliderY, this->sliderWidth, this->sliderHeight, total_pages, current_page); } From b7aab60d37e61956af9dd7055d60d7f13e1207e6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 42/45] CFileBrowser: add fallback for possible missing init directory In some rare exceptional cases it is possible that wrong or missing start directories could be defined. Result: filebrowser window will be freezing, no key is helping. With this fallback, filebrowser should jump into next existant upper directory. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ecc1f4860c9dc0cd18c8b5b1296c48f6f052ffc9 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ CFileBrowser: add fallback for possible missing init directory In some rare exceptional cases it is possible that wrong or missing start directories could be defined. Result: filebrowser window will be freezing, no key is helping. With this fallback, filebrowser should jump into next existant upper directory. ------------------ This commit was generated by Migit --- src/gui/filebrowser.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 5c4fa4e23..bb3677ece 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -42,6 +42,7 @@ #include #include #include +#include #include #include @@ -555,19 +556,29 @@ bool CFileBrowser::readDir_std(const std::string & dirname, CFileList* flist) struct stat64 statbuf; dirent64 **namelist; int n; + std::string to_scan_dir = dirname; - n = scandir64(dirname.c_str(), &namelist, 0, alphasort64); + n = scandir64(to_scan_dir.c_str(), &namelist, 0, alphasort64); if (n < 0) { - perror(("Filebrowser scandir: "+dirname).c_str()); + std::string scn_err = "Filebrowser scandir: " + to_scan_dir + " "; + to_scan_dir = "/media/"; + dprintf(DEBUG_NORMAL, "\033[33m[CFileBrowser]\[%s - %d], %s failed, %s, try fallback to [%s]\033[0m\n", __func__, __LINE__, scn_err.c_str(), strerror(errno), to_scan_dir.c_str()); + n = scandir64(to_scan_dir.c_str(), &namelist, 0, alphasort64); + name = to_scan_dir; + } + + if (n < 0){ //fallback failed + perror(("Filebrowser scandir: "+to_scan_dir).c_str()); return false; } + for (int i = 0; i < n; i++) { CFile file; if(strcmp(namelist[i]->d_name,".") != 0) { - file.Name = dirname + namelist[i]->d_name; + file.Name = to_scan_dir + namelist[i]->d_name; // printf("file.Name: '%s', getFileName: '%s' getPath: '%s'\n",file.Name.c_str(),file.getFileName().c_str(),file.getPath().c_str()); if(stat64((file.Name).c_str(),&statbuf) != 0) From ddee4406caec26a92445973680dd3693045cfa33 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 43/45] CCDraw: rework getScreen(), getScreenData(), add pixbuf checks Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/5fda283a616fc90a2232cb4502350fc423109480 Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/gui/components/cc_draw.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index 078edf940..c28144444 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -440,11 +440,13 @@ bool CCDraw::CheckFbData(const cc_fbdata_t& fbdata, const char* func, const int //screen area save fb_pixel_t* CCDraw::getScreen(int ax, int ay, int dx, int dy) { + fb_pixel_t* pixbuf = NULL; + if (dx < 1 || dy < 1 || dx * dy == 0) return NULL; + else + pixbuf = new fb_pixel_t[dx * dy]; - dprintf(DEBUG_INFO, "[CCDraw] INFO! [%s - %d], ax = %d, ay = %d, dx = %d, dy = %d\n", __func__, __LINE__, ax, ay, dx, dy); - fb_pixel_t* pixbuf = new fb_pixel_t[dx * dy]; frameBuffer->waitForIdle("CCDraw::getScreen()"); frameBuffer->SaveScreen(ax, ay, dx, dy, pixbuf); return pixbuf; @@ -453,8 +455,14 @@ fb_pixel_t* CCDraw::getScreen(int ax, int ay, int dx, int dy) cc_screen_data_t CCDraw::getScreenData(const int& ax, const int& ay, const int& dx, const int& dy) { cc_screen_data_t res; + res.x = res.y = res.dx = res.dy = 0; res.pixbuf = getScreen(ax, ay, dx, dy); - res.x = ax; res.y = ay; res.dx = dx; res.dy = dy; + + if (res.pixbuf){ + res.x = ax; res.y = ay; res.dx = dx; res.dy = dy; + } + else + dprintf(DEBUG_NORMAL, "\033[33m[CCDraw]\[%s - %d], Warning: initialize of screen buffer failed!\033[0m\n", __func__, __LINE__); return res; } From 915d9f06766008d16b15d263e0e3d20c7b3f7b09 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 15 Jun 2017 01:01:55 +0200 Subject: [PATCH 44/45] CNeutrinoApp: add hook for neutrino start Script will be executed on start of neutrino before. Handling is similar like all other possible hooks, see global.h. Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/78f1b294a9165fe9d968b28176cd2c0dd33c3f5b Author: Thilo Graf Date: 2017-06-15 (Thu, 15 Jun 2017) ------------------ This commit was generated by Migit --- src/global.h | 1 + src/neutrino.cpp | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/global.h b/src/global.h index 65f55aff7..7bde595f7 100644 --- a/src/global.h +++ b/src/global.h @@ -42,6 +42,7 @@ #define MOVIEPLAYER_START_SCRIPT CONFIGDIR "/movieplayer.start" #define MOVIEPLAYER_END_SCRIPT CONFIGDIR "/movieplayer.end" #define NEUTRINO_ENTER_FLASH_SCRIPT CONFIGDIR "/flash.start" +#define NEUTRINO_APP_START_SCRIPT CONFIGDIR "/neutrino.start" #define NEUTRINO_SCAN_SETTINGS_FILE CONFIGDIR "/scan.conf" #define NEUTRINO_PARENTALLOCKED_FILE DATADIR "/neutrino/.plocked" diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 1a2d9fb7b..10f96a1db 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2143,6 +2143,10 @@ void wake_up( bool &wakeup) int CNeutrinoApp::run(int argc, char **argv) { + puts("[neutrino] executing " NEUTRINO_APP_START_SCRIPT "."); + if (my_system(NEUTRINO_APP_START_SCRIPT) != 0) + perror(NEUTRINO_APP_START_SCRIPT " failed"); + CmdParser(argc, argv); TIMER_START(); From 8b3c5e2fabaa2545f287b109a1496cfe324410e3 Mon Sep 17 00:00:00 2001 From: vanhofen Date: Thu, 15 Jun 2017 11:01:45 +0200 Subject: [PATCH 45/45] cc_button_select.h: re-implement our color changes; ... don't highlight frame of selected buttons Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/bbdac94b32077fbedc4a8b7c039bb76b6b35f398 Author: vanhofen Date: 2017-06-15 (Thu, 15 Jun 2017) Origin message was: ------------------ - cc_button_select.h: re-implement our color changes; ... don't highlight frame of selected buttons ------------------ This commit was generated by Migit --- src/gui/components/cc_button_select.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/components/cc_button_select.h b/src/gui/components/cc_button_select.h index ecf35b8dc..928f48861 100644 --- a/src/gui/components/cc_button_select.h +++ b/src/gui/components/cc_button_select.h @@ -68,8 +68,8 @@ class CCButtonSelect * @li optional: expects type int, default = 1 */ void setSelectedButton(size_t item_id, - const fb_pixel_t& fr_col = COL_MENUCONTENTSELECTED_PLUS_2, - const fb_pixel_t& sel_fr_col = COL_MENUCONTENTSELECTED_PLUS_0, + const fb_pixel_t& fr_col = COL_FRAME_PLUS_0, + const fb_pixel_t& sel_fr_col = COL_FRAME_PLUS_0, const fb_pixel_t& bg_col = COL_MENUCONTENT_PLUS_0, const fb_pixel_t& sel_bg_col = COL_MENUCONTENTSELECTED_PLUS_0, const fb_pixel_t& text_col = COL_MENUCONTENT_TEXT,