Added playlist skeleton

This commit is contained in:
emeric
2018-02-19 16:07:14 +01:00
parent 7ffc9a3262
commit 6060296649
21 changed files with 419 additions and 38 deletions
+14 -3
View File
@@ -30,6 +30,7 @@
#include "utils/Utils.hpp"
#include "LmsApplication.hpp"
#include "Filters.hpp"
#include "ReleasesView.hpp"
namespace UserInterface {
@@ -77,18 +78,20 @@ Releases::refresh(std::vector<std::string> searchKeywords)
for (auto release : releases)
{
auto releaseId = release.id();
Wt::WTemplate* entry = new Wt::WTemplate(Wt::WString::tr("template-releases-entry"), _releasesContainer);
entry->addFunction("tr", Wt::WTemplate::Functions::tr);
Wt::WAnchor* coverAnchor = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/release/" + std::to_string(release.id())));
Wt::WAnchor* coverAnchor = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/release/" + std::to_string(releaseId)));
Wt::WImage* cover = new Wt::WImage(coverAnchor);
cover->setImageLink(SessionImageResource()->getReleaseUrl(release.id(), 128));
cover->setImageLink(SessionImageResource()->getReleaseUrl(releaseId, 128));
// Some images may not be square
cover->setWidth(128);
entry->bindWidget("cover", coverAnchor);
{
Wt::WAnchor* releaseAnchor = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/release/" + std::to_string(release.id())));
Wt::WAnchor* releaseAnchor = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/release/" + std::to_string(releaseId)));
Wt::WText* releaseName = new Wt::WText(releaseAnchor);
releaseName->setText(Wt::WString::fromUTF8(release->getName(), Wt::PlainText));
entry->bindWidget("release-name", releaseAnchor);
@@ -110,9 +113,17 @@ Releases::refresh(std::vector<std::string> searchKeywords)
auto playBtn = new Wt::WText(Wt::WString::tr("btn-releases-play-btn"), Wt::XHTMLText);
entry->bindWidget("play-btn", playBtn);
playBtn->clicked().connect(std::bind([=]
{
releasePlay.emit(releaseId);
}));
auto addBtn = new Wt::WText(Wt::WString::tr("btn-releases-add-btn"), Wt::XHTMLText);
entry->bindWidget("add-btn", addBtn);
addBtn->clicked().connect(std::bind([=]
{
releaseAdd.emit(releaseId);
}));
}
}