Warning, file /kdevelop/kdevelop/plugins/welcomepage/declarative/kdevelopdashboarddeclarativeplugin.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: 2012 Aleix Pol <aleixpol@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "kdevelopdashboarddeclarativeplugin.h" 0008 0009 #include "debug.h" 0010 #include "icoreobject.h" 0011 0012 #include <qqml.h> 0013 #include <vcs/models/brancheslistmodel.h> 0014 #include <interfaces/iproject.h> 0015 #include <interfaces/icore.h> 0016 0017 class Logger : public QObject 0018 { 0019 Q_OBJECT 0020 public: 0021 explicit Logger(const QLoggingCategory &category, QObject *parent = nullptr) 0022 : QObject(parent) 0023 , m_category(category) 0024 {} 0025 0026 Q_INVOKABLE void log(const QString &message) 0027 { 0028 qCDebug(m_category) << message; 0029 } 0030 0031 private: 0032 const QLoggingCategory &m_category; 0033 }; 0034 0035 void KDevplatformDeclarativePlugin::registerTypes(const char* uri) 0036 { 0037 static const QLoggingCategory loggingCategory{"kdevelop.plugins.welcomepage"}; 0038 0039 qmlRegisterSingletonType<KDevelop::ICore>(uri, 1, 0, "ICore", [](QQmlEngine*, QJSEngine*) -> QObject* { 0040 return KDevelop::ICore::self(); 0041 }); 0042 qmlRegisterSingletonType<KDevelop::ICore>(uri, 1, 0, "Logger", [](QQmlEngine*, QJSEngine*) -> QObject* { 0043 return new Logger(loggingCategory); 0044 }); 0045 qmlRegisterType<KDevelop::BranchesListModel>(uri, 1, 0, "BranchesListModel"); 0046 0047 qmlRegisterAnonymousType<KDevelop::IProject>(uri, 1); 0048 } 0049 0050 #include "kdevelopdashboarddeclarativeplugin.moc" 0051 #include "moc_kdevelopdashboarddeclarativeplugin.cpp"