File indexing completed on 2024-05-12 16:59:20
0001 /* 0002 * SPDX-FileCopyrightText: 2012-2016 Ivan Cukic <ivan.cukic@kde.org> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 // Self 0008 #include "Module.h" 0009 0010 // Qt 0011 #include <QHash> 0012 0013 // Utils 0014 #include <utils/d_ptr_implementation.h> 0015 0016 // Local 0017 #include "DebugApplication.h" 0018 0019 class Module::Private 0020 { 0021 public: 0022 static QHash<QString, QObject *> s_modules; 0023 }; 0024 0025 QHash<QString, QObject *> Module::Private::s_modules; 0026 0027 Module::Module(const QString &name, QObject *parent) 0028 : QObject(parent) 0029 , d() 0030 { 0031 if (!name.isEmpty()) { 0032 Private::s_modules[name] = this; 0033 } 0034 } 0035 0036 Module::~Module() 0037 { 0038 } 0039 0040 QObject *Module::get(const QString &name) 0041 { 0042 Q_ASSERT(!name.isEmpty()); 0043 0044 if (Private::s_modules.contains(name)) { 0045 qCDebug(KAMD_LOG_APPLICATION) << "Returning a valid module object for:" << name; 0046 return Private::s_modules[name]; 0047 } 0048 0049 qCWarning(KAMD_LOG_APPLICATION) << "The requested module doesn't exist:" << name; 0050 return nullptr; 0051 } 0052 0053 QHash<QString, QObject *> &Module::get() 0054 { 0055 return Private::s_modules; 0056 } 0057 0058 bool Module::isFeatureEnabled(const QStringList &feature) const 0059 { 0060 Q_UNUSED(feature); 0061 return false; 0062 } 0063 0064 bool Module::isFeatureOperational(const QStringList &feature) const 0065 { 0066 Q_UNUSED(feature); 0067 return false; 0068 } 0069 0070 void Module::setFeatureEnabled(const QStringList &feature, bool value) 0071 { 0072 Q_UNUSED(feature); 0073 Q_UNUSED(value); 0074 } 0075 0076 QStringList Module::listFeatures(const QStringList &feature) const 0077 { 0078 Q_UNUSED(feature); 0079 return QStringList(); 0080 } 0081 0082 QDBusVariant Module::featureValue(const QStringList &property) const 0083 { 0084 Q_UNUSED(property); 0085 0086 return QDBusVariant(); 0087 } 0088 0089 void Module::setFeatureValue(const QStringList &property, const QDBusVariant &value) 0090 { 0091 Q_UNUSED(property); 0092 Q_UNUSED(value); 0093 }