diff options
| author | Tannin <devnull@localhost> | 2015-05-17 14:30:14 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-05-17 14:30:14 +0200 |
| commit | e38592da977858149013d0c500c66975720b3e1f (patch) | |
| tree | a2976269475f43c9bff2049d7075987c27f51e15 /src/modlist.cpp | |
| parent | 268d2ffe8b533890b408740db1a6a3730dfd8597 (diff) | |
extended plugin interface. Plugins can now activate/deactivate mods, install mods
suggesting a name and retrieve a list of all installed mods
Diffstat (limited to 'src/modlist.cpp')
| -rw-r--r-- | src/modlist.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp index e05935ef..fc09097a 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -708,6 +708,15 @@ QString ModList::displayName(const QString &internalName) const }
}
+QStringList ModList::allMods() const
+{
+ QStringList result;
+ for (unsigned int i = 0; i < ModInfo::getNumMods(); ++i) {
+ result.append(ModInfo::getByIndex(i)->internalName());
+ }
+ return result;
+}
+
IModList::ModStates ModList::state(const QString &name) const
{
unsigned int modIndex = ModInfo::getIndex(name);
@@ -715,6 +724,20 @@ IModList::ModStates ModList::state(const QString &name) const return state(modIndex);
}
+bool ModList::setActive(const QString &name, bool active)
+{
+ unsigned int modIndex = ModInfo::getIndex(name);
+ if (modIndex == UINT_MAX) {
+ return false;
+ } else {
+ m_Profile->setModEnabled(modIndex, active);
+
+ IModList::ModStates newState = state(modIndex);
+ m_ModStateChanged(name, newState);
+ return true;
+ }
+}
+
int ModList::priority(const QString &name) const
{
unsigned int modIndex = ModInfo::getIndex(name);
|
