diff --git a/acinclude.m4 b/acinclude.m4 index 9ce0c1c9f..48a891434 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -157,6 +157,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/configure.ac b/configure.ac index 37216b765..13202d6d7 100644 --- a/configure.ac +++ b/configure.ac @@ -98,7 +98,17 @@ AM_CONDITIONAL(USE_TREMOR, test "$TREMOR" = "yes") # TUXBOX_APPS_LIB_PKGCONFIG(OPENSSL,openssl) TUXBOX_APPS_LIB_PKGCONFIG(CURL,libcurl) -PKG_CHECK_MODULES([FREETYPE], [freetype2 >= 2.5.0], echo "freetype2 >= 2.5.0 found") + +## 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"], [ + ## 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 @@ -107,7 +117,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 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 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 bdddb6f25..0deeae4bf 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); }; diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index be339d7d1..67285130d 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2173,9 +2173,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() @@ -2667,7 +2665,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()); diff --git a/src/gui/components/cc_frm.cpp b/src/gui/components/cc_frm.cpp index 9d3544573..dd414b5fb 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); } @@ -677,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 56ad077c6..3561e495a 100644 --- a/src/gui/components/cc_frm.h +++ b/src/gui/components/cc_frm.h @@ -65,11 +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_repaint; - public: CComponentsForm( const int x_pos = 0, const int y_pos = 0, const int w = 800, const int h = 600, CComponentsForm *parent = NULL, @@ -221,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 ca8769a2b..b52180456 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 @@ -101,9 +101,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_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsFrmClock::forceItemsPaint), true); - //run clock already if required if (activ) startClock(); @@ -301,11 +298,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_repaint); } diff --git a/src/gui/components/cc_frm_ext_text.cpp b/src/gui/components/cc_frm_ext_text.cpp index 0a3f9873d..864336d91 100644 --- a/src/gui/components/cc_frm_ext_text.cpp +++ b/src/gui/components/cc_frm_ext_text.cpp @@ -30,7 +30,6 @@ #include "cc_frm_ext_text.h" #include -#include #define DEF_HEIGHT 27 #define DEF_LABEL_WIDTH_PERCENT 30 @@ -115,9 +114,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_repaint = sigc::bind<0>(sigc::mem_fun1(*this, &CComponentsExtTextForm::forceItemsPaint), true); - initParent(parent); } @@ -223,11 +219,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_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 0bd85e7dc..429f468d0 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -32,7 +32,6 @@ #include #include -#include using namespace std; @@ -137,8 +136,9 @@ 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 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(); @@ -524,11 +524,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() 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 d0346dc7e..4ca37258c 100644 --- a/src/gui/components/cc_item_text.cpp +++ b/src/gui/components/cc_item_text.cpp @@ -36,6 +36,7 @@ #include #include #include + using namespace std; //sub class CComponentsText from CComponentsItem @@ -274,6 +275,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; }; diff --git a/src/gui/components/cc_signals.h b/src/gui/components/cc_signals.h index da6a6d8b2..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 @@ -113,6 +114,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; diff --git a/src/gui/hdd_menu.cpp b/src/gui/hdd_menu.cpp index 87db3e46c..48884f300 100644 --- a/src/gui/hdd_menu.cpp +++ b/src/gui/hdd_menu.cpp @@ -1356,12 +1356,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; @@ -1377,12 +1377,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[n]); + 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[n]); + 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); @@ -1396,12 +1406,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); 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 48a46b7e4..1226c3345 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -311,6 +311,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") { @@ -1129,6 +1130,7 @@ bool CMoviePlayerGui::PlayFileStart(void) { menu_ret = menu_return::RETURN_REPAINT; + FileTimeOSD->setMpTimeForced(false); time_forced = false; position = 0, duration = 0; @@ -1230,6 +1232,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); } @@ -1435,6 +1438,7 @@ void CMoviePlayerGui::PlayFileLoop(void) time_forced = false; FileTimeOSD->kill(); } + FileTimeOSD->setMpTimeForced(false); if (playstate > CMoviePlayerGui::PLAY) { playstate = CMoviePlayerGui::PLAY; speed = 1; @@ -1469,6 +1473,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); @@ -1500,6 +1509,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) { @@ -1525,6 +1536,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/screensaver.cpp b/src/gui/screensaver.cpp index d4558edd7..3bf274b39 100644 --- a/src/gui/screensaver.cpp +++ b/src/gui/screensaver.cpp @@ -144,10 +144,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) 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 diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index f10090529..ca1951541 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 */ @@ -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); } } @@ -704,16 +704,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, it->online, 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); @@ -802,7 +805,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/gui/widget/helpbox.cpp b/src/gui/widget/helpbox.cpp index 09c014261..fc8989efc 100644 --- a/src/gui/widget/helpbox.cpp +++ b/src/gui/widget/helpbox.cpp @@ -99,9 +99,10 @@ 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); + txt->forceTextPaint(); #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); diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 959e63c1a..8179769f1 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -534,50 +534,57 @@ CMenuGlobal* CMenuGlobal::getInstance() CMenuWidget::CMenuWidget() { - nameString = g_Locale->getText(NONEXISTANT_LOCALE); - name = NONEXISTANT_LOCALE; - 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) -{ - name = Name; - 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) -{ - name = NONEXISTANT_LOCALE; - 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 @@ -592,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) @@ -729,8 +714,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(); } @@ -1256,8 +1239,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 diff --git a/src/gui/widget/menue.h b/src/gui/widget/menue.h index de5908e7f..bf784e3cb 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; @@ -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(); diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 31165abba..f8ed60af4 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -659,6 +659,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; } } } @@ -720,7 +721,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; } diff --git a/src/neutrino.cpp b/src/neutrino.cpp index f7f43df83..a14afa8d0 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -972,7 +972,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; diff --git a/src/system/flashtool.cpp b/src/system/flashtool.cpp index d246af2c9..1e9c5cb26 100644 --- a/src/system/flashtool.cpp +++ b/src/system/flashtool.cpp @@ -526,6 +526,8 @@ const char *CFlashVersionInfo::getReleaseCycle(void) const const char *CFlashVersionInfo::getType(void) const { + // TODO: localize it + switch (snapshot) { case '0': @@ -540,6 +542,8 @@ const char *CFlashVersionInfo::getType(void) const return "Settings"; case 'A': return "Addon"; + case 'U': + return "Update"; case 'T': return "Text"; default: diff --git a/src/system/httptool.cpp b/src/system/httptool.cpp index 29e58fdf5..f802bb381 100644 --- a/src/system/httptool.cpp +++ b/src/system/httptool.cpp @@ -67,7 +67,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; @@ -99,7 +99,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); @@ -137,7 +137,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; @@ -163,7 +163,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); }; diff --git a/src/system/settings.h b/src/system/settings.h index b51e95fce..fb9398240 100644 --- a/src/system/settings.h +++ b/src/system/settings.h @@ -164,6 +164,7 @@ struct timer_remotebox_item std::string pass; std::string rbname; std::string rbaddress; + bool online; }; struct SNeutrinoSettings