diff --git a/main.cpp b/main.cpp index 837d232..c2f48c9 100755 --- a/main.cpp +++ b/main.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include #include "portaudio.h" @@ -83,7 +84,17 @@ int main(int argc, char *argv[]) QEventLoop eventLoop; QNetworkAccessManager manager; - const auto reply = std::unique_ptr(manager.get(QNetworkRequest{QUrl{"https://brunner.ninja/komposthaufen/dpm/presets_config_v12.json"}})); + + QNetworkDiskCache cache; + cache.setCacheDirectory("cache"); + + manager.setCache(&cache); + + QNetworkRequest request{QUrl{"https://brunner.ninja/komposthaufen/dpm/presets_config_v12.json"}}; + request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, QNetworkRequest::PreferCache); + request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, true); + + const auto reply = std::unique_ptr(manager.get(request)); QObject::connect(reply.get(), &QNetworkReply::finished, &eventLoop, &QEventLoop::quit); eventLoop.exec();