From 17484d398384862c630d3cac0e3c3693747a6d4d Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 7 Oct 2017 13:40:35 +0200 Subject: [PATCH 01/11] src/gui/test_menu.cpp fix memleak Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/74f02a16f5c1be9dd6cb2c430b1b2d25f25e4a4b Author: Jacek Jendrzej Date: 2017-10-07 (Sat, 07 Oct 2017) --- src/gui/test_menu.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/test_menu.cpp b/src/gui/test_menu.cpp index a2dfa2f32..790e18a8b 100644 --- a/src/gui/test_menu.cpp +++ b/src/gui/test_menu.cpp @@ -1121,9 +1121,12 @@ int CTestMenu::showTestMenu() w_test.setFooter(footerButtons, 2); w_test.addKey(CRCInput::RC_red, this, "footer_key"); w_test.addKey(CRCInput::RC_green, this, "footer_key"); - + int res = w_test.exec(NULL, ""); + delete w_hw; + delete w_cc; + delete w_msg; //exit - return w_test.exec(NULL, "");; + return res; } void CTestMenu::showCCTests(CMenuWidget *widget) From f3786a44f7f2cd4e2567f397bd51e05adf52b650 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 7 Oct 2017 15:03:47 +0200 Subject: [PATCH 02/11] src/gui/upnpbrowser.cpp kill infobox and timebox Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/9a0bcf0dc5daa65732f9ac854c57a43906598b4a Author: Jacek Jendrzej Date: 2017-10-07 (Sat, 07 Oct 2017) --- src/gui/upnpbrowser.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 2b335df76..9a4717e91 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -1226,8 +1226,11 @@ void CUpnpBrowserGui::paintDetails(UPnPEntry *entry, bool use_playing) void CUpnpBrowserGui::paintItem2DetailsLine(int pos) { if (pos < 0){ - if (dline) + if (dline){ dline->kill(); + infobox.kill(); + timebox.kill(); + } return; } From fe14e966ca8be61c8ea51cb56c11cdfa1ae39b8e Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 7 Oct 2017 15:12:19 +0200 Subject: [PATCH 03/11] src/gui/upnpbrowser.cpp clear framebuffer Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/7f1d736781f3f6f302b2be0ea6ba7bc99f9697e7 Author: Jacek Jendrzej Date: 2017-10-07 (Sat, 07 Oct 2017) --- src/gui/upnpbrowser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 9a4717e91..58085098e 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -632,6 +632,7 @@ void CUpnpBrowserGui::playnext(void) playAudio((*entries)[0].resources[preferred].url, (*entries)[0].type); } else if (mime.substr(0,6) == "video/") { + m_frameBuffer->Clear(); playVideo((*entries)[0].title, (*entries)[0].resources[preferred].url); m_folderplay = false; // FIXME else no way to stop in video folder } From 85df730d64ad3f4b89a3995bb5666c096a0606d5 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sun, 8 Oct 2017 16:41:28 +0200 Subject: [PATCH 04/11] fix video folderplay Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/ea0cd48d1859d0ca75274ffde922b50221bd1e3b Author: Jacek Jendrzej Date: 2017-10-08 (Sun, 08 Oct 2017) --- src/gui/movieplayer.cpp | 4 ++-- src/gui/upnpbrowser.cpp | 16 ++++++++++++---- src/gui/upnpbrowser.h | 1 + 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 70fc90d4b..6128d66cb 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1266,7 +1266,7 @@ void CMoviePlayerGui::quickZap(neutrino_msg_t msg) if ((msg == CRCInput::RC_right) || msg == (neutrino_msg_t) g_settings.key_quickzap_up) { //printf("CMoviePlayerGui::%s: CRCInput::RC_right or g_settings.key_quickzap_up\n", __func__); - if (isLuaPlay) + if (isLuaPlay || isUPNP) { playstate = CMoviePlayerGui::STOPPED; keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_NEXT; @@ -1293,7 +1293,7 @@ void CMoviePlayerGui::quickZap(neutrino_msg_t msg) else if ((msg == CRCInput::RC_left) || msg == (neutrino_msg_t) g_settings.key_quickzap_down) { //printf("CMoviePlayerGui::%s: CRCInput::RC_left or g_settings.key_quickzap_down\n", __func__); - if (isLuaPlay) + if (isLuaPlay || isUPNP) { playstate = CMoviePlayerGui::STOPPED; keyPressed = CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV; diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 58085098e..b06d3ce83 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -155,6 +155,8 @@ void CUpnpBrowserGui::Init() m_item_y = m_header_y + m_header_height; m_footer_y = m_item_y + (m_listmaxshow * m_item_height); m_infobox_y = m_footer_y + m_footer_height + OFFSET_SHADOW + OFFSET_INTER; + video_key_msg = CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL; + } CUpnpBrowserGui::~CUpnpBrowserGui() @@ -633,8 +635,8 @@ void CUpnpBrowserGui::playnext(void) } else if (mime.substr(0,6) == "video/") { m_frameBuffer->Clear(); + m_folderplay = true; playVideo((*entries)[0].title, (*entries)[0].resources[preferred].url); - m_folderplay = false; // FIXME else no way to stop in video folder } else if (mime.substr(0,6) == "image/") { if (m_folderplay) @@ -727,6 +729,7 @@ bool CUpnpBrowserGui::selectItem(std::string id) unsigned int liststart = 0; unsigned int selected = 0; unsigned int total = 0; + video_key_msg = CMoviePlayerGui::PLUGIN_PLAYSTATE_NORMAL; printf("selectItem: [%s]\n", id.c_str()); if (!getItems(id, liststart, entries, total)) @@ -858,19 +861,23 @@ bool CUpnpBrowserGui::selectItem(std::string id) m_folderplay = false; stopAudio(); } - else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_stop) { + else if (m_folderplay && (msg == (neutrino_msg_t) CRCInput::RC_stop + || video_key_msg == CMoviePlayerGui::PLUGIN_PLAYSTATE_STOP + || video_key_msg == CMoviePlayerGui::PLUGIN_PLAYSTATE_LEAVE_ALL)){ timeout = 0; m_folderplay = false; m_frameBuffer->Clear(); refresh = true; } - else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_prev) { + else if (m_folderplay && (msg == (neutrino_msg_t) CRCInput::RC_prev) + || video_key_msg == CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV){ timeout = 0; m_playid -= 2; if (m_playid < 0) m_playid = 0; } - else if (m_folderplay && msg == (neutrino_msg_t) CRCInput::RC_next) { + else if (m_folderplay && (msg == (neutrino_msg_t) CRCInput::RC_next + || video_key_msg == CMoviePlayerGui::PLUGIN_PLAYSTATE_NEXT)){ timeout = 0; stopAudio(); } @@ -1322,6 +1329,7 @@ void CUpnpBrowserGui::playVideo(std::string name, std::string url) m_frameBuffer->stopFrame(); CMoviePlayerGui::getInstance().SetFile(name, url); CMoviePlayerGui::getInstance().exec(NULL, "upnp"); + video_key_msg = CMoviePlayerGui::getInstance().getKeyPressed(); CNeutrinoApp::getInstance()->handleMsg(NeutrinoMessages::CHANGEMODE, NeutrinoMessages::mode_upnp | NeutrinoMessages::norezap); } diff --git a/src/gui/upnpbrowser.h b/src/gui/upnpbrowser.h index eff6326ad..758613cc0 100644 --- a/src/gui/upnpbrowser.h +++ b/src/gui/upnpbrowser.h @@ -96,6 +96,7 @@ class CUpnpBrowserGui : public CMenuTarget, public CListHelpers time_t m_time_played; bool m_playing_entry_is_shown; time_t timeout; + int video_key_msg; CComponentsDetailsLine * dline; CComponentsFooter footer; CComponentsInfoBox topbox, infobox, timebox; From e650c02ba8caccbf12dcae1ff0faf06ef04292e3 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 8 Oct 2017 17:48:32 +0200 Subject: [PATCH 05/11] CMenuWidget: small clean ups Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/4ad5ce65e2dec80eb25fd948aa229e41816bf25f Author: Thilo Graf Date: 2017-10-08 (Sun, 08 Oct 2017) --- src/gui/widget/menue.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/widget/menue.cpp b/src/gui/widget/menue.cpp index 07aaed0e6..3b71a6490 100644 --- a/src/gui/widget/menue.cpp +++ b/src/gui/widget/menue.cpp @@ -1455,10 +1455,8 @@ void CMenuWidget::enableSaveScreen(bool enable) void CMenuWidget::paintHint(int pos) { - if (!g_settings.show_menu_hints){ - //ResetModules(); //ensure clean up on changed setting + if (!g_settings.show_menu_hints) return; - } if (pos < 0 && !hint_painted) return; From cc07da60f5f6d1c7de845e639255538903797ee6 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 8 Oct 2017 17:48:32 +0200 Subject: [PATCH 06/11] CTimerList: increase width of remote menu eg: With oversized font sizes the buttons inside footer are squeezed. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6b28013da1801b7b55403391251adecc22f74c92 Author: Thilo Graf Date: 2017-10-08 (Sun, 08 Oct 2017) Origin message was: ------------------ CTimerList: increase width of remote menu eg: With oversized font sizes the buttons inside footer are squeezed. --- src/gui/timerlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 30abd3eda..a189ce33b 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1097,7 +1097,7 @@ void CTimerList::hide() bool CTimerList::RemoteBoxSetup() { bool ret = false; - remboxmenu = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); + remboxmenu = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER, 50); remboxmenu->addKey(CRCInput::RC_red, this, "del_ip"); remboxmenu->addKey(CRCInput::RC_green, this, "add_ip"); From d5b66e14c8861f73a3df3db616e5252f88a18c4e Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 8 Oct 2017 17:48:32 +0200 Subject: [PATCH 07/11] CTimerList: fix behavior of hide() for remotebox sub menus After hide() the the background was not fully restored or was partially damaged the corners beside the header. Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/3d9b7c1360c09a0c161199bb61fcf45b61c2319e Author: Thilo Graf Date: 2017-10-08 (Sun, 08 Oct 2017) Origin message was: ------------------ CTimerList: fix behavior of hide() for remotebox sub menus After hide() the the background was not fully restored or was partially damaged the corners beside the header. --- src/gui/timerlist.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index a189ce33b..1249c2e1c 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -315,6 +315,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) remotebox_user.forceSaveScreen(true); CKeyboardInput remotebox_pass(LOCALE_REMOTEBOX_PASS, &pass, 15); remotebox_pass.forceSaveScreen(true); + + //menu add remote box CMenuWidget * rbsetup = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBNAME, true, rbname, &remotebox_name)); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBADDR, true, rbaddress, &remotebox_address)); @@ -325,8 +327,6 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) if ((rbsetup->exec(NULL,"") == true) && (!rbaddress.empty())) { remboxmenu->addItem(new CMenuForwarder(rbname, true, NULL, this, "cha_ip")); - rbsetup->hide(); - remboxmenu->enableSaveScreen(false); remboxmenu->hide(); timer_remotebox_item timer_rb; timer_rb.rbaddress = rbaddress; @@ -377,6 +377,8 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) remotebox_user.forceSaveScreen(true); CKeyboardInput remotebox_pass(LOCALE_REMOTEBOX_PASS, &it->pass, 15); remotebox_pass.forceSaveScreen(true); + + //remote box edit CMenuWidget * rbsetup = new CMenuWidget(LOCALE_REMOTEBOX_HEAD, NEUTRINO_ICON_TIMER); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBNAME, true, it->rbname, &remotebox_name)); rbsetup->addItem(new CMenuForwarder(LOCALE_REMOTEBOX_RBADDR, true, it->rbaddress, &remotebox_address)); @@ -388,8 +390,6 @@ int CTimerList::exec(CMenuTarget* parent, const std::string & actionKey) { it->port = atoi(port); f->setName(it->rbname); - rbsetup->hide(); - remboxmenu->enableSaveScreen(false); remboxmenu->hide(); changed = true; } From 1d5474a66dcaf0381ab0d3fd95e82c8762b8a0d4 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Sun, 8 Oct 2017 17:48:32 +0200 Subject: [PATCH 08/11] CUpnpBrowserGui: fix possible compile errot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit error: suggest parentheses around ‘&&’ within ‘||’ [-Werror=parentheses] Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/cbe21aade71b95e1a90cfba249f8ec5344fa3d68 Author: Thilo Graf Date: 2017-10-08 (Sun, 08 Oct 2017) --- src/gui/upnpbrowser.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index b06d3ce83..2d33021c7 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -869,8 +869,7 @@ bool CUpnpBrowserGui::selectItem(std::string id) m_frameBuffer->Clear(); refresh = true; } - else if (m_folderplay && (msg == (neutrino_msg_t) CRCInput::RC_prev) - || video_key_msg == CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV){ + else if (m_folderplay && ((msg == (neutrino_msg_t) CRCInput::RC_prev) || video_key_msg == CMoviePlayerGui::PLUGIN_PLAYSTATE_PREV)){ timeout = 0; m_playid -= 2; if (m_playid < 0) From a2d10f6cb05bad648f57334ca2055a6686abf147 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 9 Oct 2017 12:28:22 +0200 Subject: [PATCH 09/11] upnpbrowser : fix memleak Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/d3233254c882e1e815750bb0fc78bb9226b2c5a7 Author: Jacek Jendrzej Date: 2017-10-09 (Mon, 09 Oct 2017) --- src/gui/upnpbrowser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 2d33021c7..0b3c753c9 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -643,6 +643,7 @@ void CUpnpBrowserGui::playnext(void) timeout = time(NULL) + g_settings.picviewer_slide_time; showPicture((*entries)[0].resources[preferred].url); } + delete entries; return; } } else { From f3812c8637796234a4090d4a63313b6fa619fedb Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 9 Oct 2017 16:36:49 +0200 Subject: [PATCH 10/11] upnpbrowser : fix memleaks Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/6d81594f1200c332ffa092505fba346de0ba0631 Author: Jacek Jendrzej Date: 2017-10-09 (Mon, 09 Oct 2017) --- src/gui/upnpbrowser.cpp | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 0b3c753c9..127769933 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -295,15 +295,13 @@ bool CUpnpBrowserGui::getResults(std::string id, unsigned int start, unsigned in std::vector *CUpnpBrowserGui::decodeResult(std::string result) { xmlNodePtr root, node, snode; - std::vector *entries; - xmlDocPtr parser = parseXml(result.c_str(),"UTF-8"); root = xmlDocGetRootElement(parser); if (!root) { xmlFreeDoc(parser); return NULL; } - entries = new std::vector; + std::vector *entries = new std::vector; for (node=xmlChildrenNode(root); node; node=xmlNextNode(node)) { @@ -644,9 +642,17 @@ void CUpnpBrowserGui::playnext(void) showPicture((*entries)[0].resources[preferred].url); } delete entries; + entries = NULL; return; + }else{ + delete entries; + entries = NULL; } } else { + if(entries){ + delete entries; + entries = NULL; + } neutrino_msg_t msg; neutrino_msg_data_t data; g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display @@ -658,7 +664,10 @@ void CUpnpBrowserGui::playnext(void) } } } - delete entries; + if(entries){ + delete entries; + entries = NULL; + } m_frameBuffer->Clear(); } @@ -690,9 +699,13 @@ bool CUpnpBrowserGui::getItems(std::string id, unsigned int index, std::vectorsize() || returned == 0) + if (!entries || !nfound || !tfound || !rfound || returned != entries->size() || returned == 0){ + if(entries){ + delete entries; + entries = NULL; + } return false; - + } return true; } @@ -923,6 +936,7 @@ bool CUpnpBrowserGui::selectItem(std::string id) #endif delete entries; + entries = NULL; timeout = 0; return endall; From 2f8ff6280249391ed001931f8116490a5fd73abc Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 9 Oct 2017 17:23:11 +0200 Subject: [PATCH 11/11] src/gui/upnpbrowser.cpp clear framebuffer Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/47b247472c5fdf75b41e987945c19c91a8bdc8c2 Author: Jacek Jendrzej Date: 2017-10-09 (Mon, 09 Oct 2017) --- src/gui/upnpbrowser.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 127769933..1a9cec034 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -553,6 +553,7 @@ void CUpnpBrowserGui::selectDevice() { m_folderplay = false; selectItem("0"); + m_frameBuffer->Clear(); refresh=true; } else if (msg == CRCInput::RC_blue)