gui/moviebrowser: add gui options for yt/nk cache directories

Conflicts:
	src/gui/moviebrowser.cpp
	src/system/nkparser.cpp
	src/system/nkparser.h
This commit is contained in:
martii
2013-11-17 10:48:04 +01:00
committed by [CST] Focus
parent 891170490e
commit fd1ba8df97
8 changed files with 22 additions and 6 deletions

View File

@@ -797,6 +797,7 @@ bool CMovieBrowser::loadSettings(MB_SETTINGS* settings)
settings->ytconcconn = configfile.getInt32("mb_ytconcconn", 4); // concurrent connections
settings->ytregion = configfile.getString("mb_ytregion", "default");
settings->ytsearch = configfile.getString("mb_ytsearch", "");
settings->ytthumbnaildir = configfile.getString("mb_ytthumbnaildir", "/tmp/ytparser");
settings->ytvid = configfile.getString("mb_ytvid", "");
settings->ytsearch_history_max = configfile.getInt32("mb_ytsearch_history_max", 10);
settings->ytsearch_history_size = configfile.getInt32("mb_ytsearch_history_size", 0);
@@ -860,6 +861,7 @@ bool CMovieBrowser::saveSettings(MB_SETTINGS* settings)
configfile.setInt32("mb_ytconcconn", settings->ytconcconn);
configfile.setString("mb_ytregion", settings->ytregion);
configfile.setString("mb_ytsearch", settings->ytsearch);
configfile.setString("mb_ytthumbnaildir", settings->ytthumbnaildir);
configfile.setString("mb_ytvid", settings->ytvid);
settings->ytsearch_history_size = settings->ytsearch_history.size();
@@ -3689,6 +3691,7 @@ void CMovieBrowser::loadYTitles(int mode, std::string search, std::string id)
ytparser.SetMaxResults(m_settings.ytresults);
ytparser.SetConcurrentDownloads(m_settings.ytconcconn);
ytparser.SetThumbnailDir(m_settings.ytthumbnaildir);
if (!ytparser.Parsed() || (ytparser.GetFeedMode() != mode)) {
if (ytparser.ParseFeed((cYTFeedParser::yt_feed_mode_t)mode, search, id, (cYTFeedParser::yt_feed_orderby_t)m_settings.ytorderby)) {
@@ -3981,6 +3984,8 @@ bool CMovieBrowser::showYTMenu()
mainMenu.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_YT_PREF_QUALITY, &m_settings.ytquality, YT_QUALITY_OPTIONS, YT_QUALITY_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true));
mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_CONCURRENT_CONNECTIONS, &m_settings.ytconcconn, true, 1, 8));
CFileChooser fc(&m_settings.ytthumbnaildir);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_CACHE_DIR, true, m_settings.ytthumbnaildir, &fc));
yt_menue = &mainMenu;
yt_menue_end = yt_menue->getItemsCount();
@@ -3992,6 +3997,8 @@ bool CMovieBrowser::showYTMenu()
mainMenu.exec(NULL, "");
ytparser.SetConcurrentDownloads(m_settings.ytconcconn);
ytparser.SetThumbnailDir(m_settings.ytthumbnaildir);
delete selector;
bool reload = false;
@@ -4158,13 +4165,11 @@ int CFileChooser::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
CFileBrowser browser;
browser.Dir_Mode=true;
if (browser.exec(dirPath->c_str()))
{
std::string oldPath = *dirPath;
if (browser.exec(dirPath->c_str())) {
*dirPath = browser.getSelectedFile()->Name;
short a = dirPath->compare(0,5,"/mnt/");
short b = dirPath->compare(0,7,"/media/");
if(a != 0 && b != 0)
*dirPath =""; // We clear the string if the selected folder is not at leaset /mnt/ or /hdd (There is no other possibility to clear this)
if (check_dir(dirPath->c_str(), true))
*dirPath = oldPath;
}
return menu_return::RETURN_REPAINT;