From 46e5e5e20200cd3ed4b4530276bf19959f9a043f Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 13 Sep 2017 14:46:38 +0200 Subject: [PATCH] rework multimedia-menu code; cleanup from many unused code Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/56cdb2dd6c3ee5db6b8a51b1a570c76b50951159 Author: vanhofen Date: 2017-09-13 (Wed, 13 Sep 2017) Origin message was: ------------------ - rework multimedia-menu code; cleanup from many unused code ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- data/locale/deutsch.locale | 1 - data/locale/english.locale | 1 - src/gui/mediaplayer.cpp | 197 +++++++++++-------------------------- src/gui/mediaplayer.h | 14 +-- src/neutrino.cpp | 11 +-- src/system/locals.h | 1 - src/system/locals_intern.h | 1 - 7 files changed, 61 insertions(+), 165 deletions(-) diff --git a/data/locale/deutsch.locale b/data/locale/deutsch.locale index 760835540..c7102f384 100644 --- a/data/locale/deutsch.locale +++ b/data/locale/deutsch.locale @@ -480,7 +480,6 @@ eventlistbar.channelswitch Umschalten eventlistbar.eventsort Sortieren eventlistbar.recordevent Aufnehmen extra.add_to_bouquet dem Bouquet zufügen -extra.audio_run_player Audiotaste startet Player extra.auto_delete Automatisch löschen extra.auto_timeshift Autom. Aufnahme, Sek. (0 = deakt.) extra.cache_txt Teletext zwischenspeichern diff --git a/data/locale/english.locale b/data/locale/english.locale index 331c03014..21061cde9 100644 --- a/data/locale/english.locale +++ b/data/locale/english.locale @@ -479,7 +479,6 @@ eventlistbar.channelswitch schedule eventlistbar.eventsort sorting eventlistbar.recordevent record extra.add_to_bouquet Add to bouquet -extra.audio_run_player Audio key start player extra.auto_delete Auto-delete extra.auto_timeshift Auto-record, sec (0 = disable) extra.cache_txt Cache teletext diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index f96ae5b84..a71b6d309 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -61,9 +61,6 @@ extern CInfoIcons *InfoIcons; CMediaPlayerMenu::CMediaPlayerMenu() { - setMenuTitel(); - setUsageMode(); - width = 40; audioPlayer = NULL; @@ -89,8 +86,6 @@ CMediaPlayerMenu::~CMediaPlayerMenu() int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) { - printf("init mediaplayer menu in usage mode %d\n", usage_mode); - if (parent) parent->hide(); @@ -109,7 +104,7 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) int res = inetPlayer->exec(NULL, "init"); return res; //menu_return::RETURN_REPAINT; } - else if (actionKey == "movieplayer") + else if (actionKey == "moviebrowser") { audiomute->enableMuteIcon(false); CInfoClock::getInstance()->enableInfoClock(false); @@ -131,107 +126,76 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) return res; } - //show selectable mediaplayer items int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) { CPersonalizeGui *personalize = p; - CMenuWidget *media = m; + CMenuWidget *multimedia_menu = m; - bool show = (personalize == NULL || media == NULL); + bool show = (personalize == NULL || multimedia_menu == NULL); if (personalize == NULL) personalize = new CPersonalizeGui(); - if (media == NULL) - media = new CMenuWidget(menu_title, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA); + if (multimedia_menu == NULL) + multimedia_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA); - personalize->addWidget(media); - personalize->addIntroItems(media); + personalize->addWidget(multimedia_menu); + personalize->addIntroItems(multimedia_menu); - CMenuForwarder *fw_audio = NULL; - CMenuForwarder *fw_inet = NULL; - CMenuForwarder *fw_mp = NULL; - CMenuForwarder *fw_pviewer = NULL; - CPictureViewerGui *pictureviewergui = NULL; -#if ENABLE_UPNP - static CUpnpBrowserGui *upnpbrowsergui = NULL; - CMenuForwarder *fw_upnp = NULL; -#endif - CMenuWidget *moviePlayer = NULL; - bool enabled = !CMoviePlayerGui::getInstance().Playing(); - if (usage_mode != MODE_VIDEO) - { - //audio player - neutrino_msg_t audio_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_audio : CRCInput::RC_red; - fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, enabled, NULL, this, "audioplayer", audio_rc); - fw_audio->setHint(NEUTRINO_ICON_HINT_APLAY, LOCALE_MENU_HINT_APLAY); - //internet player - neutrino_msg_t inet_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_www : CRCInput::RC_green; - fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, enabled, NULL, this, "inetplayer", inet_rc); - fw_inet->setHint(NEUTRINO_ICON_HINT_INET_RADIO, LOCALE_MENU_HINT_INET_RADIO); - } + //audio player + CMenuForwarder *fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, enabled, NULL, this, "audioplayer", CRCInput::RC_red); + fw_audio->setHint(NEUTRINO_ICON_HINT_APLAY, LOCALE_MENU_HINT_APLAY); + personalize->addItem(multimedia_menu, fw_audio, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_AUDIO]); - if (usage_mode == MODE_DEFAULT) - { - //movieplayer - if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) { - moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MOVIEPLAYER, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA_MOVIEPLAYER); - personalize->addWidget(moviePlayer); - fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, enabled, NULL, moviePlayer, NULL, CRCInput::RC_yellow); - fw_mp->setHint(NEUTRINO_ICON_HINT_MOVIE, LOCALE_MENU_HINT_MOVIE); - } + //internet player + CMenuForwarder *fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, enabled, NULL, this, "inetplayer", CRCInput::RC_green); + fw_inet->setHint(NEUTRINO_ICON_HINT_INET_RADIO, LOCALE_MENU_HINT_INET_RADIO); + personalize->addItem(multimedia_menu, fw_inet, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_INETPLAY]); + + //init movieplayer submenu + CMenuWidget *movieplayer_menu = new CMenuWidget(LOCALE_MAINMENU_MOVIEPLAYER, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA_MOVIEPLAYER); + personalize->addWidget(movieplayer_menu); + personalize->addIntroItems(movieplayer_menu); + + //moviebrowser + CMenuForwarder *fw_mbrowser = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, this, "moviebrowser", CRCInput::RC_red); + fw_mbrowser->setHint(NEUTRINO_ICON_HINT_MB, LOCALE_MENU_HINT_MB); + personalize->addItem(movieplayer_menu, fw_mbrowser, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_MBROWSER]); + + //fileplayback + CMenuForwarder *fw_fileplay = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback", CRCInput::RC_green); + fw_fileplay->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY); + personalize->addItem(movieplayer_menu, fw_fileplay, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY]); + + //ytplayback + CMenuForwarder *fw_ytplay = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, g_settings.youtube_enabled, NULL, &CMoviePlayerGui::getInstance(), "ytplayback", CRCInput::RC_yellow); + fw_ytplay->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY); + personalize->addItem(movieplayer_menu, fw_ytplay, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_YTPLAY]); + + //add movieplayer submenu + CMenuForwarder *fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, enabled, NULL, movieplayer_menu, NULL, CRCInput::RC_yellow); + fw_mp->setHint(NEUTRINO_ICON_HINT_MOVIE, LOCALE_MENU_HINT_MOVIE); + personalize->addItem(multimedia_menu, fw_mp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_MPLAYER], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); + + //pictureviewer + CMenuForwarder *fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue); + fw_pviewer->setHint(NEUTRINO_ICON_HINT_PICVIEW, LOCALE_MENU_HINT_PICVIEW); + personalize->addItem(multimedia_menu, fw_pviewer, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_PVIEWER]); - //pictureviewer - pictureviewergui = new CPictureViewerGui(); - fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, pictureviewergui, NULL, CRCInput::RC_blue); - fw_pviewer->setHint(NEUTRINO_ICON_HINT_PICVIEW, LOCALE_MENU_HINT_PICVIEW); #if ENABLE_UPNP - //upnp browser - if (!upnpbrowsergui) - upnpbrowsergui = new CUpnpBrowserGui(); - fw_upnp = new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, enabled, NULL, upnpbrowsergui, NULL, CRCInput::RC_0); - fw_upnp->setHint(NEUTRINO_ICON_HINT_A_PIC, LOCALE_MENU_HINT_UPNP); + //upnp browser + static CUpnpBrowserGui *upnpbrowsergui = NULL; + if (!upnpbrowsergui) + upnpbrowsergui = new CUpnpBrowserGui(); + + CMenuForwarder *fw_upnp = new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, enabled, NULL, upnpbrowsergui, NULL, CRCInput::RC_0); + fw_upnp->setHint(NEUTRINO_ICON_HINT_A_PIC, LOCALE_MENU_HINT_UPNP); + personalize->addItem(multimedia_menu, fw_upnp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_UPNP]); #endif -// media->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, usage_mode == MODE_AUDIO ? CMenuWidget::BTN_TYPE_CANCEL : CMenuWidget::BTN_TYPE_BACK); - } - if (usage_mode == MODE_AUDIO) - { - //audio player - personalize->addItem(media, fw_audio, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_AUDIO]); - - //internet player - personalize->addItem(media, fw_inet, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_INETPLAY]); - } - else if (usage_mode == MODE_VIDEO) - { - showMoviePlayer(media, personalize); - } - else - { - //audio player - personalize->addItem(media, fw_audio, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_AUDIO]); - - //internet player - personalize->addItem(media, fw_inet, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_INETPLAY]); - - //movieplayer - if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) { - showMoviePlayer(moviePlayer, personalize); - personalize->addItem(media, fw_mp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_MPLAYER], false, CPersonalizeGui::PERSONALIZE_SHOW_AS_ACCESS_OPTION); - } - - //picture viewer - personalize->addItem(media, fw_pviewer, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_PVIEWER]); -#if ENABLE_UPNP - //upnp browser - personalize->addItem(media, fw_upnp, &g_settings.personalize[SNeutrinoSettings::P_MEDIA_UPNP]); -#endif - } - int res = menu_return::RETURN_NONE; if (show) @@ -240,57 +204,14 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p) personalize->addPersonalizedItems(); //add PLUGIN_INTEGRATION_MULTIMEDIA plugins - unsigned int nextShortcut = (unsigned int)media->getNextShortcut(); - media->integratePlugins(PLUGIN_INTEGRATION_MULTIMEDIA, nextShortcut, enabled); + unsigned int nextShortcut = (unsigned int)multimedia_menu->getNextShortcut(); + multimedia_menu->integratePlugins(PLUGIN_INTEGRATION_MULTIMEDIA, nextShortcut, enabled); - res = media->exec(NULL, ""); - delete media; - delete moviePlayer; + res = multimedia_menu->exec(NULL, ""); + + delete movieplayer_menu; + delete multimedia_menu; delete personalize; - delete pictureviewergui; -#if ENABLE_UPNP - //delete upnpbrowsergui; -#endif - - setUsageMode();//set default usage_mode } return res; } - -//show movieplayer submenu with selectable items for moviebrowser or filebrowser -void CMediaPlayerMenu::showMoviePlayer(CMenuWidget *moviePlayer, CPersonalizeGui *p) -{ - CMenuForwarder *fw_mbrowser = new CMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, true, NULL, this, "movieplayer", CRCInput::RC_red); - fw_mbrowser->setHint(NEUTRINO_ICON_HINT_MB, LOCALE_MENU_HINT_MB); - CMenuForwarder *fw_file = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback", CRCInput::RC_green); - fw_file->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY); - - p->addIntroItems(moviePlayer); - - //moviebrowser - p->addItem(moviePlayer, fw_mbrowser, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_MBROWSER]); - - //fileplayback - p->addItem(moviePlayer, fw_file, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY]); - - //ytplayback - CMenuForwarder *fw_yt = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, g_settings.youtube_enabled, NULL, &CMoviePlayerGui::getInstance(), "ytplayback", CRCInput::RC_yellow); - fw_yt->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY); - p->addItem(moviePlayer, fw_yt, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_YTPLAY]); - -// #if 0 -// //moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_PESPLAYBACK, true, NULL, moviePlayerGui, "pesplayback")); -// //moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_TSPLAYBACK_PC, true, NULL, moviePlayerGui, "tsplayback_pc")); -// moviePlayer->addItem(new CLockedMenuForwarder(LOCALE_MOVIEBROWSER_HEAD, g_settings.parentallock_pincode, false, true, NULL, moviePlayerGui, "tsmoviebrowser")); -// moviePlayer->addItem(new CLockedMenuForwarder(LOCALE_MOVIEPLAYER_TSPLAYBACK, g_settings.parentallock_pincode, false, true, NULL, moviePlayerGui, "tsplayback", CRCInput::RC_green)); -// -// moviePlayer->addItem(new CLockedMenuForwarder(LOCALE_MOVIEPLAYER_BOOKMARK, g_settings.parentallock_pincode, false, true, NULL, moviePlayerGui, "bookmarkplayback")); -// moviePlayer->addItem(GenericMenuSeparator); -// moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK, true, NULL, moviePlayerGui, "fileplayback", CRCInput::RC_red)); -// moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_DVDPLAYBACK, true, NULL, moviePlayerGui, "dvdplayback", CRCInput::RC_yellow)); -// moviePlayer->addItem(new CMenuForwarder(LOCALE_MOVIEPLAYER_VCDPLAYBACK, true, NULL, moviePlayerGui, "vcdplayback", CRCInput::RC_blue)); -// moviePlayer->addItem(GenericMenuSeparatorLine); -// moviePlayer->addItem(new CMenuForwarder(LOCALE_MAINMENU_SETTINGS, true, NULL, &streamingSettings, NULL, CRCInput::RC_help)); -// moviePlayer->addItem(new CMenuForwarder(LOCALE_NFSMENU_HEAD, true, NULL, new CNFSSmallMenu(), NULL, CRCInput::RC_setup)); -// #endif -} diff --git a/src/gui/mediaplayer.h b/src/gui/mediaplayer.h index e2b6710d7..1da9612e8 100644 --- a/src/gui/mediaplayer.h +++ b/src/gui/mediaplayer.h @@ -38,22 +38,12 @@ class CMediaPlayerMenu : public CMenuTarget { private: - int width, usage_mode; - neutrino_locale_t menu_title; + int width; CAudioPlayerGui *audioPlayer; CAudioPlayerGui *inetPlayer; - - void showMoviePlayer(CMenuWidget *menu_movieplayer, CPersonalizeGui *p); public: - enum MM_MENU_MODES - { - MODE_DEFAULT, - MODE_AUDIO, - MODE_VIDEO - }; - CMediaPlayerMenu(); ~CMediaPlayerMenu(); static CMediaPlayerMenu* getInstance(); @@ -61,8 +51,6 @@ class CMediaPlayerMenu : public CMenuTarget int initMenuMedia(CMenuWidget *m = NULL, CPersonalizeGui *p = NULL); int exec(CMenuTarget* parent, const std::string & actionKey); - void setMenuTitel(const neutrino_locale_t title = LOCALE_MAINMENU_MEDIA){menu_title = title;}; - void setUsageMode(const int& mm_mode = MODE_DEFAULT){usage_mode = mm_mode;}; CAudioPlayerGui *getPlayerInstance() { if (audioPlayer != NULL) return audioPlayer; else if (inetPlayer != NULL) return inetPlayer; else return NULL; } }; diff --git a/src/neutrino.cpp b/src/neutrino.cpp index 9e8279617..357f4732a 100644 --- a/src/neutrino.cpp +++ b/src/neutrino.cpp @@ -2944,19 +2944,10 @@ void CNeutrinoApp::RealRun() as.exec(NULL, "-1"); StartSubtitles(); } -#if 0 - else if( (msg == CRCInput::RC_audio) && g_settings.audio_run_player) { - //open mediaplayer menu in audio mode, user can select between audioplayer and internetradio - CMediaPlayerMenu * media = CMediaPlayerMenu::getInstance(); - media->setMenuTitel(LOCALE_MAINMENU_AUDIOPLAYER); - media->setUsageMode(CMediaPlayerMenu::MODE_AUDIO); - media->exec(NULL, ""); - } -#endif else if( msg == CRCInput::RC_video || msg == CRCInput::RC_play ) { //open moviebrowser via media player menu object if (g_settings.recording_type != CNeutrinoApp::RECORDING_OFF) - CMediaPlayerMenu::getInstance()->exec(NULL,"movieplayer"); + CMediaPlayerMenu::getInstance()->exec(NULL, "moviebrowser"); } else if( ( msg == CRCInput::RC_help ) || ( msg == CRCInput::RC_info) || ( msg == NeutrinoMessages::SHOW_INFOBAR ) ) diff --git a/src/system/locals.h b/src/system/locals.h index b02bd7b04..7a98b5966 100644 --- a/src/system/locals.h +++ b/src/system/locals.h @@ -506,7 +506,6 @@ typedef enum LOCALE_EVENTLISTBAR_EVENTSORT, LOCALE_EVENTLISTBAR_RECORDEVENT, LOCALE_EXTRA_ADD_TO_BOUQUET, - LOCALE_EXTRA_AUDIO_RUN_PLAYER, LOCALE_EXTRA_AUTO_DELETE, LOCALE_EXTRA_AUTO_TIMESHIFT, LOCALE_EXTRA_CACHE_TXT, diff --git a/src/system/locals_intern.h b/src/system/locals_intern.h index d16bbc337..2e4dd045c 100644 --- a/src/system/locals_intern.h +++ b/src/system/locals_intern.h @@ -506,7 +506,6 @@ const char * locale_real_names[] = "eventlistbar.eventsort", "eventlistbar.recordevent", "extra.add_to_bouquet", - "extra.audio_run_player", "extra.auto_delete", "extra.auto_timeshift", "extra.cache_txt",