From 5a602cddaad7c670c309661f9c27edfcf1bcf064 Mon Sep 17 00:00:00 2001 From: Kevin Whitaker Date: Tue, 21 Feb 2017 00:26:16 -0500 Subject: [PATCH] Add empty tabs to fill. --- CMakeLists.txt | 2 +- src/WebInterface.cpp | 1 + src/ui/AdminInterface.cpp | 25 +++++++++++++++++++++++++ src/ui/AdminInterface.h | 33 +++++++++++++++++++++++++++++++++ src/ui/PlayerInterface.cpp | 3 +++ src/ui/PlayerInterface.h | 4 ++++ src/ui/UploadInterface.cpp | 25 +++++++++++++++++++++++++ src/ui/UploadInterface.h | 33 +++++++++++++++++++++++++++++++++ 8 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 src/ui/AdminInterface.cpp create mode 100644 src/ui/AdminInterface.h create mode 100644 src/ui/UploadInterface.cpp create mode 100644 src/ui/UploadInterface.h diff --git a/CMakeLists.txt b/CMakeLists.txt index fec0b32..10924b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ find_package(Wt REQUIRED) find_package(Groove REQUIRED) find_package(TagLib REQUIRED) -add_executable(arbitrateor src/main.cpp src/WebInterface.cpp src/GroovePlayer.cpp src/ui/LoginInterface.cpp src/ui/PlayerInterface.cpp src/ui/TrackDetails.cpp src/ui/RequestInterface.cpp) +add_executable(arbitrateor src/main.cpp src/WebInterface.cpp src/GroovePlayer.cpp src/ui/LoginInterface.cpp src/ui/PlayerInterface.cpp src/ui/TrackDetails.cpp src/ui/RequestInterface.cpp src/ui/UploadInterface.cpp src/ui/AdminInterface.cpp) target_link_libraries(arbitrateor ${Wt_LIBRARIES} ${GROOVE_LIBRARY} ${GROOVE_FINGERPRINT_LIBRARY} ${GROOVE_PLAYER_LIBRARY} ${TAGLIB_LIBRARY} pthread boost_system stdc++fs) #TODO get threading links based on platform. Remove gcc experimental fs when official c++17 exists. install(TARGETS arbitrateor RUNTIME DESTINATION bin) diff --git a/src/WebInterface.cpp b/src/WebInterface.cpp index bf2e1cc..6d42271 100644 --- a/src/WebInterface.cpp +++ b/src/WebInterface.cpp @@ -46,6 +46,7 @@ WebInterface::WebInterface(const Wt::WEnvironment& env) : Wt::WApplication(env) root()->addWidget(priv_int->loginUI); priv_int->loginUI->animateShow(Wt::WAnimation(Wt::WAnimation::AnimationEffect::SlideInFromTop)); priv_int->loginUI->checkSessionValidity(); + if(currentUser.isAdmin) priv_int->playerUI->mainDisplay->addTab(priv_int->playerUI->adminPane, "Admin", Wt::WTabWidget::LazyLoading); notificationSlot.setJavaScript(getNotificationJs("")); } diff --git a/src/ui/AdminInterface.cpp b/src/ui/AdminInterface.cpp new file mode 100644 index 0000000..0d683e8 --- /dev/null +++ b/src/ui/AdminInterface.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2017 Kevin Whitaker + * + * 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 "AdminInterface.h" + +AdminInterface::AdminInterface(WebInterface* app) +{ + this->app = app; +} diff --git a/src/ui/AdminInterface.h b/src/ui/AdminInterface.h new file mode 100644 index 0000000..df428d3 --- /dev/null +++ b/src/ui/AdminInterface.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 Kevin Whitaker + * + * 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 ADMININTERFACE_H +#define ADMININTERFACE_H + +#include +#include "../WebInterface.h" + +class AdminInterface : public Wt::WContainerWidget +{ +public: + AdminInterface(WebInterface* app); + WebInterface* app; +}; + +#endif // ADMININTERFACE_H diff --git a/src/ui/PlayerInterface.cpp b/src/ui/PlayerInterface.cpp index f608afc..a5a1268 100644 --- a/src/ui/PlayerInterface.cpp +++ b/src/ui/PlayerInterface.cpp @@ -67,6 +67,8 @@ PlayerInterface::PlayerInterface(WebInterface* app) mainDisplay = new Wt::WTabWidget(); requestPane = new RequestInterface(app); + uploadPane = new UploadInterface(app); + adminPane = new AdminInterface(app); voteMetaContainer = new Wt::WContainerWidget(); voteMetaLayout = new Wt::WVBoxLayout(); @@ -123,6 +125,7 @@ PlayerInterface::PlayerInterface(WebInterface* app) interfaceLayout->addWidget(mainDisplay); mainDisplay->addTab(voteMetaContainer,"Up Next",Wt::WTabWidget::PreLoading); mainDisplay->addTab(requestPane, "Make Request", Wt::WTabWidget::LazyLoading); + mainDisplay->addTab(uploadPane, "Upload Track", Wt::WTabWidget::LazyLoading); playControlWidget->addStyleClass("panel"); playControlWidget->addStyleClass("panel-default"); playControlWidget->decorationStyle().setBackgroundColor(Wt::WColor("gainsboro")); diff --git a/src/ui/PlayerInterface.h b/src/ui/PlayerInterface.h index 1f299ea..9adcb35 100644 --- a/src/ui/PlayerInterface.h +++ b/src/ui/PlayerInterface.h @@ -31,6 +31,8 @@ #include #include "TrackDetails.h" #include "RequestInterface.h" +#include "UploadInterface.h" +#include "AdminInterface.h" #include class PlayerInterface : public Wt::WContainerWidget @@ -57,6 +59,8 @@ public: //TabView Wt::WTabWidget* mainDisplay; RequestInterface* requestPane; + UploadInterface* uploadPane; + AdminInterface* adminPane; //Vote Controls Wt::WContainerWidget* voteMetaContainer; diff --git a/src/ui/UploadInterface.cpp b/src/ui/UploadInterface.cpp new file mode 100644 index 0000000..191dfd6 --- /dev/null +++ b/src/ui/UploadInterface.cpp @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2017 Kevin Whitaker + * + * 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 "UploadInterface.h" + +UploadInterface::UploadInterface(WebInterface* app) +{ + this->app = app; +} diff --git a/src/ui/UploadInterface.h b/src/ui/UploadInterface.h new file mode 100644 index 0000000..d7f7290 --- /dev/null +++ b/src/ui/UploadInterface.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2017 Kevin Whitaker + * + * 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 UPLOADINTERFACE_H +#define UPLOADINTERFACE_H + +#include +#include "../WebInterface.h" + +class UploadInterface : public Wt::WContainerWidget +{ +public: + UploadInterface(WebInterface* app); + WebInterface* app; +}; + +#endif // UPLOADINTERFACE_H -- GitLab