* Various changes for reworked mute icon handling in some classes

- mute icon disabled for moviebrowser, upnpbrowser, pictureviewer
- extra handling for audioplayer
This commit is contained in:
Michael Liebmann
2013-05-13 04:30:36 +02:00
parent 1049b337bb
commit bf1c7bfdb7
9 changed files with 46 additions and 11 deletions

View File

@@ -36,6 +36,7 @@
#include <daemonc/remotecontrol.h> #include <daemonc/remotecontrol.h>
#include <driver/volume.h> #include <driver/volume.h>
#include <gui/audiomute.h> #include <gui/audiomute.h>
#include <gui/mediaplayer.h>
#include <zapit/zapit.h> #include <zapit/zapit.h>
@@ -117,6 +118,11 @@ void CVolume::setVolume(const neutrino_msg_t key, bool nowait)
volscale = NULL; volscale = NULL;
} }
CAudioMute::getInstance()->AudioMute(false, true); CAudioMute::getInstance()->AudioMute(false, true);
if (mode == CNeutrinoApp::mode_audio) {
CAudioPlayerGui *cap = CMediaPlayerMenu::getInstance()->getPlayerInstance();
if (cap != NULL)
cap->refreshMuteIcon();
}
setVolume(msg); setVolume(msg);
return; return;
} }
@@ -138,6 +144,11 @@ void CVolume::setVolume(const neutrino_msg_t key, bool nowait)
volscale = NULL; volscale = NULL;
} }
CAudioMute::getInstance()->AudioMute(true, true); CAudioMute::getInstance()->AudioMute(true, true);
if (mode == CNeutrinoApp::mode_audio) {
CAudioPlayerGui *cap = CMediaPlayerMenu::getInstance()->getPlayerInstance();
if (cap != NULL)
cap->refreshMuteIcon();
}
setVolume(msg); setVolume(msg);
return; return;
} }

View File

@@ -281,6 +281,8 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey)
m_fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight(); m_fheight = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getHeight();
int iw, ih; int iw, ih;
m_frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE, &iw, &ih);
m_theight = std::max(m_theight, ih+2);
m_frameBuffer->getIconSize(NEUTRINO_ICON_MP3, &iw, &ih); m_frameBuffer->getIconSize(NEUTRINO_ICON_MP3, &iw, &ih);
m_theight = std::max(m_theight, ih+4); m_theight = std::max(m_theight, ih+4);
@@ -899,6 +901,9 @@ int CAudioPlayerGui::show()
ret = menu_return::RETURN_EXIT_ALL; ret = menu_return::RETURN_EXIT_ALL;
loop = false; loop = false;
} }
// update mute icon
paintHead();
paintLCD();
} }
} }
hide(); hide();
@@ -1667,6 +1672,11 @@ void CAudioPlayerGui::paintHead()
} }
//m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, m_x + m_width - 30, ypos); //m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MENU, m_x + m_width - 30, ypos);
#endif #endif
if ( CNeutrinoApp::getInstance()->isMuted() )
{
m_frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_MUTE, &iw, &ih);
m_frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MUTE, xpos - iw, ypos, m_theight);
}
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@@ -261,6 +261,7 @@ class CAudioPlayerGui : public CMenuTarget
bool playNext(bool allow_rotate = false); bool playNext(bool allow_rotate = false);
bool playPrev(bool allow_rotate = false); bool playPrev(bool allow_rotate = false);
int getAudioPlayerM_current() {return m_current;} int getAudioPlayerM_current() {return m_current;}
void refreshMuteIcon() { paintHead(); }
}; };

View File

@@ -38,6 +38,7 @@
#include <neutrino_menue.h> #include <neutrino_menue.h>
#include <neutrinoMessages.h> #include <neutrinoMessages.h>
#include <gui/audiomute.h>
#include <gui/movieplayer.h> #include <gui/movieplayer.h>
#include <gui/pictureviewer.h> #include <gui/pictureviewer.h>
#if ENABLE_UPNP #if ENABLE_UPNP
@@ -87,30 +88,35 @@ int CMediaPlayerMenu::exec(CMenuTarget* parent, const std::string &actionKey)
if (parent) if (parent)
parent->hide(); parent->hide();
CAudioMute *audiomute = CAudioMute::getInstance();
if (actionKey == "audioplayer") if (actionKey == "audioplayer")
{ {
audiomute->enableMuteIcon(false);
if (audioPlayer == NULL) if (audioPlayer == NULL)
audioPlayer = new CAudioPlayerGui(); audioPlayer = new CAudioPlayerGui();
int res = audioPlayer->exec(NULL, "init"); int res = audioPlayer->exec(NULL, "init");
audiomute->enableMuteIcon(true);
return res /*menu_return::RETURN_REPAINT*/; return res /*menu_return::RETURN_REPAINT*/;
} }
else if (actionKey == "inetplayer") else if (actionKey == "inetplayer")
{ {
audiomute->enableMuteIcon(false);
if (inetPlayer == NULL) if (inetPlayer == NULL)
inetPlayer = new CAudioPlayerGui(true); inetPlayer = new CAudioPlayerGui(true);
int res = inetPlayer->exec(NULL, "init"); int res = inetPlayer->exec(NULL, "init");
audiomute->enableMuteIcon(true);
return res; //menu_return::RETURN_REPAINT; return res; //menu_return::RETURN_REPAINT;
} }
else if (actionKey == "movieplayer") else if (actionKey == "movieplayer")
{ {
audiomute->enableMuteIcon(false);
int mode = CNeutrinoApp::getInstance()->getMode(); int mode = CNeutrinoApp::getInstance()->getMode();
if( mode == NeutrinoMessages::mode_radio ) if( mode == NeutrinoMessages::mode_radio )
videoDecoder->StopPicture(); videoDecoder->StopPicture();
int res = CMoviePlayerGui::getInstance().exec(NULL, "tsmoviebrowser"); int res = CMoviePlayerGui::getInstance().exec(NULL, "tsmoviebrowser");
if( mode == NeutrinoMessages::mode_radio ) if( mode == NeutrinoMessages::mode_radio )
videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg"); videoDecoder->ShowPicture(DATADIR "/neutrino/icons/radiomode.jpg");
audiomute->enableMuteIcon(true);
return res; return res;
} }

View File

@@ -63,6 +63,7 @@ class CMediaPlayerMenu : public CMenuTarget
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
void setMenuTitel(const neutrino_locale_t title = LOCALE_MAINMENU_MEDIA){menu_title = title;}; 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;}; 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; }
}; };

View File

@@ -30,6 +30,7 @@
#include <global.h> #include <global.h>
#include <neutrino.h> #include <neutrino.h>
#include <gui/audiomute.h>
#include <gui/movieplayer.h> #include <gui/movieplayer.h>
#include <gui/infoviewer.h> #include <gui/infoviewer.h>
#include <gui/timeosd.h> #include <gui/timeosd.h>
@@ -484,6 +485,8 @@ void CMoviePlayerGui::PlayFile(void)
} }
} }
CAudioMute::getInstance()->enableMuteIcon(true);
while (playstate >= CMoviePlayerGui::PLAY) while (playstate >= CMoviePlayerGui::PLAY)
{ {
if (update_lcd) { if (update_lcd) {
@@ -717,6 +720,8 @@ void CMoviePlayerGui::PlayFile(void)
restoreNeutrino(); restoreNeutrino();
CAudioMute::getInstance()->enableMuteIcon(false);
if (g_settings.mode_clock) if (g_settings.mode_clock)
InfoClock->StartClock(); InfoClock->StartClock();
} }

View File

@@ -44,6 +44,7 @@
#include <driver/fontrenderer.h> #include <driver/fontrenderer.h>
#include <driver/rcinput.h> #include <driver/rcinput.h>
#include <gui/audiomute.h>
#include <gui/nfs.h> #include <gui/nfs.h>
#include <gui/widget/buttons.h> #include <gui/widget/buttons.h>
@@ -238,6 +239,8 @@ int CPictureViewerGui::show()
if (audioplayer) if (audioplayer)
m_currentTitle = m_audioPlayer->getAudioPlayerM_current(); m_currentTitle = m_audioPlayer->getAudioPlayerM_current();
CAudioMute::getInstance()->enableMuteIcon(false);
while (loop) while (loop)
{ {
if (update) if (update)
@@ -618,6 +621,8 @@ int CPictureViewerGui::show()
} }
hide(); hide();
CAudioMute::getInstance()->enableMuteIcon(true);
return(res); return(res);
} }

View File

@@ -52,6 +52,7 @@
#include <daemonc/remotecontrol.h> #include <daemonc/remotecontrol.h>
#include <gui/audiomute.h>
#include <gui/eventlist.h> #include <gui/eventlist.h>
#include <gui/color.h> #include <gui/color.h>
#include <gui/infoviewer.h> #include <gui/infoviewer.h>
@@ -396,6 +397,8 @@ void CUpnpBrowserGui::selectDevice()
return; return;
} }
CAudioMute::getInstance()->enableMuteIcon(false);
while (loop) while (loop)
{ {
if (changed) if (changed)
@@ -488,6 +491,8 @@ void CUpnpBrowserGui::selectDevice()
} }
} }
delete scanBox; delete scanBox;
CAudioMute::getInstance()->enableMuteIcon(true);
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@@ -2047,9 +2047,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
//if(!g_settings.cacheTXT) //if(!g_settings.cacheTXT)
// tuxtxt_stop(); // tuxtxt_stop();
g_RCInput->clearRCMsg(); g_RCInput->clearRCMsg();
// restore mute symbol
if (current_muted)
g_audioMute->AudioMute(current_muted, true);
if(g_settings.mode_clock) if(g_settings.mode_clock)
InfoClock->StartClock(); InfoClock->StartClock();
StartSubtitles(); StartSubtitles();
@@ -2060,9 +2057,6 @@ void CNeutrinoApp::RealRun(CMenuWidget &mainMenu)
if(g_settings.mode_clock) if(g_settings.mode_clock)
InfoClock->StopClock(); InfoClock->StopClock();
mainMenu.exec(NULL, ""); mainMenu.exec(NULL, "");
// restore mute symbol
if (current_muted)
g_audioMute->AudioMute(current_muted, true);
if(g_settings.mode_clock) if(g_settings.mode_clock)
InfoClock->StartClock(); InfoClock->StartClock();
StartSubtitles(); StartSubtitles();
@@ -2381,9 +2375,6 @@ _show:
nNewChannel = bouquetList->Bouquets[old_b]->channelList->exec();//with ZAP! nNewChannel = bouquetList->Bouquets[old_b]->channelList->exec();//with ZAP!
else else
nNewChannel = bouquetList->exec(true); nNewChannel = bouquetList->exec(true);
// restore mute symbol
if (current_muted)
g_audioMute->AudioMute(current_muted, true);
} else if(msg == CRCInput::RC_sat) { } else if(msg == CRCInput::RC_sat) {
SetChannelMode(LIST_MODE_SAT); SetChannelMode(LIST_MODE_SAT);
nNewChannel = bouquetList->exec(true); nNewChannel = bouquetList->exec(true);