/*
* Copyright (C) 2018 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see .
*/
#pragma once
#include
#include
#include
#include
#include
#include
#include
#include "database/TrackList.hpp"
#include "database/Track.hpp"
namespace UserInterface {
class PlayQueue : public Wt::WTemplate
{
public:
PlayQueue();
void addTracks(const std::vector& tracks);
void playTracks(const std::vector& tracks);
// play the next track in the queue
void playNext();
// play the previous track in the queue
void playPrevious();
// Signal emitted when a track is to be load(and optionally played)
Wt::Signal loadTrack;
// Signal emitted when play has to be stopped
Wt::Signal<> trackUnload;
private:
Database::TrackList::pointer getTrackList();
void clearTracks();
void enqueueTracks(const std::vector& tracks);
void enqueueTrack(Database::Track::pointer track);
void addSome();
void addRadioTrack();
void updateInfo();
void updateCurrentTrack(bool selected);
void updateRepeatBtn();
void updateRadioBtn();
void load(std::size_t pos, bool play);
void stop();
bool _repeatAll = false;
bool _radioMode = false;
boost::optional _tracklistId;
Wt::WContainerWidget* _entriesContainer = nullptr;
Wt::WPushButton* _showMore = nullptr;
Wt::WText* _nbTracks = nullptr;
Wt::WText* _repeatBtn = nullptr;
Wt::WText* _radioBtn = nullptr;
boost::optional _trackPos; // current track position, if set
};
} // namespace UserInterface