diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index bcf70e4ae..cf27eaab5 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -408,6 +408,15 @@ int CAudioPlayerGui::show() } g_RCInput->getMsg(&msg, &data, 10); // 1 sec timeout to update play/stop state display + if (msg == CRCInput::RC_playpause) + { + // manipulate msg + if (m_state == CAudioPlayerGui::PAUSE) + msg = CRCInput::RC_play; + else + msg = CRCInput::RC_pause; + } + if (msg == CRCInput::RC_timeout || msg == NeutrinoMessages::EVT_TIMER) { int delay = time(NULL) - m_idletime; diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index 86810d109..3a7d43b9b 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -250,6 +250,7 @@ class CAudioPlayerGui : public CMenuTarget bool playNext(bool allow_rotate = false); bool playPrev(bool allow_rotate = false); int getAudioPlayerM_current() { return m_current; } + State getState() { return m_state; } }; #endif diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index 6892988e9..dc0f47c1f 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -889,7 +889,7 @@ int CChannelList::show() moveChannelToBouquet(); } #ifdef ENABLE_PIP - else if (!empty && ((msg == CRCInput::RC_play) || (msg == (neutrino_msg_t) g_settings.key_pip_close))) { + else if (!empty && ((msg == CRCInput::RC_play) || (msg == CRCInput::RC_playpause) || (msg == (neutrino_msg_t) g_settings.key_pip_close))) { if(SameTP()) { if (CZapit::getInstance()->GetPipChannelID() == (*chanlist)[selected]->getChannelID()) { g_Zapit->stopPip(); diff --git a/src/gui/filebrowser.cpp b/src/gui/filebrowser.cpp index 04230bd79..281de4686 100644 --- a/src/gui/filebrowser.cpp +++ b/src/gui/filebrowser.cpp @@ -714,7 +714,7 @@ bool CFileBrowser::exec(const char * const dirname) if ((filelist.empty())) continue; - if (msg == CRCInput::RC_yellow || msg == CRCInput::RC_play) + if (msg == CRCInput::RC_yellow || msg == CRCInput::RC_play || msg == CRCInput::RC_playpause) { if ((Multi_Select) && (selected < filelist.size())) { diff --git a/src/gui/moviebrowser/mb.cpp b/src/gui/moviebrowser/mb.cpp index 7b9e34e6e..d3cefce0e 100644 --- a/src/gui/moviebrowser/mb.cpp +++ b/src/gui/moviebrowser/mb.cpp @@ -2236,7 +2236,7 @@ bool CMovieBrowser::onButtonPressBrowserList(neutrino_msg_t msg) scrollBrowserItem(false, true); else if (msg == (neutrino_msg_t)g_settings.key_pagedown) scrollBrowserItem(true, true); - else if (msg == CRCInput::RC_play) + else if (msg == CRCInput::RC_play || msg == CRCInput::RC_playpause) markItem(m_pcBrowser); else result = false; @@ -2260,7 +2260,7 @@ bool CMovieBrowser::onButtonPressLastPlayList(neutrino_msg_t msg) m_pcLastPlay->scrollPageUp(1); else if (msg == (neutrino_msg_t)g_settings.key_pagedown) m_pcLastPlay->scrollPageDown(1); - else if (msg == CRCInput::RC_play) + else if (msg == CRCInput::RC_play || msg == CRCInput::RC_playpause) markItem(m_pcLastPlay); else result = false; @@ -2284,7 +2284,7 @@ bool CMovieBrowser::onButtonPressLastRecordList(neutrino_msg_t msg) m_pcLastRecord->scrollPageUp(1); else if (msg == (neutrino_msg_t)g_settings.key_pagedown) m_pcLastRecord->scrollPageDown(1); - else if (msg == CRCInput::RC_play) + else if (msg == CRCInput::RC_play || msg == CRCInput::RC_playpause) markItem(m_pcLastRecord); else result = false; diff --git a/src/gui/movieplayer.cpp b/src/gui/movieplayer.cpp index 7a3a50347..adee1c70f 100644 --- a/src/gui/movieplayer.cpp +++ b/src/gui/movieplayer.cpp @@ -1580,7 +1580,19 @@ void CMoviePlayerGui::PlayFileLoop(void) neutrino_msg_data_t data; g_RCInput->getMsg(&msg, &data, 10); // 1 secs.. + // handle CRCInput::RC_playpause key + bool handle_key_play = true; + bool handle_key_pause = true; + #if 0 //bisectional jumps + if (g_settings.mpkey_play == g_settings.mpkey_pause) + { + if (playstate == CMoviePlayerGui::PLAY) + handle_key_play = false; + else if (playstate == CMoviePlayerGui::PAUSE) + handle_key_pause = false; + } + if (bisection_loop > -1) bisection_loop++; if (bisection_loop > bisection_loop_max) @@ -1772,7 +1784,7 @@ void CMoviePlayerGui::PlayFileLoop(void) } else if (msg == (neutrino_msg_t) g_settings.key_switchformat) { g_videoSettings->SwitchFormat(); #endif - } else if (msg == (neutrino_msg_t) g_settings.mpkey_play) { + } else if (msg == (neutrino_msg_t) g_settings.mpkey_play && handle_key_play) { if (time_forced) { time_forced = false; FileTimeOSD->kill(); @@ -1816,7 +1828,7 @@ void CMoviePlayerGui::PlayFileLoop(void) delete playlist; enableOsdElements(MUTE); } - } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause) { + } else if (msg == (neutrino_msg_t) g_settings.mpkey_pause && handle_key_pause) { if (time_forced) { time_forced = false; FileTimeOSD->kill(); diff --git a/src/gui/pictureviewer.cpp b/src/gui/pictureviewer.cpp index f251f8647..150a2e7fb 100644 --- a/src/gui/pictureviewer.cpp +++ b/src/gui/pictureviewer.cpp @@ -582,29 +582,40 @@ int CPictureViewerGui::show() // FIXME: do not accept volume-keys while decoding } // control keys for audioplayer - else if (audioplayer && msg==CRCInput::RC_pause) + else if (audioplayer) { m_currentTitle = m_audioPlayer->getAudioPlayerM_current(); - m_audioPlayer->pause(); - } - else if (audioplayer && msg==CRCInput::RC_stop) - { - m_currentTitle = m_audioPlayer->getAudioPlayerM_current(); - m_audioPlayer->stop(); - } - else if (audioplayer && msg==CRCInput::RC_play) - { - m_currentTitle = m_audioPlayer->getAudioPlayerM_current(); - if (m_currentTitle > -1) - m_audioPlayer->play((unsigned int)m_currentTitle); - } - else if (audioplayer && msg==CRCInput::RC_forward) - { - m_audioPlayer->playNext(); - } - else if (audioplayer && msg==CRCInput::RC_rewind) - { - m_audioPlayer->playPrev(); + + if (msg == CRCInput::RC_playpause) + { + // manipulate msg + if (m_audioPlayer->getState() == CAudioPlayerGui::PAUSE) + msg = CRCInput::RC_play; + else + msg = CRCInput::RC_pause; + } + + if (msg == CRCInput::RC_play) + { + if (m_currentTitle > -1) + m_audioPlayer->play((unsigned int)m_currentTitle); + } + else if (msg == CRCInput::RC_pause) + { + m_audioPlayer->pause(); + } + else if (msg == CRCInput::RC_stop) + { + m_audioPlayer->stop(); + } + else if (msg == CRCInput::RC_forward || msg == CRCInput::RC_nextsong) + { + m_audioPlayer->playNext(); + } + else if (msg == CRCInput::RC_rewind || msg == CRCInput::RC_previoussong) + { + m_audioPlayer->playPrev(); + } } else if (msg == NeutrinoMessages::CHANGEMODE) { diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index 569f983ce..74dca35ad 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -943,7 +943,7 @@ int CTimerList::show() else update=true; } - else if (!timerlist.empty() && (msg == CRCInput::RC_play && g_settings.timer_remotebox_ip.size() > 0)) + else if (!timerlist.empty() && ((msg == CRCInput::RC_play || msg == CRCInput::RC_playpause) && g_settings.timer_remotebox_ip.size() > 0)) { if (timerlist[selected].eventType == CTimerd::TIMER_RECORD ) { diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index c042df621..d8b1d9ef5 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -863,7 +863,7 @@ bool CUpnpBrowserGui::selectItem(std::string id) } } } - else if (msg == CRCInput::RC_play) { + else if (msg == CRCInput::RC_play || msg == CRCInput::RC_playpause) { if ((selected - liststart) >= (*entries).size()) continue; m_folderplay = true;