add boost in because wt seems to now complain about it. Remove first song change message as it's unlikely anyone will encounter it with other events firing soon after. Start cleaning up some container/layout mess. Implement trackdetails and show this on the play controls.

This commit is contained in:
Kevin Whitaker
2017-02-16 22:55:14 -05:00
parent b101657669
commit 167b2f9084
6 changed files with 64 additions and 22 deletions

View File

@@ -21,35 +21,33 @@
#include <Wt/WText>
#include "../GroovePlayer.h"
#include <grooveplayer/player.h>
#include <Wt/WLength>
PlayerInterface::PlayerInterface(WebInterface* app)
{
this->app = app;
interfaceLayout = new Wt::WVBoxLayout();
this->setLayout(interfaceLayout);
playControlContainer = new Wt::WContainerWidget();
voteControlContainer = new Wt::WContainerWidget();
playControlLayout = new Wt::WHBoxLayout();
voteControlLayout = new Wt::WVBoxLayout();
playControlContainer->setLayout(playControlLayout);
voteControlContainer->setLayout(voteControlLayout);
currentTrackProgress = new Wt::WProgressBar();
currentTrackProgress->setFormat("");
trackProgress = new Wt::WTimer();
trackProgress->setInterval(1000);
trackProgress->timeout().connect(this,&PlayerInterface::updateProgressFromTimer);
//TODO:track details
currentTrackDetails = new TrackDetails();
playpause = new Wt::WPushButton();
playpause->setText(groove_playlist_playing(GroovePlayerMgr::getInstance()->currentPlaylist)==1?"Pause":"Resume");
playpause->setMaximumSize(Wt::WLength(60,Wt::WLength::Point),Wt::WLength(30,Wt::WLength::Point));
isPaused = groove_playlist_playing(GroovePlayerMgr::getInstance()->currentPlaylist)==0;
playpause->clicked().connect(this, &PlayerInterface::playpauseClicked);
interfaceLayout->addWidget(playControlContainer);
interfaceLayout->addLayout(playControlLayout);
interfaceLayout->addWidget(currentTrackProgress);
interfaceLayout->addWidget(voteControlContainer);
//TODO:add track details
playControlLayout->addWidget(playpause);
interfaceLayout->addLayout(voteControlLayout);
playControlLayout->addWidget(playpause,0,Wt::AlignmentFlag::AlignCenter | Wt::AlignmentFlag::AlignMiddle);
playControlLayout->addWidget(currentTrackDetails);
}
void PlayerInterface::playpauseClicked()
@@ -93,7 +91,6 @@ void PlayerInterface::updateProgressFromTimer()
void PlayerInterface::updateDetailsFromServer(AudioTrack track)
{
//TODO: request current player state.
//Find current song playing and set progress state.
double secondsIn;
groove_player_position(GroovePlayerMgr::getInstance()->currentPlayer,nullptr, &secondsIn);
@@ -105,4 +102,5 @@ void PlayerInterface::updateDetailsFromServer(AudioTrack track)
trackProgress->start();
}
playpauseUpdated();
currentTrackDetails->updateWithTrackDetails(track);
}