Use static QPixmapCache
This commit is contained in:
@@ -151,7 +151,6 @@ void RadioModel::Reset() {
|
|||||||
beginResetModel();
|
beginResetModel();
|
||||||
container_nodes_.clear();
|
container_nodes_.clear();
|
||||||
items_.clear();
|
items_.clear();
|
||||||
pixmap_cache_.clear();
|
|
||||||
pending_art_.clear();
|
pending_art_.clear();
|
||||||
pending_cache_keys_.clear();
|
pending_cache_keys_.clear();
|
||||||
delete root_;
|
delete root_;
|
||||||
@@ -282,7 +281,7 @@ QPixmap RadioModel::ChannelIcon(const QModelIndex &idx) {
|
|||||||
const QString cache_key = ChannelIconPixmapCacheKey(idx);
|
const QString cache_key = ChannelIconPixmapCacheKey(idx);
|
||||||
|
|
||||||
QPixmap cached_pixmap;
|
QPixmap cached_pixmap;
|
||||||
if (pixmap_cache_.find(cache_key, &cached_pixmap)) {
|
if (QPixmapCache::find(cache_key, &cached_pixmap)) {
|
||||||
return cached_pixmap;
|
return cached_pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,10 +315,10 @@ void RadioModel::AlbumCoverLoaded(const quint64 id, const AlbumCoverLoaderResult
|
|||||||
pending_cache_keys_.remove(cache_key);
|
pending_cache_keys_.remove(cache_key);
|
||||||
|
|
||||||
if (!result.success || result.image_scaled.isNull() || result.type == AlbumCoverLoaderResult::Type_ManuallyUnset) {
|
if (!result.success || result.image_scaled.isNull() || result.type == AlbumCoverLoaderResult::Type_ManuallyUnset) {
|
||||||
pixmap_cache_.insert(cache_key, ServiceIcon(item));
|
QPixmapCache::insert(cache_key, ServiceIcon(item));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pixmap_cache_.insert(cache_key, QPixmap::fromImage(result.image_scaled));
|
QPixmapCache::insert(cache_key, QPixmap::fromImage(result.image_scaled));
|
||||||
}
|
}
|
||||||
|
|
||||||
const QModelIndex idx = ItemToIndex(item);
|
const QModelIndex idx = ItemToIndex(item);
|
||||||
|
|||||||
@@ -94,7 +94,6 @@ class RadioModel : public SimpleTreeModel<RadioItem> {
|
|||||||
AlbumCoverLoaderOptions cover_loader_options_;
|
AlbumCoverLoaderOptions cover_loader_options_;
|
||||||
QMap<Song::Source, RadioItem*> container_nodes_;
|
QMap<Song::Source, RadioItem*> container_nodes_;
|
||||||
QList<RadioItem*> items_;
|
QList<RadioItem*> items_;
|
||||||
QPixmapCache pixmap_cache_;
|
|
||||||
QMap<quint64, ItemAndCacheKey> pending_art_;
|
QMap<quint64, ItemAndCacheKey> pending_art_;
|
||||||
QSet<QString> pending_cache_keys_;
|
QSet<QString> pending_cache_keys_;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user