moved files into src/common

This commit is contained in:
fourtf
2018-06-26 15:33:51 +02:00
parent 0bc08a364c
commit 15abedd869
90 changed files with 150 additions and 150 deletions
+44
View File
@@ -0,0 +1,44 @@
#include "common/NetworkRequest.hpp"
#include "Application.hpp"
namespace chatterino {
namespace util {
NetworkRequest::NetworkRequest(const char *url)
{
this->data.request.setUrl(QUrl(url));
}
NetworkRequest::NetworkRequest(const std::string &url)
{
this->data.request.setUrl(QUrl(QString::fromStdString(url)));
}
NetworkRequest::NetworkRequest(const QString &url)
{
this->data.request.setUrl(QUrl(url));
}
void NetworkRequest::setUseQuickLoadCache(bool value)
{
this->data.useQuickLoadCache = value;
}
void NetworkRequest::Data::writeToCache(const QByteArray &bytes)
{
if (this->useQuickLoadCache) {
auto app = getApp();
QFile cachedFile(app->paths->cacheDirectory + "/" + this->getHash());
if (cachedFile.open(QIODevice::WriteOnly)) {
cachedFile.write(bytes);
cachedFile.close();
}
}
}
} // namespace util
} // namespace chatterino