From 3932371cd12ae7ec0812fbb2db3315448e18f1a8 Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sun, 11 Oct 2020 21:17:34 +0200 Subject: Use proxy for ModList, PluginList and DownloadManager. Do not use registered callbacks when plugin is inactive. --- src/pluginlistproxy.cpp | 73 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 src/pluginlistproxy.cpp (limited to 'src/pluginlistproxy.cpp') diff --git a/src/pluginlistproxy.cpp b/src/pluginlistproxy.cpp new file mode 100644 index 00000000..1f8dc2b4 --- /dev/null +++ b/src/pluginlistproxy.cpp @@ -0,0 +1,73 @@ +#include "pluginlistproxy.h" +#include "organizerproxy.h" +#include "proxyutils.h" + +using namespace MOBase; + +PluginListProxy::PluginListProxy(OrganizerProxy* oproxy, IPluginList* pluginlist) : + m_OrganizerProxy(oproxy), m_Proxied(pluginlist) { } + +QStringList PluginListProxy::pluginNames() const +{ + return m_Proxied->pluginNames(); +} + +IPluginList::PluginStates PluginListProxy::state(const QString& name) const +{ + return m_Proxied->state(name); +} + +void PluginListProxy::setState(const QString& name, PluginStates state) +{ + return m_Proxied->setState(name, state); +} + +int PluginListProxy::priority(const QString& name) const +{ + return m_Proxied->priority(name); +} + +bool PluginListProxy::setPriority(const QString& name, int newPriority) +{ + return m_Proxied->setPriority(name, newPriority); +} + +int PluginListProxy::loadOrder(const QString& name) const +{ + return m_Proxied->loadOrder(name); +} + +void PluginListProxy::setLoadOrder(const QStringList& pluginList) +{ + return m_Proxied->setLoadOrder(pluginList); +} + +bool PluginListProxy::isMaster(const QString& name) const +{ + return m_Proxied->isMaster(name); +} + +QStringList PluginListProxy::masters(const QString& name) const +{ + return m_Proxied->masters(name); +} + +QString PluginListProxy::origin(const QString& name) const +{ + return m_Proxied->origin(name); +} + +bool PluginListProxy::onRefreshed(const std::function& callback) +{ + return m_Proxied->onRefreshed(MOShared::callIfPluginActive(m_OrganizerProxy, callback)); +} + +bool PluginListProxy::onPluginMoved(const std::function& func) +{ + return m_Proxied->onPluginMoved(MOShared::callIfPluginActive(m_OrganizerProxy, func)); +} + +bool PluginListProxy::onPluginStateChanged(const std::function&)> &func) +{ + return m_Proxied->onPluginStateChanged(MOShared::callIfPluginActive(m_OrganizerProxy, func)); +} -- cgit v1.3.1