QGIS/python/core/qgshttptransaction.sip

98 lines
3.1 KiB
Plaintext
Raw Normal View History

class QgsHttpTransaction : QObject
{
%TypeHeaderCode
#include <qgshttptransaction.h>
%End
public:
/**
2016-02-14 03:50:23 +01:00
* Constructor.
*/
QgsHttpTransaction( const QString& uri,
const QString& proxyHost = QString(),
int proxyPort = 80,
const QString& proxyUser = QString(),
const QString& proxyPass = QString(),
QNetworkProxy::ProxyType proxyType = QNetworkProxy::NoProxy,
const QString& userName = QString(),
const QString& password = QString() );
//! Destructor
virtual ~QgsHttpTransaction();
void getAsynchronously();
//! Gets the response synchronously. Note that signals will still be emitted
//! while in this function.
/*!
The function returns false if there is an error while getting the response.
@param[out] respondedContent is replaced with the new content.
@param[in] redirections is used to measure how many http redirections we've been through.
Clients typically don't need to set this.
@param postData data to send with the http message. This is only used for HTTP POST. If
0 then the request is done with HTTP GET.
@return true in case of success
*/
bool getSynchronously( QByteArray &respondedContent, int redirections = 0, const QByteArray* postData = 0 );
QString responseContentType();
/**
* If an operation returns 0 (e.g. getSynchronously()), this function
* returns the text of the error associated with the failure.
* Interactive users of this provider can then, for example,
* call a QMessageBox to display the contents.
*/
QString errorString();
2015-07-29 11:52:14 +02:00
/** Apply proxy settings from QSettings to a http object
@return true if proxy settings was applied, false else*/
static bool applyProxySettings( QHttp& http, const QString& url );
2014-11-21 01:17:21 +01:00
/** Set the credentials (username and password) */
void setCredentials( const QString& username, const QString &password );
2015-07-29 11:52:14 +02:00
/** Returns the network timeout in msec*/
int networkTimeout() const;
2015-07-29 11:52:14 +02:00
/** Sets the network timeout in milliseconds*/
void setNetworkTimeout( int msec );
public slots:
void dataStarted( int id );
void dataHeaderReceived( const QHttpResponseHeader& resp );
void dataReceived( const QHttpResponseHeader& resp );
void dataProgress( int done, int total );
void dataFinished( int id, bool error );
void transactionFinished( bool error );
void dataStateChanged( int state );
void networkTimedOut();
2015-07-29 11:52:14 +02:00
/** Aborts the current transaction*/
void abort();
signals:
2015-07-29 11:52:14 +02:00
/** Legacy code. This signal is currently not emitted and only kept for API compatibility*/
void setProgress( int done, int total );
2015-07-29 11:52:14 +02:00
/** Signal for progress update */
void dataReadProgress( int theProgress );
2015-07-29 11:52:14 +02:00
/** Signal for adjusted number of steps*/
void totalSteps( int theTotalSteps );
/** \brief emit a signal to be caught by qgisapp and display a msg on status bar */
void statusChanged( const QString& theStatusQString );
};