void PlayerManager::forward() { m_playlistInterface->playNext(); FileHandle file = m_playlistInterface->currentFile(); if(!file.isNull()) play(file); else stop(); }
void PlayerManager::back() { m_playlistInterface->playPrevious(); FileHandle file = m_playlistInterface->currentFile(); if(!file.isNull()) play(file); else stop(); }
void PlayerManager::slotNeedNextUrl() { if(m_file.isNull() || !m_crossfadeTracks) return; m_playlistInterface->playNext(); FileHandle nextFile = m_playlistInterface->currentFile(); if(!nextFile.isNull()) { m_file = nextFile; crossfadeToFile(m_file); } }
void PlayerManager::play(const FileHandle &file) { if(!m_setup) setup(); if(!m_media[0] || !m_media[1] || !m_playlistInterface) return; stopCrossfade(); // The "currently playing" media object. Phonon::MediaObject *mediaObject = m_media[m_curOutputPath]; if(file.isNull()) { if(paused()) mediaObject->play(); else if(playing()) { mediaObject->seek(0); emit seeked(0); } else { m_playlistInterface->playNext(); m_file = m_playlistInterface->currentFile(); if(!m_file.isNull()) { mediaObject->setCurrentSource(KUrl::fromPath(m_file.absFilePath())); mediaObject->play(); emit signalItemChanged(m_file); } } } else { mediaObject->setCurrentSource(KUrl::fromPath(file.absFilePath())); mediaObject->play(); if(m_file != file) emit signalItemChanged(file); m_file = file; } // Our state changed handler will perform the follow up actions necessary // once we actually start playing. }