LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
Loading...
Searching...
No Matches
standardnamfactory.cpp
Go to the documentation of this file.
1
/**********************************************************************
2
* LeechCraft - modular cross-platform feature rich internet client.
3
* Copyright (C) 2006-2014 Georg Rudoy
4
*
5
* Distributed under the Boost Software License, Version 1.0.
6
* (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7
**********************************************************************/
8
9
#include "
standardnamfactory.h
"
10
#include <QNetworkAccessManager>
11
#include <QQmlEngine>
12
#include <
util/network/networkdiskcache.h
>
13
14
namespace
LC::Util
15
{
16
StandardNAMFactory::StandardNAMFactory
(QString subpath,
17
CacheSizeGetter_f
getter,
18
QQmlEngine *engine)
19
: Subpath_ (std::move (subpath))
20
, CacheSizeGetter_ (std::move (getter))
21
{
22
if
(engine)
23
engine->setNetworkAccessManagerFactory (
this
);
24
}
25
26
QNetworkAccessManager*
StandardNAMFactory::create
(QObject *parent)
27
{
28
auto
nam =
new
QNetworkAccessManager (parent);
29
30
auto
cache =
new
NetworkDiskCache
(Subpath_, nam);
31
cache->setMaximumCacheSize (CacheSizeGetter_ ());
32
nam->setCache (cache);
33
34
return
nam;
35
}
36
}
LC::Util::NetworkDiskCache
A thread-safe garbage-collected network disk cache.
Definition
networkdiskcache.h:33
LC::Util::StandardNAMFactory::StandardNAMFactory
StandardNAMFactory(QString subpath, CacheSizeGetter_f getter, QQmlEngine *engine=nullptr)
Constructs a new StandardNAMFactory.
Definition
standardnamfactory.cpp:16
LC::Util::StandardNAMFactory::create
QNetworkAccessManager * create(QObject *parent) override
Creates the network access manager with the given parent.
Definition
standardnamfactory.cpp:26
LC::Util::StandardNAMFactory::CacheSizeGetter_f
std::function< int()> CacheSizeGetter_f
The type of the function used to query the cache size by the factory.
Definition
standardnamfactory.h:42
LC::Util
Definition
icoreproxy.h:34
networkdiskcache.h
standardnamfactory.h
src
util
qml
standardnamfactory.cpp
Generated by
1.17.0