mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
[PictureLoader] Allow saving downloaded images to local storage and not just the QNetworkManager cache (#6620)
* [PictureLoader] Allow saving downloaded images to local storage and not just the QNetworkManager cache. Took 1 hour 11 minutes Took 4 seconds Took 25 seconds * Give people options from a dropdown. Took 1 hour 6 minutes Took 3 seconds * Simplify directory removal code. Took 5 minutes Took 8 seconds * Merge pull request #8 * Create new category for new settings * Split off storage settings Took 47 minutes Took 4 seconds * Allow toggling between caching methods. Took 1 hour 30 minutes Took 9 seconds * Adjust settings dialog. Took 5 minutes Took 59 seconds Took 22 seconds Took 6 seconds * tr() strings Took 1 minute Took 6 seconds * Readjust layout, default naming scheme. Took 5 minutes * Add stretch. Took 9 minutes * Make scrollable. Took 2 minutes * Add icon. Took 7 minutes * Change naming to be uniform. Took 3 minutes Took 3 seconds --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de> Co-authored-by: RickyRister <42636155+RickyRister@users.noreply.github.com>
This commit is contained in:
parent
20cd7ce73d
commit
f8ce5c2e39
12 changed files with 1382 additions and 132 deletions
|
|
@ -1,5 +1,7 @@
|
|||
#include "cache_settings.h"
|
||||
|
||||
#include "../../interface/card_picture_loader/card_picture_loader_cache_method.h"
|
||||
#include "../../interface/card_picture_loader/card_picture_loader_local_schemes.h"
|
||||
#include "../network/update/client/release_channel.h"
|
||||
#include "card_counter_settings.h"
|
||||
#include "version_string.h"
|
||||
|
|
@ -278,6 +280,16 @@ SettingsCache::SettingsCache()
|
|||
|
||||
networkCacheSize = settings->value("personal/networkCacheSize", NETWORK_CACHE_SIZE_DEFAULT).toInt();
|
||||
redirectCacheTtl = settings->value("personal/redirectCacheTtl", NETWORK_REDIRECT_CACHE_TTL_DEFAULT).toInt();
|
||||
cardPictureLoaderCacheMethod =
|
||||
settings
|
||||
->value("personal/cardPictureLoaderCacheMethod",
|
||||
static_cast<int>(CardPictureLoaderCacheMethod::CacheMethod::NETWORK_CACHE))
|
||||
.toInt();
|
||||
localCardImageStorageNamingScheme =
|
||||
settings
|
||||
->value("personal/localCardImageStorageNamingScheme",
|
||||
static_cast<int>(CardPictureLoaderLocalSchemes::NamingScheme::Set_Folder_Name_Set_Collector))
|
||||
.toInt();
|
||||
|
||||
picDownload = settings->value("personal/picturedownload", true).toBool();
|
||||
showStatusBar = settings->value("personal/showStatusBar", false).toBool();
|
||||
|
|
@ -1112,6 +1124,13 @@ void SettingsCache::setPixmapCacheSize(const int _pixmapCacheSize)
|
|||
emit pixmapCacheSizeChanged(pixmapCacheSize);
|
||||
}
|
||||
|
||||
void SettingsCache::setCardImageCacheMethod(const CardPictureLoaderCacheMethod::CacheMethod _cardImageCachingMethod)
|
||||
{
|
||||
cardPictureLoaderCacheMethod = static_cast<int>(_cardImageCachingMethod);
|
||||
settings->setValue("personal/cardPictureLoaderCacheMethod", cardPictureLoaderCacheMethod);
|
||||
emit cardPictureLoaderCacheMethodChanged(cardPictureLoaderCacheMethod);
|
||||
}
|
||||
|
||||
void SettingsCache::setNetworkCacheSizeInMB(const int _networkCacheSize)
|
||||
{
|
||||
networkCacheSize = _networkCacheSize;
|
||||
|
|
@ -1126,6 +1145,14 @@ void SettingsCache::setNetworkRedirectCacheTtl(const int _redirectCacheTtl)
|
|||
emit redirectCacheTtlChanged(redirectCacheTtl);
|
||||
}
|
||||
|
||||
void SettingsCache::setLocalCardImageStorageNamingScheme(
|
||||
const CardPictureLoaderLocalSchemes::NamingScheme _localCardImageStorageNamingScheme)
|
||||
{
|
||||
localCardImageStorageNamingScheme = static_cast<int>(_localCardImageStorageNamingScheme);
|
||||
settings->setValue("personal/localCardImageStorageNamingScheme", localCardImageStorageNamingScheme);
|
||||
emit localCardImageStorageNamingSchemeChanged(localCardImageStorageNamingScheme);
|
||||
}
|
||||
|
||||
void SettingsCache::setClientID(const QString &_clientID)
|
||||
{
|
||||
clientID = _clientID;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#ifndef SETTINGSCACHE_H
|
||||
#define SETTINGSCACHE_H
|
||||
|
||||
#include "../../interface/card_picture_loader/card_picture_loader_cache_method.h"
|
||||
#include "../../interface/card_picture_loader/card_picture_loader_local_schemes.h"
|
||||
#include "shortcuts_settings.h"
|
||||
|
||||
#include <QDate>
|
||||
|
|
@ -184,6 +186,8 @@ signals:
|
|||
void pixmapCacheSizeChanged(int newSizeInMBs);
|
||||
void networkCacheSizeChanged(int newSizeInMBs);
|
||||
void redirectCacheTtlChanged(int newTtl);
|
||||
void cardPictureLoaderCacheMethodChanged(int cardPictureLoaderCacheMethod);
|
||||
void localCardImageStorageNamingSchemeChanged(int localCardImageStorageNamingScheme);
|
||||
void masterVolumeChanged(int value);
|
||||
void chatMentionCompleterChanged();
|
||||
void downloadSpoilerTimeIndexChanged();
|
||||
|
|
@ -303,6 +307,8 @@ private:
|
|||
int pixmapCacheSize;
|
||||
int networkCacheSize;
|
||||
int redirectCacheTtl;
|
||||
int cardPictureLoaderCacheMethod;
|
||||
int localCardImageStorageNamingScheme;
|
||||
bool scaleCards;
|
||||
int verticalCardOverlapPercent;
|
||||
bool showMessagePopups;
|
||||
|
|
@ -786,6 +792,10 @@ public:
|
|||
{
|
||||
return pixmapCacheSize;
|
||||
}
|
||||
[[nodiscard]] CardPictureLoaderCacheMethod::CacheMethod getCardPictureLoaderCacheMethod() const
|
||||
{
|
||||
return static_cast<CardPictureLoaderCacheMethod::CacheMethod>(cardPictureLoaderCacheMethod);
|
||||
}
|
||||
[[nodiscard]] int getNetworkCacheSizeInMB() const
|
||||
{
|
||||
return networkCacheSize;
|
||||
|
|
@ -794,6 +804,10 @@ public:
|
|||
{
|
||||
return redirectCacheTtl;
|
||||
}
|
||||
[[nodiscard]] CardPictureLoaderLocalSchemes::NamingScheme getLocalCardImageStorageNamingScheme() const
|
||||
{
|
||||
return static_cast<CardPictureLoaderLocalSchemes::NamingScheme>(localCardImageStorageNamingScheme);
|
||||
}
|
||||
[[nodiscard]] bool getScaleCards() const
|
||||
{
|
||||
return scaleCards;
|
||||
|
|
@ -1098,8 +1112,11 @@ public slots:
|
|||
void setIgnoreUnregisteredUsers(QT_STATE_CHANGED_T _ignoreUnregisteredUsers);
|
||||
void setIgnoreUnregisteredUserMessages(QT_STATE_CHANGED_T _ignoreUnregisteredUserMessages);
|
||||
void setPixmapCacheSize(const int _pixmapCacheSize);
|
||||
void setCardImageCacheMethod(CardPictureLoaderCacheMethod::CacheMethod _cardImageCachingMethod);
|
||||
void setNetworkCacheSizeInMB(const int _networkCacheSize);
|
||||
void setNetworkRedirectCacheTtl(const int _redirectCacheTtl);
|
||||
void setLocalCardImageStorageNamingScheme(
|
||||
const CardPictureLoaderLocalSchemes::NamingScheme _localCardImageStorageNamingScheme);
|
||||
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