From e145f9a5e84f3958be6033daa43afdb5d37b8a75 Mon Sep 17 00:00:00 2001 From: snafed Date: Tue, 6 Nov 2012 23:04:55 +0100 Subject: [PATCH] - add pictureviewer to info-key in audioplayer --- src/gui/audioplayer.cpp | 83 ++++++++++++++++++++++++++++----------- src/gui/audioplayer.h | 4 ++ src/gui/pictureviewer.cpp | 33 ++++++++++------ src/gui/pictureviewer.h | 5 +++ 4 files changed, 92 insertions(+), 33 deletions(-) diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index ffc80f4ae..c7e82d9ba 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -65,6 +65,8 @@ #include #include +#include "gui/pictureviewer.h" + #include #include #include @@ -198,6 +200,8 @@ void CAudioPlayerGui::Init(void) m_selected = 0; m_metainfo.clear(); + pictureviewer = false; + m_select_title_by_name = g_settings.audioplayer_select_title_by_name==1; if (strlen(g_settings.network_nfs_audioplayerdir)!=0) @@ -753,6 +757,22 @@ int CAudioPlayerGui::show() } } } + else if ( (msg == CRCInput::RC_info) && (!m_playlist.empty()) ) + { + pictureviewer = true; + m_frameBuffer->Clear(); + videoDecoder->StopPicture(); + CPictureViewerGui * picture = new CPictureViewerGui(); + picture->m_audioPlayer = this; + picture->exec(this, "audio"); + delete picture; + pictureviewer = false; + videoDecoder->setBlank(true); + videoDecoder->ShowPicture(DATADIR "/neutrino/icons/mp3.jpg"); + CVFD::getInstance()->setMode(CVFD::MODE_AUDIO); + paintLCD(); + screensaver(false); + } else if (msg == CRCInput::RC_help) { if (m_key_level == 2) @@ -904,6 +924,17 @@ bool CAudioPlayerGui::playNext(bool allow_rotate) return(result); } +void CAudioPlayerGui::wantNextPlay() +{ + if ((m_state != CAudioPlayerGui::STOP) && + (CAudioPlayer::getInstance()->getState() == CBaseDec::STOP) && + (!m_playlist.empty())) + { + if (m_curr_audiofile.FileType != CFile::STREAM_AUDIO) + playNext(); + } +} + bool CAudioPlayerGui::playPrev(bool allow_rotate) { bool result = false; @@ -1698,10 +1729,11 @@ const struct button_label AudioPlayerButtons[][4] = void CAudioPlayerGui::paintFoot() { // printf("paintFoot{\n"); -const struct button_label ScondLineButtons[2] = +const struct button_label ScondLineButtons[3] = { { NEUTRINO_ICON_BUTTON_OKAY , LOCALE_AUDIOPLAYER_PLAY }, { NEUTRINO_ICON_BUTTON_HELP , LOCALE_AUDIOPLAYER_KEYLEVEL }, + { NEUTRINO_ICON_BUTTON_INFO , LOCALE_PICTUREVIEWER_HEAD}, }; int top; @@ -1717,8 +1749,7 @@ const struct button_label ScondLineButtons[2] = m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_1); if (!m_playlist.empty()) - ::paintButtons(m_x, top+m_buttonHeight, m_width, 2, ScondLineButtons, m_buttonHeight, ButtonWidth); - + ::paintButtons(m_x, top+m_buttonHeight, m_width, 3, ScondLineButtons, m_buttonHeight, ButtonWidth); if (m_key_level == 0) { @@ -1943,12 +1974,16 @@ void CAudioPlayerGui::stop() { m_state = CAudioPlayerGui::STOP; m_current = 0; - //LCD - paintLCD(); - //Display - paintInfo(); - m_key_level = 0; - paintFoot(); + + if (!pictureviewer) + { + //LCD + paintLCD(); + //Display + paintInfo(); + m_key_level = 0; + paintFoot(); + } if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) CAudioPlayer::getInstance()->stop(); @@ -2022,31 +2057,31 @@ void CAudioPlayerGui::play(unsigned int pos) if (m_selected - m_liststart >= m_listmaxshow && g_settings.audioplayer_follow) { m_liststart = m_selected; - if (!m_screensaver) + if (!m_screensaver && !pictureviewer) paint(); } else if (m_liststart < m_selected && g_settings.audioplayer_follow) { m_liststart = m_selected - m_listmaxshow + 1; - if (!m_screensaver) + if (!m_screensaver && !pictureviewer) paint(); } else { if (old_current >= m_liststart && old_current - m_liststart < m_listmaxshow) { - if (!m_screensaver) + if (!m_screensaver && !pictureviewer) paintItem(old_current - m_liststart); } if (pos >= m_liststart && pos - m_liststart < m_listmaxshow) { - if (!m_screensaver) + if (!m_screensaver && !pictureviewer) paintItem(pos - m_liststart); } if (g_settings.audioplayer_follow) { if (old_selected >= m_liststart && old_selected - m_liststart < m_listmaxshow) - if (!m_screensaver) + if (!m_screensaver && !pictureviewer) paintItem(old_selected - m_liststart); } } @@ -2065,14 +2100,18 @@ void CAudioPlayerGui::play(unsigned int pos) m_curr_audiofile = m_playlist[m_current]; // Play CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1); - //LCD - paintLCD(); - // Display - if (!m_screensaver) - paintInfo(); - m_key_level = 1; - if (!m_screensaver) - paintFoot(); + + if (!pictureviewer) + { + //LCD + paintLCD(); + // Display + if (!m_screensaver) + paintInfo(); + m_key_level = 1; + if (!m_screensaver) + paintFoot(); + } } //------------------------------------------------------------------------ diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index 92ff2a2bb..6a73378e3 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -251,11 +251,15 @@ class CAudioPlayerGui : public CMenuTarget bool playNext(bool allow_rotate = false); bool playPrev(bool allow_rotate = false); + bool pictureviewer; + public: CAudioPlayerGui(bool inetmode = false); ~CAudioPlayerGui(); int show(); int exec(CMenuTarget* parent, const std::string & actionKey); + + void wantNextPlay(); }; diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index 4d2d1586c..3165df49b 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -112,8 +112,12 @@ CPictureViewerGui::~CPictureViewerGui() } //------------------------------------------------------------------------ -int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey*/) +int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & actionKey) { + audioplayer = false; + if (actionKey == "audio") + audioplayer = true; + selected = 0; width = w_max (710, 0); height = h_max (570, 0); @@ -159,14 +163,16 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey // remember last mode m_LastMode=(CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap); - //g_Zapit->setStandby(true); - g_Zapit->lockPlayBack(); + if (!audioplayer) { // !!! why? !!! + //g_Zapit->setStandby(true); + g_Zapit->lockPlayBack(); - // blank background screen - videoDecoder->setBlank(true); + // blank background screen + videoDecoder->setBlank(true); - // Stop Sectionsd - g_Sectionsd->setPauseScanning(true); + // Stop Sectionsd + g_Sectionsd->setPauseScanning(true); + } // Save and Clear background bool usedBackground = frameBuffer->getuseBackground(); @@ -180,11 +186,13 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey // free picviewer mem m_viewer->Cleanup(); - //g_Zapit->setStandby(false); - g_Zapit->unlockPlayBack(); + if (!audioplayer) { // !!! why? !!! + //g_Zapit->setStandby(false); + g_Zapit->unlockPlayBack(); - // Start Sectionsd - g_Sectionsd->setPauseScanning(false); + // Start Sectionsd + g_Sectionsd->setPauseScanning(false); + } // Restore previous background if (usedBackground) { @@ -226,6 +234,9 @@ int CPictureViewerGui::show() paint(); } + if (audioplayer) + m_audioPlayer->wantNextPlay(); + if (m_state!=SLIDESHOW) timeout=50; // egal else diff --git a/src/gui/pictureviewer.h b/src/gui/pictureviewer.h index 2a72c7728..0909d6ef4 100644 --- a/src/gui/pictureviewer.h +++ b/src/gui/pictureviewer.h @@ -37,6 +37,7 @@ #include #include #include +#include #include @@ -109,10 +110,14 @@ class CPictureViewerGui : public CMenuTarget void showHelp(); void deletePicFile(unsigned int index, bool mode); + bool audioplayer; + public: CPictureViewerGui(); ~CPictureViewerGui(); int exec(CMenuTarget* parent, const std::string & actionKey); + + CAudioPlayerGui *m_audioPlayer; };