- add pictureviewer to info-key in audioplayer

This commit is contained in:
snafed
2012-11-06 23:04:55 +01:00
committed by svenhoefer
parent 24ffee6bb2
commit e145f9a5e8
4 changed files with 92 additions and 33 deletions

View File

@@ -65,6 +65,8 @@
#include <gui/widget/stringinput.h> #include <gui/widget/stringinput.h>
#include <gui/widget/stringinput_ext.h> #include <gui/widget/stringinput_ext.h>
#include "gui/pictureviewer.h"
#include <system/settings.h> #include <system/settings.h>
#include <system/helpers.h> #include <system/helpers.h>
#include <driver/screen_max.h> #include <driver/screen_max.h>
@@ -198,6 +200,8 @@ void CAudioPlayerGui::Init(void)
m_selected = 0; m_selected = 0;
m_metainfo.clear(); m_metainfo.clear();
pictureviewer = false;
m_select_title_by_name = g_settings.audioplayer_select_title_by_name==1; m_select_title_by_name = g_settings.audioplayer_select_title_by_name==1;
if (strlen(g_settings.network_nfs_audioplayerdir)!=0) 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) else if (msg == CRCInput::RC_help)
{ {
if (m_key_level == 2) if (m_key_level == 2)
@@ -904,6 +924,17 @@ bool CAudioPlayerGui::playNext(bool allow_rotate)
return(result); 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 CAudioPlayerGui::playPrev(bool allow_rotate)
{ {
bool result = false; bool result = false;
@@ -1698,10 +1729,11 @@ const struct button_label AudioPlayerButtons[][4] =
void CAudioPlayerGui::paintFoot() void CAudioPlayerGui::paintFoot()
{ {
// printf("paintFoot{\n"); // 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_OKAY , LOCALE_AUDIOPLAYER_PLAY },
{ NEUTRINO_ICON_BUTTON_HELP , LOCALE_AUDIOPLAYER_KEYLEVEL }, { NEUTRINO_ICON_BUTTON_HELP , LOCALE_AUDIOPLAYER_KEYLEVEL },
{ NEUTRINO_ICON_BUTTON_INFO , LOCALE_PICTUREVIEWER_HEAD},
}; };
int top; 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); m_frameBuffer->paintHLine(m_x, m_x + m_width, top, COL_INFOBAR_SHADOW_PLUS_1);
if (!m_playlist.empty()) 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) if (m_key_level == 0)
{ {
@@ -1943,12 +1974,16 @@ void CAudioPlayerGui::stop()
{ {
m_state = CAudioPlayerGui::STOP; m_state = CAudioPlayerGui::STOP;
m_current = 0; m_current = 0;
if (!pictureviewer)
{
//LCD //LCD
paintLCD(); paintLCD();
//Display //Display
paintInfo(); paintInfo();
m_key_level = 0; m_key_level = 0;
paintFoot(); paintFoot();
}
if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP)
CAudioPlayer::getInstance()->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) if (m_selected - m_liststart >= m_listmaxshow && g_settings.audioplayer_follow)
{ {
m_liststart = m_selected; m_liststart = m_selected;
if (!m_screensaver) if (!m_screensaver && !pictureviewer)
paint(); paint();
} }
else if (m_liststart < m_selected && g_settings.audioplayer_follow) else if (m_liststart < m_selected && g_settings.audioplayer_follow)
{ {
m_liststart = m_selected - m_listmaxshow + 1; m_liststart = m_selected - m_listmaxshow + 1;
if (!m_screensaver) if (!m_screensaver && !pictureviewer)
paint(); paint();
} }
else else
{ {
if (old_current >= m_liststart && old_current - m_liststart < m_listmaxshow) if (old_current >= m_liststart && old_current - m_liststart < m_listmaxshow)
{ {
if (!m_screensaver) if (!m_screensaver && !pictureviewer)
paintItem(old_current - m_liststart); paintItem(old_current - m_liststart);
} }
if (pos >= m_liststart && pos - m_liststart < m_listmaxshow) if (pos >= m_liststart && pos - m_liststart < m_listmaxshow)
{ {
if (!m_screensaver) if (!m_screensaver && !pictureviewer)
paintItem(pos - m_liststart); paintItem(pos - m_liststart);
} }
if (g_settings.audioplayer_follow) if (g_settings.audioplayer_follow)
{ {
if (old_selected >= m_liststart && old_selected - m_liststart < m_listmaxshow) if (old_selected >= m_liststart && old_selected - m_liststart < m_listmaxshow)
if (!m_screensaver) if (!m_screensaver && !pictureviewer)
paintItem(old_selected - m_liststart); paintItem(old_selected - m_liststart);
} }
} }
@@ -2065,6 +2100,9 @@ void CAudioPlayerGui::play(unsigned int pos)
m_curr_audiofile = m_playlist[m_current]; m_curr_audiofile = m_playlist[m_current];
// Play // Play
CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1); CAudioPlayer::getInstance()->play(&m_curr_audiofile, g_settings.audioplayer_highprio == 1);
if (!pictureviewer)
{
//LCD //LCD
paintLCD(); paintLCD();
// Display // Display
@@ -2073,6 +2111,7 @@ void CAudioPlayerGui::play(unsigned int pos)
m_key_level = 1; m_key_level = 1;
if (!m_screensaver) if (!m_screensaver)
paintFoot(); paintFoot();
}
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@@ -251,11 +251,15 @@ 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);
bool pictureviewer;
public: public:
CAudioPlayerGui(bool inetmode = false); CAudioPlayerGui(bool inetmode = false);
~CAudioPlayerGui(); ~CAudioPlayerGui();
int show(); int show();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
void wantNextPlay();
}; };

View File

@@ -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; selected = 0;
width = w_max (710, 0); width = w_max (710, 0);
height = h_max (570, 0); height = h_max (570, 0);
@@ -159,6 +163,7 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey
// remember last mode // remember last mode
m_LastMode=(CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap); m_LastMode=(CNeutrinoApp::getInstance()->getLastMode() | NeutrinoMessages::norezap);
if (!audioplayer) { // !!! why? !!!
//g_Zapit->setStandby(true); //g_Zapit->setStandby(true);
g_Zapit->lockPlayBack(); g_Zapit->lockPlayBack();
@@ -167,6 +172,7 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey
// Stop Sectionsd // Stop Sectionsd
g_Sectionsd->setPauseScanning(true); g_Sectionsd->setPauseScanning(true);
}
// Save and Clear background // Save and Clear background
bool usedBackground = frameBuffer->getuseBackground(); bool usedBackground = frameBuffer->getuseBackground();
@@ -180,11 +186,13 @@ int CPictureViewerGui::exec(CMenuTarget* parent, const std::string & /*actionKey
// free picviewer mem // free picviewer mem
m_viewer->Cleanup(); m_viewer->Cleanup();
if (!audioplayer) { // !!! why? !!!
//g_Zapit->setStandby(false); //g_Zapit->setStandby(false);
g_Zapit->unlockPlayBack(); g_Zapit->unlockPlayBack();
// Start Sectionsd // Start Sectionsd
g_Sectionsd->setPauseScanning(false); g_Sectionsd->setPauseScanning(false);
}
// Restore previous background // Restore previous background
if (usedBackground) { if (usedBackground) {
@@ -226,6 +234,9 @@ int CPictureViewerGui::show()
paint(); paint();
} }
if (audioplayer)
m_audioPlayer->wantNextPlay();
if (m_state!=SLIDESHOW) if (m_state!=SLIDESHOW)
timeout=50; // egal timeout=50; // egal
else else

View File

@@ -37,6 +37,7 @@
#include <driver/pictureviewer/pictureviewer.h> #include <driver/pictureviewer/pictureviewer.h>
#include <gui/widget/menue.h> #include <gui/widget/menue.h>
#include <gui/filebrowser.h> #include <gui/filebrowser.h>
#include <gui/audioplayer.h>
#include <string> #include <string>
@@ -109,10 +110,14 @@ class CPictureViewerGui : public CMenuTarget
void showHelp(); void showHelp();
void deletePicFile(unsigned int index, bool mode); void deletePicFile(unsigned int index, bool mode);
bool audioplayer;
public: public:
CPictureViewerGui(); CPictureViewerGui();
~CPictureViewerGui(); ~CPictureViewerGui();
int exec(CMenuTarget* parent, const std::string & actionKey); int exec(CMenuTarget* parent, const std::string & actionKey);
CAudioPlayerGui *m_audioPlayer;
}; };