QGIS/python/core/qgsnetworkaccessmanager.sip

73 lines
2.5 KiB
Plaintext
Raw Normal View History

/*
* \class QgsNetworkAccessManager
* \brief network access manager for QGIS
* \ingroup core
* \since 1.5
*
* This class implements the QGIS network access manager. It's a singleton
* that can be used across QGIS.
*
* Plugins can insert proxy factories and thereby redirect requests to
* individual proxies.
*
* If no proxy factories are there or none returns a proxy for an URL a
* fallback proxy can be set. There's also a exclude list that defines URLs
* that the fallback proxy should not be used for, then no proxy will be used.
*
*/
class QgsNetworkAccessManager : QNetworkAccessManager
{
%TypeHeaderCode
#include <qgsnetworkaccessmanager.h>
%End
public:
//! returns a pointer to the single instance
// and creates that instance on the first call.
static QgsNetworkAccessManager *instance();
//! destructor
~QgsNetworkAccessManager();
//! insert a factory into the proxy factories list
void insertProxyFactory( QNetworkProxyFactory *factory /Transfer/ );
//! remove a factory from the proxy factories list
void removeProxyFactory( QNetworkProxyFactory *factory /TransferBack/ );
//! retrieve proxy factory list
const QList<QNetworkProxyFactory *> proxyFactories() const;
//! retrieve fall back proxy (for urls that no factory returned proxies for)
const QNetworkProxy &fallbackProxy() const;
//! retrieve exclude list (urls shouldn't use the fallback proxy)
QStringList excludeList() const;
//! set fallback proxy and URL that shouldn't use it.
void setFallbackProxyAndExcludes( const QNetworkProxy &proxy, const QStringList &excludes );
2014-01-26 18:35:21 +01:00
//! Get name for QNetworkRequest::CacheLoadControl
static QString cacheLoadControlName( QNetworkRequest::CacheLoadControl control );
2014-01-26 18:35:21 +01:00
//! Get QNetworkRequest::CacheLoadControl from name
static QNetworkRequest::CacheLoadControl cacheLoadControlFromName( const QString &name );
2014-01-26 18:35:21 +01:00
2017-01-12 22:01:50 +01:00
//! Setup the NAM according to the user's settings #spellok
2014-05-27 23:22:50 +02:00
void setupDefaultProxyAndCache();
//! return whether the system proxy should be used
bool useSystemProxy() const;
2014-05-27 23:22:50 +02:00
signals:
void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * );
void requestCreated( QNetworkReply * );
2014-05-27 23:22:50 +02:00
void requestTimedOut( QNetworkReply * );
protected:
virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0 );
private:
QgsNetworkAccessManager( QObject *parent = 0 );
};