Warning, file /plasma/plasma-mobile/components/mobileshell/mobileshellplugin.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  *  SPDX-FileCopyrightText: 2021 Devin Lin <devin@kde.org>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #include "mobileshellplugin.h"
0008 
0009 #include <QQmlContext>
0010 #include <QQuickItem>
0011 
0012 #include "components/direction.h"
0013 
0014 #include "notifications/notificationfilemenu.h"
0015 #include "notifications/notificationthumbnailer.h"
0016 
0017 #include "taskswitcher/displaysmodel.h"
0018 
0019 #include "quicksettings/paginatemodel.h"
0020 #include "quicksettings/quicksetting.h"
0021 #include "quicksettings/quicksettingsmodel.h"
0022 
0023 #include "mobileshellsettings.h"
0024 #include "shellutil.h"
0025 #include "windowutil.h"
0026 
0027 QUrl resolvePath(std::string str)
0028 {
0029     return QUrl("qrc:/org/kde/plasma/private/mobileshell/qml/" + QString::fromStdString(str));
0030 }
0031 
0032 void MobileShellPlugin::registerTypes(const char *uri)
0033 {
0034     Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.plasma.private.mobileshell"));
0035 
0036     qmlRegisterSingletonType<ShellUtil>(uri, 1, 0, "ShellUtil", [](QQmlEngine *, QJSEngine *) -> QObject * {
0037         return ShellUtil::instance();
0038     });
0039 
0040     qmlRegisterSingletonType<MobileShellSettings>(uri, 1, 0, "MobileShellSettings", [](QQmlEngine *, QJSEngine *) -> QObject * {
0041         return MobileShellSettings::self();
0042     });
0043 
0044     qmlRegisterType<QuickSetting>(uri, 1, 0, "QuickSetting");
0045     qmlRegisterType<QuickSettingsModel>(uri, 1, 0, "QuickSettingsModel");
0046     qmlRegisterType<PaginateModel>(uri, 1, 0, "PaginateModel");
0047     qmlRegisterType<SavedQuickSettings>(uri, 1, 0, "SavedQuickSettings");
0048     qmlRegisterType<SavedQuickSettingsModel>(uri, 1, 0, "SavedQuickSettingsModel");
0049     qmlRegisterSingletonType<WindowUtil>(uri, 1, 0, "WindowUtil", [](QQmlEngine *, QJSEngine *) -> QObject * {
0050         return WindowUtil::instance();
0051     });
0052 
0053     // components
0054     qmlRegisterType<Direction>(uri, 1, 0, "Direction");
0055 
0056     // notifications
0057     qmlRegisterType<NotificationThumbnailer>(uri, 1, 0, "NotificationThumbnailer");
0058     qmlRegisterType<NotificationFileMenu>(uri, 1, 0, "NotificationFileMenu");
0059 
0060     // taskswitcher
0061     qmlRegisterType<DisplaysModel>(uri, 1, 0, "DisplaysModel");
0062 
0063     // qml modules
0064 
0065     // /actiondrawer
0066     qmlRegisterType(resolvePath("actiondrawer/ActionDrawer.qml"), uri, 1, 0, "ActionDrawer");
0067     qmlRegisterType(resolvePath("actiondrawer/ActionDrawerOpenSurface.qml"), uri, 1, 0, "ActionDrawerOpenSurface");
0068     qmlRegisterType(resolvePath("actiondrawer/ActionDrawerWindow.qml"), uri, 1, 0, "ActionDrawerWindow");
0069 
0070     // /components
0071     qmlRegisterType(resolvePath("components/BaseItem.qml"), uri, 1, 0, "BaseItem");
0072     qmlRegisterType(resolvePath("components/ExtendedAbstractButton.qml"), uri, 1, 0, "ExtendedAbstractButton");
0073     qmlRegisterType(resolvePath("components/Flickable.qml"), uri, 1, 0, "Flickable");
0074     qmlRegisterType(resolvePath("components/GridView.qml"), uri, 1, 0, "GridView");
0075     qmlRegisterType(resolvePath("components/HapticsEffectLoader.qml"), uri, 1, 0, "HapticsEffectLoader");
0076     qmlRegisterType(resolvePath("components/ListView.qml"), uri, 1, 0, "ListView");
0077     qmlRegisterType(resolvePath("components/StartupFeedback.qml"), uri, 1, 0, "StartupFeedback");
0078     qmlRegisterType(resolvePath("components/VelocityCalculator.qml"), uri, 1, 0, "VelocityCalculator");
0079 
0080     // /dataproviders
0081     qmlRegisterType(resolvePath("dataproviders/BatteryInfo.qml"), uri, 1, 0, "BatteryInfo");
0082     qmlRegisterType(resolvePath("dataproviders/BluetoothInfo.qml"), uri, 1, 0, "BluetoothInfo");
0083     qmlRegisterType(resolvePath("dataproviders/SignalStrengthInfo.qml"), uri, 1, 0, "SignalStrengthInfo");
0084     qmlRegisterSingletonType(resolvePath("dataproviders/AudioProvider.qml"), uri, 1, 0, "AudioProvider");
0085 
0086     // /homescreen
0087     qmlRegisterType(resolvePath("homescreen/HomeScreen.qml"), uri, 1, 0, "HomeScreen");
0088 
0089     // /navigationpanel
0090     qmlRegisterType(resolvePath("navigationpanel/NavigationGestureArea.qml"), uri, 1, 0, "NavigationGestureArea");
0091     qmlRegisterType(resolvePath("navigationpanel/NavigationPanel.qml"), uri, 1, 0, "NavigationPanel");
0092     qmlRegisterType(resolvePath("navigationpanel/NavigationPanelAction.qml"), uri, 1, 0, "NavigationPanelAction");
0093 
0094     // /statusbar
0095     qmlRegisterType(resolvePath("statusbar/StatusBar.qml"), uri, 1, 0, "StatusBar");
0096 
0097     // /taskswitcher
0098     qmlRegisterType(resolvePath("taskswitcher/TaskSwitcher.qml"), uri, 1, 0, "TaskSwitcher");
0099 
0100     // /widgets
0101     qmlRegisterType(resolvePath("widgets/krunner/KRunnerWidget.qml"), uri, 1, 0, "KRunnerWidget");
0102     qmlRegisterType(resolvePath("widgets/mediacontrols/MediaControlsWidget.qml"), uri, 1, 0, "MediaControlsWidget");
0103     qmlRegisterType(resolvePath("widgets/notifications/NotificationsWidget.qml"), uri, 1, 0, "NotificationsWidget");
0104     qmlRegisterType(resolvePath("widgets/notifications/NotificationsModelType.qml"), uri, 1, 0, "NotificationsModelType");
0105 }