Refactor things so less manual layout is done where not needed. Yields proper boostrap panel.

This commit is contained in:
Kevin Whitaker
2017-02-19 16:40:33 -05:00
parent 4f2eb8232d
commit c6c2eccec5
4 changed files with 21 additions and 10 deletions

View File

@@ -32,7 +32,6 @@ PlayerInterface::PlayerInterface(WebInterface* app)
interfaceLayout = new Wt::WVBoxLayout(); interfaceLayout = new Wt::WVBoxLayout();
this->setLayout(interfaceLayout); this->setLayout(interfaceLayout);
playControlLayout = new Wt::WHBoxLayout(); playControlLayout = new Wt::WHBoxLayout();
voteControlLayout = new Wt::WVBoxLayout();
playControlWidget = new Wt::WContainerWidget(); playControlWidget = new Wt::WContainerWidget();
skipControls = new Wt::WContainerWidget(); skipControls = new Wt::WContainerWidget();
playControlWidget->setLayout(playControlLayout); playControlWidget->setLayout(playControlLayout);
@@ -67,16 +66,15 @@ PlayerInterface::PlayerInterface(WebInterface* app)
skipControls->addWidget(skipDeny); skipControls->addWidget(skipDeny);
mainDisplay = new Wt::WTabWidget(); mainDisplay = new Wt::WTabWidget();
requestPane = new RequestInterface(app);
voteMetaContainer = new Wt::WContainerWidget(); voteMetaContainer = new Wt::WContainerWidget();
voteMetaLayout = new Wt::WVBoxLayout(); voteMetaLayout = new Wt::WVBoxLayout();
voteMetaContainer->setLayout(voteMetaLayout); voteMetaContainer->setLayout(voteMetaLayout);
voteControlContainer = new Wt::WContainerWidget(); voteControlContainer = new Wt::WContainerWidget();
voteControlContainer->setMaximumSize(Wt::WLength(75,Wt::WLength::Percentage),Wt::WLength::Auto); voteControlContainer->setMaximumSize(Wt::WLength(75,Wt::WLength::Percentage),Wt::WLength::Auto);
voteControlContainer->decorationStyle().setBackgroundColor(Wt::WColor("lightsteelblue")); votePanel = new Wt::WPanel();
voteControlContainer->addStyleClass("panel"); votePanel->addStyleClass("panel-primary");
voteHeader = new Wt::WText("Upcoming Tracks To Vote On");
voteHeader->addStyleClass("panel-heading");
voteTracksContainer = new Wt::WContainerWidget(); voteTracksContainer = new Wt::WContainerWidget();
voteTracksContainer->addStyleClass("panel-body"); voteTracksContainer->addStyleClass("panel-body");
voteTracksLayout = new Wt::WVBoxLayout(); voteTracksLayout = new Wt::WVBoxLayout();
@@ -124,6 +122,7 @@ PlayerInterface::PlayerInterface(WebInterface* app)
interfaceLayout->addWidget(currentTrackProgress); interfaceLayout->addWidget(currentTrackProgress);
interfaceLayout->addWidget(mainDisplay); interfaceLayout->addWidget(mainDisplay);
mainDisplay->addTab(voteMetaContainer,"Up Next",Wt::WTabWidget::PreLoading); mainDisplay->addTab(voteMetaContainer,"Up Next",Wt::WTabWidget::PreLoading);
mainDisplay->addTab(requestPane, "Make Request", Wt::WTabWidget::LazyLoading);
playControlWidget->addStyleClass("panel"); playControlWidget->addStyleClass("panel");
playControlWidget->addStyleClass("panel-default"); playControlWidget->addStyleClass("panel-default");
playControlWidget->decorationStyle().setBackgroundColor(Wt::WColor("gainsboro")); playControlWidget->decorationStyle().setBackgroundColor(Wt::WColor("gainsboro"));
@@ -131,9 +130,10 @@ PlayerInterface::PlayerInterface(WebInterface* app)
playControlLayout->addWidget(playpause,0,Wt::AlignmentFlag::AlignLeft | Wt::AlignmentFlag::AlignMiddle); playControlLayout->addWidget(playpause,0,Wt::AlignmentFlag::AlignLeft | Wt::AlignmentFlag::AlignMiddle);
playControlLayout->addWidget(currentTrackDetails,0,Wt::AlignmentFlag::AlignCenter | Wt::AlignmentFlag::AlignMiddle); playControlLayout->addWidget(currentTrackDetails,0,Wt::AlignmentFlag::AlignCenter | Wt::AlignmentFlag::AlignMiddle);
playControlLayout->addWidget(skipControls,0,Wt::AlignmentFlag::AlignRight | Wt::AlignmentFlag::AlignMiddle); playControlLayout->addWidget(skipControls,0,Wt::AlignmentFlag::AlignRight | Wt::AlignmentFlag::AlignMiddle);
voteControlContainer->setLayout(voteControlLayout); votePanel->setTitle("Upcoming Tracks To Vote On");
voteControlLayout->addWidget(voteHeader,0,Wt::AlignmentFlag::AlignCenter); votePanel->decorationStyle().setBackgroundColor(Wt::WColor("lightsteelblue"));
voteControlLayout->addWidget(voteTracksContainer); voteControlContainer->addWidget(votePanel);
votePanel->setCentralWidget(voteTracksContainer);
voteTracksContainer->setLayout(voteTracksLayout); voteTracksContainer->setLayout(voteTracksLayout);
voteTracksLayout->addLayout(track1); voteTracksLayout->addLayout(track1);
voteTracksLayout->addSpacing(Wt::WLength(20,Wt::WLength::Pixel)); voteTracksLayout->addSpacing(Wt::WLength(20,Wt::WLength::Pixel));

View File

@@ -30,6 +30,8 @@
#include <Wt/WProgressBar> #include <Wt/WProgressBar>
#include <Wt/WTimer> #include <Wt/WTimer>
#include "TrackDetails.h" #include "TrackDetails.h"
#include "RequestInterface.h"
#include <Wt/WPanel>
class PlayerInterface : public Wt::WContainerWidget class PlayerInterface : public Wt::WContainerWidget
{ {
@@ -40,7 +42,6 @@ public:
Wt::WVBoxLayout* interfaceLayout; Wt::WVBoxLayout* interfaceLayout;
Wt::WHBoxLayout* playControlLayout; Wt::WHBoxLayout* playControlLayout;
Wt::WContainerWidget* playControlWidget; Wt::WContainerWidget* playControlWidget;
Wt::WVBoxLayout* voteControlLayout;
//Play controls //Play controls
TrackDetails* currentTrackDetails; TrackDetails* currentTrackDetails;
@@ -55,13 +56,14 @@ public:
//TabView //TabView
Wt::WTabWidget* mainDisplay; Wt::WTabWidget* mainDisplay;
RequestInterface* requestPane;
//Vote Controls //Vote Controls
Wt::WContainerWidget* voteMetaContainer; Wt::WContainerWidget* voteMetaContainer;
Wt::WVBoxLayout* voteMetaLayout; Wt::WVBoxLayout* voteMetaLayout;
Wt::WPanel* votePanel;
Wt::WContainerWidget* voteControlContainer; Wt::WContainerWidget* voteControlContainer;
Wt::WContainerWidget* voteTracksContainer; Wt::WContainerWidget* voteTracksContainer;
Wt::WText* voteHeader;
Wt::WVBoxLayout* voteTracksLayout; Wt::WVBoxLayout* voteTracksLayout;
Wt::WHBoxLayout* track1; Wt::WHBoxLayout* track1;
Wt::WHBoxLayout* track2; Wt::WHBoxLayout* track2;

View File

@@ -18,3 +18,9 @@
*/ */
#include "RequestInterface.h" #include "RequestInterface.h"
RequestInterface::RequestInterface(WebInterface* app)
{
this->app = app;
//TODO
}

View File

@@ -28,6 +28,9 @@ class RequestInterface : public Wt::WContainerWidget
public: public:
RequestInterface(WebInterface* app); RequestInterface(WebInterface* app);
WebInterface* app; WebInterface* app;
Wt::WContainerWidget* searchHeader;
Wt::WContainerWidget* resultBody;
}; };
#endif // REQUESTINTERFACE_H #endif // REQUESTINTERFACE_H