YT call search from yt histry

This commit is contained in:
Jacek Jendrzej
2019-06-01 19:52:41 +02:00
parent 5fa551dab6
commit e193c72d34

View File

@@ -4276,6 +4276,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:
@@ -4289,6 +4290,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)
@@ -4308,7 +4310,12 @@ int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey)
m->exec(NULL, ""); m->exec(NULL, "");
m->hide(); m->hide();
delete m; delete m;
if(!allexit) {
return menu_return::RETURN_REPAINT; 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();
@@ -4316,6 +4323,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;
} }
@@ -4401,7 +4409,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);
@@ -4420,6 +4428,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;
@@ -4434,7 +4448,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);