From c5bc3ea4dd660ab685764b0a7965ab6c4e253717 Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Fri, 20 Feb 2015 21:43:02 +0100 Subject: [PATCH 1/2] One time pixmap cache update Code will now perform a one time check on starting to see if the cache has been updated to the new 2048 default. If the update has not been set we update. After this time if the user lowers the level, it will not reset back to 2048 by default. --- cockatrice/src/settingscache.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 027c23e1..9f7b641c 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -23,7 +23,16 @@ SettingsCache::SettingsCache() picDownload = settings->value("personal/picturedownload", true).toBool(); picDownloadHq = settings->value("personal/picturedownloadhq", true).toBool(); - pixmapCacheSize = settings->value("personal/pixmapCacheSize", PIXMAPCACHE_SIZE_DEFAULT).toInt(); + + // we only want to reset the cache once, then its up to the user + bool updateCache = settings->value("update/pixmapCacheSize", false).toBool(); + if (!updateCache) { + pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT; + settings->setValue("personal/pixmapCacheSize", pixmapCacheSize); + settings->setValue("update/pixmapCacheSize", true); + } + else + pixmapCacheSize = settings->value("personal/pixmapCacheSize", PIXMAPCACHE_SIZE_DEFAULT).toInt(); //sanity check if(pixmapCacheSize < PIXMAPCACHE_SIZE_MIN || pixmapCacheSize > PIXMAPCACHE_SIZE_MAX) pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT; From 6a91f3a97622ba1367644d6c5e9f14ff958852fe Mon Sep 17 00:00:00 2001 From: Matt Lowe Date: Fri, 20 Feb 2015 21:50:16 +0100 Subject: [PATCH 2/2] Added hq image to check --- cockatrice/src/settingscache.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/cockatrice/src/settingscache.cpp b/cockatrice/src/settingscache.cpp index 9f7b641c..d3b482b9 100644 --- a/cockatrice/src/settingscache.cpp +++ b/cockatrice/src/settingscache.cpp @@ -21,14 +21,12 @@ SettingsCache::SettingsCache() playerBgPath = settings->value("zonebg/playerarea").toString(); cardBackPicturePath = settings->value("paths/cardbackpicture").toString(); - picDownload = settings->value("personal/picturedownload", true).toBool(); - picDownloadHq = settings->value("personal/picturedownloadhq", true).toBool(); - // we only want to reset the cache once, then its up to the user bool updateCache = settings->value("update/pixmapCacheSize", false).toBool(); if (!updateCache) { pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT; settings->setValue("personal/pixmapCacheSize", pixmapCacheSize); + settings->setValue("personal/picturedownloadhq", true); settings->setValue("update/pixmapCacheSize", true); } else @@ -37,6 +35,9 @@ SettingsCache::SettingsCache() if(pixmapCacheSize < PIXMAPCACHE_SIZE_MIN || pixmapCacheSize > PIXMAPCACHE_SIZE_MAX) pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT; + picDownload = settings->value("personal/picturedownload", true).toBool(); + picDownloadHq = settings->value("personal/picturedownloadhq", true).toBool(); + picUrl = settings->value("personal/picUrl", PIC_URL_DEFAULT).toString(); picUrlHq = settings->value("personal/picUrlHq", PIC_URL_HQ_DEFAULT).toString(); picUrlFallback = settings->value("personal/picUrlFallback", PIC_URL_FALLBACK).toString();