YT call search from yt histry

Origin commit data
------------------
Commit: 90f03fd0cb
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-06-01 (Sat, 01 Jun 2019)
This commit is contained in:
Jacek Jendrzej
2019-06-01 19:52:41 +02:00
committed by vanhofen
parent 048363b309
commit cb8421e089

View File

@@ -4288,6 +4288,7 @@ class CYTHistory : public CMenuTarget
private: private:
int width; int width;
int selected; int selected;
bool allexit;
std::string *search; std::string *search;
MB_SETTINGS *settings; MB_SETTINGS *settings;
public: public:
@@ -4301,6 +4302,7 @@ CYTHistory::CYTHistory(MB_SETTINGS &_settings, std::string &_search)
selected = -1; selected = -1;
settings = &_settings; settings = &_settings;
search = &_search; search = &_search;
allexit = false;
} }
int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey) 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->exec(NULL, "");
m->hide(); m->hide();
delete m; 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") { if (actionKey == "clearYThistory") {
settings->ytsearch_history.clear(); settings->ytsearch_history.clear();
@@ -4328,6 +4335,7 @@ int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_EXIT; return menu_return::RETURN_EXIT;
} }
*search = actionKey; *search = actionKey;
allexit = true;
g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0); g_RCInput->postMsg((neutrino_msg_t) CRCInput::RC_blue, 0);
return menu_return::RETURN_EXIT; return menu_return::RETURN_EXIT;
} }
@@ -4413,7 +4421,7 @@ bool CMovieBrowser::showYTMenu(bool calledExternally)
yt_menue->addKey(CRCInput::RC_spkr, ytcache_selector, "rc_spkr"); yt_menue->addKey(CRCInput::RC_spkr, ytcache_selector, "rc_spkr");
refreshYTMenu(); refreshYTMenu();
mainMenu.exec(NULL, ""); int ret = mainMenu.exec(NULL, "");
ytparser.SetConcurrentDownloads(m_settings.ytconcconn); ytparser.SetConcurrentDownloads(m_settings.ytconcconn);
ytparser.SetThumbnailDir(m_settings.ytthumbnaildir); ytparser.SetThumbnailDir(m_settings.ytthumbnaildir);
@@ -4432,6 +4440,12 @@ bool CMovieBrowser::showYTMenu(bool calledExternally)
if (calledExternally) if (calledExternally)
return true; 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); printf("MovieBrowser::showYTMenu(): selected: %d\n", select);
if (select >= 0) { if (select >= 0) {
newmode = select; newmode = select;
@@ -4446,7 +4460,7 @@ bool CMovieBrowser::showYTMenu(bool calledExternally)
else if (select == cYTFeedParser::SEARCH) { else if (select == cYTFeedParser::SEARCH) {
printf("search for: %s\n", search.c_str()); printf("search for: %s\n", search.c_str());
if (!search.empty()) { if (!search.empty()) {
reload = true; reload = !no_reload;// default true
m_settings.ytsearch = search; m_settings.ytsearch = search;
m_settings.ytmode = newmode; m_settings.ytmode = newmode;
m_settings.ytsearch_history.push_front(search); m_settings.ytsearch_history.push_front(search);