24 if(m_enable && items.count() != m_data.count())
28 std::shuffle(m_data.begin(), m_data.end(), std::default_random_engine(std::random_device()()));
34 m_index = m_data.indexOf(item);
46 if(++m_index >= m_data.count())
55 m_index = m_data.count() - 1;
62 return m_data[m_index];
121 return item.
m_path == path;
150 static void updatePlayItems(
const TTK::IndexPropertyList &indexs, MusicPlayItemList &items)
156 if(item.m_playlistRow != index.m_first)
161 item.m_playlistRow = index.m_second;
180 return m_mediaList.indexOf({playlistRow, content}, from);
192 for(
const QString &path :
qAsConst(items))
205 for(
const QString &path :
qAsConst(items))
233 const int index =
find(playlistRow, content);
248 #define GENERATE_RANDOM_INDEX(index) \
249 m_currentIndex = m_shuffle.isEnabled() ? find(m_shuffle.setCurrentIndex(index)) : (TTK::random() % m_mediaList.count());
320 #undef GENERATE_RANDOM_INDEX
326 if(m_currentIndex < 0 || m_currentIndex >=
m_mediaList.count())
337 const int playIndex =
find({playlistRow, path});
void appendQueue(int playlistRow, const QString &content)
The class of the music play item.
void playbackModeChanged(TTK::PlayMode mode)
MusicPlaylist(QObject *parent=nullptr)
void initialize(const MusicPlayItemList &items)
static void updatePlayItems(const TTK::IndexPropertyList &indexs, MusicPlayItemList &items)
bool isSameMediaPath(const QString &path) const
TTK_MODULE_EXPORT void initRandom()
#define GENERATE_RANDOM_INDEX(index)
MusicPlayItemList m_queueList
int find(const MusicPlayItem &item) const
The class of the index property.
void add(int playlistRow, const QString &content)
TTK::PlayMode playbackMode() const
MusicPlayItem currentItem() const
static constexpr int PLAY_PREVIOUS_LEVEL
TTK_MODULE_EXPORT QString generateNetworkSongPath(const QString &path)
const MusicPlayItemList & queueList() const
The namespace of the process utils.
QString currentMediaPath() const
void setCurrentIndex(const MusicPlayItem &item)
void currentIndexChanged(int index)
void setPlaybackMode(TTK::PlayMode mode)
MusicPlayItemList m_mediaList
static constexpr int PLAY_NEXT_LEVEL
void setCurrentIndex(int index)
class MusicPlaylist::Shuffle m_shuffle
TTK::PlayMode m_playbackMode
void update(const TTK::IndexPropertyList &indexs)
#define MUSIC_NETWORK_LIST
void append(int playlistRow, const QString &content)
void setShuffleMode(bool shuffle)
void setEnabled(bool enable)
const MusicPlayItemList & mediaList() const