1 | // Copyright (C) 2019 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef QQMLTYPELOADERNETWORKREPLYPROXY_P_H |
5 | #define QQMLTYPELOADERNETWORKREPLYPROXY_P_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include <QtQml/qtqmlglobal.h> |
19 | #include <QtCore/qobject.h> |
20 | #include <QtCore/private/qglobal_p.h> |
21 | |
22 | QT_REQUIRE_CONFIG(qml_network); |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QNetworkReply; |
27 | class QQmlTypeLoader; |
28 | |
29 | // This is a lame object that we need to ensure that slots connected to |
30 | // QNetworkReply get called in the correct thread (the loader thread). |
31 | // As QQmlTypeLoader lives in the main thread, and we can't use |
32 | // Qt::DirectConnection connections from a QNetworkReply (because then |
33 | // sender() wont work), we need to insert this object in the middle. |
34 | class QQmlTypeLoaderNetworkReplyProxy : public QObject |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | QQmlTypeLoaderNetworkReplyProxy(QQmlTypeLoader *l); |
39 | |
40 | public Q_SLOTS: |
41 | void finished(); |
42 | void downloadProgress(qint64, qint64); |
43 | void manualFinished(QNetworkReply*); |
44 | |
45 | private: |
46 | QQmlTypeLoader *l; |
47 | }; |
48 | |
49 | QT_END_NAMESPACE |
50 | |
51 | #endif // QQMLTYPELOADERNETWORKREPLYPROXY_P_H |
52 | |