From a216177b879bea6db659c65b0c37bbfe70ce08fd Mon Sep 17 00:00:00 2001 From: Mikaƫl Capelle Date: Sun, 25 Oct 2020 17:16:17 +0100 Subject: Move IOrganizer::removeMod() to IModList::removeMod(). --- src/modlist.cpp | 12 ++++++++++++ src/modlist.h | 3 +++ src/modlistproxy.cpp | 5 +++++ src/modlistproxy.h | 1 + src/organizercore.cpp | 11 ----------- src/organizercore.h | 1 - src/organizerproxy.cpp | 5 ----- src/organizerproxy.h | 1 - 8 files changed, 21 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/modlist.cpp b/src/modlist.cpp index 94c8883d..40a9af5e 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -939,6 +939,18 @@ QStringList ModList::allModsByProfilePriority(MOBase::IProfile* profile) const return m_Organizer->modsSortedByProfilePriority(mo2Profile); } +bool ModList::removeMod(MOBase::IModInterface* mod) +{ + unsigned int index = ModInfo::getIndex(mod->name()); + if (index == UINT_MAX) { + return mod->remove(); + } + else { + return ModInfo::removeMod(index); + } + notifyModRemoved(mod->name()); +} + IModList::ModStates ModList::state(const QString &name) const { unsigned int modIndex = ModInfo::getIndex(name); diff --git a/src/modlist.h b/src/modlist.h index 8748cb30..810b0efd 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -159,6 +159,9 @@ public: virtual QStringList allMods() const override; virtual QStringList allModsByProfilePriority(MOBase::IProfile* profile = nullptr) const override; + // \copydoc MOBase::IModList::remove + bool removeMod(MOBase::IModInterface* mod) override; + /// \copydoc MOBase::IModList::state virtual ModStates state(const QString &name) const override; diff --git a/src/modlistproxy.cpp b/src/modlistproxy.cpp index 51cea1ee..660e4b9d 100644 --- a/src/modlistproxy.cpp +++ b/src/modlistproxy.cpp @@ -22,6 +22,11 @@ QStringList ModListProxy::allModsByProfilePriority(MOBase::IProfile* profile) co return m_Proxied->allModsByProfilePriority(profile); } +bool ModListProxy::removeMod(MOBase::IModInterface* mod) +{ + return m_Proxied->removeMod(mod); +} + IModList::ModStates ModListProxy::state(const QString& name) const { return m_Proxied->state(name); diff --git a/src/modlistproxy.h b/src/modlistproxy.h index 2e653850..486564a4 100644 --- a/src/modlistproxy.h +++ b/src/modlistproxy.h @@ -16,6 +16,7 @@ public: QString displayName(const QString& internalName) const override; QStringList allMods() const override; QStringList allModsByProfilePriority(MOBase::IProfile* profile = nullptr) const override; + bool removeMod(MOBase::IModInterface* mod) override; ModStates state(const QString& name) const override; bool setActive(const QString& name, bool active) override; int setActive(const QStringList& names, bool active) override; diff --git a/src/organizercore.cpp b/src/organizercore.cpp index a66a6450..76d53791 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -665,17 +665,6 @@ MOBase::IModInterface *OrganizerCore::createMod(GuessedValue &name) .data(); } -bool OrganizerCore::removeMod(MOBase::IModInterface *mod) -{ - unsigned int index = ModInfo::getIndex(mod->name()); - if (index == UINT_MAX) { - return mod->remove(); - } else { - return ModInfo::removeMod(index); - } - m_ModList.notifyModRemoved(mod->name()); -} - void OrganizerCore::modDataChanged(MOBase::IModInterface *) { refresh(false); diff --git a/src/organizercore.h b/src/organizercore.h index 95c7ef51..50d44c49 100644 --- a/src/organizercore.h +++ b/src/organizercore.h @@ -310,7 +310,6 @@ public: MOBase::IModInterface *getMod(const QString &name) const; MOBase::IPluginGame *getGame(const QString &gameName) const; MOBase::IModInterface *createMod(MOBase::GuessedValue &name); - bool removeMod(MOBase::IModInterface *mod); void modDataChanged(MOBase::IModInterface *mod); QVariant pluginSetting(const QString &pluginName, const QString &key) const; void setPluginSetting(const QString &pluginName, const QString &key, const QVariant &value); diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp index e369c1a3..cb9e0e1d 100644 --- a/src/organizerproxy.cpp +++ b/src/organizerproxy.cpp @@ -82,11 +82,6 @@ IModInterface *OrganizerProxy::createMod(MOBase::GuessedValue &name) return m_Proxied->createMod(name); } -bool OrganizerProxy::removeMod(IModInterface *mod) -{ - return m_Proxied->removeMod(mod); -} - void OrganizerProxy::modDataChanged(IModInterface *mod) { m_Proxied->modDataChanged(mod); diff --git a/src/organizerproxy.h b/src/organizerproxy.h index a72d01b3..16ae21eb 100644 --- a/src/organizerproxy.h +++ b/src/organizerproxy.h @@ -35,7 +35,6 @@ public: virtual MOBase::IModInterface *getMod(const QString &name) const; virtual MOBase::IPluginGame *getGame(const QString &gameName) const; virtual MOBase::IModInterface *createMod(MOBase::GuessedValue &name); - virtual bool removeMod(MOBase::IModInterface *mod); virtual void modDataChanged(MOBase::IModInterface *mod); virtual QVariant pluginSetting(const QString &pluginName, const QString &key) const; virtual void setPluginSetting(const QString &pluginName, const QString &key, const QVariant &value); -- cgit v1.3.1