From 932de4c110c5d66a588b4aad5672e8ae04cbce79 Mon Sep 17 00:00:00 2001 From: Stefan Seyfried Date: Fri, 4 Mar 2011 18:58:08 +0000 Subject: [PATCH] neutrino: add MODE_VIDEO to CMediaPlayerMenu::showMenu() This allows to create a "movieplayer shortcut" key. Additionally, this probably fixes some memory leaks. git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1243 e54a6e83-5905-42d5-8d5c-058d10e6a962 Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/5e31ebc2f2172610c157d19a86546a3f7d4cca41 Author: Stefan Seyfried Date: 2011-03-04 (Fri, 04 Mar 2011) --- src/gui/mediaplayer.cpp | 59 ++++++++++++++++++++++++++--------------- src/gui/mediaplayer.h | 1 + 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index ab60de663..9966ab875 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -110,32 +110,45 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) //show selectable mediaplayer items void CMediaPlayerMenu::showMenu() { - //menue init CMenuWidget *media = new CMenuWidget(menu_title, NEUTRINO_ICON_MULTIMEDIA, width); - media->setSelected(selected); - - //audio player - neutrino_msg_t audio_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_audio:CRCInput::RC_red; - const char* audio_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_RED; - CMenuForwarder * fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, true, NULL, this, "audioplayer", audio_rc, audio_btn); - //internet player - neutrino_msg_t inet_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_www : CRCInput::RC_green; - const char* inet_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_GREEN; - CMenuForwarder * fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, this, "inetplayer", inet_rc, inet_btn); + CMenuForwarder *fw_audio = NULL; + CMenuForwarder *fw_inet = NULL; + CMenuForwarder *fw_mp = NULL; + CMenuForwarder *fw_pviewer = NULL; + CMenuForwarder *fw_upnp = NULL; + CMenuWidget *moviePlayer = NULL; - //movieplayer - CMenuWidget *moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width); - CMenuForwarder * fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, moviePlayer, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); - - //pictureviewer - CMenuForwarder * fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + if (usage_mode != MODE_VIDEO) + { + //menue init + media->setSelected(selected); - //upnp browser - CMenuForwarder * fw_upnp = new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, true, NULL, new CUpnpBrowserGui(), NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0); + //audio player + neutrino_msg_t audio_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_audio:CRCInput::RC_red; + const char* audio_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_RED; + fw_audio = new CMenuForwarder(LOCALE_MAINMENU_AUDIOPLAYER, true, NULL, this, "audioplayer", audio_rc, audio_btn); + //internet player + neutrino_msg_t inet_rc = usage_mode == MODE_AUDIO ? CRCInput::RC_www : CRCInput::RC_green; + const char* inet_btn = usage_mode == MODE_AUDIO ? "" : NEUTRINO_ICON_BUTTON_GREEN; + fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, this, "inetplayer", inet_rc, inet_btn); + } + + if (usage_mode == MODE_DEFAULT) + { + //movieplayer + moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width); + fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MOVIEPLAYER, true, NULL, moviePlayer, NULL, CRCInput::RC_yellow, NEUTRINO_ICON_BUTTON_YELLOW); + + //pictureviewer + fw_pviewer = new CMenuForwarder(LOCALE_MAINMENU_PICTUREVIEWER, true, NULL, new CPictureViewerGui(), NULL, CRCInput::RC_blue, NEUTRINO_ICON_BUTTON_BLUE); + + //upnp browser + fw_upnp = new CMenuForwarder(LOCALE_UPNPBROWSER_HEAD, true, NULL, new CUpnpBrowserGui(), NULL, CRCInput::RC_0, NEUTRINO_ICON_BUTTON_0); + + media->addIntroItems(NONEXISTANT_LOCALE, NONEXISTANT_LOCALE, usage_mode == MODE_AUDIO ? CMenuWidget::BTN_TYPE_CANCEL : CMenuWidget::BTN_TYPE_BACK); + } - 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 @@ -144,6 +157,10 @@ void CMediaPlayerMenu::showMenu() //internet player media->addItem(fw_inet); } + else if (usage_mode == MODE_VIDEO) + { + showMoviePlayer(media); + } else { //audio player diff --git a/src/gui/mediaplayer.h b/src/gui/mediaplayer.h index 605684086..b691cae9c 100644 --- a/src/gui/mediaplayer.h +++ b/src/gui/mediaplayer.h @@ -51,6 +51,7 @@ class CMediaPlayerMenu : public CMenuTarget { MODE_DEFAULT, MODE_AUDIO, + MODE_VIDEO }; CMediaPlayerMenu();