Start implementing web UI. Add track detail container. Comment out some old test code and DB code while more gets hooked up. Play/pause button is mostly implemented.

This commit is contained in:
Kevin Whitaker
2017-02-15 00:47:58 -05:00
parent 7668a923d8
commit 53bc31ebb9
8 changed files with 158 additions and 31 deletions

View File

@@ -19,10 +19,57 @@
#include "PlayerInterface.h"
#include <Wt/WText>
#include "../GroovePlayer.h"
PlayerInterface::PlayerInterface(WebInterface* app)
{
this->app = app;
tempText = new Wt::WText("You did it.");
addChild(tempText);
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);
//TODO:track details
playpause = new Wt::WPushButton();
playpause->setText(groove_playlist_playing(GroovePlayerMgr::getInstance()->currentPlaylist)==1?"Pause":"Resume");
isPaused = groove_playlist_playing(GroovePlayerMgr::getInstance()->currentPlaylist)==0;
playpause->clicked().connect(this, &PlayerInterface::playpauseClicked);
interfaceLayout->addWidget(playControlContainer);
interfaceLayout->addWidget(currentTrackProgress);
interfaceLayout->addWidget(voteControlContainer);
//TODO:add track details
playControlLayout->addWidget(playpause);
}
void PlayerInterface::playpauseClicked()
{
if(!isPaused)
{
GroovePlayerMgr::getInstance()->lastInternalEvents.push_back(GroovePlayerMgr::PlayerEvent() = {GroovePlayerMgr::PlayerEventType::PLAYING_PAUSED, app->currentUser});
}
else
{
GroovePlayerMgr::getInstance()->lastInternalEvents.push_back(GroovePlayerMgr::PlayerEvent() = {GroovePlayerMgr::PlayerEventType::PLAYING_RESUMED, app->currentUser});
}
}
void PlayerInterface::playpauseUpdated()
{
if(isPaused)
{
playpause->setText("Resume");
}
else
{
playpause->setText("Pause");
}
}