VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h@ 82781

Last change on this file since 82781 was 78665, checked in by vboxsync, 5 years ago

FE/Qt: bugref:9470: Networking stuff: Switch file downloading procedure from RTHttpGetBinary to RTHttpGetFile; This allows us to avoid memory-chunk size limitation preventing large files from being downloaded; We do this only for files, not for other network requests, because we know the target filename in that case.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mergeinfo set to (toggle deleted branches)
    /branches/VBox-3.0/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h58652,​70973
    /branches/VBox-3.2/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h66309,​66318
    /branches/VBox-4.0/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h70873
    /branches/VBox-4.1/src/VBox/Frontends/VirtualBox/src/net/UINetworkManager.h74233
    /branches/VBox-4.2/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h91503-91504,​91506-91508,​91510,​91514-91515,​91521
    /branches/VBox-4.3/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h91223
    /branches/VBox-4.3/trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h91223
    /branches/dsen/gui/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h79076-79078,​79089,​79109-79110,​79112-79113,​79127-79130,​79134,​79141,​79151,​79155,​79157-79159,​79193,​79197
    /branches/dsen/gui2/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h79224,​79228,​79233,​79235,​79258,​79262-79263,​79273,​79341,​79345,​79354,​79357,​79387-79388,​79559-79569,​79572-79573,​79578,​79581-79582,​79590-79591,​79598-79599,​79602-79603,​79605-79606,​79632,​79635,​79637,​79644
    /branches/dsen/gui3/src/VBox/Frontends/VirtualBox/src/net/UINetworkRequest.h79645-79692
File size: 5.2 KB
Line 
1/* $Id: UINetworkRequest.h 78665 2019-05-22 15:27:01Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UINetworkRequest class declaration.
4 */
5
6/*
7 * Copyright (C) 2011-2019 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef FEQT_INCLUDED_SRC_net_UINetworkRequest_h
19#define FEQT_INCLUDED_SRC_net_UINetworkRequest_h
20#ifndef RT_WITHOUT_PRAGMA_ONCE
21# pragma once
22#endif
23
24/* Qt includes: */
25#include <QUuid>
26#include <QPointer>
27
28/* GUI inludes: */
29#include "UILibraryDefs.h"
30#include "UINetworkDefs.h"
31#include "UINetworkReply.h"
32
33/* Forward declarations: */
34class UINetworkManager;
35class UINetworkManagerDialog;
36class UINetworkManagerIndicator;
37class UINetworkRequestWidget;
38class UINetworkCustomer;
39
40/** QObject extension used as network-request container. */
41class SHARED_LIBRARY_STUFF UINetworkRequest : public QObject
42{
43 Q_OBJECT;
44
45signals:
46
47 /** Notifies common UINetworkManager about progress with @a uuid changed.
48 * @param iReceived Holds the amount of bytes received.
49 * @param iTotal Holds the amount of total bytes to receive. */
50 void sigProgress(const QUuid &uuid, qint64 iReceived, qint64 iTotal);
51 /** Notifies UINetworkManager about progress with @a uuid started. */
52 void sigStarted(const QUuid &uuid);
53 /** Notifies UINetworkManager about progress with @a uuid canceled. */
54 void sigCanceled(const QUuid &uuid);
55 /** Notifies UINetworkManager about progress with @a uuid finished. */
56 void sigFinished(const QUuid &uuid);
57 /** Notifies UINetworkManager about progress with @a uuid failed with @a strError. */
58 void sigFailed(const QUuid &uuid, const QString &strError);
59
60 /** Notifies own UINetworkRequestWidget about progress changed.
61 * @param iReceived Holds the amount of bytes received.
62 * @param iTotal Holds the amount of total bytes to receive. */
63 void sigProgress(qint64 iReceived, qint64 iTotal);
64 /** Notifies own UINetworkRequestWidget about progress started. */
65 void sigStarted();
66 /** Notifies own UINetworkRequestWidget about progress finished. */
67 void sigFinished();
68 /** Notifies own UINetworkRequestWidget about progress failed with @a strError. */
69 void sigFailed(const QString &strError);
70
71public:
72
73 /** Constructs network-request of the passed @a enmType
74 * on the basis of the passed @a urls, @a strTarget and the @a requestHeaders
75 * for the @a pCustomer and @a pNetworkManager specified. */
76 UINetworkRequest(UINetworkRequestType enmType,
77 const QList<QUrl> &urls,
78 const QString &strTarget,
79 const UserDictionary &requestHeaders,
80 UINetworkCustomer *pCustomer,
81 UINetworkManager *pNetworkManager);
82 /** Destructs network-request. */
83 ~UINetworkRequest();
84
85 /** Returns the request description. */
86 const QString description() const;
87 /** Returns the request customer. */
88 UINetworkCustomer* customer() { return m_pCustomer; }
89 /** Returns the request manager. */
90 UINetworkManager* manager() const { return m_pNetworkManager; }
91 /** Returns unique request QUuid. */
92 const QUuid& uuid() const { return m_uuid; }
93 /** Returns the request reply. */
94 UINetworkReply* reply() { return m_pReply; }
95
96public slots:
97
98 /** Initiates request retrying. */
99 void sltRetry();
100 /** Initiates request cancelling. */
101 void sltCancel();
102
103private slots:
104
105 /** Handles reply about progress changed.
106 * @param iReceived Brings the amount of bytes received.
107 * @param iTotal Brings the amount of total bytes to receive. */
108 void sltHandleNetworkReplyProgress(qint64 iReceived, qint64 iTotal);
109 /** Handles reply about progress finished. */
110 void sltHandleNetworkReplyFinish();
111
112private:
113
114 /** Prepares request. */
115 void prepare();
116 /** Prepares request's reply. */
117 void prepareNetworkReply();
118
119 /** Cleanups request's reply. */
120 void cleanupNetworkReply();
121 /** Cleanups request. */
122 void cleanup();
123
124 /** Holds the request type. */
125 const UINetworkRequestType m_enmType;
126 /** Holds the request urls. */
127 const QList<QUrl> m_urls;
128 /** Holds the request target. */
129 const QString m_strTarget;
130 /** Holds the request headers. */
131 const UserDictionary m_requestHeaders;
132 /** Holds the request customer. */
133 UINetworkCustomer *m_pCustomer;
134 /** Holds the request manager. */
135 UINetworkManager *m_pNetworkManager;
136 /** Holds unique request QUuid. */
137 const QUuid m_uuid;
138
139 /** Holds current request url. */
140 QUrl m_url;
141 /** Holds index of current request url. */
142 int m_iUrlIndex;
143 /** Holds whether current request url is in progress. */
144 bool m_fRunning;
145
146 /** Holds the request reply. */
147 QPointer<UINetworkReply> m_pReply;
148};
149
150#endif /* !FEQT_INCLUDED_SRC_net_UINetworkRequest_h */
151
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use