diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2015-12-02 15:53:04 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-12-02 22:06:36 +0000 |
commit | c45b47e99eaf0bcecec606a304b338424d58561b (patch) | |
tree | 501e8e77c7f1462a44969c8b3c17acf72bdd645f /src/render/io | |
parent | 4ab78c9a125abc667a4166c58f9be2d72bdef5a7 (diff) |
Move core/io content to render/geometry and io
Change-Id: I79e0b0d62e07a269ebfce99edff56d30da28494c
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/render/io')
-rw-r--r-- | src/render/io/io.pri | 2 | ||||
-rw-r--r-- | src/render/io/qurlhelper.cpp | 65 | ||||
-rw-r--r-- | src/render/io/qurlhelper_p.h | 68 |
3 files changed, 135 insertions, 0 deletions
diff --git a/src/render/io/io.pri b/src/render/io/io.pri index e6e05ef29..c2ce822f8 100644 --- a/src/render/io/io.pri +++ b/src/render/io/io.pri @@ -6,6 +6,7 @@ HEADERS += \ $$PWD/qabstractsceneloader_p.h \ $$PWD/qaxisalignedboundingbox_p.h \ $$PWD/qsceneloader.h \ + $$PWD/qurlhelper_p.h \ $$PWD/scene_p.h \ $$PWD/scenemanager_p.h \ $$PWD/uniformbuffer_p.h \ @@ -18,6 +19,7 @@ SOURCES += \ $$PWD/qabstractsceneloader.cpp \ $$PWD/qaxisalignedboundingbox.cpp \ $$PWD/qsceneloader.cpp \ + $$PWD/qurlhelper.cpp \ $$PWD/scene.cpp \ $$PWD/scenemanager.cpp \ $$PWD/uniformbuffer.cpp \ diff --git a/src/render/io/qurlhelper.cpp b/src/render/io/qurlhelper.cpp new file mode 100644 index 000000000..5663689fe --- /dev/null +++ b/src/render/io/qurlhelper.cpp @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qurlhelper_p.h" + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +QString QUrlHelper::urlToLocalFileOrQrc(const QUrl &url) +{ + const QString scheme(url.scheme().toLower()); + if (scheme == QLatin1String("qrc")) { + if (url.authority().isEmpty()) + return QLatin1Char(':') + url.path(); + return QString(); + } + +#if defined(Q_OS_ANDROID) + if (scheme == QLatin1String("assets")) { + if (url.authority().isEmpty()) + return url.toString(); + return QString(); + } +#endif + + return url.toLocalFile(); +} + +} // Qt3DRender + +QT_END_NAMESPACE diff --git a/src/render/io/qurlhelper_p.h b/src/render/io/qurlhelper_p.h new file mode 100644 index 000000000..9c4f21384 --- /dev/null +++ b/src/render/io/qurlhelper_p.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT3DRENDER_QURLHELPER_P_H +#define QT3DRENDER_QURLHELPER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <Qt3DRender/qt3drender_global.h> +#include <QUrl> + +QT_BEGIN_NAMESPACE + +namespace Qt3DRender { + +class QT3DRENDERSHARED_EXPORT QUrlHelper +{ +public: + static QString urlToLocalFileOrQrc(const QUrl &url); +}; + +} // Qt3DRender + +QT_END_NAMESPACE + +#endif // QT3DRENDER_QURLHELPER_P_H |