Skip to content
WebInterface.cpp 3.41 KiB
Newer Older
/*
 * 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 "WebInterface.h"

struct WebInterface::internal
{
    LoginInterface* loginUI;
};

WebInterface::WebInterface(const Wt::WEnvironment& env) : Wt::WApplication(env)
{
    priv_int = new internal;
    this->useStyleSheet(Wt::WLink("/resources/font-awesome/css/font-awesome.min.css"));
    setTitle("Arbitrateor - Audio Jukebox");
    priv_int->playerUI = new PlayerInterface(this);
    priv_int->playerUI->hide();
    priv_int->loginUI = new LoginInterface(this);
    root()->addWidget(priv_int->playerUI);
    priv_int->loginUI->animateShow(Wt::WAnimation(Wt::WAnimation::AnimationEffect::SlideInFromTop));
    priv_int->loginUI->checkSessionValidity();
WebInterface::~WebInterface()
{
    delete priv_int->playerUI;
    delete priv_int->loginUI;
    delete priv_int;
}

void WebInterface::loginCompleted()
{
    //Login completed, now bring up main inteface.
    priv_int->loginUI->animateHide(Wt::WAnimation(Wt::WAnimation::AnimationEffect::Fade));
    priv_int->playerUI->animateShow(Wt::WAnimation(Wt::WAnimation::AnimationEffect::Fade, Wt::WAnimation::TimingFunction::EaseIn, 500));
    priv_int->playerUI->updateDetailsFromServer(GroovePlayerMgr::getInstance()->currentTrack);
void WebInterface::playPauseActionFromServer(User userPausing, bool pause)
    priv_int->playerUI->isPaused = pause;
    priv_int->playerUI->playpauseUpdated();
void WebInterface::songChangedFromServer(AudioTrack nextTrack)
    priv_int->playerUI->updateDetailsFromServer(nextTrack);
void WebInterface::skipVotedFromServer(User userRequestingToSkipCurrentTrack)
    //priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"skip");
void WebInterface::skipVoteUpdateFromServer(User userVoting, bool forSkip)
    //priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"vote");
void WebInterface::voteNextSongFromServer(User userVoting, AudioTrack trackVoted)
    //priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"nextvote");
    triggerUpdate();
}

void WebInterface::voteNextPollClosedFromServer()
{
    //priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"voteclosed");
void WebInterface::voteTracksUpdatedFromServer(std::list<AudioTrack> voteableTracks)
    //priv_int->playerUI->tempText->setText(priv_int->playerUI->tempText->text()+"votechanged");