diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2020-11-18 10:01:27 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-11-18 10:01:27 +0100 |
| commit | ddba54382aab3cb5548485d14c85e2611272f3cb (patch) | |
| tree | e3b1aa7f86c3d6852f2f749e40ff61971c0961b3 /src/organizerproxy.cpp | |
| parent | 06686403382a98d23685232d404dfe5837ffb8a1 (diff) | |
| parent | 61554d3df7be909acf6609b4b7465b03d7f16081 (diff) | |
Merge pull request #1292 from Holt59/iplugin-isactive-refactoring
IPlugin::isActive refactoring
Diffstat (limited to 'src/organizerproxy.cpp')
| -rw-r--r-- | src/organizerproxy.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index a988ba9f..c2283acc 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -83,6 +83,16 @@ void OrganizerProxy::modDataChanged(IModInterface *mod) m_Proxied->modDataChanged(mod);
}
+bool OrganizerProxy::isPluginEnabled(QString const& pluginName) const
+{
+ return m_PluginContainer->isEnabled(pluginName);
+}
+
+bool OrganizerProxy::isPluginEnabled(IPlugin* plugin) const
+{
+ return m_PluginContainer->isEnabled(plugin);
+}
+
QVariant OrganizerProxy::pluginSetting(const QString &pluginName, const QString &key) const
{
return m_Proxied->pluginSetting(pluginName, key);
@@ -283,8 +293,36 @@ bool OrganizerProxy::onProfileChanged(std::function<void(MOBase::IProfile*, MOBa return m_Proxied->onProfileChanged(MOShared::callIfPluginActive(this, func));
}
+// Always call these one, otherwise plugin cannot detect they are being enabled / disabled:
bool OrganizerProxy::onPluginSettingChanged(std::function<void(QString const&, const QString& key, const QVariant&, const QVariant&)> const& func)
{
- // Always call this one, otherwise plugin cannot detect they are being enabled / disabled:
return m_Proxied->onPluginSettingChanged(func);
}
+
+bool OrganizerProxy::onPluginEnabled(std::function<void(const IPlugin*)> const& func)
+{
+ return m_Proxied->onPluginEnabled(func);
+}
+
+bool OrganizerProxy::onPluginEnabled(const QString& pluginName, std::function<void()> const& func)
+{
+ return m_Proxied->onPluginEnabled([=](const IPlugin* plugin) {
+ if (plugin->name().compare(pluginName, Qt::CaseInsensitive) == 0) {
+ func();
+ }
+ });
+}
+
+bool OrganizerProxy::onPluginDisabled(std::function<void(const IPlugin*)> const& func)
+{
+ return m_Proxied->onPluginDisabled(func);
+}
+
+bool OrganizerProxy::onPluginDisabled(const QString& pluginName, std::function<void()> const& func)
+{
+ return m_Proxied->onPluginDisabled([=](const IPlugin* plugin) {
+ if (plugin->name().compare(pluginName, Qt::CaseInsensitive) == 0) {
+ func();
+ }
+ });
+}
|
