mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 23:13:13 +02:00
- mediaplayer: formatting code using astyle
Signed-off-by: Thilo Graf <dbt@novatux.de>
This commit is contained in:
@@ -52,22 +52,23 @@
|
||||
|
||||
#include <system/debug.h>
|
||||
#include <hardware/video.h>
|
||||
extern cVideo * videoDecoder;
|
||||
extern cVideo *videoDecoder;
|
||||
|
||||
|
||||
CMediaPlayerMenu::CMediaPlayerMenu()
|
||||
{
|
||||
width = 40;
|
||||
|
||||
audioPlayer = NULL;
|
||||
inetPlayer = NULL;
|
||||
|
||||
audioPlayer = NULL;
|
||||
inetPlayer = NULL;
|
||||
}
|
||||
|
||||
CMediaPlayerMenu* CMediaPlayerMenu::getInstance()
|
||||
CMediaPlayerMenu *CMediaPlayerMenu::getInstance()
|
||||
{
|
||||
static CMediaPlayerMenu* mpm = NULL;
|
||||
static CMediaPlayerMenu *mpm = NULL;
|
||||
|
||||
if(!mpm) {
|
||||
if (!mpm)
|
||||
{
|
||||
mpm = new CMediaPlayerMenu();
|
||||
printf("[neutrino] mediaplayer menu instance created\n");
|
||||
}
|
||||
@@ -76,119 +77,119 @@ CMediaPlayerMenu* CMediaPlayerMenu::getInstance()
|
||||
|
||||
CMediaPlayerMenu::~CMediaPlayerMenu()
|
||||
{
|
||||
delete audioPlayer ;
|
||||
delete inetPlayer ;
|
||||
delete audioPlayer;
|
||||
delete inetPlayer;
|
||||
}
|
||||
|
||||
int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey)
|
||||
int CMediaPlayerMenu::exec(CMenuTarget *parent, const std::string &actionKey)
|
||||
{
|
||||
if (parent)
|
||||
parent->hide();
|
||||
|
||||
|
||||
CAudioMute *audiomute = CAudioMute::getInstance();
|
||||
if (actionKey == "audioplayer")
|
||||
{
|
||||
if (audioPlayer == NULL)
|
||||
audioPlayer = new CAudioPlayerGui();
|
||||
int res = audioPlayer->exec(NULL, "init");
|
||||
return res /*menu_return::RETURN_REPAINT*/;
|
||||
return res;
|
||||
}
|
||||
else if (actionKey == "inetplayer")
|
||||
{
|
||||
if (inetPlayer == NULL)
|
||||
inetPlayer = new CAudioPlayerGui(true);
|
||||
int res = inetPlayer->exec(NULL, "init");
|
||||
return res; //menu_return::RETURN_REPAINT;
|
||||
return res;
|
||||
}
|
||||
else if (actionKey == "moviebrowser")
|
||||
{
|
||||
audiomute->enableMuteIcon(false);
|
||||
CInfoClock::getInstance()->enableInfoClock(false);
|
||||
int mode = CNeutrinoApp::getInstance()->getMode();
|
||||
if( mode == NeutrinoModes::mode_radio )
|
||||
if (mode == NeutrinoModes::mode_radio)
|
||||
CFrameBuffer::getInstance()->stopFrame();
|
||||
int res = CMoviePlayerGui::getInstance().exec(NULL, "tsmoviebrowser");
|
||||
if( mode == NeutrinoModes::mode_radio )
|
||||
if (mode == NeutrinoModes::mode_radio)
|
||||
CFrameBuffer::getInstance()->showFrame("radiomode.jpg");
|
||||
audiomute->enableMuteIcon(true);
|
||||
CInfoClock::getInstance()->enableInfoClock(true);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int res = initMenuMedia();
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//show selectable mediaplayer items
|
||||
// show selectable mediaplayer items
|
||||
int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p)
|
||||
{
|
||||
{
|
||||
CPersonalizeGui *personalize = p;
|
||||
CMenuWidget *multimedia_menu = m;
|
||||
|
||||
|
||||
bool show = (personalize == NULL || multimedia_menu == NULL);
|
||||
|
||||
if (personalize == NULL)
|
||||
personalize = new CPersonalizeGui();
|
||||
|
||||
personalize = new CPersonalizeGui();
|
||||
|
||||
if (multimedia_menu == NULL)
|
||||
multimedia_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA);
|
||||
multimedia_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIA, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA);
|
||||
|
||||
personalize->addWidget(multimedia_menu);
|
||||
personalize->addIntroItems(multimedia_menu);
|
||||
|
||||
|
||||
bool enabled = !CMoviePlayerGui::getInstance().Playing();
|
||||
|
||||
//audio player
|
||||
// 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]);
|
||||
|
||||
//internet player
|
||||
// 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_MEDIAPLAYER, NEUTRINO_ICON_MULTIMEDIA, width, MN_WIDGET_ID_MEDIA_MOVIEPLAYER);
|
||||
personalize->addWidget(movieplayer_menu);
|
||||
personalize->addIntroItems(movieplayer_menu);
|
||||
// init movieplayer submenu
|
||||
CMenuWidget *movieplayer_menu = new CMenuWidget(LOCALE_MAINMENU_MEDIAPLAYER, 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]);
|
||||
// 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 video
|
||||
CMenuForwarder *fw_fileplay_video = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_VIDEO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_video", CRCInput::RC_green);
|
||||
fw_fileplay_video->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_VIDEO);
|
||||
personalize->addItem(movieplayer_menu, fw_fileplay_video, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_VIDEO]);
|
||||
// fileplayback video
|
||||
CMenuForwarder *fw_fileplay_video = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_VIDEO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_video", CRCInput::RC_green);
|
||||
fw_fileplay_video->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_VIDEO);
|
||||
personalize->addItem(movieplayer_menu, fw_fileplay_video, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_VIDEO]);
|
||||
|
||||
#if !HAVE_CST_HARDWARE
|
||||
//fileplayback audio
|
||||
CMenuForwarder *fw_fileplay_audio = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_AUDIO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_audio", CRCInput::RC_yellow);
|
||||
fw_fileplay_audio->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_AUDIO);
|
||||
personalize->addItem(movieplayer_menu, fw_fileplay_audio, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_AUDIO]);
|
||||
// fileplayback audio
|
||||
CMenuForwarder *fw_fileplay_audio = new CMenuForwarder(LOCALE_MOVIEPLAYER_FILEPLAYBACK_AUDIO, true, NULL, &CMoviePlayerGui::getInstance(), "fileplayback_audio", CRCInput::RC_yellow);
|
||||
fw_fileplay_audio->setHint(NEUTRINO_ICON_HINT_FILEPLAY, LOCALE_MENU_HINT_FILEPLAY_AUDIO);
|
||||
personalize->addItem(movieplayer_menu, fw_fileplay_audio, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_FILEPLAY_AUDIO]);
|
||||
#endif
|
||||
|
||||
#if ENABLE_YOUTUBE_PLAYER
|
||||
//ytplayback
|
||||
CMenuForwarder *fw_ytplay = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, g_settings.youtube_enabled, NULL, &CMoviePlayerGui::getInstance(), "ytplayback", CRCInput::RC_blue);
|
||||
fw_ytplay->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY);
|
||||
personalize->addItem(movieplayer_menu, fw_ytplay, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_YTPLAY]);
|
||||
// ytplayback
|
||||
CMenuForwarder *fw_ytplay = new CMenuForwarder(LOCALE_MOVIEPLAYER_YTPLAYBACK, g_settings.youtube_enabled, NULL, &CMoviePlayerGui::getInstance(), "ytplayback", CRCInput::RC_blue);
|
||||
fw_ytplay->setHint(NEUTRINO_ICON_HINT_YTPLAY, LOCALE_MENU_HINT_YTPLAY);
|
||||
personalize->addItem(movieplayer_menu, fw_ytplay, &g_settings.personalize[SNeutrinoSettings::P_MPLAYER_YTPLAY]);
|
||||
#endif
|
||||
//add movieplayer submenu
|
||||
// add movieplayer submenu
|
||||
CMenuForwarder *fw_mp = new CMenuForwarder(LOCALE_MAINMENU_MEDIAPLAYER, 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
|
||||
// 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]);
|
||||
|
||||
#if ENABLE_UPNP
|
||||
//upnp browser
|
||||
// upnp browser
|
||||
static CUpnpBrowserGui *upnpbrowsergui = NULL;
|
||||
if (!upnpbrowsergui)
|
||||
upnpbrowsergui = new CUpnpBrowserGui();
|
||||
@@ -199,13 +200,13 @@ int CMediaPlayerMenu::initMenuMedia(CMenuWidget *m, CPersonalizeGui *p)
|
||||
#endif
|
||||
|
||||
int res = menu_return::RETURN_NONE;
|
||||
|
||||
|
||||
if (show)
|
||||
{
|
||||
//adding personalized items
|
||||
// adding personalized items
|
||||
personalize->addPersonalizedItems();
|
||||
|
||||
//add PLUGIN_INTEGRATION_MULTIMEDIA plugins
|
||||
|
||||
// add PLUGIN_INTEGRATION_MULTIMEDIA plugins
|
||||
unsigned int nextShortcut = (unsigned int)multimedia_menu->getNextShortcut();
|
||||
multimedia_menu->integratePlugins(PLUGIN_INTEGRATION_MULTIMEDIA, nextShortcut, enabled);
|
||||
|
||||
|
@@ -39,20 +39,19 @@ class CMediaPlayerMenu : public CMenuTarget
|
||||
{
|
||||
private:
|
||||
int width;
|
||||
|
||||
|
||||
CAudioPlayerGui *audioPlayer;
|
||||
CAudioPlayerGui *inetPlayer;
|
||||
|
||||
public:
|
||||
public:
|
||||
CMediaPlayerMenu();
|
||||
~CMediaPlayerMenu();
|
||||
static CMediaPlayerMenu* getInstance();
|
||||
|
||||
static CMediaPlayerMenu *getInstance();
|
||||
|
||||
int initMenuMedia(CMenuWidget *m = NULL, CPersonalizeGui *p = NULL);
|
||||
|
||||
int exec(CMenuTarget* parent, const std::string & actionKey);
|
||||
|
||||
int exec(CMenuTarget *parent, const std::string &actionKey);
|
||||
CAudioPlayerGui *getPlayerInstance() { if (audioPlayer != NULL) return audioPlayer; else if (inetPlayer != NULL) return inetPlayer; else return NULL; }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user