File indexing completed on 2024-05-12 04:46:38

0001 // SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
0002 //
0003 // SPDX-License-Identifier: LGPL-2.1-or-later
0004 
0005 #pragma once
0006 
0007 #include <QDir>
0008 #include <QQmlExtensionPlugin>
0009 
0010 class ImageToolsPlugin : public QQmlExtensionPlugin
0011 {
0012     Q_OBJECT
0013     Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid)
0014 public:
0015     void registerTypes(const char *uri) override;
0016 private:
0017     QUrl componentUrl(const QString &fileName) const;
0018 
0019     QString resolveFileUrl(const QString &filePath) const
0020     {
0021 #if defined(Q_OS_ANDROID)
0022         return QStringLiteral("qrc:/android_rcc_bundle/qml/org/mauikit/imagetools/") + filePath;
0023 #else
0024 #ifdef QUICK_COMPILER
0025         return QStringLiteral("qrc:/mauikit/imagetools/") + filePath;
0026 #else
0027         return baseUrl().toString() + QLatin1Char('/') + filePath;
0028 #endif
0029 #endif
0030     }
0031 };