Add ability to customize cache folder

Add an advanced settings page, currently only housing the "Cache" category

Fix #541
This commit is contained in:
Rasmus Karlsson
2018-08-19 16:20:14 +02:00
parent 3fc91bded5
commit a07255be2d
9 changed files with 133 additions and 14 deletions
+1 -4
View File
@@ -1,6 +1,5 @@
#include "common/NetworkData.hpp"
#include "Application.hpp"
#include "singletons/Paths.hpp"
#include "util/DebugCount.hpp"
@@ -42,9 +41,7 @@ QString NetworkData::getHash()
void NetworkData::writeToCache(const QByteArray &bytes)
{
if (this->useQuickLoadCache_) {
auto app = getApp();
QFile cachedFile(getPaths()->cacheDirectory + "/" + this->getHash());
QFile cachedFile(getPaths()->cacheDirectory() + "/" + this->getHash());
if (cachedFile.open(QIODevice::WriteOnly)) {
cachedFile.write(bytes);
+3 -4
View File
@@ -1,6 +1,5 @@
#include "common/NetworkRequest.hpp"
#include "Application.hpp"
#include "common/NetworkData.hpp"
#include "common/NetworkManager.hpp"
#include "common/Outcome.hpp"
@@ -11,6 +10,7 @@
#include <QFile>
#include <QtConcurrent>
#include <cassert>
namespace chatterino {
@@ -145,9 +145,8 @@ void NetworkRequest::execute()
Outcome NetworkRequest::tryLoadCachedFile()
{
auto app = getApp();
QFile cachedFile(getPaths()->cacheDirectory + "/" + this->data->getHash());
QFile cachedFile(getPaths()->cacheDirectory() + "/" +
this->data->getHash());
if (!cachedFile.exists()) {
// File didn't exist