From 7eba050af3c1e740174d59709d6ec6152dbe62b8 Mon Sep 17 00:00:00 2001 From: emeric Date: Fri, 23 Jan 2015 12:48:30 +0100 Subject: [PATCH] [UI] Added release name in the play queue --- src/ui/audio/PlayQueue.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/ui/audio/PlayQueue.cpp b/src/ui/audio/PlayQueue.cpp index b854cc84..e94b3f53 100644 --- a/src/ui/audio/PlayQueue.cpp +++ b/src/ui/audio/PlayQueue.cpp @@ -34,7 +34,7 @@ #include "PlayQueue.hpp" -static const int NameRole = Wt::UserRole; +static const int TrackInfoRole = Wt::UserRole; namespace { @@ -219,10 +219,11 @@ TrackSelector::setSize(std::size_t size) refreshPositions(); } -struct Name +struct TrackInfo { Wt::WString track; Wt::WString artist; + Wt::WString release; }; class PlayQueueItemDelegate : public Wt::WItemDelegate @@ -234,13 +235,13 @@ class PlayQueueItemDelegate : public Wt::WItemDelegate { Wt::WWidget* res; - if (!index.data(NameRole).empty()) + if (!index.data(TrackInfoRole).empty()) { - Name name = boost::any_cast(index.data(NameRole)); + TrackInfo trackInfo = boost::any_cast(index.data(TrackInfoRole)); Wt::WContainerWidget *container = new Wt::WContainerWidget(); - Wt::WText* track = new Wt::WText(name.track, Wt::PlainText, container); - Wt::WText* artist = new Wt::WText(name.artist, Wt::PlainText, container); + Wt::WText* track = new Wt::WText(trackInfo.track, Wt::PlainText, container); + Wt::WText* artist = new Wt::WText(trackInfo.artist + " - " + trackInfo.release, Wt::PlainText, container); artist->setInline(false); track->setInline(false); @@ -381,10 +382,11 @@ PlayQueue::addTracks(const std::vector& trackIds) coverUrl = "images/unknown-cover.jpg"; _model->setData(dataRow, COLUMN_ID_COVER, coverUrl, Wt::DecorationRole); - Name name; - name.track = Wt::WString::fromUTF8(track->getName()); - name.artist = Wt::WString::fromUTF8(track->getArtistName()); - _model->setData(dataRow, COLUMN_ID_NAME, name, NameRole); + TrackInfo trackInfo; + trackInfo.track = Wt::WString::fromUTF8(track->getName()); + trackInfo.artist = Wt::WString::fromUTF8(track->getArtistName()); + trackInfo.release = Wt::WString::fromUTF8(track->getReleaseName()); + _model->setData(dataRow, COLUMN_ID_NAME, trackInfo, TrackInfoRole); } }