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
24QT_BEGIN_NAMESPACE
25
26namespace Qt3DCore {
27class QEntity;
28}
29
30namespace Qt3DRender {
31
32Q_DECLARE_LOGGING_CATEGORY(SceneParsers)
33
34class 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
40public:
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
61Q_SIGNALS:
62 void statusChanged(ParserStatus status);
63 void errorsChanged(const QStringList &errors);
64
65protected:
66 void setStatus(ParserStatus status);
67 void logError(const QString &error);
68 void logInfo(const QString &info);
69
70private:
71 ParserStatus m_status;
72 QStringList m_errors;
73};
74
75} // namespace Qt3DRender
76
77QT_END_NAMESPACE
78
79#endif // QT3DRENDER_QSCENE_IMPORTER_P_H
80

source code of qt3d/src/render/io/qsceneimporter_p.h