Now really display artist/release names as plain text
This commit is contained in:
@@ -161,15 +161,31 @@ Scanner::MediaScanner& MediaScanner()
|
||||
}
|
||||
|
||||
Wt::WAnchor*
|
||||
LmsApplication::createArtistAnchor(Database::id_type id)
|
||||
LmsApplication::createArtistAnchor(Database::Artist::pointer artist, bool addText)
|
||||
{
|
||||
return new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/artist/" + std::to_string(id)));
|
||||
auto res = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/artist/" + std::to_string(artist.id())));
|
||||
|
||||
if (addText)
|
||||
{
|
||||
res->setTextFormat(Wt::PlainText);
|
||||
res->setText(Wt::WString::fromUTF8(artist->getName()));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
Wt::WAnchor*
|
||||
LmsApplication::createReleaseAnchor(Database::id_type id)
|
||||
LmsApplication::createReleaseAnchor(Database::Release::pointer release, bool addText)
|
||||
{
|
||||
return new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/release/" + std::to_string(id)));
|
||||
auto res = new Wt::WAnchor(Wt::WLink(Wt::WLink::InternalPath, "/release/" + std::to_string(release.id())));
|
||||
|
||||
if (addText)
|
||||
{
|
||||
res->setTextFormat(Wt::PlainText);
|
||||
res->setText(Wt::WString::fromUTF8(release->getName()));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -51,8 +51,8 @@ class LmsApplication : public Wt::WApplication
|
||||
void quit();
|
||||
void notify(const Wt::WString& message);
|
||||
|
||||
static Wt::WAnchor* createArtistAnchor(Database::id_type id);
|
||||
static Wt::WAnchor* createReleaseAnchor(Database::id_type id);
|
||||
static Wt::WAnchor* createArtistAnchor(Database::Artist::pointer artist, bool addText = true);
|
||||
static Wt::WAnchor* createReleaseAnchor(Database::Release::pointer release, bool addText = true);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
@@ -228,18 +228,14 @@ PlayQueue::addSome()
|
||||
if (artist)
|
||||
{
|
||||
entry->setCondition("if-has-artist", true);
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(track->getArtist().id());
|
||||
Wt::WText *artistText = new Wt::WText(artistAnchor);
|
||||
artistText->setText(Wt::WString::fromUTF8(artist->getName(), Wt::PlainText));
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(track->getArtist());
|
||||
entry->bindWidget("artist-name", artistAnchor);
|
||||
}
|
||||
auto release = track->getRelease();
|
||||
if (release)
|
||||
{
|
||||
entry->setCondition("if-has-release", true);
|
||||
Wt::WAnchor *releaseAnchor = LmsApplication::createReleaseAnchor(track->getRelease().id());
|
||||
Wt::WText *releaseText = new Wt::WText(releaseAnchor);
|
||||
releaseText->setText(Wt::WString::fromUTF8(release->getName(), Wt::PlainText));
|
||||
Wt::WAnchor *releaseAnchor = LmsApplication::createReleaseAnchor(track->getRelease());
|
||||
entry->bindWidget("release-name", releaseAnchor);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ Artist::refresh()
|
||||
entry->addFunction("tr", Wt::WTemplate::Functions::tr);
|
||||
|
||||
{
|
||||
Wt::WAnchor* coverAnchor = LmsApplication::createReleaseAnchor(releaseId);
|
||||
Wt::WAnchor* coverAnchor = LmsApplication::createReleaseAnchor(release, false);
|
||||
Wt::WImage* cover = new Wt::WImage(coverAnchor);
|
||||
cover->setImageLink(LmsApp->getImageResource()->getReleaseUrl(release.id(), 128));
|
||||
// Some images may not be square
|
||||
@@ -132,9 +132,7 @@ Artist::refresh()
|
||||
}
|
||||
|
||||
{
|
||||
Wt::WAnchor* releaseAnchor = LmsApplication::createReleaseAnchor(releaseId);
|
||||
Wt::WText* releaseName = new Wt::WText(releaseAnchor);
|
||||
releaseName->setText(Wt::WString::fromUTF8(release->getName(), Wt::PlainText));
|
||||
Wt::WAnchor* releaseAnchor = LmsApplication::createReleaseAnchor(release);
|
||||
entry->bindWidget("name", releaseAnchor);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include <Wt/WAnchor>
|
||||
#include <Wt/WText>
|
||||
#include <Wt/WTemplate>
|
||||
#include <Wt/WLineEdit>
|
||||
|
||||
@@ -93,9 +92,7 @@ Artists::addSome()
|
||||
entry->bindInt("nb-release", artist->getReleases(clusterIds).size());
|
||||
|
||||
{
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(artist.id());
|
||||
Wt::WText *artistText = new Wt::WText(artistAnchor);
|
||||
artistText->setText(Wt::WString::fromUTF8(artist->getName(), Wt::PlainText));
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(artist);
|
||||
entry->bindWidget("name", artistAnchor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,9 +103,7 @@ Release::refresh()
|
||||
else if (artists.size() == 1)
|
||||
{
|
||||
t->setCondition("if-has-artist", true);
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(artists.front().id());
|
||||
Wt::WText *artist = new Wt::WText(artistAnchor);
|
||||
artist->setText(Wt::WString::fromUTF8(artists.front()->getName(), Wt::PlainText));
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(artists.front());
|
||||
t->bindWidget("artist-name", artistAnchor);
|
||||
}
|
||||
}
|
||||
@@ -165,9 +163,7 @@ Release::refresh()
|
||||
if (variousArtists && track->getArtist())
|
||||
{
|
||||
entry->setCondition("if-has-artist", true);
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(track->getArtist().id());
|
||||
Wt::WText *artistText = new Wt::WText(artistAnchor);
|
||||
artistText->setText(Wt::WString::fromUTF8(track->getArtist()->getName(), Wt::PlainText));
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(track->getArtist());
|
||||
entry->bindWidget("artist-name", artistAnchor);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ Releases::addSome()
|
||||
Wt::WTemplate* entry = new Wt::WTemplate(Wt::WString::tr("Lms.Explore.Releases.template.entry"), _releasesContainer);
|
||||
entry->addFunction("tr", Wt::WTemplate::Functions::tr);
|
||||
|
||||
Wt::WAnchor* coverAnchor = LmsApplication::createReleaseAnchor(releaseId);
|
||||
Wt::WAnchor* coverAnchor = LmsApplication::createReleaseAnchor(release, false);
|
||||
Wt::WImage* cover = new Wt::WImage(coverAnchor);
|
||||
cover->setImageLink(LmsApp->getImageResource()->getReleaseUrl(releaseId, 128));
|
||||
// Some images may not be square
|
||||
@@ -101,9 +101,7 @@ Releases::addSome()
|
||||
entry->bindWidget("cover", coverAnchor);
|
||||
|
||||
{
|
||||
Wt::WAnchor* releaseAnchor = LmsApplication::createReleaseAnchor(releaseId);
|
||||
Wt::WText* releaseName = new Wt::WText(releaseAnchor);
|
||||
releaseName->setText(Wt::WString::fromUTF8(release->getName(), Wt::PlainText));
|
||||
Wt::WAnchor* releaseAnchor = LmsApplication::createReleaseAnchor(release);
|
||||
entry->bindWidget("release-name", releaseAnchor);
|
||||
}
|
||||
|
||||
@@ -116,9 +114,7 @@ Releases::addSome()
|
||||
else if (artists.size() == 1)
|
||||
{
|
||||
entry->setCondition("if-has-artist", true);
|
||||
Wt::WAnchor* artistAnchor = LmsApplication::createArtistAnchor(artists.front().id());
|
||||
Wt::WText* artist = new Wt::WText(artistAnchor);
|
||||
artist->setText(Wt::WString::fromUTF8(artists.front()->getName(), Wt::PlainText));
|
||||
Wt::WAnchor* artistAnchor = LmsApplication::createArtistAnchor(artists.front());
|
||||
entry->bindWidget("artist-name", artistAnchor);
|
||||
}
|
||||
|
||||
|
||||
@@ -126,9 +126,7 @@ Tracks::addSome()
|
||||
if (artist)
|
||||
{
|
||||
entry->setCondition("if-has-artist", true);
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(track->getArtist().id());
|
||||
Wt::WText *artistText = new Wt::WText(artistAnchor);
|
||||
artistText->setText(Wt::WString::fromUTF8(artist->getName(), Wt::PlainText));
|
||||
Wt::WAnchor *artistAnchor = LmsApplication::createArtistAnchor(track->getArtist());
|
||||
entry->bindWidget("artist-name", artistAnchor);
|
||||
}
|
||||
|
||||
@@ -136,9 +134,7 @@ Tracks::addSome()
|
||||
if (release)
|
||||
{
|
||||
entry->setCondition("if-has-release", true);
|
||||
Wt::WAnchor *releaseAnchor = LmsApplication::createReleaseAnchor(track->getRelease().id());
|
||||
Wt::WText *releaseText = new Wt::WText(releaseAnchor);
|
||||
releaseText->setText(Wt::WString::fromUTF8(release->getName(), Wt::PlainText));
|
||||
Wt::WAnchor *releaseAnchor = LmsApplication::createReleaseAnchor(track->getRelease());
|
||||
entry->bindWidget("release-name", releaseAnchor);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user