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/modlistproxy.cpp | |
| parent | 0363b73adb75714c94a7a7cea2840a9c40ee006e (diff) | |
Use proxy for ModList, PluginList and DownloadManager. Do not use registered callbacks when plugin is inactive.
Diffstat (limited to 'src/modlistproxy.cpp')
| -rw-r--r-- | src/modlistproxy.cpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/modlistproxy.cpp b/src/modlistproxy.cpp new file mode 100644 index 00000000..7ec00c49 --- /dev/null +++ b/src/modlistproxy.cpp @@ -0,0 +1,53 @@ +#include "modlistproxy.h" +#include "organizerproxy.h" +#include "proxyutils.h" + +using namespace MOBase; + +ModListProxy::ModListProxy(OrganizerProxy* oproxy, IModList* modlist) : + m_OrganizerProxy(oproxy), m_Proxied(modlist) { } + +QString ModListProxy::displayName(const QString& internalName) const +{ + return m_Proxied->displayName(internalName); +} + +QStringList ModListProxy::allMods() const +{ + return m_Proxied->allMods(); +} + +IModList::ModStates ModListProxy::state(const QString& name) const +{ + return m_Proxied->state(name); +} + +bool ModListProxy::setActive(const QString& name, bool active) +{ + return m_Proxied->setActive(name, active); +} + +int ModListProxy::setActive(const QStringList& names, bool active) +{ + return m_Proxied->setActive(names, active); +} + +int ModListProxy::priority(const QString& name) const +{ + return m_Proxied->priority(name); +} + +bool ModListProxy::setPriority(const QString& name, int newPriority) +{ + return m_Proxied->setPriority(name, newPriority); +} + +bool ModListProxy::onModStateChanged(const std::function<void(const std::map<QString, ModStates>&)>& func) +{ + return m_Proxied->onModStateChanged(MOShared::callIfPluginActive(m_OrganizerProxy, func)); +} + +bool ModListProxy::onModMoved(const std::function<void(const QString&, int, int)>& func) +{ + return m_Proxied->onModMoved(MOShared::callIfPluginActive(m_OrganizerProxy, func)); +} |
