Beispiel #1
0
void PlayerController::onAboutToFinish()
{
    int nextSong = getNextSong();

    if (nextSong >= 0) {
        m_mediaObject->enqueue(m_model->pathAt(nextSong));
        setCurrentSong_helper(nextSong);
    }
}
Beispiel #2
0
void PlayerController::next()
{
    if (!m_songsAvailable)
        return;

    const int nextSong = getNextSong();
    if (nextSong >= 0)
        setCurrentSong(nextSong);
}
Beispiel #3
0
void PlayerController::onModelReady()
{
    disconnect(m_model, SIGNAL(ready()), this, SLOT(onModelReady()));
    if (m_model->songCount()) {
        m_songsAvailable = true;
        setCurrentSong(getNextSong());
        Q_ASSERT(m_playlistModel == 0);
        m_playlistModel = new FastPlaylistModel(m_model);
        initializeView();
        qWarning() << "Controller has songs available!";
        emit songsAvailable();
    }
}
Beispiel #4
0
void getNextSoundInternal(bool toAdd)
{
	if(soundMode == SOUND_ONESHOT)
		return;
	
	destroySound();
	
	switch(soundMode)
	{
		case SOUND_NEXTFILE:
			if(getNextSong()) // if there is a next song
			{
				soundLoaded = false;			
			}
			else
			{
				exitSound(0,0);
			}
			break;
		case SOUND_RANDFILE:
			int tmpCur = 0;
			
			if(nextRandomList(getFileName(), &tmpCur)) // look in playlist first
			{
				moveCursorAbsolute(tmpCur);
				soundLoaded = false;
			}
			else
			{
				int x = randFile(getFileName(), SOUNDFILE, getBrowserEntries());
				
				if(x == -1)
				{
					exitSound(0,0);
					return;
				}
				
				moveCursorAbsolute(x);
				
				if(toAdd)
				{
					addToRandomList(getFileName(), x);
				}
				
				soundLoaded = false;
			}
			
			break;
	}
}