diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-10-11 21:17:34 +0200 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-10-11 21:17:34 +0200 |
| commit | 3932371cd12ae7ec0812fbb2db3315448e18f1a8 (patch) | |
| tree | 9751fce7edd8d6042f3f78bdfecedea520338b83 /src/pluginlistproxy.cpp | |
| parent | 0363b73adb75714c94a7a7cea2840a9c40ee006e (diff) | |
Use proxy for ModList, PluginList and DownloadManager. Do not use registered callbacks when plugin is inactive.
Diffstat (limited to 'src/pluginlistproxy.cpp')
| -rw-r--r-- | src/pluginlistproxy.cpp | 73 |
1 files changed, 73 insertions, 0 deletions
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<void()>& callback) +{ + return m_Proxied->onRefreshed(MOShared::callIfPluginActive(m_OrganizerProxy, callback)); +} + +bool PluginListProxy::onPluginMoved(const std::function<void(const QString&, int, int)>& func) +{ + return m_Proxied->onPluginMoved(MOShared::callIfPluginActive(m_OrganizerProxy, func)); +} + +bool PluginListProxy::onPluginStateChanged(const std::function<void(const std::map<QString, PluginStates>&)> &func) +{ + return m_Proxied->onPluginStateChanged(MOShared::callIfPluginActive(m_OrganizerProxy, func)); +} |
