File indexing completed on 2024-05-12 16:59:42

0001 /*
0002     SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include <QQmlContext>
0008 #include <QQmlEngine>
0009 #include <QQmlExtensionPlugin>
0010 
0011 #include "potdbackend.h"
0012 #include "potdprovider.h"
0013 #include "potdprovidermodel.h"
0014 
0015 class PotdPlugin : public QQmlExtensionPlugin
0016 {
0017     Q_OBJECT
0018     Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
0019 
0020 public:
0021     void registerTypes(const char *uri) override
0022     {
0023         Q_ASSERT(uri == QByteArrayLiteral("org.kde.plasma.wallpapers.potd"));
0024 
0025         qRegisterMetaType<PotdProviderData>();
0026 
0027         qmlRegisterType<PotdBackend>(uri, 1, 0, "PotdBackend");
0028         qmlRegisterType<PotdProviderModel>(uri, 1, 0, "PotdProviderModel");
0029 
0030         qmlRegisterUncreatableType<PotdBackend>(uri, 1, 0, "Global", QStringLiteral("Error: only enums"));
0031     }
0032 };
0033 
0034 #include "potdplugin.moc"