File indexing completed on 2024-04-28 16:55:19

0001 /*
0002  * SPDX-FileCopyrightText: 2017 The Qt Company Ltd.
0003  * SPDX-FileCopyrightText: 2017 Marco Martin <mart@kde.org>
0004  * SPDX-FileCopyrightText: 2020 Noah Davis <noahadvs@gmail.com>
0005  * SPDX-License-Identifier: LGPL-3.0-only OR GPL-2.0-or-later OR LicenseRef-KDE-Accepted-LGPL OR LicenseRef-KFQF-Accepted-GPL
0006  */
0007 
0008 #include "qqc2breezestyleplugin.h"
0009 #include "impl/breezedial.h"
0010 #include "impl/iconlabellayout.h"
0011 #include "impl/kcolorutilssingleton.h"
0012 #include "impl/paintedsymbolitem.h"
0013 
0014 #include <QQmlContext>
0015 #include <QQmlEngine>
0016 #include <QQmlFile>
0017 #include <QQuickWindow>
0018 
0019 QQC2BreezeStylePlugin::QQC2BreezeStylePlugin(QObject *parent)
0020     : QQmlExtensionPlugin(parent)
0021 {
0022 }
0023 
0024 QQC2BreezeStylePlugin::~QQC2BreezeStylePlugin()
0025 {
0026 }
0027 
0028 QString QQC2BreezeStylePlugin::name() const
0029 {
0030     return QStringLiteral("org.kde.breeze");
0031 }
0032 
0033 void QQC2BreezeStylePlugin::registerTypes(const char *uri)
0034 {
0035     Q_ASSERT(QLatin1String(uri) == name());
0036 
0037     // BEGIN org.kde.breeze
0038     qmlRegisterModule(uri, 1, 0);
0039     qmlRegisterType<PaintedSymbolItem>(uri, 1, 0, "PaintedSymbol");
0040     qmlRegisterType<IconLabelLayout>(uri, 1, 0, "IconLabelLayout");
0041     qmlRegisterType<BreezeDial>(uri, 1, 0, "BreezeDial");
0042     // KColorUtilsSingleton only has invocable functions.
0043     // Would this be better off being a SingletonInstance?
0044     qmlRegisterSingletonType<KColorUtilsSingleton>(uri, 1, 0, "KColorUtils", [](QQmlEngine *, QJSEngine *) -> QObject * {
0045         return new KColorUtilsSingleton;
0046     });
0047     // END
0048 
0049     // Prevent additional types from being added.
0050     qmlProtectModule(uri, 1);
0051 }
0052 
0053 #include "moc_qqc2breezestyleplugin.cpp"