From 9f0e941476aacf1b3fe1fa8b6e749d286eb4d87b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Fri, 22 Nov 2024 19:42:50 +0100 Subject: [PATCH] Set the maximum network cache size from settings value on PictureLoaderWorker instantiation. --- cockatrice/src/client/ui/picture_loader.cpp | 2 ++ cockatrice/src/dialogs/dlg_settings.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/client/ui/picture_loader.cpp b/cockatrice/src/client/ui/picture_loader.cpp index ba37a8448..c363c861f 100644 --- a/cockatrice/src/client/ui/picture_loader.cpp +++ b/cockatrice/src/client/ui/picture_loader.cpp @@ -136,6 +136,8 @@ PictureLoaderWorker::PictureLoaderWorker() #endif auto cache = new QNetworkDiskCache(this); cache->setCacheDirectory(SettingsCache::instance().getNetworkCachePath()); + cache->setMaximumCacheSize(1024L * 1024L * + static_cast(SettingsCache::instance().getNetworkCacheSizeInMB())); // Note: the settings is in MB, but QNetworkDiskCache uses bytes connect(&SettingsCache::instance(), &SettingsCache::networkCacheSizeChanged, cache, [cache](int newSizeInMB) { cache->setMaximumCacheSize(1024L * 1024L * static_cast(newSizeInMB)); }); diff --git a/cockatrice/src/dialogs/dlg_settings.cpp b/cockatrice/src/dialogs/dlg_settings.cpp index efdff930a..72a3f5fcc 100644 --- a/cockatrice/src/dialogs/dlg_settings.cpp +++ b/cockatrice/src/dialogs/dlg_settings.cpp @@ -844,7 +844,7 @@ void DeckEditorSettingsPage::retranslateUi() urlLinkLabel.setText(QString("%2").arg(WIKI_CUSTOM_PIC_URL).arg(tr("How to add a custom URL"))); clearDownloadedPicsButton.setText(tr("Delete Downloaded Images")); resetDownloadURLs.setText(tr("Reset Download URLs")); - networkCacheLabel.setText(tr("Downloaded images directory size:")); + networkCacheLabel.setText(tr("Network Cache Size:")); networkCacheEdit.setToolTip(tr("On-disk cache for downloaded pictures")); pixmapCacheLabel.setText(tr("Picture cache size:")); pixmapCacheEdit.setToolTip(tr("In-memory cache for pictures not currently on screen"));