File indexing completed on 2025-01-26 04:24:57
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 DocumentsPlugin : public QQmlExtensionPlugin 0011 { 0012 Q_OBJECT 0013 Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) 0014 public: 0015 void registerTypes(const char *uri) override; 0016 0017 private: 0018 void initializeEngine(QQmlEngine *engine, const char *uri) override; 0019 QUrl componentUrl(const QString &fileName) const; 0020 0021 QString resolveFileUrl(const QString &filePath) const 0022 { 0023 #if defined(Q_OS_ANDROID) 0024 return QStringLiteral("qrc:/android_rcc_bundle/qml/org/mauikit/documents/") + filePath; 0025 #else 0026 #ifdef QUICK_COMPILER 0027 return QStringLiteral("qrc:/mauikit/documents/") + filePath; 0028 #else 0029 return baseUrl().toString() + QLatin1Char('/') + filePath; 0030 #endif 0031 #endif 0032 } 0033 };