[UI] Added release name in the play queue
This commit is contained in:
+12
-10
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
#include "PlayQueue.hpp"
|
#include "PlayQueue.hpp"
|
||||||
|
|
||||||
static const int NameRole = Wt::UserRole;
|
static const int TrackInfoRole = Wt::UserRole;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -219,10 +219,11 @@ TrackSelector::setSize(std::size_t size)
|
|||||||
refreshPositions();
|
refreshPositions();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Name
|
struct TrackInfo
|
||||||
{
|
{
|
||||||
Wt::WString track;
|
Wt::WString track;
|
||||||
Wt::WString artist;
|
Wt::WString artist;
|
||||||
|
Wt::WString release;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlayQueueItemDelegate : public Wt::WItemDelegate
|
class PlayQueueItemDelegate : public Wt::WItemDelegate
|
||||||
@@ -234,13 +235,13 @@ class PlayQueueItemDelegate : public Wt::WItemDelegate
|
|||||||
{
|
{
|
||||||
Wt::WWidget* res;
|
Wt::WWidget* res;
|
||||||
|
|
||||||
if (!index.data(NameRole).empty())
|
if (!index.data(TrackInfoRole).empty())
|
||||||
{
|
{
|
||||||
Name name = boost::any_cast<Name>(index.data(NameRole));
|
TrackInfo trackInfo = boost::any_cast<TrackInfo>(index.data(TrackInfoRole));
|
||||||
|
|
||||||
Wt::WContainerWidget *container = new Wt::WContainerWidget();
|
Wt::WContainerWidget *container = new Wt::WContainerWidget();
|
||||||
Wt::WText* track = new Wt::WText(name.track, Wt::PlainText, container);
|
Wt::WText* track = new Wt::WText(trackInfo.track, Wt::PlainText, container);
|
||||||
Wt::WText* artist = new Wt::WText(name.artist, Wt::PlainText, container);
|
Wt::WText* artist = new Wt::WText(trackInfo.artist + " - " + trackInfo.release, Wt::PlainText, container);
|
||||||
|
|
||||||
artist->setInline(false);
|
artist->setInline(false);
|
||||||
track->setInline(false);
|
track->setInline(false);
|
||||||
@@ -381,10 +382,11 @@ PlayQueue::addTracks(const std::vector<Database::Track::id_type>& trackIds)
|
|||||||
coverUrl = "images/unknown-cover.jpg";
|
coverUrl = "images/unknown-cover.jpg";
|
||||||
_model->setData(dataRow, COLUMN_ID_COVER, coverUrl, Wt::DecorationRole);
|
_model->setData(dataRow, COLUMN_ID_COVER, coverUrl, Wt::DecorationRole);
|
||||||
|
|
||||||
Name name;
|
TrackInfo trackInfo;
|
||||||
name.track = Wt::WString::fromUTF8(track->getName());
|
trackInfo.track = Wt::WString::fromUTF8(track->getName());
|
||||||
name.artist = Wt::WString::fromUTF8(track->getArtistName());
|
trackInfo.artist = Wt::WString::fromUTF8(track->getArtistName());
|
||||||
_model->setData(dataRow, COLUMN_ID_NAME, name, NameRole);
|
trackInfo.release = Wt::WString::fromUTF8(track->getReleaseName());
|
||||||
|
_model->setData(dataRow, COLUMN_ID_NAME, trackInfo, TrackInfoRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user