1 | /* $Id: UINetworkCustomer.h 98103 2023-01-17 14:15:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * VBox Qt GUI - UINetworkCustomer class declaration.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2012-2023 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_UINetworkCustomer_h
|
---|
29 | #define FEQT_INCLUDED_SRC_networking_UINetworkCustomer_h
|
---|
30 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
31 | # pragma once
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | /* Qt includes: */
|
---|
35 | #include <QObject>
|
---|
36 | #include <QUrl>
|
---|
37 | #include <QUuid>
|
---|
38 |
|
---|
39 | /* GUI includes: */
|
---|
40 | #include "UILibraryDefs.h"
|
---|
41 | #include "UINetworkDefs.h"
|
---|
42 |
|
---|
43 | /* Forward declarations: */
|
---|
44 | class UINetworkReply;
|
---|
45 |
|
---|
46 | /** Interface to access UINetworkRequestManager protected functionality. */
|
---|
47 | class SHARED_LIBRARY_STUFF UINetworkCustomer : public QObject
|
---|
48 | {
|
---|
49 | Q_OBJECT;
|
---|
50 |
|
---|
51 | signals:
|
---|
52 |
|
---|
53 | /** Notifies listeners about @a pNetworkCustomer being destroyed. */
|
---|
54 | void sigBeingDestroyed(UINetworkCustomer *pNetworkCustomer);
|
---|
55 |
|
---|
56 | public:
|
---|
57 |
|
---|
58 | /** Constructs network customer passing @a pParent to the base-class. */
|
---|
59 | UINetworkCustomer();
|
---|
60 | /** Destructs network customer. */
|
---|
61 | virtual ~UINetworkCustomer() RT_OVERRIDE;
|
---|
62 |
|
---|
63 | /** Returns description of the current network operation. */
|
---|
64 | virtual QString description() const { return QString(); }
|
---|
65 |
|
---|
66 | /** Handles network reply progress for @a iReceived amount of bytes among @a iTotal. */
|
---|
67 | virtual void processNetworkReplyProgress(qint64 iReceived, qint64 iTotal) = 0;
|
---|
68 | /** Handles network reply failed with specified @a strError. */
|
---|
69 | virtual void processNetworkReplyFailed(const QString &strError) = 0;
|
---|
70 | /** Handles network reply canceling for a passed @a pReply. */
|
---|
71 | virtual void processNetworkReplyCanceled(UINetworkReply *pReply) = 0;
|
---|
72 | /** Handles network reply finishing for a passed @a pReply. */
|
---|
73 | virtual void processNetworkReplyFinished(UINetworkReply *pReply) = 0;
|
---|
74 |
|
---|
75 | protected:
|
---|
76 |
|
---|
77 | /** Creates network-request.
|
---|
78 | * @param enmType Brings request type.
|
---|
79 | * @param urls Brings request urls, there can be few of them.
|
---|
80 | * @param strTarget Brings request target path.
|
---|
81 | * @param requestHeaders Brings request headers in dictionary form. */
|
---|
82 | void createNetworkRequest(UINetworkRequestType enmType,
|
---|
83 | const QList<QUrl> urls,
|
---|
84 | const QString &strTarget = QString(),
|
---|
85 | const UserDictionary requestHeaders = UserDictionary());
|
---|
86 |
|
---|
87 | /** Aborts network-request. */
|
---|
88 | void cancelNetworkRequest();
|
---|
89 |
|
---|
90 | private:
|
---|
91 |
|
---|
92 | /** Holds the network-request ID. */
|
---|
93 | QUuid m_uId;
|
---|
94 | };
|
---|
95 |
|
---|
96 | #endif /* !FEQT_INCLUDED_SRC_networking_UINetworkCustomer_h */
|
---|