Use album grouping function
This commit is contained in:
@@ -670,11 +670,7 @@ QVariant CollectionModel::data(const QModelIndex &idx, const int role) const {
|
|||||||
bool is_album_node = false;
|
bool is_album_node = false;
|
||||||
if (role == Qt::DecorationRole && item->type == CollectionItem::Type_Container) {
|
if (role == Qt::DecorationRole && item->type == CollectionItem::Type_Container) {
|
||||||
GroupBy container_type = group_by_[item->container_level];
|
GroupBy container_type = group_by_[item->container_level];
|
||||||
is_album_node = container_type == GroupBy_Album ||
|
is_album_node = IsAlbumGrouping(container_type);
|
||||||
container_type == GroupBy_AlbumDisc ||
|
|
||||||
container_type == GroupBy_YearAlbum ||
|
|
||||||
container_type == GroupBy_YearAlbumDisc ||
|
|
||||||
container_type == GroupBy_OriginalYearAlbum;
|
|
||||||
}
|
}
|
||||||
if (is_album_node) {
|
if (is_album_node) {
|
||||||
// It has const behaviour some of the time - that's ok right?
|
// It has const behaviour some of the time - that's ok right?
|
||||||
|
|||||||
@@ -179,6 +179,8 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
|
|
||||||
quint64 icon_cache_disk_size() { return sIconCache->cacheSize(); }
|
quint64 icon_cache_disk_size() { return sIconCache->cacheSize(); }
|
||||||
|
|
||||||
|
static bool IsAlbumGrouping(const GroupBy group_by) { return group_by == GroupBy_Album || group_by == GroupBy_YearAlbum || group_by == GroupBy_OriginalYearAlbum || group_by == GroupBy_AlbumDisc || group_by == GroupBy_YearAlbumDisc; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void TotalSongCountUpdated(const int count);
|
void TotalSongCountUpdated(const int count);
|
||||||
void TotalArtistCountUpdated(const int count);
|
void TotalArtistCountUpdated(const int count);
|
||||||
@@ -251,7 +253,6 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
|
|||||||
QVariant data(const CollectionItem *item, const int role) const;
|
QVariant data(const CollectionItem *item, const int role) const;
|
||||||
bool CompareItems(const CollectionItem *a, const CollectionItem *b) const;
|
bool CompareItems(const CollectionItem *a, const CollectionItem *b) const;
|
||||||
int MaximumCacheSize(QSettings *s, const char *size_id, const char *size_unit_id, const int cache_size_default) const;
|
int MaximumCacheSize(QSettings *s, const char *size_id, const char *size_unit_id, const int cache_size_default) const;
|
||||||
bool IsAlbumGrouping(const GroupBy group_by) const { return group_by == GroupBy_Album || group_by == GroupBy_YearAlbum || group_by == GroupBy_OriginalYearAlbum || group_by == GroupBy_AlbumDisc || group_by == GroupBy_YearAlbumDisc; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CollectionBackend *backend_;
|
CollectionBackend *backend_;
|
||||||
|
|||||||
@@ -803,13 +803,7 @@ void InternetSearchView::LazyLoadAlbumCover(const QModelIndex &proxy_index) {
|
|||||||
|
|
||||||
// Is this an album?
|
// Is this an album?
|
||||||
const CollectionModel::GroupBy container_type = CollectionModel::GroupBy(proxy_index.data(CollectionModel::Role_ContainerType).toInt());
|
const CollectionModel::GroupBy container_type = CollectionModel::GroupBy(proxy_index.data(CollectionModel::Role_ContainerType).toInt());
|
||||||
if (container_type != CollectionModel::GroupBy_Album &&
|
if (!CollectionModel::IsAlbumGrouping(container_type)) return;
|
||||||
container_type != CollectionModel::GroupBy_AlbumDisc &&
|
|
||||||
container_type != CollectionModel::GroupBy_YearAlbum &&
|
|
||||||
container_type != CollectionModel::GroupBy_YearAlbumDisc &&
|
|
||||||
container_type != CollectionModel::GroupBy_OriginalYearAlbum) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark the item as loading art
|
// Mark the item as loading art
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user