mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-10 00:04:48 -07:00
Cache redirects properly by implementing our own QSettings cache for urls. (#5186)
* Cache redirects properly by implementing our own QSettings cache for urls. * Load and store redirects properly. * Set the maximum network cache size from settings value on PictureLoaderWorker instantiation. * Address comments. * Lint. * Adjust debug statements to be in line with existing ones. * Minor Tweaks * Make redirect cache ttl a user-adjustable setting. * Fix Build * Minor Cleanup * Minor Cleanup * Build Fix --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: ZeldaZach <zahalpern+github@gmail.com>
This commit is contained in:
parent
1bc92623dc
commit
83409c32c4
8 changed files with 178 additions and 16 deletions
|
|
@ -221,6 +221,7 @@ SettingsCache::SettingsCache()
|
|||
pixmapCacheSize = PIXMAPCACHE_SIZE_DEFAULT;
|
||||
|
||||
networkCacheSize = settings->value("personal/networkCacheSize", NETWORK_CACHE_SIZE_DEFAULT).toInt();
|
||||
redirectCacheTtl = settings->value("personal/redirectCacheTtl", NETWORK_REDIRECT_CACHE_TTL_DEFAULT).toInt();
|
||||
|
||||
picDownload = settings->value("personal/picturedownload", true).toBool();
|
||||
|
||||
|
|
@ -657,6 +658,13 @@ void SettingsCache::setNetworkCacheSizeInMB(const int _networkCacheSize)
|
|||
emit networkCacheSizeChanged(networkCacheSize);
|
||||
}
|
||||
|
||||
void SettingsCache::setNetworkRedirectCacheTtl(const int _redirectCacheTtl)
|
||||
{
|
||||
redirectCacheTtl = _redirectCacheTtl;
|
||||
settings->setValue("personal/redirectCacheSize", redirectCacheTtl);
|
||||
emit redirectCacheTtlChanged(redirectCacheTtl);
|
||||
}
|
||||
|
||||
void SettingsCache::setClientID(const QString &_clientID)
|
||||
{
|
||||
clientID = _clientID;
|
||||
|
|
@ -1030,6 +1038,7 @@ void SettingsCache::loadPaths()
|
|||
replaysPath = getSafeConfigPath("paths/replays", dataPath + "/replays/");
|
||||
themesPath = getSafeConfigPath("paths/themes", dataPath + "/themes/");
|
||||
picsPath = getSafeConfigPath("paths/pics", dataPath + "/pics/");
|
||||
redirectCachePath = getSafeConfigPath("paths/redirects", getCachePath() + "/redirects/");
|
||||
// this has never been exposed as an user-configurable setting
|
||||
if (picsPath.endsWith("/")) {
|
||||
customPicsPath = getSafeConfigPath("paths/custompics", picsPath + "CUSTOM/");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue