summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Feenstra <26406078+JonathanFeenstra@users.noreply.github.com>2026-01-11 12:36:07 +0100
committerGitHub <noreply@github.com>2026-01-11 12:36:07 +0100
commit717b5ac389ea15350d32f813a3f03d908de0ab06 (patch)
treec698d35614132823507d6226ed8d4a2d291ab21c
parent1505519ecd03e47c1c046c5c985aa947e06ff5ba (diff)
Add instanceName and profiles methods to plugin API (#2321)
-rw-r--r--src/aboutdialog.ui2
-rw-r--r--src/organizercore.cpp19
-rw-r--r--src/organizercore.h6
-rw-r--r--src/organizerproxy.cpp19
-rw-r--r--src/organizerproxy.h5
-rw-r--r--src/version.rc2
6 files changed, 51 insertions, 2 deletions
diff --git a/src/aboutdialog.ui b/src/aboutdialog.ui
index 92cacd44..323e20ac 100644
--- a/src/aboutdialog.ui
+++ b/src/aboutdialog.ui
@@ -127,7 +127,7 @@
<item>
<widget class="QLabel" name="label_3">
<property name="text">
- <string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2011-2016 Sebastian Herbord&lt;br/&gt;Copyright © 2016-2025 Mod Organizer 2 Contributors&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string notr="true">&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2011-2016 Sebastian Herbord&lt;br/&gt;Copyright © 2016-2026 Mod Organizer 2 Contributors&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index 88f68805..a8fc67c2 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -70,6 +70,7 @@
#include <string> //for wstring
#include <tuple>
#include <utility>
+#include <vector>
#include <libbsarch/bs_archive.h>
@@ -613,6 +614,24 @@ void OrganizerCore::setCurrentProfile(const QString& profileName)
m_ProfileChanged(oldProfile.get(), m_CurrentProfile.get());
}
+QStringList OrganizerCore::profileNames() const
+{
+ QDir profilesDir(m_Settings.paths().profiles());
+ return profilesDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
+}
+
+std::shared_ptr<const MOBase::IProfile>
+OrganizerCore::getProfile(const QString& profileName) const
+{
+ QDir profileDir(m_Settings.paths().profiles());
+ profileDir.cd(profileName);
+ if (!profileDir.exists()) {
+ return nullptr;
+ }
+
+ return std::make_shared<Profile>(profileDir, managedGame(), gameFeatures());
+}
+
MOBase::IModRepositoryBridge* OrganizerCore::createNexusBridge() const
{
return new NexusBridge(m_PluginContainer);
diff --git a/src/organizercore.h b/src/organizercore.h
index d4ce1500..22c4f19a 100644
--- a/src/organizercore.h
+++ b/src/organizercore.h
@@ -45,6 +45,9 @@ class GameFeatures;
class PluginContainer;
class DirectoryRefresher;
+#include <memory>
+#include <vector>
+
namespace MOBase
{
template <typename T>
@@ -270,6 +273,9 @@ public:
Profile* currentProfile() const { return m_CurrentProfile.get(); }
void setCurrentProfile(const QString& profileName);
+ QStringList profileNames() const;
+ std::shared_ptr<const MOBase::IProfile> getProfile(const QString& profileName) const;
+
std::vector<QString> enabledArchives();
MOBase::Version getVersion() const { return m_Updater.getVersion(); }
diff --git a/src/organizerproxy.cpp b/src/organizerproxy.cpp
index 22a8a023..72247b54 100644
--- a/src/organizerproxy.cpp
+++ b/src/organizerproxy.cpp
@@ -3,6 +3,7 @@
#include "downloadmanagerproxy.h"
#include "gamefeaturesproxy.h"
#include "glob_matching.h"
+#include "instancemanager.h"
#include "modlistproxy.h"
#include "organizercore.h"
#include "plugincontainer.h"
@@ -15,6 +16,8 @@
#include <QApplication>
#include <QObject>
+#include <memory>
+
using namespace MOBase;
using namespace MOShared;
@@ -84,6 +87,11 @@ IModRepositoryBridge* OrganizerProxy::createNexusBridge() const
return new NexusBridge(m_PluginContainer, m_Plugin->name());
}
+QString OrganizerProxy::instanceName() const
+{
+ return InstanceManager::singleton().currentInstance()->displayName();
+}
+
QString OrganizerProxy::profileName() const
{
return m_Proxied->profileName();
@@ -367,6 +375,17 @@ MOBase::IProfile* OrganizerProxy::profile() const
return m_Proxied->currentProfile();
}
+QStringList OrganizerProxy::profileNames() const
+{
+ return m_Proxied->profileNames();
+}
+
+std::shared_ptr<const MOBase::IProfile>
+OrganizerProxy::getProfile(const QString& name) const
+{
+ return m_Proxied->getProfile(name);
+}
+
MOBase::IPluginGame const* OrganizerProxy::managedGame() const
{
return m_Proxied->managedGame();
diff --git a/src/organizerproxy.h b/src/organizerproxy.h
index 2c70cb2c..9ff664b5 100644
--- a/src/organizerproxy.h
+++ b/src/organizerproxy.h
@@ -30,6 +30,7 @@ public:
public: // IOrganizer interface
MOBase::IModRepositoryBridge* createNexusBridge() const override;
+ QString instanceName() const override;
QString profileName() const override;
QString profilePath() const override;
QString downloadsPath() const override;
@@ -65,6 +66,10 @@ public: // IOrganizer interface
MOBase::IPluginList* pluginList() const override;
MOBase::IModList* modList() const override;
MOBase::IProfile* profile() const override;
+ QStringList profileNames() const override;
+ std::shared_ptr<const MOBase::IProfile>
+ getProfile(const QString& name) const override;
+
MOBase::IGameFeatures* gameFeatures() const override;
HANDLE startApplication(const QString& executable,
diff --git a/src/version.rc b/src/version.rc
index 1979fdf1..477a7dc5 100644
--- a/src/version.rc
+++ b/src/version.rc
@@ -24,7 +24,7 @@ BEGIN
VALUE "FileDescription", "Mod Organizer 2 GUI\0"
VALUE "OriginalFilename", "ModOrganizer.exe\0"
VALUE "InternalName", "ModOrganizer2\0"
- VALUE "LegalCopyright", "Copyright 2011-2016 Sebastian Herbord\r\nCopyright 2016-2025 Mod Organizer 2 contributors\0"
+ VALUE "LegalCopyright", "Copyright 2011-2016 Sebastian Herbord\r\nCopyright 2016-2026 Mod Organizer 2 contributors\0"
VALUE "ProductName", "Mod Organizer 2\0"
VALUE "ProductVersion", VER_FILEVERSION_STR
END