Uncomment user actions and fix by finding active DB object instead of converting dead one. Use font-awesome to make icons for buttons. Implement rest of basic logic for login page. Some style fixings. Start adding skip controls.

This commit is contained in:
Kevin Whitaker
2017-02-18 14:25:52 -05:00
parent c5e979e948
commit cb393b0c0d
7 changed files with 113 additions and 42 deletions

View File

@@ -24,6 +24,7 @@
#include <Wt/WLength>
#include <Wt/WColor>
#include <Wt/WBorder>
#include <Wt/WString>
PlayerInterface::PlayerInterface(WebInterface* app)
{
@@ -33,6 +34,7 @@ PlayerInterface::PlayerInterface(WebInterface* app)
playControlLayout = new Wt::WHBoxLayout();
voteControlLayout = new Wt::WVBoxLayout();
playControlWidget = new Wt::WContainerWidget();
skipControls = new Wt::WContainerWidget();
playControlWidget->setLayout(playControlLayout);
currentTrackProgress = new Wt::WProgressBar();
@@ -43,10 +45,17 @@ PlayerInterface::PlayerInterface(WebInterface* app)
trackProgress->timeout().connect(this,&PlayerInterface::updateProgressFromTimer);
currentTrackDetails = new TrackDetails();
playpause = new Wt::WPushButton();
playpause->setText(groove_playlist_playing(GroovePlayerMgr::getInstance()->currentPlaylist)==1?"Pause":"Resume");
playpause->setTextFormat(Wt::XHTMLText);
playpause->decorationStyle().font().setFamily(Wt::WFont::Default,"FontAwesome");
playpause->setText(groove_playlist_playing(GroovePlayerMgr::getInstance()->currentPlaylist)==1?Wt::WString::fromUTF8("&#61516;"):Wt::WString::fromUTF8("&#61515;"));
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);
skipRequest = new Wt::WPushButton();
skipRequest->setTextFormat(Wt::XHTMLText);
skipRequest->decorationStyle().font().setFamily(Wt::WFont::Default,"FontAwesome");
skipRequest->setText("&#61521;"); //cancel skip? &#61534;
skipControls->addWidget(skipRequest);
interfaceLayout->addWidget(playControlWidget);
interfaceLayout->addWidget(currentTrackProgress);
@@ -55,17 +64,18 @@ PlayerInterface::PlayerInterface(WebInterface* app)
playControlWidget->decorationStyle().setBackgroundColor(Wt::WColor("#00B200"));
playControlLayout->addWidget(playpause,0,Wt::AlignmentFlag::AlignLeft | Wt::AlignmentFlag::AlignMiddle);
playControlLayout->addWidget(currentTrackDetails);
playControlLayout->addWidget(skipControls,0,Wt::AlignmentFlag::AlignRight | Wt::AlignmentFlag::AlignMiddle);
}
void PlayerInterface::playpauseClicked()
{
if(!isPaused)
{
GroovePlayerMgr::getInstance()->lastInternalEvents.push_back(GroovePlayerMgr::PlayerEvent() = {GroovePlayerMgr::PlayerEventType::PLAYING_PAUSED, app->currentUser});
GroovePlayerMgr::getInstance()->lastInternalEvents.push_back(GroovePlayerMgr::PlayerEvent() = {GroovePlayerMgr::PlayerEventType::PLAYING_PAUSED, app->currentUser, std::list<AudioTrack>{GroovePlayerMgr::getInstance()->currentTrack}});
}
else
{
GroovePlayerMgr::getInstance()->lastInternalEvents.push_back(GroovePlayerMgr::PlayerEvent() = {GroovePlayerMgr::PlayerEventType::PLAYING_RESUMED, app->currentUser});
GroovePlayerMgr::getInstance()->lastInternalEvents.push_back(GroovePlayerMgr::PlayerEvent() = {GroovePlayerMgr::PlayerEventType::PLAYING_RESUMED, app->currentUser, std::list<AudioTrack>{GroovePlayerMgr::getInstance()->currentTrack}});
}
}
@@ -73,11 +83,11 @@ void PlayerInterface::playpauseUpdated()
{
if(isPaused)
{
playpause->setText("Resume");
playpause->setText(Wt::WString::fromUTF8("&#61515;"));
}
else
{
playpause->setText("Pause");
playpause->setText(Wt::WString::fromUTF8("&#61516;"));
}
}