Skip to content

Commit

Permalink
CollectionModel: Always create QNetworkDiskCache
Browse files Browse the repository at this point in the history
Fixes #1593
  • Loading branch information
jonaski committed Nov 3, 2024
1 parent 9584222 commit a2017c0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/collection/collectionmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ CollectionModel::CollectionModel(const SharedPtr<CollectionBackend> backend, con
total_artist_count_(0),
total_album_count_(0),
loading_(false),
icon_disk_cache_(nullptr) {
icon_disk_cache_(new QNetworkDiskCache(this)) {

setObjectName(backend_->source() == Song::Source::Collection ? QLatin1String(metaObject()->className()) : QStringLiteral("%1%2").arg(Song::DescriptionForSource(backend_->source()), QLatin1String(metaObject()->className())));

Expand All @@ -114,10 +114,7 @@ CollectionModel::CollectionModel(const SharedPtr<CollectionBackend> backend, con
pixmap_no_cover_ = nocover.pixmap(nocover_sizes.last()).scaled(kPrettyCoverSize, kPrettyCoverSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
}

if (!qgetenv("DISPLAY").isEmpty() && !icon_disk_cache_) {
icon_disk_cache_ = new QNetworkDiskCache(this);
icon_disk_cache_->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + u'/' + QLatin1String(kPixmapDiskCacheDir) + u'-' + Song::TextForSource(backend_->source()));
}
icon_disk_cache_->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + u'/' + QLatin1String(kPixmapDiskCacheDir) + u'-' + Song::TextForSource(backend_->source()));

QObject::connect(&*backend_, &CollectionBackend::SongsAdded, this, &CollectionModel::AddReAddOrUpdate);
QObject::connect(&*backend_, &CollectionBackend::SongsChanged, this, &CollectionModel::AddReAddOrUpdate);
Expand Down

0 comments on commit a2017c0

Please sign in to comment.