| 636 | } |
| 637 | |
| 638 | bool PluginContainer::isEnabled(IPlugin* plugin) const |
| 639 | { |
| 640 | // Check if it's a game plugin: |
| 641 | if (implementInterface<IPluginGame>(plugin)) { |
| 642 | return plugin == m_Organizer->managedGame(); |
| 643 | } |
| 644 | |
| 645 | // Check the master, if any: |
| 646 | auto& requirements = m_Requirements.at(plugin); |
| 647 | |
| 648 | if (requirements.master()) { |
| 649 | return isEnabled(requirements.master()); |
| 650 | } |
| 651 | |
| 652 | // Check if the plugin is enabled: |
| 653 | if (!m_Organizer->persistent(plugin->name(), "enabled", plugin->enabledByDefault()) |
| 654 | .toBool()) { |
| 655 | return false; |
| 656 | } |
| 657 | |
| 658 | // Check the requirements: |
| 659 | return m_Requirements.at(plugin).canEnable(); |
| 660 | } |
| 661 | |
| 662 | void PluginContainer::setEnabled(MOBase::IPlugin* plugin, bool enable, |
| 663 | bool dependencies) |
no test coverage detected