diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index fba14d67e..28f812f08 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -242,8 +242,12 @@ CAudioPlayerGui::~CAudioPlayerGui() } //------------------------------------------------------------------------ -int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &) +int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) { + + if (actionKey == "init") + Init(); + CNeutrinoApp::getInstance()->StopSubtitles(); CAudioPlayer::getInstance()->init(); diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index 08a1d8da1..25d804377 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -36,7 +36,7 @@ #include #include -#include "gui/audioplayer.h" + #include "gui/movieplayer.h" #include "gui/pictureviewer.h" #include "gui/upnpbrowser.h" @@ -48,7 +48,6 @@ #include - CMediaPlayerMenu::CMediaPlayerMenu() { frameBuffer = CFrameBuffer::getInstance(); @@ -64,6 +63,9 @@ CMediaPlayerMenu::CMediaPlayerMenu() x = getScreenStartX (width); y = getScreenStartY (height); + + audioPlayer = NULL; + inetPlayer = NULL; } CMediaPlayerMenu* CMediaPlayerMenu::getInstance() @@ -79,10 +81,11 @@ CMediaPlayerMenu* CMediaPlayerMenu::getInstance() CMediaPlayerMenu::~CMediaPlayerMenu() { - + delete audioPlayer ; + delete inetPlayer ; } -int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &/*actionKey*/) +int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) { printf("init mediaplayer menu in usage mode %d\n", usage_mode); int res = menu_return::RETURN_REPAINT; @@ -90,6 +93,23 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &/*actionKey*/ if (parent) parent->hide(); + if (actionKey == "audioplayer") + { + if (audioPlayer == NULL) + audioPlayer = new CAudioPlayerGui(); + audioPlayer->exec(NULL, "init"); + + return res; + } + else if (actionKey == "inetplayer") + { + if (inetPlayer == NULL) + inetPlayer = new CAudioPlayerGui(true); + inetPlayer->exec(NULL, "init"); + + return res; + } + showMenu(); return res; @@ -110,12 +130,12 @@ void CMediaPlayerMenu::showMenu() //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, new CAudioPlayerGui(), NULL, audio_rc, audio_btn); + 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, new CAudioPlayerGui(true), NULL, inet_rc, inet_btn); + CMenuForwarder * fw_inet = new CMenuForwarder(LOCALE_INETRADIO_NAME, true, NULL, this, "inetplayer", inet_rc, inet_btn); //movieplayer CMenuWidget *moviePlayer = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width); diff --git a/src/gui/mediaplayer.h b/src/gui/mediaplayer.h index 2a491b2e7..7d2f8d92c 100644 --- a/src/gui/mediaplayer.h +++ b/src/gui/mediaplayer.h @@ -30,7 +30,7 @@ #define __MEDIAPLAYER__ #include - +#include "gui/audioplayer.h" #include #include @@ -39,6 +39,8 @@ class CMediaPlayerMenu : public CMenuTarget { private: CFrameBuffer *frameBuffer; + CAudioPlayerGui *audioPlayer; + CAudioPlayerGui *inetPlayer; int x, y, width, height, hheight, mheight, selected, usage_mode; neutrino_locale_t menu_title;