mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-30 18:43:55 -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
|
|
@ -16,16 +16,21 @@
|
|||
|
||||
class ReleaseChannel;
|
||||
|
||||
// size should be a multiple of 64
|
||||
#define PIXMAPCACHE_SIZE_DEFAULT 2047
|
||||
// In MB (Increments of 64)
|
||||
#define PIXMAPCACHE_SIZE_DEFAULT 2048
|
||||
#define PIXMAPCACHE_SIZE_MIN 64
|
||||
#define PIXMAPCACHE_SIZE_MAX 2047
|
||||
#define PIXMAPCACHE_SIZE_MAX 4096
|
||||
|
||||
// In MB
|
||||
constexpr int NETWORK_CACHE_SIZE_DEFAULT = 1024 * 4; // 4 GB
|
||||
constexpr int NETWORK_CACHE_SIZE_MIN = 1; // 1 MB
|
||||
constexpr int NETWORK_CACHE_SIZE_MAX = 1024 * 1024; // 1 TB
|
||||
|
||||
// In Days
|
||||
#define NETWORK_REDIRECT_CACHE_TTL_DEFAULT 30
|
||||
#define NETWORK_REDIRECT_CACHE_TTL_MIN 1
|
||||
#define NETWORK_REDIRECT_CACHE_TTL_MAX 90
|
||||
|
||||
#define DEFAULT_LANG_NAME "English"
|
||||
#define CLIENT_INFO_NOT_SET "notset"
|
||||
|
||||
|
|
@ -53,6 +58,7 @@ signals:
|
|||
void ignoreUnregisteredUserMessagesChanged();
|
||||
void pixmapCacheSizeChanged(int newSizeInMBs);
|
||||
void networkCacheSizeChanged(int newSizeInMBs);
|
||||
void redirectCacheTtlChanged(int newTtl);
|
||||
void masterVolumeChanged(int value);
|
||||
void chatMentionCompleterChanged();
|
||||
void downloadSpoilerTimeIndexChanged();
|
||||
|
|
@ -73,8 +79,8 @@ private:
|
|||
QByteArray tokenDialogGeometry;
|
||||
QByteArray setsDialogGeometry;
|
||||
QString lang;
|
||||
QString deckPath, replaysPath, picsPath, customPicsPath, cardDatabasePath, customCardDatabasePath, themesPath,
|
||||
spoilerDatabasePath, tokenDatabasePath, themeName;
|
||||
QString deckPath, replaysPath, picsPath, redirectCachePath, customPicsPath, cardDatabasePath,
|
||||
customCardDatabasePath, themesPath, spoilerDatabasePath, tokenDatabasePath, themeName;
|
||||
bool notifyAboutUpdates;
|
||||
bool notifyAboutNewVersion;
|
||||
bool showTipsOnStartup;
|
||||
|
|
@ -116,6 +122,7 @@ private:
|
|||
bool useTearOffMenus;
|
||||
int pixmapCacheSize;
|
||||
int networkCacheSize;
|
||||
int redirectCacheTtl;
|
||||
bool scaleCards;
|
||||
int verticalCardOverlapPercent;
|
||||
bool showMessagePopups;
|
||||
|
|
@ -183,6 +190,10 @@ public:
|
|||
{
|
||||
return picsPath;
|
||||
}
|
||||
QString getRedirectCachePath() const
|
||||
{
|
||||
return redirectCachePath;
|
||||
}
|
||||
QString getCustomPicsPath() const
|
||||
{
|
||||
return customPicsPath;
|
||||
|
|
@ -356,6 +367,10 @@ public:
|
|||
{
|
||||
return networkCacheSize;
|
||||
}
|
||||
int getRedirectCacheTtl() const
|
||||
{
|
||||
return redirectCacheTtl;
|
||||
}
|
||||
bool getScaleCards() const
|
||||
{
|
||||
return scaleCards;
|
||||
|
|
@ -557,6 +572,7 @@ public slots:
|
|||
void setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages);
|
||||
void setPixmapCacheSize(const int _pixmapCacheSize);
|
||||
void setNetworkCacheSizeInMB(const int _networkCacheSize);
|
||||
void setNetworkRedirectCacheTtl(const int _redirectCacheTtl);
|
||||
void setCardScaling(const QT_STATE_CHANGED_T _scaleCards);
|
||||
void setStackCardOverlapPercent(const int _verticalCardOverlapPercent);
|
||||
void setShowMessagePopups(const QT_STATE_CHANGED_T _showMessagePopups);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue