VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/networking/UINetworkRequest.h

Last change on this file was 106061, checked in by vboxsync, 3 months ago

Copyright year updates by scm.

  • 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: 4.0 KB
Line 
1/* $Id: UINetworkRequest.h 106061 2024-09-16 14:03:52Z vboxsync $ */
2/** @file
3 * VBox Qt GUI - UINetworkRequest class declaration.
4 */
5
6/*
7 * Copyright (C) 2011-2024 Oracle and/or its affiliates.
8 *
9 * This file is part of VirtualBox base platform packages, as
10 * available from https://www.virtualbox.org.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation, in version 3 of the
15 * License.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, see <https://www.gnu.org/licenses>.
24 *
25 * SPDX-License-Identifier: GPL-3.0-only
26 */
27
28#ifndef FEQT_INCLUDED_SRC_networking_UINetworkRequest_h
29#define FEQT_INCLUDED_SRC_networking_UINetworkRequest_h
30#ifndef RT_WITHOUT_PRAGMA_ONCE
31# pragma once
32#endif
33
34/* Qt includes: */
35#include <QObject>
36#include <QPointer>
37
38/* GUI inludes: */
39#include "UILibraryDefs.h"
40#include "UINetworkDefs.h"
41#include "UINetworkReply.h"
42
43/** QObject extension used as network-request container. */
44class SHARED_LIBRARY_STUFF UINetworkRequest : public QObject
45{
46 Q_OBJECT;
47
48signals:
49
50 /** Notifies listener about progress started. */
51 void sigStarted();
52 /** Notifies listener about progress changed.
53 * @param iReceived Brings the amount of bytes received.
54 * @param iTotal Brings the amount of total bytes to receive. */
55 void sigProgress(qint64 iReceived, qint64 iTotal);
56 /** Notifies listener about progress failed.
57 * @param strError Brings the error progress failed with. */
58 void sigFailed(const QString &strError);
59 /** Notifies listener about progress canceled. */
60 void sigCanceled();
61 /** Notifies listener about progress finished. */
62 void sigFinished();
63
64public:
65
66 /** Constructs network-request.
67 * @param enmType Brings request type.
68 * @param urls Brings request urls, there can be few of them.
69 * @param strTarget Brings request target path.
70 * @param requestHeaders Brings request headers in dictionary form. */
71 UINetworkRequest(UINetworkRequestType enmType,
72 const QList<QUrl> &urls,
73 const QString &strTarget,
74 const UserDictionary &requestHeaders);
75 /** Destructs network-request. */
76 virtual ~UINetworkRequest() RT_OVERRIDE RT_FINAL;
77
78 /** Returns the request reply. */
79 UINetworkReply *reply() { return m_pReply; }
80
81public slots:
82
83 /** Initiates request cancelling. */
84 void sltCancel();
85
86private slots:
87
88 /** Handles reply about progress changed.
89 * @param iReceived Brings the amount of bytes received.
90 * @param iTotal Brings the amount of total bytes to receive. */
91 void sltHandleNetworkReplyProgress(qint64 iReceived, qint64 iTotal);
92 /** Handles reply about progress finished. */
93 void sltHandleNetworkReplyFinish();
94
95private:
96
97 /** Prepares request. */
98 void prepare();
99 /** Prepares request's reply. */
100 void prepareNetworkReply();
101
102 /** Cleanups request's reply. */
103 void cleanupNetworkReply();
104 /** Cleanups request. */
105 void cleanup();
106
107 /** Holds the request type. */
108 const UINetworkRequestType m_enmType;
109 /** Holds the request urls. */
110 const QList<QUrl> m_urls;
111 /** Holds the request target. */
112 const QString m_strTarget;
113 /** Holds the request headers. */
114 const UserDictionary m_requestHeaders;
115
116 /** Holds current request url. */
117 QUrl m_url;
118 /** Holds index of current request url. */
119 int m_iUrlIndex;
120 /** Holds whether current request url is in progress. */
121 bool m_fRunning;
122
123 /** Holds the request reply. */
124 QPointer<UINetworkReply> m_pReply;
125};
126
127#endif /* !FEQT_INCLUDED_SRC_networking_UINetworkRequest_h */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette