diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ee701b04309e644f839bf5362650441b87b9b3c..67fbec597b1ec11f1881fa4495bde57b882202b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/src/WebInterface.cpp b/src/WebInterface.cpp index 896ea690319b6e65574bc392c2066c66de6b5c7e..3f8f09a9fd134bc3f2e8f0d0c63575acdf4ad8a2 100644 --- a/src/WebInterface.cpp +++ b/src/WebInterface.cpp @@ -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? } diff --git a/src/WebInterface.h b/src/WebInterface.h index 012b9d4c69a6d60b8ae4a85b1143a1e4cf7eca82..ca5c0b5f278b33855dfcf8df3f3fbb960323573d 100644 --- a/src/WebInterface.h +++ b/src/WebInterface.h @@ -27,6 +27,7 @@ class WebInterface : public Wt::WApplication { public: WebInterface(const Wt::WEnvironment& env); + ~WebInterface(); void loginCompleted(); private: struct internal; diff --git a/src/ui/LoginInterface.cpp b/src/ui/LoginInterface.cpp index c70ba6bf066bb906b985f9fd649e5b417344df0a..9ee626e11fd0bfc8b2e675586edeeb00c7a67799 100644 --- a/src/ui/LoginInterface.cpp +++ b/src/ui/LoginInterface.cpp @@ -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)); } diff --git a/src/ui/LoginInterface.h b/src/ui/LoginInterface.h index 0b0c63a8ec2a966480e9a2810f1de3a7d4fa7c7f..aaca2b460af0da91996476099d72112c72045b8f 100644 --- a/src/ui/LoginInterface.h +++ b/src/ui/LoginInterface.h @@ -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 diff --git a/src/ui/PlayerInterface.cpp b/src/ui/PlayerInterface.cpp new file mode 100644 index 0000000000000000000000000000000000000000..f6f7ff91d2f9a3f4baed657c4dc52f28a59f5aa8 --- /dev/null +++ b/src/ui/PlayerInterface.cpp @@ -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.")); +} diff --git a/src/ui/PlayerInterface.h b/src/ui/PlayerInterface.h new file mode 100644 index 0000000000000000000000000000000000000000..84ed2d1774d53125f7b136bc0a8ade51fa69f85d --- /dev/null +++ b/src/ui/PlayerInterface.h @@ -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