Fix setting pixmap cache limit

This commit is contained in:
Jonas Kvinge 2019-11-19 21:49:46 +01:00
parent b386ca14df
commit cf0442d5b8
2 changed files with 4 additions and 1 deletions

View File

@ -70,6 +70,7 @@ using std::placeholders::_2;
const char *CollectionModel::kSavedGroupingsSettingsGroup = "SavedGroupings";
const int CollectionModel::kPrettyCoverSize = 32;
const int CollectionModel::kPixmapCacheLimit = QPixmapCache::cacheLimit() * 8;
static bool IsArtistGroupBy(const CollectionModel::GroupBy by) {
return by == CollectionModel::GroupBy_Artist || by == CollectionModel::GroupBy_AlbumArtist;
@ -125,7 +126,7 @@ CollectionModel::CollectionModel(CollectionBackend *backend, Application *app, Q
backend_->UpdateTotalArtistCountAsync();
backend_->UpdateTotalAlbumCountAsync();
QPixmapCache::setCacheLimit(QPixmapCache::cacheLimit() * 8);
QPixmapCache::setCacheLimit(kPixmapCacheLimit);
}
@ -835,6 +836,7 @@ void CollectionModel::BeginReset() {
divider_nodes_.clear();
pending_art_.clear();
pending_cache_keys_.clear();
QPixmapCache::clear();
root_ = new CollectionItem(this);
root_->compilation_artist_node_ = nullptr;

View File

@ -70,6 +70,7 @@ class CollectionModel : public SimpleTreeModel<CollectionItem> {
static const char *kSavedGroupingsSettingsGroup;
static const int kPrettyCoverSize;
static const int kPixmapCacheLimit;
enum Role {
Role_Type = Qt::UserRole + 1,