File indexing completed on 2024-12-22 04:31:09

0001 #include "pluginmanager.h"
0002 
0003 using namespace MauiKitPlugin;
0004 
0005 MauiKitPlugin::PluginsModel::PluginsModel(QObject *parent)
0006     : MauiList(parent)
0007 {
0008 }
0009 
0010 FMH::MODEL_LIST MauiKitPlugin::PluginsModel::items() const
0011 {
0012     return m_plugins;
0013 }
0014 
0015 void MauiKitPlugin::PluginInterface::setType(const uint &value)
0016 {
0017     if (m_type == value) {
0018         return;
0019     }
0020 
0021     m_type = value;
0022     emit typeChanged();
0023 }
0024 
0025 void MauiKitPlugin::PluginInterface::setTarget(const uint &value)
0026 {
0027 }
0028 
0029 void MauiKitPlugin::PluginInterface::setOrientation(const uint &value)
0030 {
0031 }
0032 
0033 MauiKitPlugin::PluginManager::PluginManager(QObject *parent)
0034     : QObject(parent)
0035     , m_plugins(new PluginsModel(this))
0036     , m_interfaces(new PluginInterfacesModel(this))
0037 {
0038 }
0039 
0040 void MauiKitPlugin::PluginManager::registerInterface(QObject *interface, const QString &id)
0041 {
0042     if (m_interfaces.contains(id)) {
0043         qWarning() << "Interface id has already been registered" << id;
0044         return;
0045     }
0046 
0047     m_interfaces.append(id, interface);
0048 }