mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 07:55:21 +01:00
Qt/QML edition
This commit is contained in:
commit
d7b361ba44
2168 changed files with 721948 additions and 0 deletions
32
networkaccessmanagerfactory.cpp
Normal file
32
networkaccessmanagerfactory.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* Copyright (C) 2020 Raspberry Pi (Trading) Limited
|
||||
*/
|
||||
|
||||
#include "networkaccessmanagerfactory.h"
|
||||
#include "config.h"
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkDiskCache>
|
||||
#include <QStandardPaths>
|
||||
#include <QDir>
|
||||
#include <QUrl>
|
||||
#include <QDebug>
|
||||
|
||||
/* Configure caching for files downloaded from Internet by QML (e.g. os_list.json and icons) */
|
||||
NetworkAccessManagerFactory::NetworkAccessManagerFactory()
|
||||
{
|
||||
_c = new QNetworkDiskCache(this);
|
||||
_c->setCacheDirectory(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)+QDir::separator()+"oslistcache");
|
||||
/* Only cache images and not the .json */
|
||||
//_c->remove(QUrl(OSLIST_URL));
|
||||
|
||||
/* Clear all for now as we do not know any potential subitems_url in advance */
|
||||
_c->clear();
|
||||
}
|
||||
|
||||
QNetworkAccessManager *NetworkAccessManagerFactory::create(QObject *parent)
|
||||
{
|
||||
QNetworkAccessManager *nam = new QNetworkAccessManager(parent);
|
||||
nam->setCache(_c);
|
||||
return nam;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue