/* * 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 REQUESTINTERFACE_H #define REQUESTINTERFACE_H #include #include "../WebInterface.h" #include #include #include #include #include #include "TrackDetails.h" class RequestInterface : public Wt::WContainerWidget { public: RequestInterface(WebInterface* app); WebInterface* app; class RequestItem : public Wt::WContainerWidget { public: TrackDetails* track; Wt::WHBoxLayout* layout; Wt::WPushButton* voteBtn; RequestInterface* parent; void requestClicked() { this->parent->trackRequestClicked(track->extractTrackFromDetails()); }; RequestItem(RequestInterface* parent, AudioTrack track) { this->track = new TrackDetails(); this->track->updateWithTrackDetails(track); this->track->changeBackgroundColor(Wt::WColor("gainsboro")); layout = new Wt::WHBoxLayout(); voteBtn = new Wt::WPushButton(); this->parent = parent; this->setLayout(layout); voteBtn->setTextFormat(Wt::XHTMLText); voteBtn->decorationStyle().font().setFamily(Wt::WFont::Default,"FontAwesome"); voteBtn->setText(""); layout->addWidget(this->track,1,Wt::AlignmentFlag::AlignMiddle | Wt::AlignmentFlag::AlignLeft); layout->addWidget(voteBtn,0,Wt::AlignmentFlag::AlignMiddle | Wt::AlignmentFlag::AlignRight); voteBtn->clicked().connect(this, &RequestItem::requestClicked); }; ~RequestItem(){ this->clear(); } }; Wt::WVBoxLayout* mainLayout; Wt::WContainerWidget* searchHeader; Wt::WHBoxLayout* searchLayout; Wt::WLineEdit* searchBox; Wt::WPushButton* searchBtn; Wt::WContainerWidget* resultBody; Wt::WGridLayout* resultLayout; std::list foundItems; void trackRequestClicked(AudioTrack track); void searchClicked(); }; #endif // REQUESTINTERFACE_H