From 9b1e78c662123883e74ebff9f2f3a72733fdc081 Mon Sep 17 00:00:00 2001 From: emeric Date: Sun, 10 Apr 2022 14:30:00 +0200 Subject: [PATCH] Still converting to bootstrap 5 --- approot/explore.xml | 4 ++-- approot/release.xml | 32 ++++++++++++------------------ approot/tracks.xml | 6 +++--- src/lms/ui/LmsApplication.cpp | 1 + src/lms/ui/explore/ReleaseView.cpp | 27 ++++++++++++++----------- 5 files changed, 34 insertions(+), 36 deletions(-) diff --git a/approot/explore.xml b/approot/explore.xml index a73606e7..3d872f35 100644 --- a/approot/explore.xml +++ b/approot/explore.xml @@ -5,8 +5,8 @@ ${contents} - - + + ${add-filter class="btn-sm btn-info me-1"}${clusters class="d-inline-block"} diff --git a/approot/release.xml b/approot/release.xml index f5ffe1be..ff6e9d41 100644 --- a/approot/release.xml +++ b/approot/release.xml @@ -8,17 +8,17 @@
-
+
${cover class="Lms-explore-release-cover"}
-
+
${name} ${}${artists}${} ${}${tr:Lms.Explore.various-artists}${} - ${}${year}${} (${orig-year})${} · ${}${duration} + ${}${year}${} (${orig-year})${} · ${}${duration} ${clusters class="mb-2"} - ${play-btn class="me-2"}${more-btn} + ${play-btn class="btn btn-dark me-2"}${more-btn class="btn btn-dark"}
${container class="d-grid gap-3"}
@@ -55,27 +55,21 @@ -
-
+
+
${}${track-number}${}
-
+
${name} - ${}${artists}${} + ${}
${artists}
${
}
-
-
- ${play-btn class="me-2"}${more-btn} -
-
- ${duration} -
+
+ ${duration} +
+
+ ${more-btn class="btn btn-sm btn-outline-secondary border-0"}
- - ${artist} - - diff --git a/approot/tracks.xml b/approot/tracks.xml index 471bb3e0..d03cfbdf 100644 --- a/approot/tracks.xml +++ b/approot/tracks.xml @@ -12,16 +12,16 @@ -
+
${cover}
-
${name}
+ ${name} ${} - ${}${release class="Lms-btn Lms-releasename text-primary"}${} + ${}${release}${} ${}${artists}${} ${}
diff --git a/src/lms/ui/LmsApplication.cpp b/src/lms/ui/LmsApplication.cpp index d151a7cc..7f650fbe 100644 --- a/src/lms/ui/LmsApplication.cpp +++ b/src/lms/ui/LmsApplication.cpp @@ -452,6 +452,7 @@ LmsApplication::createHome() _coverResource = std::make_shared(); declareJavaScriptFunction("onLoadCover", "function(id) { id.className += \" Lms-cover-loaded\"}"); + declareJavaScriptFunction("stopPropagation", "function(event) { event.stopPropagation() }"); doJavaScript("$('body').tooltip({ selector: '[data-toggle=\"tooltip\"]'})"); Wt::WTemplate* main {root()->addWidget(std::make_unique(Wt::WString::tr("Lms.main.template")))}; diff --git a/src/lms/ui/explore/ReleaseView.cpp b/src/lms/ui/explore/ReleaseView.cpp index 3b8d5431..d1573fce 100644 --- a/src/lms/ui/explore/ReleaseView.cpp +++ b/src/lms/ui/explore/ReleaseView.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -159,7 +160,7 @@ Release::refreshView() } { - Wt::WText* playBtn {bindNew("play-btn", Wt::WString::tr("Lms.Explore.template.play-btn"), Wt::TextFormat::XHTML)}; + Wt::WPushButton* playBtn {bindNew("play-btn", Wt::WString::tr("Lms.Explore.template.play-btn"), Wt::TextFormat::XHTML)}; playBtn->clicked().connect([=] { releasesAction.emit(PlayQueueAction::Play, {*releaseId}); @@ -167,7 +168,7 @@ Release::refreshView() } { - Wt::WText* moreBtn {bindNew("more-btn", Wt::WString::tr("Lms.Explore.template.more-btn"), Wt::TextFormat::XHTML)}; + Wt::WPushButton* moreBtn {bindNew("more-btn", Wt::WString::tr("Lms.Explore.template.more-btn"), Wt::TextFormat::XHTML)}; moreBtn->clicked().connect([=] { displayReleasePopupMenu(*moreBtn, *releaseId, releasesAction); @@ -218,6 +219,11 @@ Release::refreshView() Wt::WTemplate* entry {container->addNew(Wt::WString::tr("Lms.Explore.Release.template.entry"))}; + entry->clicked().connect([=] + { + tracksAction.emit(PlayQueueAction::Play, {trackId}); + }); + entry->bindString("name", Wt::WString::fromUTF8(track->getName()), Wt::TextFormat::Plain); const auto artists {track->getArtists({TrackArtistLinkType::Artist})}; @@ -226,10 +232,13 @@ Release::refreshView() entry->setCondition("if-has-artists", true); Wt::WContainerWidget* artistsContainer {entry->bindNew("artists")}; + bool firstArtist {true}; for (const auto& artist : artists) { - Wt::WTemplate *t {artistsContainer->addNew(Wt::WString::tr("Lms.Explore.Release.template.entry-artist"))}; - t->bindWidget("artist", LmsApplication::createArtistAnchor(artist)); + if (!firstArtist) + artistsContainer->addNew(" · "); + artistsContainer->addWidget(LmsApplication::createArtistAnchor(artist)); + firstArtist = false; } } @@ -240,14 +249,8 @@ Release::refreshView() entry->bindInt("track-number", *trackNumber); } - Wt::WText* playBtn {entry->bindNew("play-btn", Wt::WString::tr("Lms.Explore.template.play-btn"), Wt::TextFormat::XHTML)}; - playBtn->clicked().connect([=]() - { - tracksAction.emit(PlayQueueAction::Play, {trackId}); - }); - - Wt::WText* moreBtn {entry->bindNew("more-btn", Wt::WString::tr("Lms.Explore.template.more-btn"), Wt::TextFormat::XHTML)}; - moreBtn->clicked().connect([=]() + Wt::WPushButton* moreBtn {entry->bindNew("more-btn", Wt::WString::tr("Lms.Explore.template.more-btn"), Wt::TextFormat::XHTML)}; + moreBtn->clicked().connect([=] { displayTrackPopupMenu(*moreBtn, trackId, tracksAction); });