mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-29 12:20:24 -07:00
* [Settings] Split cache_settings into multiple files Took 9 minutes Took 4 minutes * [Settings] Fwd declare settings classes in cache_settings Took 15 minutes * Fix oracle includes. Took 8 minutes * Address comments, fix windows CI Took 8 minutes * fix copy constructor visibility Took 3 minutes * lint Took 2 minutes * Fix native format tests. Took 5 minutes * Remove test header guard Took 4 seconds * Remove tests invalid in CI environ Took 24 seconds * Adjust to rebase. Took 11 minutes * Change settings file name. Took 8 minutes --------- Co-authored-by: Lukas Brübach <lukas.bruebach@bdosecurity.de> Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
57 lines
1.9 KiB
C++
57 lines
1.9 KiB
C++
#ifndef CACHE_STORAGE_SETTINGS_H
|
|
#define CACHE_STORAGE_SETTINGS_H
|
|
|
|
#include "settings_manager.h"
|
|
|
|
#include <libcockatrice/interfaces/interface_cache_storage_settings_provider.h>
|
|
|
|
// In MB (Increments of 64)
|
|
#define PIXMAPCACHE_SIZE_DEFAULT 2048
|
|
#define PIXMAPCACHE_SIZE_MIN 64
|
|
#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
|
|
|
|
#define LOCAL_CARD_IMAGE_NAMING_SCHEME_DEFAULT 6
|
|
|
|
// In Days
|
|
#define NETWORK_REDIRECT_CACHE_TTL_DEFAULT 30
|
|
#define NETWORK_REDIRECT_CACHE_TTL_MIN 1
|
|
#define NETWORK_REDIRECT_CACHE_TTL_MAX 90
|
|
|
|
class CacheStorageSettings : public SettingsManager, public ICacheStorageSettingsProvider
|
|
{
|
|
Q_OBJECT
|
|
friend class SettingsCache;
|
|
|
|
public:
|
|
[[nodiscard]] int getPixmapCacheSize() const override;
|
|
[[nodiscard]] int getNetworkCacheSizeInMB() const override;
|
|
[[nodiscard]] int getRedirectCacheTtl() const override;
|
|
[[nodiscard]] int getCardPictureLoaderCacheMethod() const;
|
|
[[nodiscard]] int getLocalCardImageStorageNamingScheme() const;
|
|
|
|
void setPixmapCacheSize(int _pixmapCacheSize);
|
|
void setNetworkCacheSizeInMB(int _networkCacheSize);
|
|
void setNetworkRedirectCacheTtl(int _redirectCacheTtl);
|
|
void setCardImageCacheMethod(int _cardImageCachingMethod);
|
|
void setLocalCardImageStorageNamingScheme(int _scheme);
|
|
|
|
signals:
|
|
void pixmapCacheSizeChanged(int newSizeInMBs);
|
|
void networkCacheSizeChanged(int newSizeInMBs);
|
|
void redirectCacheTtlChanged(int newTtl);
|
|
void cardPictureLoaderCacheMethodChanged(int cardPictureLoaderCacheMethod);
|
|
void localCardImageStorageNamingSchemeChanged(int localCardImageStorageNamingScheme);
|
|
|
|
public:
|
|
explicit CacheStorageSettings(const QString &settingPath, QObject *parent = nullptr);
|
|
|
|
private:
|
|
CacheStorageSettings(const CacheStorageSettings & /*other*/);
|
|
};
|
|
|
|
#endif // CACHE_STORAGE_SETTINGS_H
|