From e61353a7289e48a24972a1cfa15bfa0174e4dc2d Mon Sep 17 00:00:00 2001 From: vanhofen Date: Wed, 20 Oct 2021 19:31:13 +0200 Subject: [PATCH] mediaplayer: formatting code using astyle Origin commit data ------------------ Commit: https://github.com/neutrino-images/ni-neutrino/commit/f1650062087470d5d777122e2cb38a3cf46acfeb Author: vanhofen Date: 2021-10-20 (Wed, 20 Oct 2021) Origin message was: ------------------ - mediaplayer: formatting code using astyle --- src/gui/mediaplayer.cpp | 107 ++++++++++++++++++++-------------------- src/gui/mediaplayer.h | 13 +++-- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/src/gui/mediaplayer.cpp b/src/gui/mediaplayer.cpp index 766e45c76..582c2fdd2 100644 --- a/src/gui/mediaplayer.cpp +++ b/src/gui/mediaplayer.cpp @@ -52,7 +52,7 @@ #include #include -extern cVideo * videoDecoder; +extern cVideo *videoDecoder; //NI InfoIcons @@ -61,16 +61,17 @@ 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"); } @@ -79,29 +80,29 @@ 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") { @@ -109,91 +110,91 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey) CInfoClock::getInstance()->enableInfoClock(false); CInfoIcons::getInstance()->enableInfoIcons(false); //NI InfoIcons 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); CInfoIcons::getInstance()->enableInfoIcons(true); //NI InfoIcons 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(); @@ -204,13 +205,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); diff --git a/src/gui/mediaplayer.h b/src/gui/mediaplayer.h index 11ff58e67..3b05e9b8c 100644 --- a/src/gui/mediaplayer.h +++ b/src/gui/mediaplayer.h @@ -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