summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-10-25 17:46:29 +0100
committerMikaël Capelle <capelle.mikael@gmail.com>2020-10-25 17:46:29 +0100
commit551e8353e090040ee337e718cf0f1b9fe31a0423 (patch)
treeb6a31a880e10f528b4f17c7e19c1639b116278ac /src
parenta216177b879bea6db659c65b0c37bbfe70ce08fd (diff)
Move IOrganizer::getMod() to IModList::getMod().
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp8
-rw-r--r--src/modlist.cpp6
-rw-r--r--src/modlist.h3
-rw-r--r--src/modlistproxy.cpp5
-rw-r--r--src/modlistproxy.h1
-rw-r--r--src/organizercore.cpp6
-rw-r--r--src/organizercore.h1
-rw-r--r--src/organizerproxy.cpp5
-rw-r--r--src/organizerproxy.h1
9 files changed, 19 insertions, 17 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index a2afb8a0..85aa0df1 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -3603,7 +3603,7 @@ void MainWindow::createEmptyMod_clicked()
}
}
- if (m_OrganizerCore.getMod(name) != nullptr) {
+ if (m_OrganizerCore.modList()->getMod(name) != nullptr) {
reportError(tr("A mod with this name already exists"));
return;
}
@@ -3638,13 +3638,13 @@ void MainWindow::createSeparator_clicked()
GUESS_USER);
if (!ok) { return; }
}
- if (m_OrganizerCore.getMod(name) != nullptr)
+ if (m_OrganizerCore.modList()->getMod(name) != nullptr)
{
reportError(tr("A separator with this name already exists"));
return;
}
name->append("_separator");
- if (m_OrganizerCore.getMod(name) != nullptr)
+ if (m_OrganizerCore.modList()->getMod(name) != nullptr)
{
return;
}
@@ -3739,7 +3739,7 @@ void MainWindow::createModFromOverwrite()
}
}
- if (m_OrganizerCore.getMod(name) != nullptr) {
+ if (m_OrganizerCore.modList()->getMod(name) != nullptr) {
reportError(tr("A mod with this name already exists"));
return;
}
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 40a9af5e..98ee3f3a 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -939,6 +939,12 @@ QStringList ModList::allModsByProfilePriority(MOBase::IProfile* profile) const
return m_Organizer->modsSortedByProfilePriority(mo2Profile);
}
+MOBase::IModInterface* ModList::getMod(const QString& name) const
+{
+ unsigned int index = ModInfo::getIndex(name);
+ return index == UINT_MAX ? nullptr : ModInfo::getByIndex(index).data();
+}
+
bool ModList::removeMod(MOBase::IModInterface* mod)
{
unsigned int index = ModInfo::getIndex(mod->name());
diff --git a/src/modlist.h b/src/modlist.h
index 810b0efd..385ca04c 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::getMod
+ MOBase::IModInterface* getMod(const QString& name) const override;
+
// \copydoc MOBase::IModList::remove
bool removeMod(MOBase::IModInterface* mod) override;
diff --git a/src/modlistproxy.cpp b/src/modlistproxy.cpp
index 660e4b9d..8fcbdbdf 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);
}
+IModInterface* ModListProxy::getMod(const QString& name) const
+{
+ return m_Proxied->getMod(name);
+}
+
bool ModListProxy::removeMod(MOBase::IModInterface* mod)
{
return m_Proxied->removeMod(mod);
diff --git a/src/modlistproxy.h b/src/modlistproxy.h
index 486564a4..c805cf4e 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;
+ MOBase::IModInterface* getMod(const QString& name) const override;
bool removeMod(MOBase::IModInterface* mod) override;
ModStates state(const QString& name) const override;
bool setActive(const QString& name, bool active) override;
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index 76d53791..82305c1a 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -618,12 +618,6 @@ MOBase::VersionInfo OrganizerCore::appVersion() const
return m_Updater.getVersion();
}
-MOBase::IModInterface *OrganizerCore::getMod(const QString &name) const
-{
- unsigned int index = ModInfo::getIndex(name);
- return index == UINT_MAX ? nullptr : ModInfo::getByIndex(index).data();
-}
-
MOBase::IPluginGame *OrganizerCore::getGame(const QString &name) const
{
for (IPluginGame *game : m_PluginContainer->plugins<IPluginGame>()) {
diff --git a/src/organizercore.h b/src/organizercore.h
index 50d44c49..61caeed0 100644
--- a/src/organizercore.h
+++ b/src/organizercore.h
@@ -307,7 +307,6 @@ public:
QString basePath() const;
QString modsPath() const;
MOBase::VersionInfo appVersion() const;
- MOBase::IModInterface *getMod(const QString &name) const;
MOBase::IPluginGame *getGame(const QString &gameName) const;
MOBase::IModInterface *createMod(MOBase::GuessedValue<QString> &name);
void modDataChanged(MOBase::IModInterface *mod);
diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp
index cb9e0e1d..56e40ae5 100644
--- a/src/organizerproxy.cpp
+++ b/src/organizerproxy.cpp
@@ -67,11 +67,6 @@ VersionInfo OrganizerProxy::appVersion() const
return m_Proxied->appVersion();
}
-IModInterface *OrganizerProxy::getMod(const QString &name) const
-{
- return m_Proxied->getMod(name);
-}
-
IPluginGame *OrganizerProxy::getGame(const QString &gameName) const
{
return m_Proxied->getGame(gameName);
diff --git a/src/organizerproxy.h b/src/organizerproxy.h
index 16ae21eb..6cf9de77 100644
--- a/src/organizerproxy.h
+++ b/src/organizerproxy.h
@@ -32,7 +32,6 @@ public:
virtual QString basePath() const;
virtual QString modsPath() const;
virtual MOBase::VersionInfo appVersion() const;
- virtual MOBase::IModInterface *getMod(const QString &name) const;
virtual MOBase::IPluginGame *getGame(const QString &gameName) const;
virtual MOBase::IModInterface *createMod(MOBase::GuessedValue<QString> &name);
virtual void modDataChanged(MOBase::IModInterface *mod);