From 293d32c776c4cb6e5e2c9f0914512f0e878b0cf1 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 28 Jan 2017 17:55:14 +0100 Subject: [PATCH 01/26] src/gui/lua/lua_curl.cpp set dumb cookie for dumb 403 forbidden --- src/gui/lua/lua_curl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/lua/lua_curl.cpp b/src/gui/lua/lua_curl.cpp index 9bcf47ef5..fe1217512 100644 --- a/src/gui/lua/lua_curl.cpp +++ b/src/gui/lua/lua_curl.cpp @@ -267,7 +267,7 @@ Example: curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L); /* enable all supported built-in compressions */ curl_easy_setopt(curl_handle, CURLOPT_ACCEPT_ENCODING, ""); - + curl_easy_setopt(curl_handle, CURLOPT_COOKIE, ""); if (!userAgent.empty()) curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, userAgent.c_str()); From bcf478ba67d63ffafb9ff756b6a91a898625ec00 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Sun, 29 Jan 2017 04:29:47 +0100 Subject: [PATCH 02/26] install.sh: Preserve symlinks at update --- data/scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/scripts/install.sh b/data/scripts/install.sh index 1e3dcb8ec..26238fa8a 100755 --- a/data/scripts/install.sh +++ b/data/scripts/install.sh @@ -21,7 +21,7 @@ update_file() fi echo "update $FILE_IMAGE" rm -f $FILE_IMAGE - cp $FILE_NEW $FILE_IMAGE + cp -d $FILE_NEW $FILE_IMAGE fi } From f76dda36df1478b928b92e39584ff0dec13d410c Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 29 Jan 2017 20:54:35 +0100 Subject: [PATCH 03/26] fix uninitialised values --- src/gui/components/cc_frm_window.cpp | 2 +- src/gui/components/cc_item.cpp | 1 + src/gui/movieinfo.cpp | 1 + src/gui/widget/menue.cpp | 2 ++ 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/components/cc_frm_window.cpp b/src/gui/components/cc_frm_window.cpp index 7137f76ab..80455a5ad 100644 --- a/src/gui/components/cc_frm_window.cpp +++ b/src/gui/components/cc_frm_window.cpp @@ -157,7 +157,7 @@ void CComponentsWindow::initVarWindow( const int& x_pos, const int& y_pos, const ccw_col_head = COL_MENUHEAD_PLUS_0; ccw_col_head_text = COL_MENUHEAD_TEXT; ccw_col_footer = COL_MENUFOOT_PLUS_0; - + cc_parent = NULL; page_scroll_mode = PG_SCROLL_M_OFF; //permanent disabled here, only in body used! initCCWItems(); diff --git a/src/gui/components/cc_item.cpp b/src/gui/components/cc_item.cpp index d695cbdf1..4a6f49faf 100644 --- a/src/gui/components/cc_item.cpp +++ b/src/gui/components/cc_item.cpp @@ -50,6 +50,7 @@ CComponentsItem::CComponentsItem(CComponentsForm* parent) cc_item_selected = false; cc_page_number = 0; cc_has_focus = true; + cc_parent = NULL; initParent(parent); } diff --git a/src/gui/movieinfo.cpp b/src/gui/movieinfo.cpp index 954c93cde..f06e68c9b 100644 --- a/src/gui/movieinfo.cpp +++ b/src/gui/movieinfo.cpp @@ -497,6 +497,7 @@ void MI_MOVIE_INFO::clear(void) timePlay.tm_year = 100; timePlay.tm_mday = 0; timePlay.tm_mon = 1; + timePlay.tm_isdst = -1; file.Name = ""; file.Url = ""; diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 4a990afb1..5bf5010c3 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -550,6 +550,7 @@ CMenuWidget::CMenuWidget() info_box = NULL; header = NULL; nextShortcut = 1; + x = y = 0; } CMenuWidget::CMenuWidget(const neutrino_locale_t Name, const std::string & Icon, const int mwidth, const mn_widget_id_t &w_index) @@ -624,6 +625,7 @@ void CMenuWidget::Init(const std::string &Icon, const int mwidth, const mn_widge nextShortcut = 1; saveScreen_width = 0; saveScreen_height = 0; + x = y = 0; } void CMenuWidget::move(int xoff, int yoff) From 5f93b57d847900999c245636bef3d706ccbdd74b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 04/26] hintbox: restore proper handling of up/down keys When no scrollbar is present, just pass through up/down keys instead of only canceling the hintbox. This restores the behaviour before commit dde298b1b7. Prominent examle is the "channel not available" popup which prevented further channel switching until canceled. --- src/gui/widget/hintbox.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/gui/widget/hintbox.cpp b/src/gui/widget/hintbox.cpp index 9be2aae6f..8e513756a 100644 --- a/src/gui/widget/hintbox.cpp +++ b/src/gui/widget/hintbox.cpp @@ -219,16 +219,13 @@ int CHintBox::exec() { res = messages_return::cancel_all; } - else if ((msg == CRCInput::RC_up) || (msg == CRCInput::RC_down)) + else if (enable_txt_scroll && (msg == CRCInput::RC_up || msg == CRCInput::RC_down)) { - if (enable_txt_scroll){ - if (msg == CRCInput::RC_up) - this->scroll_up(); - else - this->scroll_down(); - } + /* if ! enable_txt_scroll, fall through to last else branch instead */ + if (msg == CRCInput::RC_up) + this->scroll_up(); else - res = messages_return::cancel_all; + this->scroll_down(); } else if (CNeutrinoApp::getInstance()->listModeKey(msg)){ // do nothing //TODO: if passed rc messages are ignored rc messaages: has no effect here too!! From fd9387a43ce1e0912c24d8caf40fe3690f7ef71c Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 05/26] opkg_manager: use system-update script if available opkg has several problems with complex system updates, especially when having to update itself and with the package ordering during update To avoid hard coding the workarounds into neutrino, just call a script named "system-update" (if available) instead of "opkg upgrade". This script can be tuned to the specific target and its problems. --- src/gui/opkg_manager.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 7c38b5f99..a23d698e7 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -11,7 +11,7 @@ Adaptions: Copyright (C) 2013 martii gitorious.org/neutrino-mp/martiis-neutrino-mp - Copyright (C) 2015-2016 Stefan Seyfried + Copyright (C) 2015-2017 Stefan Seyfried License: GPL @@ -71,6 +71,11 @@ #define OPKG_BAD_PATTERN_LIST_FILE CONFIGDIR "/bad_package_pattern.list" #define OPKG_CONFIG_FILE "/etc/opkg/opkg.conf" +/* script to call instead of "opkg upgrade" + * opkg fails to gracefully self-upgrade, and additionally has some ordering issues + */ +#define SYSTEM_UPDATE "system-update" + using namespace std; enum @@ -89,7 +94,7 @@ enum OM_MAX }; -static const string pkg_types[OM_MAX] = +static string pkg_types[OM_MAX] = { OPKG_CL " list ", OPKG_CL " list-installed ", @@ -614,6 +619,11 @@ bool COPKGManager::hasOpkgSupport() return false; } + if (! find_executable(SYSTEM_UPDATE).empty()) { + dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] " SYSTEM_UPDATE " script found\n", __func__, __LINE__); + pkg_types[OM_UPGRADE] = SYSTEM_UPDATE; + } + #if 0 /* If directory /var/lib/opkg resp. /opt/opkg does not exist, it is created by opkg itself */ From 1454d09a750d5614b3263d2a114d2523ca362bf2 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 06/26] opkg_manager: avoid the zombie apocalypse, use waitpid() --- src/gui/opkg_manager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index a23d698e7..b32df8d78 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -781,6 +781,8 @@ void COPKGManager::getPkgData(const int pkg_content_id) } } + waitpid(pid, NULL, 0); /* beware of the zombie apocalypse! */ + fclose(f); } From 9d5fc68b832a098ef07cc340fbf1d0b99e777d66 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 07/26] shellwindow: use time_monotonic_ms() --- src/gui/widget/shellwindow.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp index 78fa6d23e..ddd850351 100644 --- a/src/gui/widget/shellwindow.cpp +++ b/src/gui/widget/shellwindow.cpp @@ -7,7 +7,7 @@ Implementation: Copyright (C) 2013 martii gitorious.org/neutrino-mp/martiis-neutrino-mp - Copyright (C) 2015 Stefan Seyfried + Copyright (C) 2015-2017 Stefan Seyfried License: GPL @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -103,22 +104,19 @@ void CShellWindow::exec() fds.events = POLLIN | POLLHUP | POLLERR; fcntl(fds.fd, F_SETFL, fcntl(fds.fd, F_GETFL, 0) | O_NONBLOCK); - struct timeval tv; - gettimeofday(&tv,NULL); - uint64_t lastPaint = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); + time_t lastPaint = time_monotonic_ms(); bool ok = true, nlseen = false, dirty = false, incomplete = false; char output[1024]; std::string txt = ""; std::string line = ""; do { - uint64_t now; + time_t now; fds.revents = 0; int r = poll(&fds, 1, 300); if (r > 0) { if (!feof(f)) { - gettimeofday(&tv,NULL); - now = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); + now = time_monotonic_ms(); unsigned int lines_read = 0; while (fgets(output, sizeof(output), f)) { @@ -178,7 +176,7 @@ void CShellWindow::exec() first = false; txt += *it; } - if (((lines_read == lines_max) && (lastPaint + 100000 < now)) || (lastPaint + 250000 < now)) { + if (((lines_read >= lines_max) && (lastPaint + 100 < now)) || (lastPaint + 250 < now)) { textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); if (!textBox->isPainted()) if (mode & VERBOSE) textBox->paint(); @@ -192,9 +190,8 @@ void CShellWindow::exec() } else if (r < 0) ok = false; - gettimeofday(&tv,NULL); - now = (uint64_t) tv.tv_usec + (uint64_t)((uint64_t) tv.tv_sec * (uint64_t) 1000000); - if (!ok || (r < 1 && dirty && lastPaint + 250000 < now)) { + now = time_monotonic_ms(); + if (!ok || (r < 1 && dirty && lastPaint + 250 < now)) { textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); if (!textBox->isPainted()) if (mode & VERBOSE) textBox->paint(); From 85bb568d021ababe5163860402cffe12ca0f5ff4 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 08/26] helpers: add run_pty() function This runs an external command inside a pty. Running inside a pty, external commands using stdio(3) will disable stdout buffering when running from a terminal, which is often desirable. --- src/Makefile.am | 1 + src/system/helpers.cpp | 19 ++++++++++++++++++- src/system/helpers.h | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 7d67e67cb..dcf9c8196 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -123,6 +123,7 @@ neutrino_LDADD = \ $(PUGIXML_LIBS) \ -ldvbsi++ \ -ljpeg \ + -lutil \ -lOpenThreads \ -lrt -lpthread diff --git a/src/system/helpers.cpp b/src/system/helpers.cpp index 00a8bacbb..50a93901c 100644 --- a/src/system/helpers.cpp +++ b/src/system/helpers.cpp @@ -4,7 +4,7 @@ License: GPL (C) 2012-2013 the neutrino-hd developers - (C) 2012-2015 Stefan Seyfried + (C) 2012-2017 Stefan Seyfried This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -30,6 +30,7 @@ #include #include #include +#include /* forkpty*/ #include #include #include @@ -220,6 +221,22 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type) } return(fp); } + +int run_pty(pid_t &pid, const char *cmdstring) +{ + int master = -1; + if ((pid = forkpty(&master, NULL, NULL, NULL)) < 0) + return -1; + else if (pid == 0) { + int maxfd = getdtablesize(); + for(int i = 3; i < maxfd; i++) + close(i); + execl("/bin/sh", "sh", "-c", cmdstring, (char *)0); + exit(0); + } + return master; +} + #if 0 int mkdirhier(const char *pathname, mode_t mode) { diff --git a/src/system/helpers.h b/src/system/helpers.h index 7cd1fef20..dd23280a3 100644 --- a/src/system/helpers.h +++ b/src/system/helpers.h @@ -41,6 +41,7 @@ int my_system(const char * cmd); int my_system(int argc, const char *arg, ...); /* argc is number of arguments including command */ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type); +int run_pty(pid_t &pid, const char *cmdstring); int safe_mkdir(const char * path); inline int safe_mkdir(std::string path) { return safe_mkdir(path.c_str()); } From b623aad5c3fe567f157f187786787e7a932c2ddd Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 09/26] textbox: fix output for BOTTOM mode If more text is added to a textbox than fits into the window, the last lines are stripped. In BOTTOM (and non-SCROLL) mode, it makes more sense to strip the first lines. This is used by shellwindow, e.g. in package management menu. --- src/gui/widget/textbox.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index cb8bbb1e0..e669687ae 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -679,11 +679,14 @@ void CTextBox::refreshText(void) if (m_nMode & TOP) // move to top of frame y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * m_nLinesPerPage) >> 1); - else if (m_nMode & BOTTOM) + else if (m_nMode & BOTTOM) { + /* if BOTTOM && !SCROLL, show the last lines if more than one page worth of text is in cLineArray */ + if (!(m_nMode & SCROLL) && (m_nNrOfLines > m_nLinesPerPage)) + m_nCurrentLine = m_nNrOfLines - m_nLinesPerPage; // move to bottom of frame y += m_cFrameTextRel.iHeight - (lines > 1 ? (lines - 1)*m_nFontTextHeight : 0) - text_Vborder_width; //m_nFontTextHeight + text_Vborder_width /*- ((m_cFrameTextRel.iHeight + m_nFontTextHeight*/ * m_nLinesPerPage/*) >> 1)*/; - else + } else // fit into mid of frame space y += m_nFontTextHeight + ((m_cFrameTextRel.iHeight - m_nFontTextHeight * lines) >> 1); From 046de91ce6c3cdf6069abb8b30b50310560528a4 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 10/26] shellwindow: use run_pty() instead of my_popen() --- src/gui/widget/shellwindow.cpp | 37 +++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp index ddd850351..f4a1509aa 100644 --- a/src/gui/widget/shellwindow.cpp +++ b/src/gui/widget/shellwindow.cpp @@ -64,6 +64,24 @@ void CShellWindow::setCommand(const std::string &Command, const int Mode, int* R exec(); } +static int read_line(int fd, struct pollfd *fds, char *b, size_t sz) +{ + int ret; + size_t i = 0; + while ((ret = read(fd, b + i, 1)) > 0) { + i++; + if (b[i - 1] == '\n') + break; + if (i >= sz) + break; + fds->revents = 0; + if (poll(fds, 1, 300) < 1) + break; + } + b[i] = 0; + return i; +} + void CShellWindow::exec() { std::string cmd; @@ -81,11 +99,11 @@ void CShellWindow::exec() else { pid_t pid = 0; cmd = command + " 2>&1"; - FILE *f = my_popen(pid, cmd.c_str(), "r"); - if (!f) { + int f = run_pty(pid, cmd.c_str()); + if (f < 0) { if (res) *res = -1; - dprintf(DEBUG_NORMAL, "[CShellWindow] [%s:%d] Error! my_popen errno: %d command: %s\n", __func__, __LINE__, errno, cmd.c_str()); + dprintf(DEBUG_NORMAL, "[CShellWindow] [%s:%d] Error! run_pty errno: %d command: %s\n", __func__, __LINE__, errno, cmd.c_str()); return; } @@ -100,7 +118,7 @@ void CShellWindow::exec() textBox->enableSaveScreen(false); } struct pollfd fds; - fds.fd = fileno(f); + fds.fd = f; fds.events = POLLIN | POLLHUP | POLLERR; fcntl(fds.fd, F_SETFL, fcntl(fds.fd, F_GETFL, 0) | O_NONBLOCK); @@ -115,11 +133,9 @@ void CShellWindow::exec() fds.revents = 0; int r = poll(&fds, 1, 300); if (r > 0) { - if (!feof(f)) { - now = time_monotonic_ms(); - + if (fds.revents & POLLIN) { unsigned int lines_read = 0; - while (fgets(output, sizeof(output), f)) { + while (read_line(f, &fds, output, sizeof(output)-1)) { char *outputp = output; dirty = true; @@ -131,7 +147,9 @@ void CShellWindow::exec() *outputp = 0; break; case '\r': +#if 0 outputp = output; +#endif break; case '\n': lines_read++; @@ -166,6 +184,7 @@ void CShellWindow::exec() else dprintf(DEBUG_NORMAL, "[CShellWindow] [%s:%d] res=NULL ok=%d\n", __func__, __LINE__, ok); + now = time_monotonic_ms(); if (lines.size() > lines_max) lines.pop_front(); txt = ""; @@ -205,7 +224,7 @@ void CShellWindow::exec() textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); } - fclose(f); + close(f); int s; errno = 0; int r = waitpid(pid, &s, 0); From d372892ef5c67b092fd38ae7ca1b6a0024c43815 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 11/26] shellwindow: ensure text is set correctly and only when necessary --- src/gui/widget/shellwindow.cpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp index f4a1509aa..d8b69068a 100644 --- a/src/gui/widget/shellwindow.cpp +++ b/src/gui/widget/shellwindow.cpp @@ -82,6 +82,16 @@ static int read_line(int fd, struct pollfd *fds, char *b, size_t sz) return i; } +static std::string lines2txt(list &lines) +{ + std::string txt = ""; + for (std::list::const_iterator it = lines.begin(), end = lines.end(); it != end; ++it) { + txt += *it; + txt += '\n'; + } + return txt; +} + void CShellWindow::exec() { std::string cmd; @@ -187,15 +197,8 @@ void CShellWindow::exec() now = time_monotonic_ms(); if (lines.size() > lines_max) lines.pop_front(); - txt = ""; - bool first = true; - for (std::list::const_iterator it = lines.begin(), end = lines.end(); it != end; ++it) { - if (!first) - txt += '\n'; - first = false; - txt += *it; - } if (((lines_read >= lines_max) && (lastPaint + 100 < now)) || (lastPaint + 250 < now)) { + txt = lines2txt(lines); textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); if (!textBox->isPainted()) if (mode & VERBOSE) textBox->paint(); @@ -211,6 +214,7 @@ void CShellWindow::exec() now = time_monotonic_ms(); if (!ok || (r < 1 && dirty && lastPaint + 250 < now)) { + txt = lines2txt(lines); textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); if (!textBox->isPainted()) if (mode & VERBOSE) textBox->paint(); @@ -220,6 +224,7 @@ void CShellWindow::exec() } while(ok); if (mode & VERBOSE) { + txt = lines2txt(lines); txt += "\n...ready"; textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); } From edab27be9205177ac1736e682fe5e8c4d6b8a080 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 12/26] shellwindow: reduce update interval --- src/gui/widget/shellwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/widget/shellwindow.cpp b/src/gui/widget/shellwindow.cpp index d8b69068a..931390243 100644 --- a/src/gui/widget/shellwindow.cpp +++ b/src/gui/widget/shellwindow.cpp @@ -197,7 +197,7 @@ void CShellWindow::exec() now = time_monotonic_ms(); if (lines.size() > lines_max) lines.pop_front(); - if (((lines_read >= lines_max) && (lastPaint + 100 < now)) || (lastPaint + 250 < now)) { + if (((lines_read >= lines_max) && (lastPaint + 100 < now)) || (lastPaint + 500 < now)) { txt = lines2txt(lines); textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); if (!textBox->isPainted()) @@ -213,7 +213,7 @@ void CShellWindow::exec() ok = false; now = time_monotonic_ms(); - if (!ok || (r < 1 && dirty && lastPaint + 250 < now)) { + if (!ok || (r < 1 && dirty && lastPaint + 500 < now)) { txt = lines2txt(lines); textBox->setText(&txt, textBox->getWindowsPos().iWidth, false); if (!textBox->isPainted()) From bbd7667ee9c953fea08a35d04bef51a44d1cf3f0 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 13/26] opkg_manager: don't set error flag for shellwindow The shellwindow exits if the "ok" flag is set to false, aborting further execution of more commands. This hurts with system-update script. --- src/gui/opkg_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index b32df8d78..61b41312f 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -915,13 +915,13 @@ void COPKGManager::handleShellOutput(string* cur_line, int* res, bool* ok) //download error: if (line.find("opkg_download:") != string::npos){ *res = OM_DOWNLOAD_ERR; - *ok = false; + //*ok = false; return; } //not enough space if (line.find("No space left on device") != string::npos){ *res = OM_OUT_OF_SPACE_ERR; - *ok = false; + //*ok = false; return; } //deps @@ -934,7 +934,7 @@ void COPKGManager::handleShellOutput(string* cur_line, int* res, bool* ok) if (*ok){ dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] ERROR: unhandled error %s\n", __func__, __LINE__, line.c_str()); *res = OM_UNKNOWN_ERR; - *ok = false; + //*ok = false; return; } From 3956f06d3a7138ad568ea84a4d56ade60c1d4dd1 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 14/26] opkg_manager: make console output more useful --- src/gui/opkg_manager.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 61b41312f..3d0b2f7fb 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -888,9 +888,12 @@ void COPKGManager::handleShellOutput(string* cur_line, int* res, bool* ok) if (pos2 != string::npos) has_err = true; + dprintf(DEBUG_NORMAL, "[COPKGManager:%d] %s\n", __LINE__, line.c_str()); //check for collected errors and set res value if (has_err){ + /* all lines printed already dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] result: %s\n", __func__, __LINE__, line.c_str()); + */ /*duplicate option cache: option is defined in OPKG_CL_CONFIG_OPTIONS, * NOTE: if found first cache option in the opkg.conf file, this will be preferred and it's not really an error! @@ -932,7 +935,7 @@ void COPKGManager::handleShellOutput(string* cur_line, int* res, bool* ok) } //unknown error if (*ok){ - dprintf(DEBUG_NORMAL, "[COPKGManager] [%s - %d] ERROR: unhandled error %s\n", __func__, __LINE__, line.c_str()); + dprintf(DEBUG_DEBUG, "[COPKGManager] [%s - %d] ERROR: unhandled error %s\n", __func__, __LINE__, line.c_str()); *res = OM_UNKNOWN_ERR; //*ok = false; return; From 8a6194a0470b47d5ce8efccf56190df3cb50f177 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 15/26] opkg_manager: add magic string to reset error flags ... to be used by sytem-update script --- src/gui/opkg_manager.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 3d0b2f7fb..64b70f154 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -933,6 +933,13 @@ void COPKGManager::handleShellOutput(string* cur_line, int* res, bool* ok) *ok = false; return; } + /* hack */ + if (line.find("system-update: err_reset") != string::npos) { + *res = OM_SUCCESS; + *ok = true; + has_err = false; + return; + } //unknown error if (*ok){ dprintf(DEBUG_DEBUG, "[COPKGManager] [%s - %d] ERROR: unhandled error %s\n", __func__, __LINE__, line.c_str()); From 3fb3f39be7b1c1fcc1b744871abf83865e5c2b53 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 16/26] opkg_manager: make error messages less cryptic the errno has nothing to do with the error that happened, so do not use it for the error message --- src/gui/opkg_manager.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 64b70f154..ba4012fa7 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -213,7 +213,10 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey) { string pkg_name = fileBrowser.getSelectedFile()->Name; if (!installPackage(pkg_name)) + showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), "", pkg_name); + /* errno is never set properly, the string is totally useless. showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name); + */ *local_dir = fileBrowser.getCurrentDir(); refreshMenu(); @@ -225,7 +228,10 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey) parent->hide(); int r = execCmd(actionKey, CShellWindow::VERBOSE | CShellWindow::ACKNOWLEDGE_EVENT); if (r) { + /* errno is never set properly, the string is totally useless. showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), strerror(errno), actionKey); + */ + showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), "", actionKey); } else installed = true; refreshMenu(); @@ -999,7 +1005,10 @@ bool COPKGManager::installPackage(const string& pkg_name, string options, bool f break; } default: + showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), "", pkg_types[OM_INSTALL] + opts + pkg_name); + /* errno / strerror considered useless here showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_types[OM_INSTALL] + opts + pkg_name); + */ } }else{ if (force_configure) From fd52cd5023c433b84da67aaf075c1a27c2e2b02b Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 17/26] upkg_manager: comment out stale code --- src/gui/opkg_manager.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index ba4012fa7..9da03a18e 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -954,10 +954,13 @@ void COPKGManager::handleShellOutput(string* cur_line, int* res, bool* ok) return; } +#if 0 + /* never reached */ if (!has_err){ *ok = true; *res = OM_SUCCESS; } +#endif } *res = _res; From 17b8e684e002e0899b1ee906f0b585f0e8c9c536 Mon Sep 17 00:00:00 2001 From: GetAway Date: Sun, 29 Jan 2017 21:27:45 +0100 Subject: [PATCH 18/26] - neutrino: fix umount of netfs-drives in ExitRun() function --- src/neutrino.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 19593cbdd..458e3b25e 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -3614,6 +3614,7 @@ void CNeutrinoApp::ExitRun(const bool /*write_si*/, int retcode) my_system("/etc/init.d/rcK"); sync(); + CFSMounter::umount(); // unreachable NFS server my_system(2,"/bin/umount", "-a"); sleep(1); From 891bc71f9d834fa72427fbcb10a8dec153d49653 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Sun, 29 Jan 2017 22:31:21 +0100 Subject: [PATCH 19/26] - streaminfo2: add comment because of broken libcoolstream2 output --- src/gui/streaminfo2.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/streaminfo2.cpp b/src/gui/streaminfo2.cpp index 7d9d6e93c..d99ab6818 100644 --- a/src/gui/streaminfo2.cpp +++ b/src/gui/streaminfo2.cpp @@ -620,12 +620,17 @@ void CStreamInfo2::paint_techinfo(int xpos, int ypos) average_bitrate_pos = ypos += iheight; //AUDIOTYPE ypos += iheight; - int type, layer, freq, mode, lbitrate; - audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); snprintf(buf, sizeof(buf), "%s:", g_Locale->getText (LOCALE_STREAMINFO_AUDIOTYPE)); g_Font[font_info]->RenderString (xpos, ypos, box_width, buf, COL_MENUCONTENT_TEXT); + int type, layer, freq, mode, lbitrate; + /* + audioDecoder->getAudioInfo() seems broken in libcoolstream2. + ddmode is always 1 ("CH1/CH2"). + */ + audioDecoder->getAudioInfo(type, layer, freq, lbitrate, mode); + if (type == AUDIO_FMT_MPEG) { const char *mpegmodes[] = From dc4ce280ed2c04f5dcf2885730007a2dfeb8d626 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 30 Jan 2017 07:11:19 +0100 Subject: [PATCH 20/26] CMoviePlayerGui: Bind enable/disable FileTime to enableInfoClock() --- src/gui/infoclock.cpp | 21 ++++++++++++++- src/gui/movieplayer.cpp | 57 ++++++++++++++++++----------------------- src/gui/movieplayer.h | 5 ---- src/gui/osd_setup.cpp | 14 +++++++--- src/gui/timeosd.cpp | 21 +++++++++------ src/gui/timeosd.h | 10 ++++++-- src/gui/volumebar.cpp | 5 +++- src/neutrino.cpp | 9 ++++--- 8 files changed, 87 insertions(+), 55 deletions(-) diff --git a/src/gui/infoclock.cpp b/src/gui/infoclock.cpp index c0e8ebc58..fa4f66c5b 100644 --- a/src/gui/infoclock.cpp +++ b/src/gui/infoclock.cpp @@ -32,9 +32,11 @@ #include #include #include +#include #include +#include - +extern CTimeOSD *FileTimeOSD; CInfoClock::CInfoClock():CComponentsFrmClock( 1, 1, NULL, "%H:%M:%S", NULL, false, 1, NULL, CC_SHADOW_ON) { @@ -122,6 +124,23 @@ bool CInfoClock::enableInfoClock(bool enable) ret = StopInfoClock(); } } + + if (enable) { + if (FileTimeOSD->getRestore()) { + 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(); + } + } + return ret; } diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index c4223a1fe..eee9d3b19 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -80,6 +80,7 @@ extern cVideo * videoDecoder; extern CRemoteControl *g_RemoteControl; /* neutrino.cpp */ extern CVolume* g_volume; +extern CTimeOSD *FileTimeOSD; #define TIMESHIFT_SECONDS 3 #define ISO_MOUNT_POINT "/media/iso" @@ -206,8 +207,6 @@ void CMoviePlayerGui::Init(void) blockedFromPlugin = false; m_screensaver = false; m_idletime = time(NULL); - m_mode = CTimeOSD::MODE_HIDE; - m_restore = false; } void CMoviePlayerGui::cutNeutrino() @@ -281,6 +280,10 @@ int CMoviePlayerGui::exec(CMenuTarget * parent, const std::string & actionKey) ClearFlags(); ClearQueue(); + FileTimeOSD->kill(); + FileTimeOSD->setMode(CTimeOSD::MODE_HIDE); + time_forced = false; + if (actionKey == "tsmoviebrowser") { isMovieBrowser = true; moviebrowser->setMode(MB_SHOW_RECORDS); @@ -469,11 +472,6 @@ void CMoviePlayerGui::enableOsdElements(bool mute) CAudioMute::getInstance()->enableMuteIcon(true); CInfoClock::getInstance()->enableInfoClock(true); - - if (m_restore) { - FileTime.setMode(m_mode); - FileTime.update(position, duration); - } } void CMoviePlayerGui::disableOsdElements(bool mute) @@ -482,11 +480,6 @@ void CMoviePlayerGui::disableOsdElements(bool mute) CAudioMute::getInstance()->enableMuteIcon(false); CInfoClock::getInstance()->enableInfoClock(false); - - m_mode = FileTime.getMode(); - m_restore = FileTime.IsVisible(); - if (m_restore) - FileTime.kill(); } void CMoviePlayerGui::makeFilename() @@ -1204,8 +1197,8 @@ bool CMoviePlayerGui::PlayFileStart(void) speed = -1; playback->SetSpeed(-1); playstate = CMoviePlayerGui::REW; - if (!FileTime.IsVisible() && !time_forced) { - FileTime.switchMode(position, duration); + if (!FileTimeOSD->IsVisible() && !time_forced) { + FileTimeOSD->switchMode(position, duration); time_forced = true; } } else if (timeshift == TSHIFT_MODE_OFF || !g_settings.timeshift_pause) { @@ -1300,7 +1293,7 @@ void CMoviePlayerGui::PlayFileLoop(void) if ((playstate >= CMoviePlayerGui::PLAY) && (timeshift != TSHIFT_MODE_OFF || (playstate != CMoviePlayerGui::PAUSE))) { if (playback->GetPosition(position, duration)) { - FileTime.update(position, duration); + FileTimeOSD->update(position, duration); if (duration > 100) file_prozent = (unsigned char) (position / (duration / 100)); @@ -1332,7 +1325,7 @@ void CMoviePlayerGui::PlayFileLoop(void) if (playstate == CMoviePlayerGui::STOPPED) at_eof = true; - FileTime.update(position, duration); + FileTimeOSD->update(position, duration); } showSubtitle(0); @@ -1407,7 +1400,7 @@ void CMoviePlayerGui::PlayFileLoop(void) } else if (msg == (neutrino_msg_t) g_settings.mpkey_play) { if (time_forced) { time_forced = false; - FileTime.kill(); + FileTimeOSD->kill(); } if (playstate > CMoviePlayerGui::PLAY) { playstate = CMoviePlayerGui::PLAY; @@ -1473,7 +1466,7 @@ void CMoviePlayerGui::PlayFileLoop(void) clearSubtitle(); update_lcd = true; } else if (msg == (neutrino_msg_t) g_settings.mpkey_time) { - FileTime.switchMode(position, duration); + FileTimeOSD->switchMode(position, duration); } else if (msg == (neutrino_msg_t) g_settings.mbkey_cover) { makeScreenShot(false, true); } else if (msg == (neutrino_msg_t) g_settings.key_screenshot) { @@ -1495,8 +1488,8 @@ void CMoviePlayerGui::PlayFileLoop(void) updateLcd(); } - if (!FileTime.IsVisible() && !time_forced) { - FileTime.switchMode(position, duration); + if (!FileTimeOSD->IsVisible() && !time_forced) { + FileTimeOSD->switchMode(position, duration); time_forced = true; } if (timeshift == TSHIFT_MODE_OFF) @@ -1572,8 +1565,8 @@ void CMoviePlayerGui::PlayFileLoop(void) update_lcd = true; clearSubtitle(); } else if (timeshift != TSHIFT_MODE_OFF && (msg == CRCInput::RC_text || msg == CRCInput::RC_epg || msg == NeutrinoMessages::SHOW_EPG)) { - bool restore = FileTime.IsVisible(); - FileTime.kill(); + bool restore = FileTimeOSD->IsVisible(); + FileTimeOSD->kill(); if (msg == CRCInput::RC_epg ) g_EventList->exec(CNeutrinoApp::getInstance()->channelList->getActiveChannel_ChannelID(), CNeutrinoApp::getInstance()->channelList->getActiveChannelName()); @@ -1586,15 +1579,15 @@ void CMoviePlayerGui::PlayFileLoop(void) frameBuffer->paintBackground(); } if (restore) - FileTime.show(position); + FileTimeOSD->show(position); #if 0 } else if (msg == CRCInput::RC_red) { - bool restore = FileTime.IsVisible(); - FileTime.kill(); + bool restore = FileTimeOSD->IsVisible(); + FileTimeOSD->kill(); CStreamInfo2 streaminfo; streaminfo.exec(NULL, ""); if (restore) - FileTime.show(position); + FileTimeOSD->show(position); update_lcd = true; #endif } else if (msg == NeutrinoMessages::SHOW_EPG) { @@ -1625,12 +1618,12 @@ void CMoviePlayerGui::PlayFileLoop(void) } else if (msg == (neutrino_msg_t) CRCInput::RC_setup) { CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::SHOW_MAINMENU, 0); } else if (msg == CRCInput::RC_red || msg == CRCInput::RC_green || msg == CRCInput::RC_yellow || msg == CRCInput::RC_blue ) { - //maybe move FileTime.kill to Usermenu to simplify this call - bool restore = FileTime.IsVisible(); - FileTime.kill(); + //maybe move FileTimeOSD->kill to Usermenu to simplify this call + bool restore = FileTimeOSD->IsVisible(); + FileTimeOSD->kill(); CNeutrinoApp::getInstance()->usermenu.showUserMenu(msg); if (restore) - FileTime.show(position); + FileTimeOSD->show(position); update_lcd = true; } else { if (CNeutrinoApp::getInstance()->handleMsg(msg, data) & messages_return::cancel_all) { @@ -1665,7 +1658,7 @@ void CMoviePlayerGui::PlayFileEnd(bool restore) { printf("%s: stopping, this %p thread %p\n", __func__, this, CMoviePlayerGui::bgPlayThread);fflush(stdout); if (filelist_it == filelist.end()) - FileTime.kill(); + FileTimeOSD->kill(); clearSubtitle(); playback->SetSpeed(1); @@ -2190,7 +2183,7 @@ void CMoviePlayerGui::UpdatePosition() if (playback->GetPosition(position, duration)) { if (duration > 100) file_prozent = (unsigned char) (position / (duration / 100)); - FileTime.update(position, duration); + FileTimeOSD->update(position, duration); #ifdef DEBUG printf("CMoviePlayerGui::%s: spd %d pos %d/%d (%d, %d%%)\n", __func__, speed, position, duration, duration-position, file_prozent); #endif diff --git a/src/gui/movieplayer.h b/src/gui/movieplayer.h index b0da2d4c2..3d59912c1 100644 --- a/src/gui/movieplayer.h +++ b/src/gui/movieplayer.h @@ -118,7 +118,6 @@ class CMoviePlayerGui : public CMenuTarget int startposition; int position; int duration; - CTimeOSD FileTime; unsigned short numpida; unsigned short vpid; @@ -189,9 +188,6 @@ class CMoviePlayerGui : public CMenuTarget static CMoviePlayerGui* instance_mp; static CMoviePlayerGui* instance_bg; - CTimeOSD::mode m_mode; - bool m_restore; - void Init(void); void PlayFile(); bool PlayFileStart(); @@ -242,7 +238,6 @@ class CMoviePlayerGui : public CMenuTarget int exec(CMenuTarget* parent, const std::string & actionKey); bool Playing() { return playing; }; - bool osdTimeVisible() { return FileTime.IsVisible(); }; std::string CurrentAudioName() { return currentaudioname; }; int GetSpeed() { return speed; } int GetPosition() { return position; } diff --git a/src/gui/osd_setup.cpp b/src/gui/osd_setup.cpp index 698ac5110..87e76624d 100644 --- a/src/gui/osd_setup.cpp +++ b/src/gui/osd_setup.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include @@ -67,6 +68,7 @@ extern CRemoteControl * g_RemoteControl; extern const char * locale_real_names[]; extern std::string ttx_font_file; +extern CTimeOSD *FileTimeOSD; COsdSetup::COsdSetup(int wizard_mode) { @@ -1286,19 +1288,19 @@ void COsdSetup::showOsdInfoclockSetup(CMenuWidget *menu_infoclock) { menu_infoclock->addIntroItems(LOCALE_MISCSETTINGS_INFOCLOCK); - CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOCLOCK, &g_settings.mode_clock, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, NULL, CRCInput::RC_red); + CMenuOptionChooser *mc = new CMenuOptionChooser(LOCALE_MISCSETTINGS_INFOCLOCK, &g_settings.mode_clock, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this, CRCInput::RC_red); mc->setHint("", LOCALE_MENU_HINT_CLOCK_MODE); menu_infoclock->addItem(mc); menu_infoclock->addItem(GenericMenuSeparatorLine); // size of info clock - CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE_HEIGHT, &g_settings.infoClockFontSize, true, 30, 120); + CMenuOptionNumberChooser* mn = new CMenuOptionNumberChooser(LOCALE_CLOCK_SIZE_HEIGHT, &g_settings.infoClockFontSize, true, 30, 120, this); mn->setHint("", LOCALE_MENU_HINT_CLOCK_SIZE); menu_infoclock->addItem(mn); // clock with seconds - mc = new CMenuOptionChooser(LOCALE_CLOCK_SECONDS, &g_settings.infoClockSeconds, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true); + mc = new CMenuOptionChooser(LOCALE_CLOCK_SECONDS, &g_settings.infoClockSeconds, OPTIONS_OFF0_ON1_OPTIONS, OPTIONS_OFF0_ON1_OPTION_COUNT, true, this); mc->setHint("", LOCALE_MENU_HINT_CLOCK_SECONDS); menu_infoclock->addItem(mc); @@ -1391,6 +1393,12 @@ bool COsdSetup::changeNotify(const neutrino_locale_t OptionName, void * data) CVolumeHelper::getInstance()->refresh(); return false; } + else if ((ARE_LOCALES_EQUAL(OptionName, LOCALE_MISCSETTINGS_INFOCLOCK)) || + (ARE_LOCALES_EQUAL(OptionName, LOCALE_CLOCK_SIZE_HEIGHT)) || + (ARE_LOCALES_EQUAL(OptionName, LOCALE_CLOCK_SECONDS))) { + CInfoClock::getInstance()->ClearDisplay(); + FileTimeOSD->Init(); + } return false; } diff --git a/src/gui/timeosd.cpp b/src/gui/timeosd.cpp index 8d631319e..597d2b2b2 100644 --- a/src/gui/timeosd.cpp +++ b/src/gui/timeosd.cpp @@ -32,12 +32,16 @@ #include #include #include +#include #include #include "screensaver.h" CTimeOSD::CTimeOSD():CComponentsFrmClock( 1, 1, NULL, "%H:%M:%S", NULL, false, 1, NULL, CC_SHADOW_ON) { + m_mode = MODE_HIDE; + tmp_mode = MODE_HIDE; + m_restore = false; Init(); } @@ -45,7 +49,6 @@ void CTimeOSD::Init() { paint_bg = g_settings.infoClockBackground; m_time_show = time(0); - m_mode = MODE_HIDE; //use current theme colors setColorAll(COL_FRAME_PLUS_0, COL_MENUCONTENT_PLUS_0, COL_SHADOW_PLUS_0); @@ -59,13 +62,7 @@ void CTimeOSD::Init() setColorBody(COL_BACKGROUND_PLUS_0); } - //set height, NOTE: height is strictly bound to settings - if (g_settings.infoClockFontSize != height){ - height = g_settings.infoClockFontSize; - int dx = 0; - int dy = height; - setClockFont(*CNeutrinoFonts::getInstance()->getDynFont(dx, dy, cl_format_str, cl_font_style)); - } + setClockFont(CInfoClock::getInstance()->getClockFont()); // set corner radius depending on clock height corner_rad = (g_settings.rounded_corners) ? std::max(height/10, CORNER_RADIUS_SMALL) : 0; @@ -84,6 +81,14 @@ CTimeOSD::~CTimeOSD() } #endif +CTimeOSD* CTimeOSD::getInstance() +{ + static CTimeOSD* timeOSD = NULL; + if(!timeOSD) + timeOSD = new CTimeOSD(); + return timeOSD; +} + void CTimeOSD::initTimeString() { struct tm t; diff --git a/src/gui/timeosd.h b/src/gui/timeosd.h index cf15b7643..c79da7dec 100644 --- a/src/gui/timeosd.h +++ b/src/gui/timeosd.h @@ -42,10 +42,10 @@ class CTimeOSD : public CComponentsFrmClock private: CProgressBar timescale; - mode m_mode; + mode m_mode, tmp_mode; + bool m_restore; time_t m_time_show; - void Init(); void initTimeString(); void updatePos(int position, int duration); void KillAndResetTimescale(); @@ -53,6 +53,8 @@ class CTimeOSD : public CComponentsFrmClock public: CTimeOSD(); // ~CTimeOSD(); is inherited + void Init(); + static CTimeOSD* getInstance(); void show(time_t time_show, bool force = true); void kill(); bool IsVisible() {return m_mode != MODE_HIDE;} @@ -60,6 +62,10 @@ class CTimeOSD : public CComponentsFrmClock void switchMode(int position, int duration); mode getMode() { return m_mode; }; void setMode (mode mode_) { m_mode = mode_; }; + 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 setHeight(const int){}//NOTE: dummy member, height is strictly bound to settings }; #endif diff --git a/src/gui/volumebar.cpp b/src/gui/volumebar.cpp index 982c15e12..58a41f7d9 100644 --- a/src/gui/volumebar.cpp +++ b/src/gui/volumebar.cpp @@ -33,9 +33,12 @@ #include #include +#include #include #include +extern CTimeOSD *FileTimeOSD; + using namespace std; @@ -134,7 +137,7 @@ void CVolumeBar::initVolumeBarPosition() break; } case VOLUMEBAR_POS_TOP_LEFT: - if (CMoviePlayerGui::getInstance().osdTimeVisible()) + if (FileTimeOSD->IsVisible()) y = clock_y + clock_height + v_spacer + OFFSET_SHADOW; break; case VOLUMEBAR_POS_BOTTOM_LEFT: diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 458e3b25e..d6467bdf2 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -100,6 +100,7 @@ #include "gui/widget/menue.h" #include "gui/widget/msgbox.h" #include "gui/infoclock.h" +#include "gui/timeosd.h" #include "gui/parentallock_setup.h" #ifdef ENABLE_PIP #include "gui/pipsetup.h" @@ -146,6 +147,7 @@ int old_b_id = -1; CInfoClock *InfoClock; +CTimeOSD *FileTimeOSD; int allow_flash = 1; Zapit_config zapitCfg; char zapit_lat[20]="#"; @@ -2155,6 +2157,8 @@ TIMER_START(); g_RemoteControl = new CRemoteControl; g_EpgData = new CEpgData; + InfoClock = CInfoClock::getInstance(); + FileTimeOSD = CTimeOSD::getInstance(); g_InfoViewer = new CInfoViewer; g_EventList = new CEventList; @@ -2341,9 +2345,6 @@ void CNeutrinoApp::RealRun() dprintf(DEBUG_NORMAL, "initialized everything\n"); - //activating infoclock - InfoClock = CInfoClock::getInstance(); - if(g_settings.power_standby || init_cec_setting) standbyMode(true, true); @@ -4224,6 +4225,8 @@ void stop_daemons(bool stopall, bool for_flash) videoDecoder->SetCECMode((VIDEO_HDMI_CEC_MODE)0); } + delete InfoClock; + delete FileTimeOSD; delete &CMoviePlayerGui::getInstance(); CZapit::getInstance()->Stop(); From 6b4a8495989c5cf17230f400ff73601c110c3d76 Mon Sep 17 00:00:00 2001 From: "M. Liebmann" Date: Mon, 30 Jan 2017 07:11:24 +0100 Subject: [PATCH 21/26] src/gui/opkg_manager.cpp: Fix compiler warning --- src/gui/opkg_manager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/opkg_manager.cpp b/src/gui/opkg_manager.cpp index 9da03a18e..f9970b7ec 100644 --- a/src/gui/opkg_manager.cpp +++ b/src/gui/opkg_manager.cpp @@ -213,7 +213,7 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey) { string pkg_name = fileBrowser.getSelectedFile()->Name; if (!installPackage(pkg_name)) - showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), "", pkg_name); + showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), NULL, pkg_name); /* errno is never set properly, the string is totally useless. showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_name); */ @@ -231,7 +231,7 @@ int COPKGManager::exec(CMenuTarget* parent, const string &actionKey) /* errno is never set properly, the string is totally useless. showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), strerror(errno), actionKey); */ - showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), "", actionKey); + showError(g_Locale->getText(LOCALE_OPKG_FAILURE_UPGRADE), NULL, actionKey); } else installed = true; refreshMenu(); @@ -1008,7 +1008,7 @@ bool COPKGManager::installPackage(const string& pkg_name, string options, bool f break; } default: - showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), "", pkg_types[OM_INSTALL] + opts + pkg_name); + showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), NULL, pkg_types[OM_INSTALL] + opts + pkg_name); /* errno / strerror considered useless here showError(g_Locale->getText(LOCALE_OPKG_FAILURE_INSTALL), strerror(errno), pkg_types[OM_INSTALL] + opts + pkg_name); */ From 5f0aea48d2cd785a119edead9ccbaab78c7073b9 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 30 Jan 2017 09:46:35 +0100 Subject: [PATCH 22/26] CComponentsDetailLine: remove multiple init of cc_save_bg. Init is passed with paintFbItems() at the end of paint() methode. --- src/gui/components/cc_detailsline.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/gui/components/cc_detailsline.cpp b/src/gui/components/cc_detailsline.cpp index 760b21fd6..cb86eb14a 100644 --- a/src/gui/components/cc_detailsline.cpp +++ b/src/gui/components/cc_detailsline.cpp @@ -88,8 +88,6 @@ CComponentsDetailLine::~CComponentsDetailLine() //paint details line with current parameters void CComponentsDetailLine::paint(bool do_save_bg) { - cc_save_bg = do_save_bg; - hide(); if (hasChanges()) clearFbData(); From 6a3778ba93851a3bdb579aaa6bb07577aff96a4e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 30 Jan 2017 10:32:15 +0100 Subject: [PATCH 23/26] CMenuWidget: Forcing removal of details line during removing of hint box. --- src/gui/widget/menue.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 5bf5010c3..8e148aea7 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1454,6 +1454,8 @@ void CMenuWidget::paintHint(int pos) if (info_box) { savescreen ? info_box->hide() : info_box->kill(); hint_painted = info_box->isPainted(); + if (details_line) + details_line->hide(); } return; } From f4f351e9ba82e5f0ec6ecdbdc41c0a1297f2bbab Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 30 Jan 2017 17:22:41 +0100 Subject: [PATCH 24/26] some inits --- src/gui/components/cc_item_picture.cpp | 1 + src/gui/lua/lua_curl.cpp | 6 +++--- src/gui/lua/lua_menue.h | 8 ++++---- src/gui/tmdb.cpp | 4 ++-- src/system/ytcache.cpp | 2 +- src/system/ytparser.cpp | 4 ++-- 6 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index c18543611..b3515ce90 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -386,6 +386,7 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale) { + channel_name = ""; alt_pic_name = ""; setChannel(channelId, channelName); do_scale = allow_scale; diff --git a/src/gui/lua/lua_curl.cpp b/src/gui/lua/lua_curl.cpp index fe1217512..b5163677e 100644 --- a/src/gui/lua/lua_curl.cpp +++ b/src/gui/lua/lua_curl.cpp @@ -178,7 +178,7 @@ Example: CLuaCurl *D = CurlCheckData(L, 1); if (!D) return 0; - char errMsg[1024]; + char errMsg[1024]={0}; CURL *curl_handle = curl_easy_init(); if (!curl_handle) { memset(errMsg, '\0', sizeof(errMsg)); @@ -309,7 +309,7 @@ Example: #endif } - char cerror[CURL_ERROR_SIZE]; + char cerror[CURL_ERROR_SIZE]={0}; curl_easy_setopt(curl_handle, CURLOPT_ERRORBUFFER, cerror); printf("\n[curl:download] download %s => %s\n", url.c_str(), (toFile)?outputfile.c_str():"return string"); @@ -330,7 +330,7 @@ Example: CURLcode res1 = curl_easy_getinfo(curl_handle, CURLINFO_EFFECTIVE_URL, &deffektive); CURLcode res2 = curl_easy_getinfo(curl_handle, CURLINFO_REDIRECT_URL, &dredirect); - char msg1[1024]; + char msg1[1024]={0}; memset(msg1, '\0', sizeof(msg1)); snprintf(msg1, sizeof(msg1)-1, "\n[curl:download] O.K. size: %.0f bytes, time: %.02f sec.", dsize, dtime); msg = msg1; diff --git a/src/gui/lua/lua_menue.h b/src/gui/lua/lua_menue.h index 7bee51603..dc0bf967d 100644 --- a/src/gui/lua/lua_menue.h +++ b/src/gui/lua/lua_menue.h @@ -62,7 +62,7 @@ class CLuaMenuForwarder : public CMenuTarget std::string luaId; CLuaMenuForwarder(lua_State *L, std::string _luaAction, std::string _luaId); ~CLuaMenuForwarder(); - int exec(CMenuTarget* parent, const std::string & actionKey); + int exec(CMenuTarget* parent=NULL, const std::string & actionKey=""); }; class CLuaMenuFilebrowser : public CLuaMenuForwarder @@ -74,7 +74,7 @@ class CLuaMenuFilebrowser : public CLuaMenuForwarder void Init(std::string *_value, bool _dirMode); public: CLuaMenuFilebrowser(lua_State *_L, std::string _luaAction, std::string _luaId, std::string *_value, bool _dirMode); - int exec(CMenuTarget* parent, const std::string & actionKey); + int exec(CMenuTarget* parent=NULL, const std::string & actionKey=""); void addFilter(std::string s) { filter.push_back(s); }; }; @@ -91,7 +91,7 @@ class CLuaMenuStringinput : public CLuaMenuForwarder void Init(const char *_name, std::string *_value, int _size, std::string _valid_chars, CChangeObserver *_observ, const char *_icon, bool _sms); public: CLuaMenuStringinput(lua_State *_L, std::string _luaAction, std::string _luaId, const char *_name, std::string *_value, int _size, std::string _valid_chars, CChangeObserver *_observ, const char *_icon, bool _sms); - int exec(CMenuTarget* parent, const std::string & actionKey); + int exec(CMenuTarget* parent=NULL, const std::string & actionKey=""); }; class CLuaMenuKeyboardinput : public CLuaMenuForwarder @@ -106,7 +106,7 @@ class CLuaMenuKeyboardinput : public CLuaMenuForwarder void Init(const char *_name, std::string *_value, int _size, CChangeObserver *_observ, const char *_icon, std::string _help, std::string _help2); public: CLuaMenuKeyboardinput(lua_State *_L, std::string _luaAction, std::string _luaId, const char *_name, std::string *_value, int _size, CChangeObserver *_observ, const char *_icon, std::string _help, std::string _help2); - int exec(CMenuTarget* parent, const std::string & actionKey); + int exec(CMenuTarget* parent=NULL, const std::string & actionKey=""); }; class CLuaInstMenu diff --git a/src/gui/tmdb.cpp b/src/gui/tmdb.cpp index e4e65b70a..8ebe101c1 100644 --- a/src/gui/tmdb.cpp +++ b/src/gui/tmdb.cpp @@ -128,7 +128,7 @@ bool cTmdb::getUrl(std::string &url, std::string &answer, CURL *_curl_handle) } } - char cerror[CURL_ERROR_SIZE]; + char cerror[CURL_ERROR_SIZE] = {0}; curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror); printf("try to get [%s] ...\n", url.c_str()); @@ -169,7 +169,7 @@ bool cTmdb::DownloadUrl(std::string url, std::string file, CURL *_curl_handle) } } - char cerror[CURL_ERROR_SIZE]; + char cerror[CURL_ERROR_SIZE] = {0}; curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror); printf("try to get [%s] ...\n", url.c_str()); diff --git a/src/system/ytcache.cpp b/src/system/ytcache.cpp index 64dcb6672..0f04358f4 100644 --- a/src/system/ytcache.cpp +++ b/src/system/ytcache.cpp @@ -148,7 +148,7 @@ bool cYTCache::download(MI_MOVIE_INFO *mi) curl_easy_setopt(curl, CURLOPT_NOPROGRESS, (long)0); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); - char cerror[CURL_ERROR_SIZE]; + char cerror[CURL_ERROR_SIZE] = {0}; curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, cerror); if(!g_settings.softupdate_proxyserver.empty()) { diff --git a/src/system/ytparser.cpp b/src/system/ytparser.cpp index 6f4418c49..928df3afe 100644 --- a/src/system/ytparser.cpp +++ b/src/system/ytparser.cpp @@ -151,7 +151,7 @@ bool cYTFeedParser::getUrl(std::string &url, std::string &answer, CURL *_curl_ha } } - char cerror[CURL_ERROR_SIZE]; + char cerror[CURL_ERROR_SIZE] = {0}; curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror); printf("try to get [%s] ...\n", url.c_str()); @@ -192,7 +192,7 @@ bool cYTFeedParser::DownloadUrl(std::string &url, std::string &file, CURL *_curl } } - char cerror[CURL_ERROR_SIZE]; + char cerror[CURL_ERROR_SIZE] = {0}; curl_easy_setopt(_curl_handle, CURLOPT_ERRORBUFFER, cerror); printf("try to get [%s] ...\n", url.c_str()); From 0056a533210206f37957e55391b6499ef5763cca Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 30 Jan 2017 19:04:17 +0100 Subject: [PATCH 25/26] some inits --- src/gui/channellist.cpp | 1 + src/gui/components/cc_item_picture.cpp | 1 + src/gui/components/cc_item_progressbar.cpp | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index a4d56cb47..e463c458f 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -2399,6 +2399,7 @@ void CChannelList::paint_events(CChannelEventList &evtlist) evt.description = g_Locale->getText(LOCALE_EPGLIST_NOEVENTS); evt.eventID = 0; evt.startTime = 0; + evt.duration = 0; evtlist.push_back(evt); } diff --git a/src/gui/components/cc_item_picture.cpp b/src/gui/components/cc_item_picture.cpp index b3515ce90..1abad278a 100644 --- a/src/gui/components/cc_item_picture.cpp +++ b/src/gui/components/cc_item_picture.cpp @@ -387,6 +387,7 @@ CComponentsChannelLogo::CComponentsChannelLogo( const int &x_pos, const int &y_p void CComponentsChannelLogo::init(const uint64_t& channelId, const std::string& channelName, bool allow_scale) { channel_name = ""; + channel_id = 0; alt_pic_name = ""; setChannel(channelId, channelName); do_scale = allow_scale; diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index c4126f6dc..eabbc55d5 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -217,7 +217,7 @@ CProgressBarCache *CProgressBarCache::pbcLookup(int dy, int dx, int active_col, if (it != pbCache.end()) return *it; - CProgressBarCache *pbc = new CProgressBarCache(dy, dx, active_col, passive_col, design, enable_invert, enable_gradient, R, G, Y); + static CProgressBarCache *pbc = new CProgressBarCache(dy, dx, active_col, passive_col, design, enable_invert, enable_gradient, R, G, Y); pbCache.push_back(pbc); return pbc; } From f045fb18e94b7214e00e974f7ec086f1084cc558 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 30 Jan 2017 19:26:44 +0100 Subject: [PATCH 26/26] src/gui/components/cc_item_progressbar.cpp revert static --- src/gui/components/cc_item_progressbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/components/cc_item_progressbar.cpp b/src/gui/components/cc_item_progressbar.cpp index eabbc55d5..c4126f6dc 100644 --- a/src/gui/components/cc_item_progressbar.cpp +++ b/src/gui/components/cc_item_progressbar.cpp @@ -217,7 +217,7 @@ CProgressBarCache *CProgressBarCache::pbcLookup(int dy, int dx, int active_col, if (it != pbCache.end()) return *it; - static CProgressBarCache *pbc = new CProgressBarCache(dy, dx, active_col, passive_col, design, enable_invert, enable_gradient, R, G, Y); + CProgressBarCache *pbc = new CProgressBarCache(dy, dx, active_col, passive_col, design, enable_invert, enable_gradient, R, G, Y); pbCache.push_back(pbc); return pbc; }