File: qgsnetworkaccessmanager.sip

package info (click to toggle)
qgis 2.18.28%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,007,948 kB
  • sloc: cpp: 671,774; python: 158,539; xml: 35,690; ansic: 8,346; sh: 1,766; perl: 1,669; sql: 999; yacc: 836; lex: 461; makefile: 292
file content (95 lines) | stat: -rw-r--r-- 3,329 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
%Feature PROXY_FACTORY

/*
 * \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();

%If (PROXY_FACTORY)
    //! 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;
%End

    //! 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)
    const QStringList &excludeList() const;

    //! set fallback proxy and URL that shouldn't use it.
    void setFallbackProxyAndExcludes( const QNetworkProxy &proxy, const QStringList &excludes );

    //! Get name for QNetworkRequest::CacheLoadControl
    static QString cacheLoadControlName( QNetworkRequest::CacheLoadControl theControl );

    //! Get QNetworkRequest::CacheLoadControl from name
    static QNetworkRequest::CacheLoadControl cacheLoadControlFromName( const QString &theName );

    //! Setup the NAM according to the user's settings
    void setupDefaultProxyAndCache();

    //! return whether the system proxy should be used
    bool useSystemProxy() const;

  public slots:
    /** Send GET request, calls get().
     * Emits requestSent().
     * @param request request to be sent
     * @deprecated use get() directly
     */
    void sendGet( const QNetworkRequest & request ) /Deprecated/;
    /** Abort and delete reply.
     * @param reply reply to be aborted.
     * @deprecated use abort() and deleteLayer() on the reply directly
     */
    void deleteReply( QNetworkReply * reply ) /Deprecated/;

  signals:
    void requestAboutToBeCreated( QNetworkAccessManager::Operation, const QNetworkRequest &, QIODevice * );
    void requestCreated( QNetworkReply * );
    void requestTimedOut( QNetworkReply * );
    /** Emitted when request was sent by request()
     * @param reply request reply
     * @param sender the object which called request() slot.
     * @deprecated only emitted from deprecated sendGet
     */
    void requestSent( QNetworkReply * reply, QObject *sender );

  protected:
    virtual QNetworkReply *createRequest( QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *outgoingData = 0 );

  private:
    QgsNetworkAccessManager( QObject *parent = 0 );
};