| 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 QSHAREDIMAGELOADER_H | 
| 5 | #define QSHAREDIMAGELOADER_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 <QImage> | 
| 21 | #include <QVariant> | 
| 22 | #include <QLoggingCategory> | 
| 23 | #include <qqml.h> | 
| 24 | |
| 25 | QT_BEGIN_NAMESPACE | 
| 26 | |
| 27 | Q_DECLARE_LOGGING_CATEGORY(lcSharedImage); | 
| 28 | |
| 29 | class QSharedImageLoaderPrivate; | 
| 30 | |
| 31 | class Q_LABSSHAREDIMAGE_EXPORT QSharedImageLoader : public QObject | 
| 32 | { | 
| 33 | Q_OBJECT | 
| 34 | Q_DECLARE_PRIVATE(QSharedImageLoader) | 
| 35 | |
| 36 | // We need to provide some type, in order to mention the 1.0 version. | 
| 37 | QML_ANONYMOUS | 
| 38 | QML_ADDED_IN_VERSION(1, 0) | 
| 39 | |
| 40 | public: | 
| 41 | typedef QVector<QVariant> ImageParameters; | 
| 42 | |
| 43 | QSharedImageLoader(QObject *parent = nullptr); | 
| 44 | ~QSharedImageLoader(); | 
| 45 | |
| 46 | QImage load(const QString &path, ImageParameters *params = nullptr); | 
| 47 | |
| 48 | protected: | 
| 49 | virtual QImage loadFile(const QString &path, ImageParameters *params); | 
| 50 | virtual QString key(const QString &path, ImageParameters *params); | 
| 51 | |
| 52 | private: | 
| 53 | Q_DISABLE_COPY(QSharedImageLoader) | 
| 54 | }; | 
| 55 | |
| 56 | QT_END_NAMESPACE | 
| 57 | |
| 58 | #endif // QSHAREDIMAGELOADER_H | 
| 59 | 
