Overte C++ Documentation
HTTPResourceRequest.h
1 //
2 // HTTPResourceRequest.h
3 // libraries/networking/src
4 //
5 // Created by Ryan Huffman on 2015/07/23
6 // Copyright 2015 High Fidelity, Inc.
7 //
8 // Distributed under the Apache License, Version 2.0.
9 // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10 //
11 
12 #ifndef hifi_HTTPResourceRequest_h
13 #define hifi_HTTPResourceRequest_h
14 
15 #include <QNetworkReply>
16 #include <QUrl>
17 #include <QTimer>
18 
19 #include "ResourceRequest.h"
20 
21 class HTTPResourceRequest : public ResourceRequest {
22  Q_OBJECT
23 public:
24  HTTPResourceRequest(
25  const QUrl& url,
26  const bool isObservable = true,
27  const qint64 callerId = -1,
28  const QString& = ""
29  ) : ResourceRequest(url, isObservable, callerId) { }
30  ~HTTPResourceRequest();
31 
32 protected:
33  virtual void doSend() override;
34 
35 private slots:
36  void onTimeout();
37  void onDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
38  void onRequestFinished();
39 
40 private:
41  void setupTimer();
42  void cleanupTimer();
43 
44  QTimer* _sendTimer { nullptr };
45  QNetworkReply* _reply { nullptr };
46 };
47 
48 #endif