From cb8421e0893012e16b429a2bb425e1387dcbf5c6 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Sat, 1 Jun 2019 19:52:41 +0200 Subject: [PATCH] YT call search from yt histry Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/90f03fd0cbba7c73cecfa09c7627cbee29cfe7fd Author: Jacek Jendrzej Date: 2019-06-01 (Sat, 01 Jun 2019) --- src/gui/moviebrowser/mb.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 70966424f..131322f38 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -4288,6 +4288,7 @@ class CYTHistory : public CMenuTarget private: int width; int selected; + bool allexit; std::string *search; MB_SETTINGS *settings; public: @@ -4301,6 +4302,7 @@ CYTHistory::CYTHistory(MB_SETTINGS &_settings, std::string &_search) selected = -1; settings = &_settings; search = &_search; + allexit = false; } int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey) @@ -4320,7 +4322,12 @@ int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey) m->exec(NULL, ""); m->hide(); delete m; - return menu_return::RETURN_REPAINT; + if(!allexit) { + return menu_return::RETURN_REPAINT; + }else { + allexit = false; + return menu_return::RETURN_EXIT_ALL; + } } if (actionKey == "clearYThistory") { settings->ytsearch_history.clear(); @@ -4328,6 +4335,7 @@ int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey) return menu_return::RETURN_EXIT; } *search = actionKey; + allexit = true; g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0); return menu_return::RETURN_EXIT; } @@ -4413,7 +4421,7 @@ bool CMovieBrowser::showYTMenu(bool calledExternally) yt_menue->addKey(CRCInput::RC_spkr, ytcache_selector, "rc_spkr"); refreshYTMenu(); - mainMenu.exec(NULL, ""); + int ret = mainMenu.exec(NULL, ""); ytparser.SetConcurrentDownloads(m_settings.ytconcconn); ytparser.SetThumbnailDir(m_settings.ytthumbnaildir); @@ -4432,6 +4440,12 @@ bool CMovieBrowser::showYTMenu(bool calledExternally) if (calledExternally) return true; + bool no_reload = false; + if (ret == menu_return::RETURN_EXIT_ALL && !search.empty() && !m_settings.ytsearch.empty() && search != m_settings.ytsearch){ + select = cYTFeedParser::SEARCH; + no_reload = true; + } + printf("MovieBrowser::showYTMenu(): selected: %d\n", select); if (select >= 0) { newmode = select; @@ -4446,7 +4460,7 @@ bool CMovieBrowser::showYTMenu(bool calledExternally) else if (select == cYTFeedParser::SEARCH) { printf("search for: %s\n", search.c_str()); if (!search.empty()) { - reload = true; + reload = !no_reload;// default true m_settings.ytsearch = search; m_settings.ytmode = newmode; m_settings.ytsearch_history.push_front(search);