gui/mediaplayer_setup.cpp: integrate MB / YT settings, (c) martii

Origin commit data
------------------
Branch: ni/coolstream
Commit: 9b78e49d0e
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2014-12-26 (Fri, 26 Dec 2014)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
[CST] Focus
2014-12-26 14:16:02 +03:00
parent 4294ea2a4b
commit 85fc0dd24c
7 changed files with 124 additions and 48 deletions

View File

@@ -34,7 +34,6 @@
#include <config.h>
#endif
#include "mediaplayer_setup.h"
#include <global.h>
@@ -43,18 +42,15 @@
#include <gui/widget/icons.h>
#include <gui/widget/stringinput.h>
#include <gui/audioplayer_setup.h>
#include <gui/pictureviewer_setup.h>
#include <gui/webtv_setup.h>
#include <gui/moviebrowser.h>
#include <driver/screen_max.h>
#include <system/debug.h>
CMediaPlayerSetup::CMediaPlayerSetup()
{
width = w_max (40, 10);
@@ -63,7 +59,6 @@ CMediaPlayerSetup::CMediaPlayerSetup()
CMediaPlayerSetup::~CMediaPlayerSetup()
{
}
int CMediaPlayerSetup::exec(CMenuTarget* parent, const std::string & /*actionKey*/)
@@ -83,7 +78,48 @@ int CMediaPlayerSetup::exec(CMenuTarget* parent, const std::string & /*actionKey
/*shows media setup menue entries*/
int CMediaPlayerSetup::showMediaPlayerSetup()
{
CMenuWidget* mediaSetup = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width);
mediaSetup->setSelected(selected);
// intros
mediaSetup->addIntroItems(LOCALE_MAINMENU_MEDIA);
CMenuForwarder *mf;
CAudioPlayerSetup asetup;
mf = new CMenuForwarder(LOCALE_AUDIOPLAYER_NAME, true, NULL, &asetup, "", CRCInput::RC_red);
mf->setHint(NEUTRINO_ICON_HINT_APLAY, LOCALE_MENU_HINT_APLAY_SETUP);
mediaSetup->addItem(mf);
CPictureViewerSetup psetup;
mf = new CMenuForwarder(LOCALE_PICTUREVIEWER_HEAD, true, NULL, &psetup, "", CRCInput::RC_green);
mf->setHint(NEUTRINO_ICON_HINT_PICVIEW, LOCALE_MENU_HINT_PICTUREVIEWER_SETUP);
mediaSetup->addItem(mf);
CWebTVSetup wsetup;
mf = new CMenuForwarder(LOCALE_WEBTV_HEAD, true, NULL, &wsetup, "show_menu", CRCInput::RC_yellow);
mf->setHint(NEUTRINO_ICON_HINT_TVMODE /* FIXME */, LOCALE_MENU_HINT_WEBTV_SETUP);
mediaSetup->addItem(mf);
mediaSetup->addItem(new CMenuSeparator(CMenuSeparator::LINE | CMenuSeparator::STRING, LOCALE_MAINMENU_MOVIEPLAYER));
CMovieBrowser msetup;
int shortcut = 1;
mf = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, &msetup, "show_menu", CRCInput::convertDigitToKey(shortcut++));
mf->setHint(NEUTRINO_ICON_HINT_MB, LOCALE_MENU_HINT_MOVIEBROWSER_SETUP);
mediaSetup->addItem(mf);
mf = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, true, NULL, &msetup, "show_ytmenu", CRCInput::convertDigitToKey(shortcut++));
mf->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY_SETUP);
mediaSetup->addItem(mf);
int res = mediaSetup->exec (NULL, "");
selected = mediaSetup->getSelected();
delete mediaSetup;
return res;
#if 0
CMenuWidget* mediaSetup = new CMenuWidget(LOCALE_MAINMENU_SETTINGS, NEUTRINO_ICON_SETTINGS, width);
mediaSetup->setSelected(selected);
@@ -105,4 +141,5 @@ int CMediaPlayerSetup::showMediaPlayerSetup()
selected = mediaSetup->getSelected();
delete mediaSetup;
return res;
#endif
}

View File

@@ -863,6 +863,16 @@ int CMovieBrowser::exec(CMenuTarget* parent, const std::string & actionKey)
m_movieSelectionHandler->bookmarks.user[i].pos =0;
}
}
else if(actionKey == "show_menu")
{
showMenu(true);
}
else if(actionKey == "show_ytmenu")
{
showYTMenu(true);
saveSettings(&m_settings);
}
return returnval;
}
@@ -1746,7 +1756,7 @@ bool CMovieBrowser::onButtonPressMainFrame(neutrino_msg_t msg)
if (show_mode == MB_SHOW_YT)
showYTMenu();
else
showMenu(m_movieSelectionHandler);
showMenu();
}
else if (msg == CRCInput::RC_text || msg == CRCInput::RC_radio) {
@@ -2764,7 +2774,7 @@ int CMovieBrowser::showMovieInfoMenu(MI_MOVIE_INFO* movie_info)
return res;
}
bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /* movie_info */, bool calledExternally)
bool CMovieBrowser::showMenu(bool calledExternally)
{
/* first clear screen */
framebuffer->paintBackground();
@@ -2864,19 +2874,22 @@ bool CMovieBrowser::showMenu(MI_MOVIE_INFO* /* movie_info */, bool calledExterna
CMovieHelp* movieHelp = new CMovieHelp();
CNFSSmallMenu* nfs = new CNFSSmallMenu();
CMenuWidget mainMenu(LOCALE_MOVIEBROWSER_HEAD, NEUTRINO_ICON_MOVIEPLAYER);
mainMenu.addIntroItems(LOCALE_MOVIEBROWSER_MENU_MAIN_HEAD);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_INFO_HEAD, (m_movieSelectionHandler != NULL), NULL, this, "show_movie_info_menu", CRCInput::RC_red));
mainMenu.addItem(GenericMenuSeparatorLine);
mainMenu.addItem(new CMenuForwarder(LOCALE_EPGPLUS_OPTIONS, true, NULL, &optionsMenu,NULL, CRCInput::RC_green));
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_MENU_DIRECTORIES_HEAD, true, NULL, &dirMenu, NULL, CRCInput::RC_yellow));
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, true, NULL, this, "reload_movie_info", CRCInput::RC_blue));
//mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_MENU_NFS_HEAD, true, NULL, nfs, NULL, CRCInput::RC_setup));
mainMenu.addItem(GenericMenuSeparatorLine);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_MENU_HELP_HEAD, true, NULL, movieHelp, NULL, CRCInput::RC_help));
//mainMenu.addItem(GenericMenuSeparator);
if (!calledExternally) {
CMenuWidget mainMenu(LOCALE_MOVIEBROWSER_HEAD, NEUTRINO_ICON_MOVIEPLAYER);
mainMenu.addIntroItems(LOCALE_MOVIEBROWSER_MENU_MAIN_HEAD);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_INFO_HEAD, (m_movieSelectionHandler != NULL), NULL, this, "show_movie_info_menu", CRCInput::RC_red));
mainMenu.addItem(GenericMenuSeparatorLine);
mainMenu.addItem(new CMenuForwarder(LOCALE_EPGPLUS_OPTIONS, true, NULL, &optionsMenu,NULL, CRCInput::RC_green));
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_MENU_DIRECTORIES_HEAD, true, NULL, &dirMenu, NULL, CRCInput::RC_yellow));
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES, true, NULL, this, "reload_movie_info", CRCInput::RC_blue));
//mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_MENU_NFS_HEAD, true, NULL, nfs, NULL, CRCInput::RC_setup));
mainMenu.addItem(GenericMenuSeparatorLine);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_MENU_HELP_HEAD, true, NULL, movieHelp, NULL, CRCInput::RC_help));
//mainMenu.addItem(GenericMenuSeparator);
mainMenu.exec(NULL, " ");
mainMenu.exec(NULL, " ");
} else
optionsMenu.exec(NULL, "");
// post menu handling
if (m_parentalLock != MB_PARENTAL_LOCK_OFF_TMP)
@@ -3441,7 +3454,7 @@ int CYTHistory::exec(CMenuTarget* parent, const std::string &actionKey)
return menu_return::RETURN_EXIT;
}
bool CMovieBrowser::showYTMenu()
bool CMovieBrowser::showYTMenu(bool calledExternally)
{
framebuffer->paintBackground();
@@ -3452,30 +3465,36 @@ bool CMovieBrowser::showYTMenu()
CMenuSelectorTarget * selector = new CMenuSelectorTarget(&select);
char cnt[5];
for (unsigned i = 0; i < YT_FEED_OPTION_COUNT; i++) {
sprintf(cnt, "%d", YT_FEED_OPTIONS[i].key);
mainMenu.addItem(new CMenuForwarder(YT_FEED_OPTIONS[i].value, true, NULL, selector, cnt, CRCInput::convertDigitToKey(i + 1)), m_settings.ytmode == (int) YT_FEED_OPTIONS[i].key);
if (!calledExternally) {
for (unsigned i = 0; i < YT_FEED_OPTION_COUNT; i++) {
sprintf(cnt, "%d", YT_FEED_OPTIONS[i].key);
mainMenu.addItem(new CMenuForwarder(YT_FEED_OPTIONS[i].value, true, NULL, selector, cnt, CRCInput::convertDigitToKey(i + 1)), m_settings.ytmode == (int) YT_FEED_OPTIONS[i].key);
}
mainMenu.addItem(GenericMenuSeparatorLine);
bool enabled = (!m_vMovieInfo.empty()) && (m_movieSelectionHandler != NULL);
sprintf(cnt, "%d", cYTFeedParser::RELATED);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_RELATED, enabled, NULL, selector, cnt, CRCInput::RC_red));
mainMenu.addItem(GenericMenuSeparatorLine);
}
mainMenu.addItem(GenericMenuSeparatorLine);
bool enabled = (!m_vMovieInfo.empty()) && (m_movieSelectionHandler != NULL);
sprintf(cnt, "%d", cYTFeedParser::RELATED);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_RELATED, enabled, NULL, selector, cnt, CRCInput::RC_red));
mainMenu.addItem(GenericMenuSeparatorLine);
std::string search = m_settings.ytsearch;
CKeyboardInput stringInput(LOCALE_MOVIEBROWSER_YT_SEARCH, &search);
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_SEARCH, true, search, &stringInput, NULL, CRCInput::RC_green));
mainMenu.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_YT_ORDERBY, &m_settings.ytorderby, YT_ORDERBY_OPTIONS, YT_ORDERBY_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true));
sprintf(cnt, "%d", cYTFeedParser::SEARCH);
mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_yellow));
if (!calledExternally) {
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_SEARCH, true, search, &stringInput, NULL, CRCInput::RC_green));
mainMenu.addItem(new CMenuOptionChooser(LOCALE_MOVIEBROWSER_YT_ORDERBY, &m_settings.ytorderby, YT_ORDERBY_OPTIONS, YT_ORDERBY_OPTION_COUNT, true, NULL, CRCInput::RC_nokey, "", true));
sprintf(cnt, "%d", cYTFeedParser::SEARCH);
mainMenu.addItem(new CMenuForwarder(LOCALE_EVENTFINDER_START_SEARCH, true, NULL, selector, cnt, CRCInput::RC_yellow));
}
CYTHistory ytHistory(m_settings, search);
if (m_settings.ytsearch_history_size > 0)
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_HISTORY, true, NULL, &ytHistory, "", CRCInput::RC_blue));
if (!calledExternally) {
if (m_settings.ytsearch_history_size > 0)
mainMenu.addItem(new CMenuForwarder(LOCALE_MOVIEBROWSER_YT_HISTORY, true, NULL, &ytHistory, "", CRCInput::RC_blue));
mainMenu.addItem(GenericMenuSeparatorLine);
mainMenu.addItem(GenericMenuSeparatorLine);
}
mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_MAX_RESULTS, &m_settings.ytresults, true, 10, 50, NULL));
mainMenu.addItem(new CMenuOptionNumberChooser(LOCALE_MOVIEBROWSER_YT_MAX_HISTORY, &m_settings.ytsearch_history_max, true, 10, 50, NULL));
@@ -3524,8 +3543,18 @@ bool CMovieBrowser::showYTMenu()
delete selector;
bool reload = false;
printf("MovieBrowser::showYTMenu(): selected: %d\n", select);
int newmode = -1;
if (rstr != m_settings.ytregion) {
m_settings.ytregion = rstr;
if (newmode < 0)
newmode = m_settings.ytmode;
reload = true;
printf("change region to %s\n", m_settings.ytregion.c_str());
}
if (calledExternally)
return true;
printf("MovieBrowser::showYTMenu(): selected: %d\n", select);
if (select >= 0) {
newmode = select;
if (select == cYTFeedParser::RELATED) {
@@ -3565,13 +3594,7 @@ bool CMovieBrowser::showYTMenu()
reload = true;
}
}
if (rstr != m_settings.ytregion) {
m_settings.ytregion = rstr;
if (newmode < 0)
newmode = m_settings.ytmode;
reload = true;
printf("change region to %s\n", m_settings.ytregion.c_str());
}
if (reload) {
CHintBox loadBox(LOCALE_MOVIEPLAYER_YTPLAYBACK, g_Locale->getText(LOCALE_MOVIEBROWSER_SCAN_FOR_MOVIES));
loadBox.paint();

View File

@@ -354,7 +354,7 @@ class CMovieBrowser : public CMenuTarget
std::vector<MI_MOVIE_INFO> yt_completed;
std::vector<MI_MOVIE_INFO> yt_failed;
void loadYTitles(int mode, std::string search = "", std::string id = "");
bool showYTMenu(void);
bool showYTMenu(bool calledExternally = false);
void refreshYTMenu();
public: // Functions //////////////////////////////////////////////////////////7
@@ -430,7 +430,7 @@ class CMovieBrowser : public CMenuTarget
void getStorageInfo(void); // P3
///// Menu ////////////////////////////////////
bool showMenu(MI_MOVIE_INFO* movie_info, bool calledExternally = false); // P2
bool showMenu(bool calledExternally = false);
int showMovieInfoMenu(MI_MOVIE_INFO* movie_info); // P2
int showStartPosSelectionMenu(void); // P2