feat: artist sections, fav indicator, art scaling fix, volume popup fix
- Artist profile: collapsible Albums / EPs & Singles / Other sections keyed on release_type; fetches up to 200 albums per artist - Favorites: starred icon on favorited tracks, context menu shows Add or Remove (not both); IDs cached when fav tracks are loaded - Shuffle button: one-time shuffle via shuffleNow() without touching global shuffle flag, so double-click still plays in order - Now-playing art: replaced setFixedHeight hack with ArtWidget that overrides hasHeightForWidth() — scales smoothly up and down, no min-size - Volume popup: replaced QMenu (laggy, broken drag) with Qt::Popup QFrame; appears below button; fixed size locked at 100% label width Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -84,12 +84,30 @@ void Tracks::setPlayingTrackId(qint64 id)
|
||||
m_model->setPlayingId(id);
|
||||
}
|
||||
|
||||
void Tracks::setFavTrackIds(const QSet<qint64> &ids)
|
||||
{
|
||||
m_model->setFavIds(ids);
|
||||
}
|
||||
|
||||
void Tracks::addFavTrackId(qint64 id)
|
||||
{
|
||||
m_model->addFavId(id);
|
||||
}
|
||||
|
||||
void Tracks::removeFavTrackId(qint64 id)
|
||||
{
|
||||
m_model->removeFavId(id);
|
||||
}
|
||||
|
||||
void Tracks::playAll(bool shuffle)
|
||||
{
|
||||
const QJsonArray tracks = m_model->currentTracksJson();
|
||||
if (tracks.isEmpty()) return;
|
||||
m_queue->setShuffle(shuffle);
|
||||
m_queue->setContext(tracks, 0);
|
||||
// Shuffle once without touching the global shuffle flag — so a subsequent
|
||||
// double-click on a track plays in normal order (unless global shuffle is on).
|
||||
if (shuffle && !m_queue->shuffleEnabled())
|
||||
m_queue->shuffleNow();
|
||||
const qint64 firstId = static_cast<qint64>(m_queue->current()["id"].toDouble());
|
||||
if (firstId > 0)
|
||||
emit playTrackRequested(firstId);
|
||||
@@ -119,8 +137,21 @@ void Tracks::onContextMenu(const QPoint &pos)
|
||||
auto *playNext = menu.addAction(QIcon(":/res/icons/media-skip-forward.svg"), tr("Play next"));
|
||||
auto *addQueue = menu.addAction(QIcon(":/res/icons/media-playlist-append.svg"), tr("Add to queue"));
|
||||
menu.addSeparator();
|
||||
auto *addFav = menu.addAction(QIcon(":/res/icons/starred-symbolic.svg"), tr("Add to favorites"));
|
||||
auto *remFav = menu.addAction(QIcon(":/res/icons/non-starred-symbolic.svg"), tr("Remove from favorites"));
|
||||
|
||||
const bool isFav = m_model->isFav(id);
|
||||
if (isFav) {
|
||||
auto *remFav = menu.addAction(QIcon(":/res/icons/non-starred-symbolic.svg"), tr("Remove from favorites"));
|
||||
connect(remFav, &QAction::triggered, this, [this, id] {
|
||||
m_backend->removeFavTrack(id);
|
||||
m_model->removeFavId(id);
|
||||
});
|
||||
} else {
|
||||
auto *addFav = menu.addAction(QIcon(":/res/icons/starred-symbolic.svg"), tr("Add to favorites"));
|
||||
connect(addFav, &QAction::triggered, this, [this, id] {
|
||||
m_backend->addFavTrack(id);
|
||||
m_model->addFavId(id);
|
||||
});
|
||||
}
|
||||
|
||||
const int row = index.row();
|
||||
connect(playNow, &QAction::triggered, this, [this, id, row] {
|
||||
@@ -133,12 +164,6 @@ void Tracks::onContextMenu(const QPoint &pos)
|
||||
connect(addQueue, &QAction::triggered, this, [this, trackJson] {
|
||||
m_queue->addToQueue(trackJson);
|
||||
});
|
||||
connect(addFav, &QAction::triggered, this, [this, id] {
|
||||
m_backend->addFavTrack(id);
|
||||
});
|
||||
connect(remFav, &QAction::triggered, this, [this, id] {
|
||||
m_backend->removeFavTrack(id);
|
||||
});
|
||||
|
||||
// Open album
|
||||
const QString albumId = m_model->trackAt(index.row()).albumId;
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QVector>
|
||||
#include <QPair>
|
||||
#include <QString>
|
||||
#include <QSet>
|
||||
|
||||
namespace List
|
||||
{
|
||||
@@ -28,6 +29,11 @@ namespace List
|
||||
/// Called when the backend fires EV_TRACK_CHANGED so the playing row is highlighted.
|
||||
void setPlayingTrackId(qint64 id);
|
||||
|
||||
/// Populate favorite track IDs so the star indicator and context menu reflect fav status.
|
||||
void setFavTrackIds(const QSet<qint64> &ids);
|
||||
void addFavTrackId(qint64 id);
|
||||
void removeFavTrackId(qint64 id);
|
||||
|
||||
/// Start playing all tracks in the current view from the beginning.
|
||||
/// If shuffle is true, enables shuffle mode before starting.
|
||||
void playAll(bool shuffle = false);
|
||||
|
||||
Reference in New Issue
Block a user