1 | // Copyright (C) 2017 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 QSHAREDIMAGEPROVIDER_H |
5 | #define QSHAREDIMAGEPROVIDER_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 "qtlabssharedimageglobal_p.h" |
19 | |
20 | #include <QQuickImageProvider> |
21 | #include <private/qquickpixmapcache_p.h> |
22 | #include <QScopedPointer> |
23 | |
24 | #include "qsharedimageloader_p.h" |
25 | |
26 | QT_BEGIN_NAMESPACE |
27 | |
28 | class SharedImageProvider; |
29 | |
30 | class QuickSharedImageLoader : public QSharedImageLoader |
31 | { |
32 | Q_OBJECT |
33 | friend class SharedImageProvider; |
34 | |
35 | public: |
36 | enum ImageParameter { |
37 | OriginalSize = 0, |
38 | RequestedSize, |
39 | ProviderOptions, |
40 | NumImageParameters |
41 | }; |
42 | |
43 | QuickSharedImageLoader(QObject *parent = nullptr); |
44 | protected: |
45 | QImage loadFile(const QString &path, ImageParameters *params) override; |
46 | QString key(const QString &path, ImageParameters *params) override; |
47 | }; |
48 | |
49 | class Q_LABSSHAREDIMAGE_PRIVATE_EXPORT SharedImageProvider : public QQuickImageProviderWithOptions |
50 | { |
51 | public: |
52 | SharedImageProvider(); |
53 | |
54 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize, const QQuickImageProviderOptions &options) override; |
55 | |
56 | protected: |
57 | QScopedPointer<QuickSharedImageLoader> loader; |
58 | }; |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // QSHAREDIMAGEPROVIDER_H |
63 |