File indexing completed on 2024-05-05 17:39:47
0001 /* 0002 SPDX-FileCopyrightText: 2020 Arjen Hiemstra <ahiemstra@heimr.nl> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #include "FormatterPlugin.h" 0008 0009 #include "FormatterWrapper.h" 0010 #include "Unit.h" 0011 0012 #include <QQmlEngine> 0013 0014 using namespace KSysGuard; 0015 0016 void FormatterPlugin::registerTypes(const char *uri) 0017 { 0018 Q_ASSERT(QLatin1String(uri) == QLatin1String("org.kde.ksysguard.formatter")); 0019 0020 qRegisterMetaType<KSysGuard::Unit>(); 0021 qRegisterMetaType<KSysGuard::MetricPrefix>(); 0022 qmlRegisterSingletonType<KSysGuard::FormatterWrapper>(uri, 1, 0, "Formatter", [](QQmlEngine *, QJSEngine *) -> QObject * { 0023 return new FormatterWrapper(); 0024 }); 0025 qmlRegisterUncreatableMetaObject(KSysGuard::staticMetaObject, uri, 1, 0, "Units", QStringLiteral("Contains unit enums")); 0026 }