19#ifndef JELLYFIN_MODEL_SHUFFLE_H
20#define JELLYFIN_MODEL_SHUFFLE_H
79 virtual int itemAt(
int index)
const {
return -1; }
87 virtual bool hasNext()
const {
return false; }
97 static int random(
int max,
int min = 0);
108 virtual int nextItem()
const override;
109 virtual int itemAt(
int index)
const override;
112 virtual void next()
override;
113 virtual void setIndex(
int i)
override;
115 virtual bool hasNext()
const override;
130 virtual int nextItem()
const override;
131 virtual int itemAt(
int index)
const override;
153 virtual int nextItem()
const override;
155 virtual void next()
override;
157 virtual bool hasNext()
const override;
Base class for shuffles that shuffle the entire list in advance.
Definition shuffle.h:126
virtual int itemAt(int index) const override
Determine the item index at at the shuffled index.
Definition shuffle.cpp:110
virtual int nextItem() const override
Definition shuffle.cpp:106
ListShuffleBase(const Playlist *parent)
Definition shuffle.cpp:99
virtual int currentItem() const override
Definition shuffle.cpp:102
QVector< int > m_map
Definition shuffle.h:133
A shuffler that does not shuffle.
Definition shuffle.h:103
int m_index
Definition shuffle.h:119
virtual void setIndex(int i) override
Set the index of the now playing item.
Definition shuffle.cpp:90
NoShuffle(const Playlist *parent)
Definition shuffle.cpp:36
int nextIndex() const
Definition shuffle.cpp:78
virtual bool hasPrevious() const override
Definition shuffle.cpp:47
virtual int nextItem() const override
Definition shuffle.cpp:58
virtual void next() override
The shuffle should determine the next item.
Definition shuffle.cpp:39
virtual bool hasNext() const override
Definition shuffle.cpp:51
virtual int itemAt(int index) const override
Determine the item index at at the shuffled index.
Definition shuffle.cpp:74
int previousIndex() const
Definition shuffle.cpp:62
virtual void previous() override
The shuffle should determine the previous item.
Definition shuffle.cpp:43
virtual int currentItem() const override
Definition shuffle.cpp:55
Model of a playlist, a list of items that can be played.
Definition playlist.h:47
A shuffler that is pretty random. Does not care about repeating items in a list.
Definition shuffle.h:148
bool canShuffleInAdvance() override
If this Shuffle implementation shuffles the entire list in advance.
Definition shuffle.cpp:140
virtual void previous() override
The shuffle should determine the previous item.
Definition shuffle.cpp:151
RandomShuffle(const Playlist *parent)
Definition shuffle.cpp:137
virtual bool hasPrevious() const override
Definition shuffle.cpp:165
virtual void next() override
The shuffle should determine the next item.
Definition shuffle.cpp:156
virtual int nextItem() const override
Definition shuffle.cpp:148
int m_previous
Definition shuffle.h:159
int m_next
Definition shuffle.h:159
int m_current
Definition shuffle.h:159
virtual bool hasNext() const override
Definition shuffle.cpp:169
virtual int currentItem() const override
Definition shuffle.cpp:144
Interface for an algorithm shuffling a playlist.
Definition shuffle.h:32
virtual bool canShuffleInAdvance()
If this Shuffle implementation shuffles the entire list in advance.
Definition shuffle.h:42
virtual bool hasPrevious() const
Definition shuffle.h:86
virtual void next()
The shuffle should determine the next item.
Definition shuffle.h:53
virtual void previous()
The shuffle should determine the previous item.
Definition shuffle.h:58
void setRepeatAll(bool repeatAll)
Sets whether the shuffler to loop over the list if all items are played.
Definition shuffle.h:92
Shuffle(const Playlist *parent)
Definition shuffle.h:34
static int random(int max, int min=0)
Definition shuffle.cpp:28
virtual void shuffleInAdvance()
Shuffle the list in advance. Should only be called if canShuffleInAdvance() is called.
Definition shuffle.h:48
bool m_repeatAll
Definition shuffle.h:96
virtual int nextItem() const
Definition shuffle.h:84
virtual int itemAt(int index) const
Determine the item index at at the shuffled index.
Definition shuffle.h:79
virtual bool hasNext() const
Definition shuffle.h:87
virtual int currentItem() const
Definition shuffle.h:69
virtual void setIndex(int i)
Set the index of the now playing item.
Definition shuffle.h:64
const Playlist * m_playlist
Playlist that can be used to gather information about the songs if needed for the algorithm.
Definition shuffle.h:95
A simple shuffler which shuffles each item in the list in advance.
Definition shuffle.h:139
virtual void shuffleInAdvance() override
Shuffle the list in advance. Should only be called if canShuffleInAdvance() is called.
Definition shuffle.cpp:118
SimpleListShuffle(const Playlist *parent)
Definition shuffle.cpp:115
A smart shuffler that shuffles a list with a few constraints to make it appear "more random" to an us...
Definition shuffle.h:168