1 | // Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
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 QT3DRENDER_QSCENE_IMPORTER_P_H |
5 | #define QT3DRENDER_QSCENE_IMPORTER_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 <QObject> |
19 | #include <QStringList> |
20 | #include <QLoggingCategory> |
21 | #include <QUrl> |
22 | #include <private/qt3drender_global_p.h> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | namespace Qt3DCore { |
27 | class QEntity; |
28 | } |
29 | |
30 | namespace Qt3DRender { |
31 | |
32 | Q_DECLARE_LOGGING_CATEGORY(SceneParsers) |
33 | |
34 | class Q_3DRENDERSHARED_PRIVATE_EXPORT QSceneImporter : public QObject |
35 | { |
36 | Q_OBJECT |
37 | Q_PROPERTY(ParserStatus status READ status NOTIFY statusChanged) |
38 | Q_PROPERTY(QStringList errors READ errors NOTIFY errorsChanged) |
39 | |
40 | public: |
41 | enum ParserStatus { |
42 | Empty, |
43 | Loading, |
44 | Loaded, |
45 | Error |
46 | }; |
47 | Q_ENUM(ParserStatus) // LCOV_EXCL_LINE |
48 | |
49 | QSceneImporter(); |
50 | virtual ~QSceneImporter(); |
51 | |
52 | virtual void setSource(const QUrl &source) = 0; |
53 | virtual void setData(const QByteArray& data, const QString &basePath) = 0; |
54 | virtual bool areFileTypesSupported(const QStringList &extensions) const = 0; |
55 | virtual Qt3DCore::QEntity *scene(const QString &id = QString()) = 0; |
56 | virtual Qt3DCore::QEntity *node(const QString &id) = 0; |
57 | |
58 | ParserStatus status() const; |
59 | QStringList errors() const; |
60 | |
61 | Q_SIGNALS: |
62 | void statusChanged(ParserStatus status); |
63 | void errorsChanged(const QStringList &errors); |
64 | |
65 | protected: |
66 | void setStatus(ParserStatus status); |
67 | void logError(const QString &error); |
68 | void logInfo(const QString &info); |
69 | |
70 | private: |
71 | ParserStatus m_status; |
72 | QStringList m_errors; |
73 | }; |
74 | |
75 | } // namespace Qt3DRender |
76 | |
77 | QT_END_NAMESPACE |
78 | |
79 | #endif // QT3DRENDER_QSCENE_IMPORTER_P_H |
80 | |