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:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,15 +21,44 @@
|
||||
#define PLAYERINTERFACE_H
|
||||
|
||||
#include <Wt/WContainerWidget>
|
||||
#include <Wt/WHBoxLayout>
|
||||
#include <Wt/WVBoxLayout>
|
||||
#include "../WebInterface.h"
|
||||
#include <Wt/WPushButton>
|
||||
#include <Wt/WText>
|
||||
#include <Wt/WProgressBar>
|
||||
#include <Wt/WTimer>
|
||||
#include "TrackDetails.h"
|
||||
|
||||
class PlayerInterface : public Wt::WContainerWidget
|
||||
{
|
||||
public:
|
||||
PlayerInterface(WebInterface* app);
|
||||
WebInterface* app;
|
||||
Wt::WText* tempText;
|
||||
|
||||
Wt::WVBoxLayout* interfaceLayout;
|
||||
Wt::WContainerWidget* playControlContainer;
|
||||
Wt::WHBoxLayout* playControlLayout;
|
||||
Wt::WVBoxLayout* voteControlLayout;
|
||||
Wt::WContainerWidget* voteControlContainer;
|
||||
|
||||
//Play controls
|
||||
TrackDetails* currentTrackDetails;
|
||||
Wt::WProgressBar* currentTrackProgress;
|
||||
Wt::WTimer* trackProgress;
|
||||
Wt::WHBoxLayout* currentTrackLayout;
|
||||
Wt::WContainerWidget* currentTrackContainer;
|
||||
Wt::WPushButton* playpause;
|
||||
|
||||
bool isPaused = false;
|
||||
//TODO:put in controls for requesting/admin skip and adding users as admin.
|
||||
|
||||
//Vote controls
|
||||
//TODO:put in vote controls for seeing tracks to vote on and vote buttons.
|
||||
//TODO:put in controls for requesting songs.
|
||||
|
||||
void playpauseClicked();
|
||||
void playpauseUpdated();
|
||||
};
|
||||
|
||||
#endif // PLAYERINTERFACE_H
|
||||
|
||||
20
src/ui/TrackDetails.cpp
Normal file
20
src/ui/TrackDetails.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Kevin Whitaker <eyecreate@gmail.com>
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "TrackDetails.h"
|
||||
29
src/ui/TrackDetails.h
Normal file
29
src/ui/TrackDetails.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (C) 2017 Kevin Whitaker <eyecreate@gmail.com>
|
||||
*
|
||||
* This program 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 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TRACKDETAILS_H
|
||||
#define TRACKDETAILS_H
|
||||
|
||||
#include <Wt/WContainerWidget>
|
||||
|
||||
class TrackDetails : Wt::WContainerWidget
|
||||
{
|
||||
};
|
||||
|
||||
#endif // TRACKDETAILS_H
|
||||
Reference in New Issue
Block a user