Vesna
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
NetworkRequestHandler.h
Go to the documentation of this file.
1 #ifndef NETWORKREQUESTHANDLER_H
2 #define NETWORKREQUESTHANDLER_H
3 
4 #include <QObject>
5 #include <QNetworkReply>
6 #include "ApplicationDefines.h"
7 
8 class QSslError;
9 class QUrlQuery;
11 
12 class NetworkRequestHandler : public QObject
13 {
14  Q_OBJECT
15 public:
17  {
22  };
23  Q_ENUM( SendNetworkRequestResult )
24 
26  virtual ~NetworkRequestHandler();
27 
28  void Init( ApplicationStateManager *applicationStateManager );
29  void RegisterNetworkRequest( const ApplicationDefines::NetworkRequestType networkRequestType, const QUrl url, const int networkRequestParameter = ApplicationDefines::NetworkRequestParameterUndefined );
30 
35  SendNetworkRequestResult SendNetworkRequest( const QJsonObject jsonRequest, const ApplicationDefines::NetworkRequestType networkRequestType, const int replyTimeout = 0 );
36 
41  SendNetworkRequestResult SendNetworkRequest( const QUrlQuery urlQuery, const ApplicationDefines::NetworkRequestType networkRequestType, const int replyTimeout = 0 );
42 
43 private slots:
44  void OnNetworkReply( QNetworkReply *reply );
45  void OnSSLErrors( const QList<QSslError> &sslErrors );
46  void OnNetworkReplyError( QNetworkReply::NetworkError code );
47  void OnNetworkReplyTimeout( const ApplicationDefines::NetworkRequestType networkRequestType );
48 
49 private:
50  void PostSendData( QNetworkReply *networkReply, const int replyTimeout, const ApplicationDefines::NetworkRequestType networkRequestType );
51 
52  class DataClass;
53  QScopedPointer<DataClass> d;
54 };
55 
56 #endif // NETWORKREQUESTHANDLER_H
Definition: ApplicationStateManager.h:43
Definition: ProjectConfiguration.h:11
Definition: NetworkRequestHandler.h:19
SendNetworkRequestResult
Definition: NetworkRequestHandler.h:16
void Init(ApplicationStateManager *applicationStateManager)
Definition: NetworkRequestHandler.cpp:165
Definition: NetworkRequestHandler.h:18
Definition: NetworkRequestHandler.h:20
void RegisterNetworkRequest(const ApplicationDefines::NetworkRequestType networkRequestType, const QUrl url, const int networkRequestParameter=ApplicationDefines::NetworkRequestParameterUndefined)
Definition: NetworkRequestHandler.cpp:173
Definition: ApplicationDefines.h:88
SendNetworkRequestResult SendNetworkRequest(const QJsonObject jsonRequest, const ApplicationDefines::NetworkRequestType networkRequestType, const int replyTimeout=0)
SendNetworkRequest - sends an HTTP POST request to the destination specified by request.
Definition: NetworkRequestHandler.cpp:179
Definition: NetworkRequestHandler.h:12
Definition: NetworkRequestHandler.h:21