fix: artistview nullptr connect warning + album version in header

- Move updateToggleText() after m_list creation to avoid null connects
- Show version (e.g. "Deluxe") in album header title

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
joren
2026-03-24 23:55:12 +01:00
parent e4c2694584
commit 4ba6d00748
2 changed files with 4 additions and 2 deletions

View File

@@ -30,7 +30,6 @@ ArtistSection::ArtistSection(const QString &title, QWidget *parent)
" border: none; border-bottom: 1px solid #333; }"
"QToolButton:hover { background: #1e1e1e; }"
));
updateToggleText(0);
layout->addWidget(m_toggle);
m_list = new AlbumListView(this);
@@ -38,6 +37,7 @@ ArtistSection::ArtistSection(const QString &title, QWidget *parent)
connect(m_toggle, &QToolButton::toggled, m_list, &AlbumListView::setVisible);
connect(m_list, &AlbumListView::albumSelected, this, &ArtistSection::albumSelected);
updateToggleText(0);
}
void ArtistSection::setAlbums(const QJsonArray &albums)

View File

@@ -119,7 +119,9 @@ public:
void setAlbum(const QJsonObject &album)
{
m_title->setText(album["title"].toString());
const QString base = album["title"].toString();
const QString ver = album["version"].toString().trimmed();
m_title->setText(ver.isEmpty() ? base : base + QStringLiteral(" (") + ver + QLatin1Char(')'));
m_artistId = static_cast<qint64>(album["artist"].toObject()["id"].toDouble());
m_subtitle->setText(album["artist"].toObject()["name"].toString());
m_subtitle->setEnabled(m_artistId > 0);