Add interface class to represent player interface. Have simple hide/show animation between. Put up more interface elements on login interface to show inteded ui.
This commit is contained in:
@@ -8,7 +8,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
||||
find_package(Wt REQUIRED)
|
||||
find_package(Groove REQUIRED)
|
||||
|
||||
add_executable(arbitrateor src/main.cpp src/WebInterface.cpp src/GroovePlayer.cpp src/ui/LoginInterface.cpp)
|
||||
add_executable(arbitrateor src/main.cpp src/WebInterface.cpp src/GroovePlayer.cpp src/ui/LoginInterface.cpp src/ui/PlayerInterface.cpp)
|
||||
target_link_libraries(arbitrateor ${Wt_LIBRARIES} ${GROOVE_LIBRARY})
|
||||
|
||||
install(TARGETS arbitrateor RUNTIME DESTINATION bin)
|
||||
|
||||
@@ -19,24 +19,39 @@
|
||||
|
||||
#include "WebInterface.h"
|
||||
#include "ui/LoginInterface.h"
|
||||
#include "ui/PlayerInterface.h"
|
||||
#include <Wt/WText>
|
||||
#include <Wt/WAnimation>
|
||||
|
||||
struct WebInterface::internal
|
||||
{
|
||||
LoginInterface* loginUI;
|
||||
PlayerInterface* playerUI;
|
||||
};
|
||||
|
||||
WebInterface::WebInterface(const Wt::WEnvironment& env) : Wt::WApplication(env)
|
||||
{
|
||||
priv_int = new internal;
|
||||
setTitle("Arbitrateor - Audio Jukebox");
|
||||
priv_int->playerUI = new PlayerInterface(this);
|
||||
priv_int->playerUI->hide();
|
||||
priv_int->loginUI = new LoginInterface(this);
|
||||
priv_int->loginUI->animateShow(Wt::WAnimation(Wt::WAnimation::AnimationEffect::SlideInFromTop));
|
||||
root()->addWidget(priv_int->playerUI);
|
||||
root()->addWidget(priv_int->loginUI);
|
||||
}
|
||||
|
||||
WebInterface::~WebInterface()
|
||||
{
|
||||
delete priv_int->playerUI;
|
||||
delete priv_int->loginUI;
|
||||
delete priv_int;
|
||||
}
|
||||
|
||||
void WebInterface::loginCompleted()
|
||||
{
|
||||
//Login completed, now bring up main inteface.
|
||||
root()->removeWidget(priv_int->loginUI);
|
||||
root()->addWidget(new Wt::WText("you did it"));
|
||||
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));
|
||||
//TODO: set up player to dynamically update?
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ class WebInterface : public Wt::WApplication
|
||||
{
|
||||
public:
|
||||
WebInterface(const Wt::WEnvironment& env);
|
||||
~WebInterface();
|
||||
void loginCompleted();
|
||||
private:
|
||||
struct internal;
|
||||
|
||||
@@ -18,12 +18,33 @@
|
||||
*/
|
||||
|
||||
#include "LoginInterface.h"
|
||||
#include <Wt/WText>
|
||||
|
||||
LoginInterface::LoginInterface(WebInterface* app)
|
||||
{
|
||||
this->app = app;
|
||||
loginContainer = new Wt::WContainerWidget();
|
||||
loginLayout = new Wt::WVBoxLayout();
|
||||
loginContainer->setLayout(loginLayout);
|
||||
usernameArea = new Wt::WHBoxLayout();
|
||||
passwordArea = new Wt::WHBoxLayout();
|
||||
usernameContainer = new Wt::WContainerWidget();
|
||||
passwordContainer = new Wt::WContainerWidget();
|
||||
usernameContainer->setLayout(usernameArea);
|
||||
passwordContainer->setLayout(passwordArea);
|
||||
usernameField = new Wt::WLineEdit();
|
||||
passwordField = new Wt::WLineEdit();
|
||||
passwordField->setEchoMode(Wt::WLineEdit::EchoMode::Password);
|
||||
usernameArea->addWidget(new Wt::WText("Username:"));
|
||||
usernameArea->addWidget(usernameField);
|
||||
passwordArea->addWidget(new Wt::WText("Password:"));
|
||||
passwordArea->addWidget(passwordField);
|
||||
loginLayout->addWidget(new Wt::WText("Please Login to access."));
|
||||
loginLayout->addWidget(usernameContainer);
|
||||
loginLayout->addWidget(passwordContainer);
|
||||
loginButton = new Wt::WPushButton("Login");
|
||||
loginButton->clicked().connect(app, &WebInterface::loginCompleted);
|
||||
setContentAlignment(Wt::AlignmentFlag::AlignCenter);
|
||||
addChild(loginButton);
|
||||
loginLayout->addWidget(loginButton);
|
||||
addChild(loginContainer);
|
||||
loginContainer->setWidth(Wt::WLength(50, Wt::WLength::Percentage));
|
||||
}
|
||||
|
||||
@@ -22,6 +22,10 @@
|
||||
|
||||
#include <Wt/WContainerWidget>
|
||||
#include <Wt/WPushButton>
|
||||
#include <Wt/WVBoxLayout>
|
||||
#include <Wt/WHBoxLayout>
|
||||
#include <Wt/WLineEdit>
|
||||
#include <Wt/WText>
|
||||
#include "../WebInterface.h"
|
||||
|
||||
class LoginInterface : public Wt::WContainerWidget
|
||||
@@ -30,6 +34,15 @@ public:
|
||||
LoginInterface(WebInterface* app);
|
||||
private:
|
||||
Wt::WPushButton* loginButton;
|
||||
Wt::WVBoxLayout* loginLayout;
|
||||
Wt::WContainerWidget* loginContainer;
|
||||
Wt::WHBoxLayout* usernameArea;
|
||||
Wt::WContainerWidget* usernameContainer;
|
||||
Wt::WHBoxLayout* passwordArea;
|
||||
Wt::WContainerWidget* passwordContainer;
|
||||
Wt::WLineEdit* usernameField;
|
||||
Wt::WLineEdit* passwordField;
|
||||
WebInterface* app;
|
||||
};
|
||||
|
||||
#endif // LOGININTERFACE_H
|
||||
|
||||
27
src/ui/PlayerInterface.cpp
Normal file
27
src/ui/PlayerInterface.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* 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 "PlayerInterface.h"
|
||||
#include <Wt/WText>
|
||||
|
||||
PlayerInterface::PlayerInterface(WebInterface* app)
|
||||
{
|
||||
this->app = app;
|
||||
addChild(new Wt::WText("You did it."));
|
||||
}
|
||||
33
src/ui/PlayerInterface.h
Normal file
33
src/ui/PlayerInterface.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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 PLAYERINTERFACE_H
|
||||
#define PLAYERINTERFACE_H
|
||||
|
||||
#include <Wt/WContainerWidget>
|
||||
#include "../WebInterface.h"
|
||||
|
||||
class PlayerInterface : public Wt::WContainerWidget
|
||||
{
|
||||
public:
|
||||
PlayerInterface(WebInterface* app);
|
||||
WebInterface* app;
|
||||
};
|
||||
|
||||
#endif // PLAYERINTERFACE_H
|
||||
Reference in New Issue
Block a user