From 296aa5b9011a75bfeca84238ebff4fa7d17957d2 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 2 Feb 2017 09:33:20 +0100 Subject: [PATCH 01/25] Revert "CChannelList: ensure repaint of new header content" This reverts commit ea700ddf525a0293c94c68bf084be426544dc34a. --- src/gui/channellist.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 1f7ffbb7d..efa09a771 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2168,9 +2168,7 @@ void CChannelList::paintHead() else logo_off = 10; - if (header->isPainted()) //clean up background of header for new contents - header->kill(header->getColorBody(), -1, CC_FBDATA_TYPES, false); - header->paint0(); + header->paint(CC_SAVE_SCREEN_NO); } CComponentsHeader* CChannelList::getHeaderObject() From a2f9d4b462916d9514817c928b2fa270f552d0b5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 2 Feb 2017 09:34:45 +0100 Subject: [PATCH 02/25] Revert "CMenuWidget: ensure repaint of all header content if it is already painted" This reverts commit 97ed7cdaf74c7a539c792773541f5ac5e6608856. --- src/gui/widget/menue.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 3f5039f7d..cb83c00f5 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1257,8 +1257,6 @@ void CMenuWidget::paint() header->setCaptionColor(COL_MENUHEAD_TEXT); header->enableColBodyGradient(g_settings.theme.menu_Head_gradient, COL_MENUCONTENT_PLUS_0); header->enableGradientBgCleanUp(savescreen); - if (header->isPainted()) - header->kill(header->getColorBody()); header->paint(CC_SAVE_SCREEN_NO); // paint body shadow From be8588a4a5c73e0618f9280c8ae3cd3ca475fcd5 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 2 Feb 2017 10:58:31 +0100 Subject: [PATCH 03/25] CComponentsSignals: add signal OnBeforeRePaint --- src/gui/components/cc_signals.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/components/cc_signals.h b/src/gui/components/cc_signals.h index da6a6d8b2..c3c60727e 100644 --- a/src/gui/components/cc_signals.h +++ b/src/gui/components/cc_signals.h @@ -113,6 +113,8 @@ class CComponentsSignals : public sigc::trackable ///signal on before paint() sigc::signal OnBeforePaint; + ///signal on before repaint, means: paint() is already done and item paint() is called again + sigc::signal OnBeforeRePaint; ///signal on after paint() sigc::signal OnAfterPaint; From 1c217b404ff25f08d50cfc897d1f39942b071871 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 2 Feb 2017 11:00:47 +0100 Subject: [PATCH 04/25] Forms/header/clock: implement slot into OnBeforeRePaint --- src/gui/components/cc_frm.cpp | 3 +++ src/gui/components/cc_frm.h | 4 +++- src/gui/components/cc_frm_clock.cpp | 4 ++-- src/gui/components/cc_frm_ext_text.cpp | 4 ++-- src/gui/components/cc_frm_header.cpp | 14 +++++++------- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 626fdff67..19843a5b9 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -344,6 +344,9 @@ void CComponentsForm::paintForm(bool do_save_bg) void CComponentsForm::paint(bool do_save_bg) { + if(is_painted) + OnBeforeRePaint(); + OnBeforePaint(); paintForm(do_save_bg); } diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index 56ad077c6..b9cab7934 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -68,7 +68,9 @@ class CComponentsForm : public CComponentsItem ///force repaint of all possible text items void forceItemsPaint(bool force); ///slot for background paint event, reserved for forceItemsPaint() - sigc::slot0 sl_repaint; + sigc::slot0 sl_items_repaint; + ///slot for repaint event, reserved for actions before repaint if paint() already was done. + sigc::slot0 sl_form_repaint; public: CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index c3995318d..fcce3647e 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -101,7 +101,7 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, cl_sl_show = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime); //init slot to ensure paint segments after painted background - sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsFrmClock::forceItemsPaint), true); + sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsFrmClock::forceItemsPaint), true); //run clock already if required if (activ) @@ -304,7 +304,7 @@ void CComponentsFrmClock::initCCLockItems() if(!OnAfterPaintBg.empty()) OnAfterPaintBg.clear(); //init slot to handle repaint of segments if background was repainted - OnAfterPaintBg.connect(sl_repaint); + OnAfterPaintBg.connect(sl_items_repaint); } diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 3abf816f4..420ea2775 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -115,7 +115,7 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; //init slot to ensure paint text items after painted background - sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsExtTextForm::forceItemsPaint), true); + sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsExtTextForm::forceItemsPaint), true); initParent(parent); @@ -226,7 +226,7 @@ void CComponentsExtTextForm::initCCTextItems() if(!OnAfterPaintBg.empty()) OnAfterPaintBg.clear(); //init slot to handle repaint of text if background was repainted - OnAfterPaintBg.connect(sl_repaint); + OnAfterPaintBg.connect(sl_items_repaint); } void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 4c21bd560..8a56e24ad 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -136,8 +136,13 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_cl_sec_format = cch_cl_format; cch_cl_enable_run = false; - //init slot to ensure paint segments after painted background - sl_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsHeader::forceItemsPaint), true); + //init slot to ensure paint items after painted background + sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::forceItemsPaint), true); + OnAfterPaintBg.connect(sl_items_repaint); + + //init slot before re paint of header, paint() is already done + sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), col_body, -1, CC_FBDATA_TYPES, false); + OnBeforeRePaint.connect(sl_form_repaint); addContextButton(buttons); initCCItems(); @@ -523,11 +528,6 @@ void CComponentsHeader::initCaption() */ //height = max(height, cch_text_obj->getHeight()); } - - if(!OnAfterPaintBg.empty()) - OnAfterPaintBg.clear(); - //init slot to handle repaint of text if background was repainted - OnAfterPaintBg.connect(sl_repaint); } void CComponentsHeader::initCCItems() From 2ca807e34abc93e91f6ac0aae4c3326a21036fb9 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Wed, 1 Feb 2017 22:07:10 +0100 Subject: [PATCH 05/25] configure.ac: use pkg-config to check freetype version the PKG_CHECK_MODULES macro allows to check for a version -- use it instead of homegrown TUXBOX_APPS_LIB_PKGCONFIG Signed-off-by: M. Liebmann --- configure.ac | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index 64e4093a3..be06c84e3 100644 --- a/configure.ac +++ b/configure.ac @@ -90,19 +90,10 @@ AM_CONDITIONAL(USE_TREMOR, test "$TREMOR" = "yes") # TUXBOX_APPS_LIB_PKGCONFIG(OPENSSL,openssl) TUXBOX_APPS_LIB_PKGCONFIG(CURL,libcurl) -TUXBOX_APPS_LIB_PKGCONFIG(FREETYPE,freetype2) -CPPFLAGS+=" $(freetype-config --cflags)" -AC_MSG_CHECKING([whether FreeType version is 2.5.0 or higher]) - AC_TRY_CPP([ - #include - #include FT_FREETYPE_H - #if FREETYPE_MAJOR < 2 || (FREETYPE_MAJOR == 2 && FREETYPE_MINOR < 5) - #error Freetype version too low. - #endif - ], - [AC_MSG_RESULT(yes)], - [AC_MSG_ERROR([Need FreeType library version 2.5.0 or higher]) - ]) + +## For the check you must use the corresponding libtool number as version number, +## see freetype source code docs/VERSIONS.TXT +PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 16.2.10], echo "freetype2 >= 2.5.0 found", [echo "freetype2 >= 2.5.0 not found"; exit 1]) # fallback to curl-config (which is ugly for cross-compilation) if test -z "$CURL_LIBS" -a -z "$CURL_CFLAGS"; then @@ -111,6 +102,18 @@ fi # fallback to freetype-config (which is ugly for cross-compilation) if test -z "$FREETYPE_LIBS" -a -z "$FREETYPE_CFLAGS"; then TUXBOX_APPS_LIB_CONFIG(FREETYPE,freetype-config) + CPPFLAGS+="$FREETYPE_CFLAGS" + AC_MSG_CHECKING([whether FreeType version is 2.5.0 or higher]) + AC_TRY_CPP([ + #include + #include FT_FREETYPE_H + #if FREETYPE_MAJOR < 2 || (FREETYPE_MAJOR == 2 && FREETYPE_MINOR < 5) + #error Freetype version too low. + #endif + ], + [AC_MSG_RESULT(yes)], + [AC_MSG_ERROR([Need FreeType library version 2.5.0 or higher]) + ]) fi TUXBOX_APPS_LIB_PKGCONFIG(PNG,libpng) From dccb6ba8f2919adea5d950ba85250d44b0f812a1 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sat, 4 Feb 2017 10:23:32 +0100 Subject: [PATCH 06/25] configure.ac: Fix freetype check --- configure.ac | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index be06c84e3..3ebe71b4d 100644 --- a/configure.ac +++ b/configure.ac @@ -93,7 +93,14 @@ TUXBOX_APPS_LIB_PKGCONFIG(CURL,libcurl) ## For the check you must use the corresponding libtool number as version number, ## see freetype source code docs/VERSIONS.TXT -PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 16.2.10], echo "freetype2 >= 2.5.0 found", [echo "freetype2 >= 2.5.0 not found"; exit 1]) +PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 16.2.10], + [echo "freetype2 >= 2.5.0 found"], [ + ## If freetype is not found: + ## Activate this line if you want to search with freetype-config instead + [echo "freetype2 >= 2.5.0 not found, use alternative search method with freetype-config"] + ## Activate this line if you want to abort +# AC_MSG_ERROR([freetype2 >= 2.5.0 not found]) + ]) # fallback to curl-config (which is ugly for cross-compilation) if test -z "$CURL_LIBS" -a -z "$CURL_CFLAGS"; then @@ -102,7 +109,7 @@ fi # fallback to freetype-config (which is ugly for cross-compilation) if test -z "$FREETYPE_LIBS" -a -z "$FREETYPE_CFLAGS"; then TUXBOX_APPS_LIB_CONFIG(FREETYPE,freetype-config) - CPPFLAGS+="$FREETYPE_CFLAGS" + CPPFLAGS+=" $FREETYPE_CFLAGS" AC_MSG_CHECKING([whether FreeType version is 2.5.0 or higher]) AC_TRY_CPP([ #include From 7d5cbea37d93749b87670ec98b75f78ec00decc8 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 5 Feb 2017 17:31:24 +0100 Subject: [PATCH 07/25] movieplayer: Fix display filetime --- src/gui/infoclock.cpp | 27 +++++++++++++++------------ src/gui/movieplayer.cpp | 12 ++++++++++++ src/gui/timeosd.cpp | 1 + src/gui/timeosd.h | 5 ++++- 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index 23aa8e290..54b485b09 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -126,19 +126,22 @@ bool CInfoClock::enableInfoClock(bool enable) } } - if (enable) { - if (FileTimeOSD->getRestore()) { - FileTimeOSD->setMode(FileTimeOSD->getTmpMode()); - FileTimeOSD->update(CMoviePlayerGui::getInstance().GetPosition(), - CMoviePlayerGui::getInstance().GetDuration()); + if (!FileTimeOSD->getMpTimeForced()) { + if (enable) { + if (FileTimeOSD->getRestore()) { + FileTimeOSD->setRestore(false); + FileTimeOSD->setMode(FileTimeOSD->getTmpMode()); + FileTimeOSD->update(CMoviePlayerGui::getInstance().GetPosition(), + CMoviePlayerGui::getInstance().GetDuration()); + } } - } - else { - if (FileTimeOSD->getMode() != CTimeOSD::MODE_HIDE) { - FileTimeOSD->setTmpMode(); - FileTimeOSD->setRestore(); - if (FileTimeOSD->getRestore()) - FileTimeOSD->kill(); + else { + if (FileTimeOSD->getMode() != CTimeOSD::MODE_HIDE) { + FileTimeOSD->setTmpMode(); + FileTimeOSD->setRestore(true); + if (FileTimeOSD->getRestore()) + FileTimeOSD->kill(); + } } } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index eee9d3b19..dfb1b2d02 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -282,6 +282,7 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) FileTimeOSD->kill(); FileTimeOSD->setMode(CTimeOSD::MODE_HIDE); + FileTimeOSD->setMpTimeForced(false); time_forced = false; if (actionKey == "tsmoviebrowser") { @@ -1100,6 +1101,7 @@ bool CMoviePlayerGui::PlayFileStart(void) { menu_ret = menu_return::RETURN_REPAINT; + FileTimeOSD->setMpTimeForced(false); time_forced = false; position = 0, duration = 0; @@ -1201,6 +1203,7 @@ bool CMoviePlayerGui::PlayFileStart(void) FileTimeOSD->switchMode(position, duration); time_forced = true; } + FileTimeOSD->setMpTimeForced(true); } else if (timeshift == TSHIFT_MODE_OFF || !g_settings.timeshift_pause) { playback->SetSpeed(1); } @@ -1402,6 +1405,7 @@ void CMoviePlayerGui::PlayFileLoop(void) time_forced = false; FileTimeOSD->kill(); } + FileTimeOSD->setMpTimeForced(false); if (playstate > CMoviePlayerGui::PLAY) { playstate = CMoviePlayerGui::PLAY; speed = 1; @@ -1436,6 +1440,11 @@ void CMoviePlayerGui::PlayFileLoop(void) enableOsdElements(MUTE); } } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) { + if (time_forced) { + time_forced = false; + FileTimeOSD->kill(); + } + FileTimeOSD->setMpTimeForced(false); if (playstate == CMoviePlayerGui::PAUSE) { playstate = CMoviePlayerGui::PLAY; //CVFD::getInstance()->ShowIcon(VFD_ICON_PAUSE, false); @@ -1467,6 +1476,8 @@ void CMoviePlayerGui::PlayFileLoop(void) update_lcd = true; } else if (msg == (neutrino_msg_t) g_settings.mpkey_time) { FileTimeOSD->switchMode(position, duration); + time_forced = false; + FileTimeOSD->setMpTimeForced(false); } else if (msg == (neutrino_msg_t) g_settings.mbkey_cover) { makeScreenShot(false, true); } else if (msg == (neutrino_msg_t) g_settings.key_screenshot) { @@ -1492,6 +1503,7 @@ void CMoviePlayerGui::PlayFileLoop(void) FileTimeOSD->switchMode(position, duration); time_forced = true; } + FileTimeOSD->setMpTimeForced(true); if (timeshift == TSHIFT_MODE_OFF) callInfoViewer(); } else if (msg == CRCInput::RC_1) { // Jump Backwards 1 minute diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 597d2b2b2..32c025f0f 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -42,6 +42,7 @@ CTimeOSD::CTimeOSD():CComponentsFrmClock( 1, 1, NULL, "%H:%M:%S", NULL, false, 1 m_mode = MODE_HIDE; tmp_mode = MODE_HIDE; m_restore = false; + mp_time_forced = false; Init(); } diff --git a/src/gui/timeosd.h b/src/gui/timeosd.h index c79da7dec..fe2f678f3 100644 --- a/src/gui/timeosd.h +++ b/src/gui/timeosd.h @@ -44,6 +44,7 @@ class CTimeOSD : public CComponentsFrmClock CProgressBar timescale; mode m_mode, tmp_mode; bool m_restore; + bool mp_time_forced; time_t m_time_show; void initTimeString(); @@ -65,7 +66,9 @@ class CTimeOSD : public CComponentsFrmClock mode getTmpMode() { return tmp_mode; }; void setTmpMode () { tmp_mode = m_mode; }; bool getRestore() { return m_restore; }; - void setRestore() { m_restore = (m_mode != MODE_HIDE); }; + void setRestore(bool m) { m_restore = m; }; void setHeight(const int){}//NOTE: dummy member, height is strictly bound to settings + bool getMpTimeForced() { return mp_time_forced; }; + void setMpTimeForced(bool m) { mp_time_forced = m; }; }; #endif From 041135986694282b442277f913af2825b917e739 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 6 Feb 2017 21:09:42 +0100 Subject: [PATCH 08/25] - hdd_menu: fix hd-idle/hdparm logic; fix small memleaks --- src/gui/hdd_menu.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 8205ddae9..0f6b1d058 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -1113,12 +1113,12 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) if (n < 0) return menu_return::RETURN_NONE; - const char hdidle[] = "/sbin/hd-idle"; - bool have_hdidle = !access(hdidle, X_OK); - if (g_settings.hdd_sleep > 0 && g_settings.hdd_sleep < 60) g_settings.hdd_sleep = 60; + const char hdidle[] = "/sbin/hd-idle"; + bool have_hdidle = !access(hdidle, X_OK); + if (have_hdidle) { system("kill $(pidof hd-idle)"); int sleep_seconds = g_settings.hdd_sleep; @@ -1134,12 +1134,22 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) } if (sleep_seconds) my_system(3, hdidle, "-i", to_string(sleep_seconds).c_str()); + + while (n--) + free(namelist[i]); + free(namelist); + return menu_return::RETURN_NONE; } const char hdparm[] = "/sbin/hdparm"; bool have_hdparm = !access(hdparm, X_OK); if (!have_hdparm) + { + while (n--) + free(namelist[i]); + free(namelist); return menu_return::RETURN_NONE; + } struct stat stat_buf; bool have_nonbb_hdparm = !::lstat(hdparm, &stat_buf) && !S_ISLNK(stat_buf.st_mode); @@ -1153,12 +1163,11 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) snprintf(M_opt, sizeof(M_opt), "-M%d", g_settings.hdd_noise); snprintf(opt, sizeof(opt), "/dev/%s",namelist[i]->d_name); - if (have_hdidle) - my_system(3, hdparm, M_opt, opt); - else if (have_nonbb_hdparm) + if (have_nonbb_hdparm) my_system(4, hdparm, M_opt, S_opt, opt); else // busybox hdparm doesn't support "-M" my_system(3, hdparm, S_opt, opt); + free(namelist[i]); } free(namelist); From 22b0248d70af37ea41a29fe09d5c385093f49b05 Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 6 Feb 2017 12:16:50 +0100 Subject: [PATCH 09/25] dont ask which box, if just one is present. --- src/gui/timerlist.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 06ef816d8..ab70eb431 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -703,16 +703,19 @@ void CTimerList::updateEvents(void) void CTimerList::RemoteBoxSelect() { int select = 0; - CMenuWidget *m = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); - CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); - for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) - m->addItem(new CMenuForwarder(it->rbname, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); + if (g_settings.timer_remotebox_ip.size() > 1) { + CMenuWidget *m = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); + CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); - m->enableSaveScreen(true); - m->exec(NULL, ""); + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) + m->addItem(new CMenuForwarder(it->rbname, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); - delete selector; + m->enableSaveScreen(true); + m->exec(NULL, ""); + + delete selector; + } std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); std::advance(it,select); From fb5ab7f9ecd74c28a4c658edd041af37a7c31a6e Mon Sep 17 00:00:00 2001 From: TangoCash Date: Mon, 6 Feb 2017 14:36:22 +0100 Subject: [PATCH 10/25] fix pre and post times, set menuentry for unavailable boxes inactiv --- src/gui/timerlist.cpp | 25 ++++++++++++++----------- src/system/settings.h | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index ab70eb431..929ab4bbe 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -439,14 +439,16 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) } else if ((strcmp(key, "send_remotetimer") == 0) && RemoteBoxChanExists(timerlist[selected].channel_id)) { + int pre,post; + Timer->getRecordingSafety(pre,post); CHTTPTool httpTool; std::string r_url; r_url = "http://"; r_url += RemoteBoxConnectUrl(timerlist[selected].remotebox_name); r_url += "/control/timer?action=new"; - r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + timerlist[selected].rem_pre); - r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - timerlist[selected].rem_post); - r_url += "&announce=" + to_string((int)timerlist[selected].announceTime); + r_url += "&alarm=" + to_string((int)timerlist[selected].alarmTime + pre); + r_url += "&stop=" + to_string((int)timerlist[selected].stopTime - post); + r_url += "&announce=" + to_string((int)timerlist[selected].announceTime + pre); r_url += "&channel_id=" + string_printf_helper(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timerlist[selected].channel_id); r_url += "&aj=on"; r_url += "&rs=on"; @@ -458,13 +460,11 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) } else if ((strcmp(key, "fetch_remotetimer") == 0) && LocalBoxChanExists(timerlist[selected].channel_id)) { - int pre,post; - Timer->getRecordingSafety(pre,post); std::string remotebox_name = timerlist[selected].remotebox_name; std::string eventID = to_string((int)timerlist[selected].eventID); - int res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + pre, - timerlist[selected].stopTime - post, 0, 0, timerlist[selected].announceTime, + int res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + timerlist[selected].rem_pre, + timerlist[selected].stopTime - timerlist[selected].rem_post, 0, 0, timerlist[selected].announceTime + timerlist[selected].rem_pre, TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL),"",false); if (res == -1) @@ -473,8 +473,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) if (forceAdd) { - res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + pre, - timerlist[selected].stopTime - post, 0, 0, timerlist[selected].announceTime, + res = Timer->addRecordTimerEvent(timerlist[selected].channel_id, timerlist[selected].alarmTime + timerlist[selected].rem_pre, + timerlist[selected].stopTime - timerlist[selected].rem_post, 0, 0, timerlist[selected].announceTime + timerlist[selected].rem_pre, TIMERD_APIDS_CONF, true, timerlist[selected].announceTime > time(NULL),"",true); } } @@ -709,7 +709,7 @@ void CTimerList::RemoteBoxSelect() CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select); for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) - m->addItem(new CMenuForwarder(it->rbname, true, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); + m->addItem(new CMenuForwarder(it->rbname, it->online, NULL, selector, to_string(std::distance(g_settings.timer_remotebox_ip.begin(),it)).c_str())); m->enableSaveScreen(true); m->exec(NULL, ""); @@ -804,7 +804,10 @@ void CTimerList::RemoteBoxTimerList(CTimerd::TimerList &rtimerlist) { printf("Failed to parse JSON\n"); printf("%s\n", reader.getFormattedErrorMessages().c_str()); - } + it->online = false; + } else + it->online = true; + Json::Value delays = root["data"]["timer"][0]; rem_pre = atoi(delays["config"].get("pre_delay","0").asString()); diff --git a/src/system/settings.h b/src/system/settings.h index 8d0e53e71..2d9d302d4 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -160,6 +160,7 @@ struct timer_remotebox_item std::string pass; std::string rbname; std::string rbaddress; + bool online; }; struct SNeutrinoSettings From d925655c3b3a5a0529d8c5db0ef1e42610b7ede5 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 6 Feb 2017 21:53:51 +0100 Subject: [PATCH 11/25] - flashtool: allow type U (update-package) --- src/system/flashtool.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index 9b21a3ba8..20447b361 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -517,6 +517,8 @@ const char *CFlashVersionInfo::getReleaseCycle(void) const const char *CFlashVersionInfo::getType(void) const { + // TODO: localize it + switch (snapshot) { case '0': @@ -531,6 +533,8 @@ const char *CFlashVersionInfo::getType(void) const return "Settings"; case 'A': return "Addon"; + case 'U': + return "Update"; case 'T': return "Text"; default: From aed22b3788681fd99491e32d9b6595455073f7f0 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 6 Feb 2017 23:21:01 +0100 Subject: [PATCH 12/25] - hdd_menu: fix c/p error --- src/gui/hdd_menu.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 0f6b1d058..d1d7b6233 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -1136,7 +1136,7 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) my_system(3, hdidle, "-i", to_string(sleep_seconds).c_str()); while (n--) - free(namelist[i]); + free(namelist[n]); free(namelist); return menu_return::RETURN_NONE; } @@ -1146,7 +1146,7 @@ int CHDDDestExec::exec(CMenuTarget* /*parent*/, const std::string&) if (!have_hdparm) { while (n--) - free(namelist[i]); + free(namelist[n]); free(namelist); return menu_return::RETURN_NONE; } From e4d0abc7dc37e88e5295740d2d25cdeeded36fc3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Feb 2017 21:25:33 +0100 Subject: [PATCH 13/25] signals: reduce multiple includes for sigc++/bind.h --- src/gui/components/cc_frm_clock.cpp | 2 +- src/gui/components/cc_frm_ext_text.cpp | 1 - src/gui/components/cc_frm_header.cpp | 1 - src/gui/components/cc_item.h | 2 ++ src/gui/components/cc_item_text.cpp | 1 + src/gui/components/cc_signals.h | 1 + 6 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index fcce3647e..c52001eb7 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -30,7 +30,7 @@ #include "cc_frm_clock.h" #include -#include + #include #include #include diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 420ea2775..707d43627 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -29,7 +29,6 @@ #include #include "cc_frm_ext_text.h" -#include #define DEF_HEIGHT 27 #define DEF_LABEL_WIDTH_PERCENT 30 diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 8a56e24ad..cda9c5628 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -31,7 +31,6 @@ #include "cc_frm_header.h" #include -#include using namespace std; diff --git a/src/gui/components/cc_item.h b/src/gui/components/cc_item.h index dad19d96e..4f5f42da5 100644 --- a/src/gui/components/cc_item.h +++ b/src/gui/components/cc_item.h @@ -27,10 +27,12 @@ #include "cc_types.h" #include "cc_base.h" #include "cc_draw.h" +#include "cc_signals.h" #include #include #include + class CComponentsItem : public CComponents { protected: diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index 67ee50401..c31e34f13 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -35,6 +35,7 @@ #include #include #include + using namespace std; //sub class CComponentsText from CComponentsItem diff --git a/src/gui/components/cc_signals.h b/src/gui/components/cc_signals.h index c3c60727e..5c3fdaca1 100644 --- a/src/gui/components/cc_signals.h +++ b/src/gui/components/cc_signals.h @@ -88,6 +88,7 @@ class CYourClass : sigc::trackable //<- not forget, requierd by destructor! #define __CC_SIGNALS_H__ #include +#include #include class CComponentsSignals : public sigc::trackable From 06fa3f248885ac76994864c135bfb8d5605dc609 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Feb 2017 19:32:25 +0100 Subject: [PATCH 14/25] CComponentsForm: move slots into base classes Usable for all form classes --- src/gui/components/cc_frm.cpp | 17 ----------------- src/gui/components/cc_frm.h | 10 +++------- src/gui/components/cc_frm_clock.cpp | 8 -------- src/gui/components/cc_frm_ext_text.cpp | 8 -------- src/gui/components/cc_frm_header.cpp | 4 ---- src/gui/components/cc_item_text.cpp | 6 ++++++ src/gui/components/cc_item_text.h | 1 - 7 files changed, 9 insertions(+), 45 deletions(-) diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 19843a5b9..d124f3395 100644 --- a/src/gui/components/cc_frm.cpp +++ b/src/gui/components/cc_frm.cpp @@ -680,20 +680,3 @@ bool CComponentsForm::enableColBodyGradient(const int& enable_mode, const fb_pix } return false; } - -void CComponentsForm::forceItemsPaint(bool force) -{ - for (size_t i = 0; i < v_cc_items.size(); i++){ - dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] found item type = [%d] \033[0m\n", __func__, __LINE__, v_cc_items[i]->getItemType()); - if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_TEXT){ - CComponentsText* text = static_cast (v_cc_items[i]); - text->forceTextPaint(force); - dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_TEXT [%u] content [%s]\033[0m\n", __func__, __LINE__, i, text->getText().c_str()); - } - if (v_cc_items[i]->getItemType() == CC_ITEMTYPE_LABEL){ - CComponentsLabel* label = static_cast (v_cc_items[i]); - label ->forceTextPaint(force); - dprintf(DEBUG_DEBUG, "\033[33m[CComponentsForm] [%s - %d] force repaint of item type CC_ITEMTYPE_LABEL [%u] content [%s]\033[0m\n", __func__, __LINE__, i, label->getText().c_str()); - } - } -} diff --git a/src/gui/components/cc_frm.h b/src/gui/components/cc_frm.h index b9cab7934..3561e495a 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -65,13 +65,6 @@ class CComponentsForm : public CComponentsItem const fb_pixel_t& color_body, const fb_pixel_t& color_shadow); - ///force repaint of all possible text items - void forceItemsPaint(bool force); - ///slot for background paint event, reserved for forceItemsPaint() - sigc::slot0 sl_items_repaint; - ///slot for repaint event, reserved for actions before repaint if paint() already was done. - sigc::slot0 sl_form_repaint; - public: CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, CComponentsForm *parent = NULL, @@ -223,6 +216,9 @@ class CComponentsForm : public CComponentsItem virtual bool clearPaintCache(); ///cleanup old gradient buffers include from sub items, returns true if any gradient buffer data was removed virtual bool clearFbGradientData(); + + ///slot for repaint event, reserved for actions before repaint if paint() already was done. + sigc::slot0 sl_form_repaint; }; #endif diff --git a/src/gui/components/cc_frm_clock.cpp b/src/gui/components/cc_frm_clock.cpp index c52001eb7..08a498eb1 100644 --- a/src/gui/components/cc_frm_clock.cpp +++ b/src/gui/components/cc_frm_clock.cpp @@ -100,9 +100,6 @@ CComponentsFrmClock::CComponentsFrmClock( const int& x_pos, //init slot for running clock cl_sl_show = sigc::mem_fun0(*this, &CComponentsFrmClock::ShowTime); - //init slot to ensure paint segments after painted background - sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsFrmClock::forceItemsPaint), true); - //run clock already if required if (activ) startClock(); @@ -300,11 +297,6 @@ void CComponentsFrmClock::initCCLockItems() x_lbl += v_cc_items[i-1]->getWidth(); v_cc_items[i]->setPos(x_lbl, y_lbl); } - - if(!OnAfterPaintBg.empty()) - OnAfterPaintBg.clear(); - //init slot to handle repaint of segments if background was repainted - OnAfterPaintBg.connect(sl_items_repaint); } diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 707d43627..9cd27aa23 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -113,9 +113,6 @@ void CComponentsExtTextForm::initVarExtTextForm(const int& x_pos, const int& y_p } ccx_label_align = ccx_text_align = CTextBox::NO_AUTO_LINEBREAK; - //init slot to ensure paint text items after painted background - sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsExtTextForm::forceItemsPaint), true); - initParent(parent); } @@ -221,11 +218,6 @@ void CComponentsExtTextForm::initCCTextItems() { initLabel(); initText(); - - if(!OnAfterPaintBg.empty()) - OnAfterPaintBg.clear(); - //init slot to handle repaint of text if background was repainted - OnAfterPaintBg.connect(sl_items_repaint); } void CComponentsExtTextForm::setLabelWidthPercent(const uint8_t& percent_val) diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index cda9c5628..838f4f35c 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -135,10 +135,6 @@ void CComponentsHeader::initVarHeader( const int& x_pos, const int& y_pos, const cch_cl_sec_format = cch_cl_format; cch_cl_enable_run = false; - //init slot to ensure paint items after painted background - sl_items_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::forceItemsPaint), true); - OnAfterPaintBg.connect(sl_items_repaint); - //init slot before re paint of header, paint() is already done sl_form_repaint = sigc::bind(sigc::mem_fun(*this, &CComponentsHeader::kill), col_body, -1, CC_FBDATA_TYPES, false); OnBeforeRePaint.connect(sl_form_repaint); diff --git a/src/gui/components/cc_item_text.cpp b/src/gui/components/cc_item_text.cpp index c31e34f13..8a3897d2d 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -274,6 +274,12 @@ bool CComponentsText::setTextFromFile(const string& path_to_textfile, const int void CComponentsText::paintText(bool do_save_bg) { + if (cc_parent){ + if(!cc_parent->OnAfterPaintBg.empty()) + cc_parent->OnAfterPaintBg.clear(); + //init slot to handle repaint of text if background was repainted + cc_parent->OnAfterPaintBg.connect(sigc::bind(sigc::mem_fun(*this, &CComponentsText::forceTextPaint), true)); + } initCCText(); if (!is_painted) paintInit(do_save_bg); diff --git a/src/gui/components/cc_item_text.h b/src/gui/components/cc_item_text.h index 1de07d08c..5e5d53d48 100644 --- a/src/gui/components/cc_item_text.h +++ b/src/gui/components/cc_item_text.h @@ -196,7 +196,6 @@ class CComponentsText : public CCTextScreen, public CComponentsItem ///force paint of text even if text was changed or not virtual void forceTextPaint(bool force_text_paint = true){ct_force_text_paint = force_text_paint;}; - ///gets the embedded CTextBox object, so it's possible to get access directly to its methods and properties virtual CTextBox* getCTextBoxObject() { return ct_textbox; }; From 9f7605127a83bcab4e41b7c23d101f544790a6ef Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 6 Feb 2017 21:20:34 +0100 Subject: [PATCH 15/25] Helpbox: fix missing text after page repaint --- src/gui/widget/helpbox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widget/helpbox.cpp b/src/gui/widget/helpbox.cpp index 4169b5d13..bb5c04829 100644 --- a/src/gui/widget/helpbox.cpp +++ b/src/gui/widget/helpbox.cpp @@ -98,9 +98,9 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in if (!text.empty()){ int x_text = w_picon + (picon ? OFFSET_INNER_MID : 0); CComponentsText * txt = new CComponentsText(x_text, 0, line->getWidth()-x_text, 0, text, text_mode, font); + txt->doPaintBg(false); #if 0 //"contrast agent", if you want to see where the text items are drawn. txt->setColorBody(COL_RED); - txt->doPaintBg(true); #endif int lines = txt->getCTextBoxObject()->getLines(); txt_height = std::max(lines*font->getHeight(), h_line); From 95de68c5a5725ac919c40b2092413d2b0fc62d6b Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 7 Feb 2017 15:04:51 +0100 Subject: [PATCH 16/25] CTextBox: compare condition for text render more precisely --- src/gui/widget/textbox.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 54968c03c..bc2fcac5a 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -657,6 +657,7 @@ void CTextBox::refreshText(void) if (allow_paint_bg){ //TRACE("[CTextBox] %s restore bg %d\r\n", __FUNCTION__, __LINE__); frameBuffer->RestoreScreen(ax, ay, dx, dy, m_bgpixbuf); + m_bg_painted = true; } } } @@ -718,7 +719,7 @@ void CTextBox::refreshText(void) frameBuffer->paintBoxRel(tx, ty-th, tw, th, COL_RED, m_nBgRadius, m_nBgRadiusType); #endif //TRACE("[CTextBox] %s Line %d m_cFrame.iX %d m_cFrameTextRel.iX %d\r\n", __FUNCTION__, __LINE__, m_cFrame.iX, m_cFrameTextRel.iX); - if (m_bg_painted || m_old_cText != m_cText) + if (m_bg_painted || (m_old_cText != m_cText)) m_pcFontText->RenderString(tx, ty, tw, m_cLineArray[i].c_str(), m_textColor, 0, m_renderMode | ((m_utf8_encoded) ? Font::IS_UTF8 : 0)); y += m_nFontTextHeight; } From 622e7a4dd259ccf1c2b963f354091b59415abae7 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Tue, 7 Feb 2017 17:06:11 +0100 Subject: [PATCH 17/25] CScreenSaver: ensure full cleanup of infoclock after stopped screensaver This provokes re init of info clock. --- src/gui/screensaver.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gui/screensaver.cpp b/src/gui/screensaver.cpp index 7c3b50b5a..7532803a0 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -143,10 +143,12 @@ void CScreenSaver::Stop() m_frameBuffer->paintBackground(); //clear entire screen CAudioMute::getInstance()->enableMuteIcon(status_mute); - if (!OnAfterStop.empty()) + if (!OnAfterStop.empty()){ OnAfterStop(); - else + }else{ + CInfoClock::getInstance()->ClearDisplay(); //provokes reinit CInfoClock::getInstance()->enableInfoClock(); + } } void* CScreenSaver::ScreenSaverPrg(void* arg) From a62d5b7c8edbec32838b99e952a6e54174937894 Mon Sep 17 00:00:00 2001 From: GetAway Date: Tue, 7 Feb 2017 08:39:09 +0100 Subject: [PATCH 18/25] make the webtv directory configurable --- acinclude.m4 | 3 +++ src/neutrino.cpp | 2 +- src/nhttpd/yhttpd_mods/mod_yparser.cpp | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index e50254329..42956bd07 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -155,6 +155,9 @@ TUXBOX_APPS_DIRECTORY_ONE(plugindir,PLUGINDIR,libdir,/lib,/tuxbox/plugins, TUXBOX_APPS_DIRECTORY_ONE(plugindir_var,PLUGINDIR_VAR,localstatedir,/var,/tuxbox/plugins, [--with-plugindir_var=PATH ],[where to find the plugins in /var]) +TUXBOX_APPS_DIRECTORY_ONE(webtvdir_var,WEBTVDIR_VAR,localstatedir,/var,/tuxbox/plugins/webtv, + [--with-webtvdir_var=PATH ],[where to find the livestreamScriptPath in /var]) + TUXBOX_APPS_DIRECTORY_ONE(plugindir_mnt,PLUGINDIR_MNT,mntdir,/mnt,/plugins, [--with-plugindir_mnt=PATH ],[where to find the the extern plugins]) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 4e68ed97d..f1416d10d 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -939,7 +939,7 @@ int CNeutrinoApp::loadSetup(const char * fname) g_settings.infoClockSeconds = configfile.getInt32("infoClockSeconds", 1); g_settings.livestreamResolution = configfile.getInt32("livestreamResolution", 1920); - g_settings.livestreamScriptPath = configfile.getString("livestreamScriptPath", PLUGINDIR_VAR "/webtv"); + g_settings.livestreamScriptPath = configfile.getString("livestreamScriptPath", WEBTVDIR_VAR); g_settings.version_pseudo = configfile.getString("version_pseudo", "19700101000000"); diff --git a/src/nhttpd/yhttpd_mods/mod_yparser.cpp b/src/nhttpd/yhttpd_mods/mod_yparser.cpp index bcef54ea4..34e1ace67 100644 --- a/src/nhttpd/yhttpd_mods/mod_yparser.cpp +++ b/src/nhttpd/yhttpd_mods/mod_yparser.cpp @@ -457,6 +457,7 @@ std::string CyParser::YWeb_cgi_cmd(CyhookHandler *hh, std::string ycmd) { else if (ycmd_name.compare("GAMESDIR")) yresult = GAMESDIR; else if (ycmd_name.compare("PLUGINDIR")) yresult = PLUGINDIR; else if (ycmd_name.compare("PLUGINDIR_VAR")) yresult = PLUGINDIR_VAR; + else if (ycmd_name.compare("WEBTVDIR_VAR")) yresult = WEBTVDIR_VAR; else if (ycmd_name.compare("LUAPLUGINDIR")) yresult = LUAPLUGINDIR; else if (ycmd_name.compare("LOCALEDIR")) yresult = LOCALEDIR; else if (ycmd_name.compare("LOCALEDIR_VAR")) yresult = LOCALEDIR_VAR; From 4b55d2597fd1beed0402a8a1ec2309c4dc22ce22 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Thu, 9 Feb 2017 08:24:20 +0100 Subject: [PATCH 19/25] - helpbox: fix display of text after scroll; thx to DboxOldie --- src/gui/widget/helpbox.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/widget/helpbox.cpp b/src/gui/widget/helpbox.cpp index bb5c04829..bc84a2ee2 100644 --- a/src/gui/widget/helpbox.cpp +++ b/src/gui/widget/helpbox.cpp @@ -99,6 +99,7 @@ void Helpbox::addLine(const std::string& icon, const std::string& text, const in int x_text = w_picon + (picon ? OFFSET_INNER_MID : 0); CComponentsText * txt = new CComponentsText(x_text, 0, line->getWidth()-x_text, 0, text, text_mode, font); txt->doPaintBg(false); + txt->forceTextPaint(); #if 0 //"contrast agent", if you want to see where the text items are drawn. txt->setColorBody(COL_RED); #endif From c1f788ac424c968a624e2aa12a02b7ea27b4a88b Mon Sep 17 00:00:00 2001 From: GetAway Date: Tue, 7 Feb 2017 22:19:57 +0100 Subject: [PATCH 20/25] change to CURLOPT_CONNECTTIMEOUT_MS and ... use a connect_timeout of 300ms for remote timer --- src/gui/timerlist.cpp | 2 +- src/system/httptool.cpp | 8 ++++---- src/system/httptool.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 929ab4bbe..f54d04c30 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -280,7 +280,7 @@ CTimerList::CTimerList() Timer = new CTimerdClient(); timerNew_message = ""; timerNew_pluginName = ""; - httpConnectTimeout = 3; + httpConnectTimeout = 300; // ms changed = false; /* most probable default */ diff --git a/src/system/httptool.cpp b/src/system/httptool.cpp index 2d023c124..c68c84527 100644 --- a/src/system/httptool.cpp +++ b/src/system/httptool.cpp @@ -66,7 +66,7 @@ int CHTTPTool::show_progress( void *clientp, double dltotal, double dlnow, doubl return 0; } //#define DEBUG -bool CHTTPTool::downloadFile(const std::string & URL, const char * const downloadTarget, int globalProgressEnd, int connecttimeout/*=10*/, int timeout/*=1800*/) +bool CHTTPTool::downloadFile(const std::string & URL, const char * const downloadTarget, int globalProgressEnd, int connecttimeout/*=10000*/, int timeout/*=1800*/) { CURL *curl; CURLcode res; @@ -98,7 +98,7 @@ printf("url is %s\n", URL.c_str()); curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str()); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1); curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); - curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, connecttimeout); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, connecttimeout); curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); #ifdef DEBUG curl_easy_setopt(curl, CURLOPT_VERBOSE, 1); @@ -136,7 +136,7 @@ printf("download code %d\n", res); return res==CURLE_OK; } -std::string CHTTPTool::downloadString(const std::string & URL, int globalProgressEnd, int connecttimeout/*=10*/, int timeout/*=1800*/) +std::string CHTTPTool::downloadString(const std::string & URL, int globalProgressEnd, int connecttimeout/*=10000*/, int timeout/*=1800*/) { CURL *curl; CURLcode res; @@ -162,7 +162,7 @@ printf("url is %s\n", URL.c_str()); curl_easy_setopt(curl, CURLOPT_USERAGENT, userAgent.c_str()); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, (long)1); curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout); - curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, connecttimeout); + curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT_MS, connecttimeout); curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, false); #ifdef DEBUG diff --git a/src/system/httptool.h b/src/system/httptool.h index 919cf4dbb..845cc3bf6 100644 --- a/src/system/httptool.h +++ b/src/system/httptool.h @@ -52,8 +52,8 @@ class CHTTPTool CHTTPTool(); void setStatusViewer( CProgressWindow* statusview ); - bool downloadFile( const std::string & URL, const char * const downloadTarget, int globalProgressEnd=-1, int connecttimeout=10, int timeout=1800); - std::string downloadString(const std::string & URL, int globalProgressEnd=-1, int connecttimeout=10, int timeout=1800); + bool downloadFile( const std::string & URL, const char * const downloadTarget, int globalProgressEnd=-1, int connecttimeout=10000, int timeout=1800); + std::string downloadString(const std::string & URL, int globalProgressEnd=-1, int connecttimeout=10000, int timeout=1800); }; From 2dda93ed2b5cdb9a7fd9ca9a9d05944ba4a4ecdc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 9 Feb 2017 15:52:39 +0100 Subject: [PATCH 21/25] CMenuWidget: use only nameString as container for widget name neutrino_locale_t name could be transformed always to real string to unify this container --- src/gui/widget/menue.cpp | 7 +------ src/gui/widget/menue.h | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index cb83c00f5..d3c5d2266 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -534,8 +534,7 @@ CMenuGlobal* CMenuGlobal::getInstance() CMenuWidget::CMenuWidget() { - nameString = g_Locale->getText(NONEXISTANT_LOCALE); - name = NONEXISTANT_LOCALE; + nameString = ""; iconfile = ""; selected = -1; iconOffset = 0; @@ -555,7 +554,6 @@ CMenuWidget::CMenuWidget() CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) { - name = Name; nameString = g_Locale->getText(Name); preselected = -1; Init(Icon, mwidth, w_index); @@ -563,7 +561,6 @@ CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) { - name = NONEXISTANT_LOCALE; nameString = Name; preselected = -1; Init(Icon, mwidth, w_index); @@ -729,8 +726,6 @@ CMenuItem* CMenuWidget::getItem(const uint& item_id) const char *CMenuWidget::getName() { - if (name != NONEXISTANT_LOCALE) - return g_Locale->getText(name); return nameString.c_str(); } diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 5cfa58da2..6c60eef90 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -504,7 +504,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals unsigned int saveScreen_x; protected: std::string nameString; - neutrino_locale_t name; + CFrameBuffer *frameBuffer; std::vector items; std::vector page_start; From 0435ca20a322483adc1f30951841a07d0a242c38 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 9 Feb 2017 16:35:03 +0100 Subject: [PATCH 22/25] CMenuWidget: remove dub code from init --- src/gui/widget/menue.cpp | 98 ++++++++++++++++++---------------------- src/gui/widget/menue.h | 2 +- 2 files changed, 44 insertions(+), 56 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index d3c5d2266..d859c966b 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -534,47 +534,57 @@ CMenuGlobal* CMenuGlobal::getInstance() CMenuWidget::CMenuWidget() { - nameString = ""; - iconfile = ""; - selected = -1; + Init("", "", 0, 0); +} + +CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) +{ + Init(g_Locale->getText(Name), Icon, mwidth, w_index); +} + +CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) +{ + Init(Name, Icon, mwidth, w_index); +} + +void CMenuWidget::Init(const std::string &NameString, const std::string &Icon, const int mwidth, const mn_widget_id_t &w_index) +{ + //pos + x = y = 0; + + //caption and icon + nameString = NameString; + iconfile = Icon; + + //basic attributes iconOffset = 0; offx = offy = 0; from_wizard = SNeutrinoSettings::WIZARD_OFF; fade = true; sb_width = 0; savescreen = false; - background = NULL; preselected = -1; + nextShortcut = 1; + current_page = 0; + has_hints = false; + brief_hints = BRIEF_HINT_NO; + hint_painted = false; + hint_height = 0; + fbutton_count = 0; + fbutton_labels = NULL; + fbutton_width = 0; + fbutton_height = 0; + saveScreen_width = 0; + saveScreen_height = 0; + + //objects + background = NULL; details_line = NULL; info_box = NULL; header = NULL; - nextShortcut = 1; - x = y = 0; -} + frameBuffer = CFrameBuffer::getInstance(); + mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here -CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) -{ - nameString = g_Locale->getText(Name); - preselected = -1; - Init(Icon, mwidth, w_index); -} - -CMenuWidget::CMenuWidget(const std::string &Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) -{ - nameString = Name; - preselected = -1; - Init(Icon, mwidth, w_index); -} - -void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widget_id_t &w_index) -{ - mglobal = CMenuGlobal::getInstance(); //create CMenuGlobal instance only here - frameBuffer = CFrameBuffer::getInstance(); - iconfile = Icon; - details_line = NULL; - - info_box = NULL; - header = NULL; //handle select values if(w_index > MN_WIDGET_ID_MAX){ //error @@ -589,40 +599,18 @@ void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widge //overwrite preselected value with global select value selected = (widget_index == NO_WIDGET_ID ? preselected : mglobal->v_selected[widget_index]); - + //dimension min_width = 0; width = 0; /* is set in paint() */ - - if (mwidth > 100) - { + if (mwidth > 100){ /* warn about abuse until we found all offenders... */ fprintf(stderr, "Warning: %s (%s) (%s) mwidth over 100%%: %d\n", __FUNCTION__, nameString.c_str(), Icon.c_str(), mwidth); } - else - { + else{ min_width = frameBuffer->getScreenWidth(true) * mwidth / 100; if(min_width > (int) frameBuffer->getScreenWidth()) min_width = frameBuffer->getScreenWidth(); } - - current_page = 0; - offx = offy = 0; - from_wizard = SNeutrinoSettings::WIZARD_OFF; - fade = true; - savescreen = false; - background = NULL; - has_hints = false; - brief_hints = BRIEF_HINT_NO; - hint_painted = false; - hint_height = 0; - fbutton_count = 0; - fbutton_labels = NULL; - fbutton_width = 0; - fbutton_height = 0; - nextShortcut = 1; - saveScreen_width = 0; - saveScreen_height = 0; - x = y = 0; } void CMenuWidget::move(int xoff, int yoff) diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index 6c60eef90..bc58f3d9b 100644 --- a/src/gui/widget/menue.h +++ b/src/gui/widget/menue.h @@ -544,7 +544,7 @@ class CMenuWidget : public CMenuTarget, public CComponentsSignals bool washidden; int nextShortcut; - void Init(const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index); + void Init(const std::string &NameString, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index); virtual void paintItems(); void checkHints(); void calcSize(); From a56bb97b50c59be5dc71bf7703c8bec8f2edf8d4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 9 Feb 2017 22:40:38 +0100 Subject: [PATCH 23/25] Revert "CChannelList: delete with red yes button" This reverts commit 36896849689c552989cf365984de546a4ed5282a. User request: Is not desired --- src/gui/channellist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index efa09a771..c28a6bbe5 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2660,7 +2660,7 @@ void CChannelList::deleteChannel(bool ask) if (!bouquet || !bouquet->zapitBouquet) return; - if (ask && ShowMsg(LOCALE_FILEBROWSER_DELETE, (*chanlist)[selected]->getName(), CMsgBox::mbrYes, CMsgBox::mbNoYes)!=CMsgBox::mbrYes) + if (ask && ShowMsg(LOCALE_FILEBROWSER_DELETE, (*chanlist)[selected]->getName(), CMsgBox::mbrNo, CMsgBox::mbYes|CMsgBox::mbNo)!=CMsgBox::mbrYes) return; bouquet->zapitBouquet->removeService((*chanlist)[selected]->getChannelID()); From 80f6e611ba9086193bbfcea30284469dd9fc33a5 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 10 Feb 2017 20:33:15 +0100 Subject: [PATCH 24/25] src/driver/pictureviewer/pictureviewer.cpp check whether there is enough free memory for the image buffer --- src/driver/pictureviewer/pictureviewer.cpp | 44 +++++++++++++++++++--- src/driver/pictureviewer/pictureviewer.h | 1 + 2 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/driver/pictureviewer/pictureviewer.cpp b/src/driver/pictureviewer/pictureviewer.cpp index c658cea04..4bb9a63cf 100644 --- a/src/driver/pictureviewer/pictureviewer.cpp +++ b/src/driver/pictureviewer/pictureviewer.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef FBV_SUPPORT_GIF extern int fh_gif_getsize (const char *, int *, int *, int, int); @@ -168,7 +169,11 @@ bool CPictureViewer::DecodeImage (const std::string & _name, bool showBusySign, free (m_NextPic_Buffer); m_NextPic_Buffer = NULL; } - m_NextPic_Buffer = (unsigned char *) malloc (x * y * 3); + size_t bufsize = x * y * 3; + if (!checkfreemem(bufsize)){ + return false; + } + m_NextPic_Buffer = (unsigned char *) malloc (bufsize); if (m_NextPic_Buffer == NULL) { dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc, %s\n", __func__, __LINE__, strerror(errno)); return false; @@ -443,7 +448,12 @@ void CPictureViewer::showBusy (int sx, int sy, int width, char r, char g, char b free (m_busy_buffer); m_busy_buffer = NULL; } - m_busy_buffer = (unsigned char *) malloc (width * width * cpp); + size_t bufsize = width * width * cpp; + if (!checkfreemem(bufsize)){ + cs_free_uncached (fb_buffer); + return; + } + m_busy_buffer = (unsigned char *) malloc (bufsize); if (m_busy_buffer == NULL) { dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Error: malloc\n", __func__, __LINE__); cs_free_uncached (fb_buffer); @@ -658,9 +668,13 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, mode_str = "getIcon"; fh = fh_getsize(name.c_str(), &x, &y, INT_MAX, INT_MAX); + size_t bufsize = x * y * 4; + if (!checkfreemem(bufsize)) + return NULL; + if (fh) { - buffer = (unsigned char *) malloc(x * y * 4); + buffer = (unsigned char *) malloc(bufsize);//x * y * 4 if (buffer == NULL) { dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode %s: Error: malloc\n", __func__, __LINE__, mode_str.c_str()); @@ -681,6 +695,7 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, if((GetImage) && (*width < 1 || *height < 1)){ dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode: %s, file: %s (Pos: %d %d, Dim: %d x %d)\n", __func__, __LINE__, mode_str.c_str(), name.c_str(), x, y, *width, *height); free(buffer); + buffer = NULL; return NULL; } // resize only getImage @@ -703,9 +718,11 @@ fb_pixel_t * CPictureViewer::int_getImage(const std::string & name, int *width, }else{ dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode %s: Error decoding file %s\n", __func__, __LINE__, mode_str.c_str(), name.c_str()); free(buffer); + buffer = NULL; return NULL; } free(buffer); + buffer = NULL; }else dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] mode: %s, file: %s Error: %s, buffer = %p (Pos: %d %d, Dim: %d x %d)\n", __func__, __LINE__, mode_str.c_str(), name.c_str(), strerror(errno), buffer, x, y, *width, *height); return ret; @@ -726,12 +743,15 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy, unsigned char * cr; if(dst == NULL) { - cr = (unsigned char*) malloc(dx * dy * ((alpha) ? 4 : 3)); - + size_t bufsize = dx * dy * ((alpha) ? 4 : 3); + if (!checkfreemem(bufsize)){ + return orgin; + } + cr = (unsigned char*) malloc(bufsize); if(cr == NULL) { dprintf(DEBUG_NORMAL, "[CPictureViewer] [%s - %d] Resize Error: malloc\n", __func__, __LINE__); - return(orgin); + return orgin; } }else cr = dst; @@ -818,6 +838,7 @@ unsigned char * CPictureViewer::int_Resize(unsigned char *orgin, int ox, int oy, } } free(orgin); + orgin = NULL; return(cr); } @@ -830,3 +851,14 @@ unsigned char * CPictureViewer::ResizeA(unsigned char *orgin, int ox, int oy, in { return int_Resize(orgin, ox, oy, dx, dy, COLOR, NULL, true); } + +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\n", __func__, __LINE__); + return false; + } + return true; +} diff --git a/src/driver/pictureviewer/pictureviewer.h b/src/driver/pictureviewer/pictureviewer.h index 8183f1943..71fc01143 100644 --- a/src/driver/pictureviewer/pictureviewer.h +++ b/src/driver/pictureviewer/pictureviewer.h @@ -112,6 +112,7 @@ class CPictureViewer void add_format(int (*picsize)(const char *,int *,int*,int,int),int (*picread)(const char *,unsigned char **,int*,int*), int (*id)(const char*)); unsigned char * int_Resize(unsigned char *orgin, int ox, int oy, int dx, int dy, ScalingMode type, unsigned char * dst, bool alpha); fb_pixel_t * int_getImage(const std::string & name, int *width, int *height, bool GetImage); + bool checkfreemem(size_t bufsize); }; From 582051b9a1ac5cdb31c92e0e03292a4febd88275 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Fri, 10 Feb 2017 20:33:28 +0100 Subject: [PATCH 25/25] src/driver/audiometadata.cpp init cover_temporary --- src/driver/audiometadata.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/driver/audiometadata.cpp b/src/driver/audiometadata.cpp index c94689be1..7dbe1bd08 100644 --- a/src/driver/audiometadata.cpp +++ b/src/driver/audiometadata.cpp @@ -40,7 +40,8 @@ // constructor CAudioMetaData::CAudioMetaData() { - clear(); + cover_temporary = false; + clear(); } // destructor