Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
Jellyfin::Model::Shuffle Class Reference

Interface for an algorithm shuffling a playlist. More...

#include <shuffle.h>

Inheritance diagram for Jellyfin::Model::Shuffle:
Jellyfin::Model::NoShuffle Jellyfin::Model::RandomShuffle Jellyfin::Model::ListShuffleBase Jellyfin::Model::SimpleListShuffle

Public Member Functions

 Shuffle (const Playlist *parent)
 
virtual bool canShuffleInAdvance ()
 If this Shuffle implementation shuffles the entire list in advance.
 
virtual void shuffleInAdvance ()
 Shuffle the list in advance. Should only be called if canShuffleInAdvance() is called.
 
virtual void next ()
 The shuffle should determine the next item.
 
virtual void previous ()
 The shuffle should determine the previous item.
 
virtual void setIndex (int i)
 Set the index of the now playing item.
 
virtual int currentItem () const
 
virtual int itemAt (int index) const
 Determine the item index at at the shuffled index.
 
virtual int nextItem () const
 
virtual bool hasPrevious () const
 
virtual bool hasNext () const
 
void setRepeatAll (bool repeatAll)
 Sets whether the shuffler to loop over the list if all items are played.
 

Static Protected Member Functions

static int random (int max, int min=0)
 

Protected Attributes

const Playlistm_playlist
 Playlist that can be used to gather information about the songs if needed for the algorithm.
 
bool m_repeatAll = false
 

Detailed Description

Interface for an algorithm shuffling a playlist.

Constructor & Destructor Documentation

◆ Shuffle()

Jellyfin::Model::Shuffle::Shuffle ( const Playlist * parent)
inline

Member Function Documentation

◆ canShuffleInAdvance()

virtual bool Jellyfin::Model::Shuffle::canShuffleInAdvance ( )
inlinevirtual

If this Shuffle implementation shuffles the entire list in advance.

Returns
True if this shuffle class shuffles the entire list in advance

Some shuffle implementations may only shuffle the next item as they go.

Reimplemented in Jellyfin::Model::RandomShuffle.

◆ currentItem()

virtual int Jellyfin::Model::Shuffle::currentItem ( ) const
inlinevirtual
Returns
the index of the currently playing item

Reimplemented in Jellyfin::Model::ListShuffleBase, Jellyfin::Model::NoShuffle, and Jellyfin::Model::RandomShuffle.

◆ hasNext()

virtual bool Jellyfin::Model::Shuffle::hasNext ( ) const
inlinevirtual

◆ hasPrevious()

virtual bool Jellyfin::Model::Shuffle::hasPrevious ( ) const
inlinevirtual

◆ itemAt()

virtual int Jellyfin::Model::Shuffle::itemAt ( int index) const
inlinevirtual

Determine the item index at at the shuffled index.

Parameters
indexThe shuffled index
Returns
The actual index

If canShuffleInAdvance() returns false, a new implemention is not needed or -1 may be returned. This function should not even be called in that case.

Reimplemented in Jellyfin::Model::ListShuffleBase, and Jellyfin::Model::NoShuffle.

◆ next()

virtual void Jellyfin::Model::Shuffle::next ( )
inlinevirtual

The shuffle should determine the next item.

Reimplemented in Jellyfin::Model::NoShuffle, and Jellyfin::Model::RandomShuffle.

◆ nextItem()

virtual int Jellyfin::Model::Shuffle::nextItem ( ) const
inlinevirtual
Returns
the index of the next item

Reimplemented in Jellyfin::Model::ListShuffleBase, Jellyfin::Model::NoShuffle, and Jellyfin::Model::RandomShuffle.

◆ previous()

virtual void Jellyfin::Model::Shuffle::previous ( )
inlinevirtual

The shuffle should determine the previous item.

Reimplemented in Jellyfin::Model::NoShuffle, and Jellyfin::Model::RandomShuffle.

◆ random()

int Jellyfin::Model::Shuffle::random ( int max,
int min = 0 )
staticprotected

◆ setIndex()

virtual void Jellyfin::Model::Shuffle::setIndex ( int i)
inlinevirtual

Set the index of the now playing item.

Parameters
i

Reimplemented in Jellyfin::Model::NoShuffle.

◆ setRepeatAll()

void Jellyfin::Model::Shuffle::setRepeatAll ( bool repeatAll)
inline

Sets whether the shuffler to loop over the list if all items are played.

◆ shuffleInAdvance()

virtual void Jellyfin::Model::Shuffle::shuffleInAdvance ( )
inlinevirtual

Shuffle the list in advance. Should only be called if canShuffleInAdvance() is called.

Reimplemented in Jellyfin::Model::SimpleListShuffle.

Member Data Documentation

◆ m_playlist

const Playlist* Jellyfin::Model::Shuffle::m_playlist
protected

Playlist that can be used to gather information about the songs if needed for the algorithm.

◆ m_repeatAll

bool Jellyfin::Model::Shuffle::m_repeatAll = false
protected

The documentation for this class was generated from the following files: