File indexing completed on 2024-05-12 05:38:09

0001 /*
0002     SPDX-FileCopyrightText: 2015-2016 Eike Hein <hein@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include "taskmanagerplugin.h"
0008 
0009 #include "abstracttasksmodel.h"
0010 #include "activityinfo.h"
0011 #include "tasksmodel.h"
0012 #include "virtualdesktopinfo.h"
0013 
0014 #ifdef WITH_KPIPEWIRE
0015 #include <pipewiresourceitem.h>
0016 #endif
0017 #include "screencasting.h"
0018 #include "screencastingrequest.h"
0019 
0020 namespace TaskManager
0021 {
0022 void TaskManagerPlugin::registerTypes(const char *uri)
0023 {
0024     Q_ASSERT(uri == QByteArrayLiteral("org.kde.taskmanager"));
0025 
0026     // Expose the AbstractTasksModel::AdditionalRoles enum to Qt Quick
0027     // for use with the TasksModel::data invokable. TasksModel inherits
0028     // the data roles from its source model, despite not inheriting from
0029     // AbstractTasksModel to avoid multiple inheritance from QObject-
0030     // derived classes.
0031     qmlRegisterUncreatableType<AbstractTasksModel>(uri, 0, 1, "AbstractTasksModel", "");
0032 
0033     qmlRegisterType<TasksModel>(uri, 0, 1, "TasksModel");
0034     qmlRegisterType<ActivityInfo>(uri, 0, 1, "ActivityInfo");
0035     qmlRegisterType<VirtualDesktopInfo>(uri, 0, 1, "VirtualDesktopInfo");
0036 #ifdef WITH_KPIPEWIRE
0037     qmlRegisterType<PipeWireSourceItem>(uri, 0, 1, "PipeWireSourceItem");
0038 #endif
0039     qmlRegisterType<ScreencastingRequest>(uri, 0, 1, "ScreencastingRequest");
0040     qmlRegisterUncreatableType<Screencasting>(uri, 0, 1, "Screencasting", "Use ScreencastingItem");
0041 
0042     const QString reason = QStringLiteral("error: only enums");
0043     qmlRegisterUncreatableMetaObject(RegionFilterMode::staticMetaObject, uri, 0, 1, "RegionFilterMode", reason);
0044 }
0045 
0046 }