From d2c2fc33d96ea724eeadd6ae6983c7f203f0cb16 Mon Sep 17 00:00:00 2001 From: Nico Sonack Date: Tue, 8 Aug 2023 23:51:46 +0200 Subject: [PATCH] feat: Add list of external artist urls to ArtistLinks menu Just a minor feature that I was missing when I was digging around in Spotify. Also, this enables tooltips on the artist menu such that you can preview the URL you're about to open in your web browser. Signed-off-by: Nico Sonack --- src/menu/artistlinks.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/menu/artistlinks.cpp b/src/menu/artistlinks.cpp index f87c81f3f..a432ba551 100644 --- a/src/menu/artistlinks.cpp +++ b/src/menu/artistlinks.cpp @@ -8,6 +8,7 @@ Menu::ArtistLinks::ArtistLinks(const lib::spt::artist &artist, { setIcon(Icon::get("edit-find")); setTitle("Links"); + setToolTipsVisible(true); QMenu::connect(this, &QMenu::aboutToShow, this, &Menu::ArtistLinks::onAboutToShow); @@ -17,6 +18,13 @@ Menu::ArtistLinks::ArtistLinks(const lib::spt::artist &artist, this, &Menu::ArtistLinks::onDuckDuckGo); addSeparator(); + + for (auto const& ext_url : artist.external_urls) { + addLink(ext_url.first, ext_url.second); + } + + addSeparator(); + loading = addAction("Searching..."); loading->setEnabled(false); } @@ -43,6 +51,7 @@ void Menu::ArtistLinks::onDuckDuckGo(bool /*checked*/) void Menu::ArtistLinks::addLink(const std::string &title, const std::string &url) { auto *action = addAction(QString::fromStdString(title)); + action->setToolTip(QString::fromStdString(url)); QAction::connect(action, &QAction::triggered, [this, url](bool /*checked*/) { Url::open(url, LinkType::Web, this);