File indexing completed on 2024-11-10 05:02:45

0001 /*
0002     SPDX-FileCopyrightText: 2013 Marco Martin <mart@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "imageplugin.h"
0008 #include <QQmlContext>
0009 
0010 #include <KFileItem>
0011 
0012 #include "finder/mediametadatafinder.h"
0013 #include "imagebackend.h"
0014 #include "provider/packageimageprovider.h"
0015 #include "sortingmode.h"
0016 #include "utils/maximizedwindowmonitor.h"
0017 #include "utils/mediaproxy.h"
0018 
0019 void ImagePlugin::initializeEngine(QQmlEngine *engine, const char *)
0020 {
0021     engine->addImageProvider(QStringLiteral("package"), new PackageImageProvider);
0022 }
0023 
0024 void ImagePlugin::registerTypes(const char *uri)
0025 {
0026     qRegisterMetaType<KFileItem>(); // For image preview
0027     qRegisterMetaType<MediaMetadata>(); // For image preview
0028 
0029     qmlRegisterType<ImageBackend>(uri, 2, 0, "ImageBackend");
0030     qmlRegisterType<MediaProxy>(uri, 2, 0, "MediaProxy");
0031 
0032     qmlRegisterType<MaximizedWindowMonitor>(uri, 2, 0, "MaximizedWindowMonitor");
0033 
0034     qmlRegisterAnonymousType<QAbstractItemModel>("QAbstractItemModel", 1);
0035 
0036     const QString reason = QStringLiteral("error: only enums");
0037     qmlRegisterUncreatableMetaObject(Provider::staticMetaObject, uri, 2, 0, "Provider", reason);
0038     qmlRegisterUncreatableMetaObject(BackgroundType::staticMetaObject, uri, 2, 0, "BackgroundType", reason);
0039     qmlRegisterUncreatableMetaObject(SortingMode::staticMetaObject, uri, 2, 0, "SortingMode", reason);
0040 }