Merge pull request #9 from AnyOldName3/implement-more-interfaces-2

Implement more interfaces
This commit is contained in:
Jeremy Rimpo
2018-05-01 18:25:53 -05:00
committed by GitHub
9 changed files with 1491 additions and 386 deletions
+1
View File
@@ -34,6 +34,7 @@ SET(project_path "${default_project_path}" CACHE PATH "path to the other mo proj
SET(lib_path "${project_path}/../../install/libs")
INCLUDE_DIRECTORIES(${project_path}/uibase/src
${project_path}/game_features/src
${PYTHON_ROOT}/Include
${SIP_ROOT}
${PYTHON_ROOT}/PC)
+391
View File
@@ -0,0 +1,391 @@
#include "gamefeatureswrappers.h"
#include <boost/any.hpp>
#include <typeindex>
#include <ipluginlist.h>
#include <iprofile.h>
#include <isavegame.h>
#include <isavegameinfowidget.h>
#include "gilock.h"
#include "pycatch.h"
/////////////////////////////
/// BSAInvalidation Wrapper
bool BSAInvalidationWrapper::isInvalidationBSA(const QString &bsaName)
{
GILock lock;
try {
return this->get_override("isInvalidationBSA")(bsaName);
} PYCATCH;
}
void BSAInvalidationWrapper::deactivate(MOBase::IProfile *profile)
{
GILock lock;
try {
this->get_override("deactivate")(boost::python::ptr(profile));
} PYCATCH;
}
void BSAInvalidationWrapper::activate(MOBase::IProfile *profile)
{
GILock lock;
try {
this->get_override("activate")(boost::python::ptr(profile));
} PYCATCH;
}
/// end BSAInvalidation Wrapper
/////////////////////////////
/// DataArchives Wrapper
QStringList DataArchivesWrapper::vanillaArchives() const
{
GILock lock;
try {
return this->get_override("vanillaArchives")();
} PYCATCH;
}
QStringList DataArchivesWrapper::archives(const MOBase::IProfile *profile) const
{
GILock lock;
try {
return this->get_override("archives")(boost::python::ptr(profile));
} PYCATCH;
}
void DataArchivesWrapper::addArchive(MOBase::IProfile *profile, int index, const QString &archiveName)
{
GILock lock;
try {
this->get_override("addArchive")(boost::python::ptr(profile), index, archiveName);
} PYCATCH;
}
void DataArchivesWrapper::removeArchive(MOBase::IProfile * profile, const QString & archiveName)
{
GILock lock;
try {
this->get_override("removeArchive")(boost::python::ptr(profile), archiveName);
} PYCATCH;
}
/// end DataArchives Wrapper
/////////////////////////////
/// GamePlugins Wrapper
void GamePluginsWrapper::writePluginLists(const MOBase::IPluginList * pluginList)
{
GILock lock;
try {
this->get_override("writePluginLists")(boost::python::ptr(pluginList));
} PYCATCH;
}
void GamePluginsWrapper::readPluginLists(MOBase::IPluginList * pluginList)
{
GILock lock;
try {
this->get_override("readPluginLists")(boost::python::ptr(pluginList));
} PYCATCH;
}
/// end GamePlugins Wrapper
/////////////////////////////
/// LocalSavegames Wrapper
MappingType LocalSavegamesWrapper::mappings(const QDir & profileSaveDir) const
{
GILock lock;
try {
return this->get_override("mappings")(profileSaveDir);
} PYCATCH;
}
void LocalSavegamesWrapper::prepareProfile(MOBase::IProfile * profile)
{
GILock lock;
try {
this->get_override("prepareProfile")(boost::python::ptr(profile));
} PYCATCH;
}
/// end LocalSavegames Wrapper
/////////////////////////////
/// SaveGameInfo Wrapper
MOBase::ISaveGame const * SaveGameInfoWrapper::getSaveGameInfo(QString const & file) const
{
GILock lock;
try {
return this->get_override("getSaveGameInfo")(file);
} PYCATCH;
}
SaveGameInfoWrapper::MissingAssets SaveGameInfoWrapper::getMissingAssets(QString const & file) const
{
GILock lock;
try {
return this->get_override("getMissingAssets")(file);
} PYCATCH;
}
MOBase::ISaveGameInfoWidget * SaveGameInfoWrapper::getSaveGameWidget(QWidget * parent) const
{
qCritical("Calling method with unimplemented from_python converter.");
GILock lock;
try {
return this->get_override("getSaveGameWidget")(boost::python::ptr(parent));
} PYCATCH;
}
bool SaveGameInfoWrapper::hasScriptExtenderSave(QString const & file) const
{
GILock lock;
try {
return this->get_override("hasScriptExtenderSave")(file);
} PYCATCH;
}
/// end SaveGameInfo Wrapper
/////////////////////////////
/// ScriptExtender Wrapper
QString ScriptExtenderWrapper::BinaryName() const
{
GILock lock;
try {
return this->get_override("BinaryName")();
} PYCATCH;
}
QString ScriptExtenderWrapper::PluginPath() const
{
GILock lock;
try {
return this->get_override("PluginPath")();
} PYCATCH;
}
QString ScriptExtenderWrapper::loaderName() const
{
GILock lock;
try {
return this->get_override("loaderName")();
} PYCATCH;
}
QString ScriptExtenderWrapper::loaderPath() const
{
GILock lock;
try {
return this->get_override("loaderPath")();
} PYCATCH;
}
QStringList ScriptExtenderWrapper::saveGameAttachmentExtensions() const
{
GILock lock;
try {
return this->get_override("saveGameAttachmentExtensions")();
} PYCATCH;
}
bool ScriptExtenderWrapper::isInstalled() const
{
GILock lock;
try {
return this->get_override("isInstalled")();
} PYCATCH;
}
QString ScriptExtenderWrapper::getExtenderVersion() const
{
GILock lock;
try {
return this->get_override("getExtenderVersion")();
} PYCATCH;
}
WORD ScriptExtenderWrapper::getArch() const
{
GILock lock;
try {
return this->get_override("getArch")();
} PYCATCH;
}
/// end ScriptExtender Wrapper
/////////////////////////////
/// UnmanagedMods Wrapper
QStringList UnmanagedModsWrapper::mods(bool onlyOfficial) const
{
GILock lock;
try {
return this->get_override("mods")(onlyOfficial);
} PYCATCH;
}
QString UnmanagedModsWrapper::displayName(const QString & modName) const
{
GILock lock;
try {
return this->get_override("displayName")(modName);
} PYCATCH;
}
QFileInfo UnmanagedModsWrapper::referenceFile(const QString & modName) const
{
GILock lock;
try {
return this->get_override("referenceFile")(modName);
} PYCATCH;
}
QStringList UnmanagedModsWrapper::secondaryFiles(const QString & modName) const
{
GILock lock;
try {
return this->get_override("secondaryFiles")(modName);
} PYCATCH;
}
/// end UnmanagedMods Wrapper
/////////////////////////////
template<typename T>
void insertGameFeature(std::map<std::type_index, boost::any> &map, const boost::python::object &pyObject)
{
map[std::type_index(typeid(T))] = boost::python::extract<T*>(pyObject)();
}
game_features_map_from_python::game_features_map_from_python()
{
boost::python::converter::registry::push_back(&convertible, &construct, boost::python::type_id<std::map<std::type_index, boost::any>>());
}
void * game_features_map_from_python::convertible(PyObject * objPtr)
{
return PyDict_Check(objPtr) ? objPtr : nullptr;
}
void game_features_map_from_python::construct(PyObject * objPtr, boost::python::converter::rvalue_from_python_stage1_data * data)
{
void *storage = ((boost::python::converter::rvalue_from_python_storage<std::map<std::type_index, boost::any>>*)data)->storage.bytes;
std::map<std::type_index, boost::any> *result = new (storage) std::map<std::type_index, boost::any>();
boost::python::dict source(boost::python::handle<>(boost::python::borrowed(objPtr)));
boost::python::list keys = source.keys();
int len = boost::python::len(keys);
for (int i = 0; i < len; ++i)
{
boost::python::object pyKey = keys[i];
// pyKey should be a Boost.Python.class corresponding to a game feature.
std::string className = boost::python::extract<std::string>(pyKey.attr("__name__"))();
if (className == "BSAInvalidation")
insertGameFeature<BSAInvalidation>(*result, source[pyKey]);
else if (className == "DataArchives")
insertGameFeature<DataArchives>(*result, source[pyKey]);
else if (className == "GamePlugins")
insertGameFeature<GamePlugins>(*result, source[pyKey]);
else if (className == "LocalSavegames")
insertGameFeature<LocalSavegames>(*result, source[pyKey]);
else if (className == "SaveGameInfo")
insertGameFeature<SaveGameInfo>(*result, source[pyKey]);
else if (className == "ScriptExtender")
insertGameFeature<ScriptExtender>(*result, source[pyKey]);
else if (className == "UnmanagedMods")
insertGameFeature<UnmanagedMods>(*result, source[pyKey]);
}
data->convertible = storage;
}
void registerGameFeaturesPythonConverters()
{
namespace bpy = boost::python;
game_features_map_from_python();
// Features require defs for all methods as Python can access C++ features
bpy::class_<BSAInvalidationWrapper, boost::noncopyable>("BSAInvalidation")
.def("isInvalidationBSA", bpy::pure_virtual(&BSAInvalidation::isInvalidationBSA))
.def("deactivate", bpy::pure_virtual(&BSAInvalidation::deactivate))
.def("activate", bpy::pure_virtual(&BSAInvalidation::activate))
;
bpy::class_<DataArchivesWrapper, boost::noncopyable>("DataArchives")
.def("vanillaArchives", bpy::pure_virtual(&DataArchives::vanillaArchives))
.def("archives", bpy::pure_virtual(&DataArchives::archives))
.def("addArchive", bpy::pure_virtual(&DataArchives::addArchive))
.def("removeArchive", bpy::pure_virtual(&DataArchives::removeArchive))
;
bpy::class_<GamePluginsWrapper, boost::noncopyable>("GamePlugins")
.def("writePluginLists", bpy::pure_virtual(&GamePlugins::writePluginLists))
.def("readPluginLists", bpy::pure_virtual(&GamePlugins::readPluginLists))
;
bpy::class_<LocalSavegamesWrapper, boost::noncopyable>("LocalSavegames")
.def("mappings", bpy::pure_virtual(&LocalSavegames::mappings))
.def("prepareProfile", bpy::pure_virtual(&LocalSavegames::prepareProfile))
;
bpy::class_<SaveGameInfoWrapper, boost::noncopyable>("SaveGameInfo")
.def("getSaveGameInfo", bpy::pure_virtual(&SaveGameInfo::getSaveGameInfo), bpy::return_value_policy<bpy::manage_new_object>())
.def("getMissingAssets", bpy::pure_virtual(&SaveGameInfo::getMissingAssets))
.def("getSaveGameWidget", bpy::pure_virtual(&SaveGameInfo::getSaveGameWidget), bpy::return_value_policy<bpy::manage_new_object>())
.def("hasScriptExtenderSave", bpy::pure_virtual(&SaveGameInfo::hasScriptExtenderSave))
;
bpy::class_<ScriptExtenderWrapper, boost::noncopyable>("ScriptExtender")
.def("BinaryName", bpy::pure_virtual(&ScriptExtender::BinaryName))
.def("PluginPath", bpy::pure_virtual(&ScriptExtender::PluginPath))
.def("loaderName", bpy::pure_virtual(&ScriptExtender::loaderName))
.def("loaderPath", bpy::pure_virtual(&ScriptExtender::loaderPath))
.def("saveGameAttachmentExtensions", bpy::pure_virtual(&ScriptExtender::saveGameAttachmentExtensions))
.def("isInstalled", bpy::pure_virtual(&ScriptExtender::isInstalled))
.def("getExtenderVersion", bpy::pure_virtual(&ScriptExtender::getExtenderVersion))
.def("getArch", bpy::pure_virtual(&ScriptExtender::getArch))
;
bpy::class_<UnmanagedModsWrapper, boost::noncopyable>("UnmanagedMods")
.def("mods", bpy::pure_virtual(&UnmanagedMods::mods))
.def("displayName", bpy::pure_virtual(&UnmanagedMods::displayName))
.def("referenceFile", bpy::pure_virtual(&UnmanagedMods::referenceFile))
.def("secondaryFiles", bpy::pure_virtual(&UnmanagedMods::secondaryFiles))
;
}
+85
View File
@@ -0,0 +1,85 @@
#ifndef GAMEFEATURESWRAPPERS_H
#define GAMEFEATURESWRAPPERS_H
#include <bsainvalidation.h>
#include <dataarchives.h>
#include <gameplugins.h>
#include <localsavegames.h>
#include <savegameinfo.h>
#include <scriptextender.h>
#include <unmanagedmods.h>
// this might need turning off if Q_MOC_RUN is defined
#include <boost/python.hpp>
/////////////////////////////
/// Wrapper declarations
class BSAInvalidationWrapper : public BSAInvalidation, public boost::python::wrapper<BSAInvalidation>
{
virtual bool isInvalidationBSA(const QString &bsaName) override;
virtual void deactivate(MOBase::IProfile *profile) override;
virtual void activate(MOBase::IProfile *profile) override;
};
class DataArchivesWrapper : public DataArchives, public boost::python::wrapper<DataArchives>
{
virtual QStringList vanillaArchives() const override;
virtual QStringList archives(const MOBase::IProfile *profile) const override;
virtual void addArchive(MOBase::IProfile *profile, int index, const QString &archiveName) override;
virtual void removeArchive(MOBase::IProfile *profile, const QString &archiveName) override;
};
class GamePluginsWrapper : public GamePlugins, public boost::python::wrapper<GamePlugins>
{
virtual void writePluginLists(const MOBase::IPluginList *pluginList) override;
virtual void readPluginLists(MOBase::IPluginList *pluginList) override;
};
class LocalSavegamesWrapper : public LocalSavegames, public boost::python::wrapper<LocalSavegames>
{
virtual MappingType mappings(const QDir &profileSaveDir) const override;
virtual void prepareProfile(MOBase::IProfile *profile) override;
};
class SaveGameInfoWrapper : public SaveGameInfo, public boost::python::wrapper<SaveGameInfo>
{
virtual MOBase::ISaveGame const *getSaveGameInfo(QString const &file) const override;
virtual MissingAssets getMissingAssets(QString const &file) const override;
virtual MOBase::ISaveGameInfoWidget *getSaveGameWidget(QWidget *parent = 0) const override;
virtual bool hasScriptExtenderSave(QString const &file) const override;
};
class ScriptExtenderWrapper : public ScriptExtender, public boost::python::wrapper<ScriptExtender>
{
virtual QString BinaryName() const override;
virtual QString PluginPath() const override;
virtual QString loaderName() const override;
virtual QString loaderPath() const override;
virtual QStringList saveGameAttachmentExtensions() const override;
virtual bool isInstalled() const override;
virtual QString getExtenderVersion() const override;
virtual WORD getArch() const override;
};
class UnmanagedModsWrapper : public UnmanagedMods, public boost::python::wrapper<UnmanagedMods>
{
virtual QStringList mods(bool onlyOfficial) const override;
virtual QString displayName(const QString &modName) const override;
virtual QFileInfo referenceFile(const QString &modName) const override;
virtual QStringList secondaryFiles(const QString &modName) const override;
};
/// end Wrapper declarations
/////////////////////////////
struct game_features_map_from_python
{
game_features_map_from_python();
static void *convertible(PyObject *objPtr);
static void construct(PyObject *objPtr, boost::python::converter::rvalue_from_python_stage1_data *data);
};
void registerGameFeaturesPythonConverters();
#endif // GAMEFEATURESWRAPPERS_H
File diff suppressed because it is too large Load Diff
+137 -34
View File
@@ -2,68 +2,126 @@
#define PROXYPLUGINWRAPPERS_H
#include <iplugintool.h>
#include <iplugindiagnose.h>
#include <ipluginfilemapper.h>
#include <iplugingame.h>
#include <iplugininstallersimple.h>
#include <iplugininstallercustom.h>
#include <ipluginmodpage.h>
#include <ipluginpreview.h>
#include <iplugintool.h>
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
#endif
#define COMMON_I_PLUGIN_WRAPPER_DECLARATIONS public: \
virtual bool init(MOBase::IOrganizer *moInfo) override; \
virtual QString name() const override; \
virtual QString author() const override; \
virtual QString description() const override; \
virtual MOBase::VersionInfo version() const override; \
virtual bool isActive() const override; \
virtual QList<MOBase::PluginSetting> settings() const override;
class IPluginWrapper : public MOBase::IPlugin, public boost::python::wrapper<MOBase::IPlugin>
{
Q_INTERFACES(MOBase::IPlugin)
public:
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
virtual QString author() const;
virtual QString description() const;
virtual MOBase::VersionInfo version() const;
virtual bool isActive() const;
virtual QList<MOBase::PluginSetting> settings() const;
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
};
class IPluginToolWrapper: public MOBase::IPluginTool, public boost::python::wrapper<MOBase::IPluginTool>
// Even though the base interface is not an IPlugin or QObject, this has to be because we have no way to pass Mod Organizer a plugin that implements multiple interfaces.
// QObject must be the first base class because moc assumes the first base class is a QObject
class IPluginDiagnoseWrapper : public QObject, public MOBase::IPluginDiagnose, public MOBase::IPlugin, public boost::python::wrapper<MOBase::IPluginDiagnose>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginTool)
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginDiagnose)
public:
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
virtual QString author() const;
virtual QString description() const;
virtual MOBase::VersionInfo version() const;
virtual bool isActive() const;
virtual QList<MOBase::PluginSetting> settings() const;
virtual std::vector<unsigned int> activeProblems() const override;
virtual QString shortDescription(unsigned int key) const override;
virtual QString fullDescription(unsigned int key) const override;
virtual bool hasGuidedFix(unsigned int key) const override;
virtual void startGuidedFix(unsigned int key) const override;
// Other functions exist, but shouldn't need wrapping as a default implementation exists
// This was protected, but Python doesn't have that, so it needs making public
virtual void invalidate();
virtual QString displayName() const;
virtual QString tooltip() const;
virtual QIcon icon() const;
virtual void setParentWidget(QWidget *parent);
public slots:
virtual void display() const;
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
};
class IPluginInstallerCustomWrapper: public MOBase::IPluginInstallerCustom, public boost::python::wrapper<MOBase::IPluginInstallerCustom>
// Even though the base interface is not an IPlugin or QObject, this has to be because we have no way to pass Mod Organizer a plugin that implements multiple interfaces.
// QObject must be the first base class because moc assumes the first base class is a QObject
class IPluginFileMapperWrapper : public QObject, public MOBase::IPluginFileMapper, public MOBase::IPlugin, public boost::python::wrapper<MOBase::IPluginFileMapper>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginFileMapper)
public:
virtual MappingType mappings() const override;
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
};
class IPluginGameWrapper : public MOBase::IPluginGame, public boost::python::wrapper<MOBase::IPluginGame> {
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginGame)
public:
virtual QString gameName() const override;
virtual void initializeProfile(const QDir &directory, ProfileSettings settings) const override;
virtual QString savegameExtension() const override;
virtual QString savegameSEExtension() const override;
virtual bool isInstalled() const override;
virtual QIcon gameIcon() const override;
virtual QDir gameDirectory() const override;
virtual QDir dataDirectory() const override;
virtual void setGamePath(const QString &path) override;
virtual QDir documentsDirectory() const override;
virtual QDir savesDirectory() const override;
virtual QList<MOBase::ExecutableInfo> executables() const override;
virtual QString steamAPPId() const override;
virtual QStringList primaryPlugins() const override;
virtual QStringList gameVariants() const override;
virtual void setGameVariant(const QString &variant) override;
virtual QString binaryName() const override;
virtual QString gameShortName() const override;
virtual QStringList validShortNames() const override;
virtual QString gameNexusName() const override;
virtual QStringList iniFiles() const override;
virtual QStringList DLCPlugins() const override;
virtual QStringList CCPlugins() const override;
virtual LoadOrderMechanism loadOrderMechanism() const override;
virtual SortMechanism sortMechanism() const override;
virtual int nexusModOrganizerID() const override;
virtual int nexusGameID() const override;
virtual bool looksValid(QDir const &dir) const override;
virtual QString gameVersion() const override;
virtual QString getLauncherName() const override;
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
protected:
// Apparently, Python developers interpret an underscore in a function name as it being protected
virtual std::map<std::type_index, boost::any> featureList() const override;
// Thankfully, the default implementation of the templated 'T *feature()' function should allow us to get away without overriding it.
};
class IPluginInstallerCustomWrapper : public MOBase::IPluginInstallerCustom, public boost::python::wrapper<MOBase::IPluginInstallerCustom>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerCustom)
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
public:
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
virtual QString author() const;
virtual QString description() const;
virtual MOBase::VersionInfo version() const;
virtual bool isActive() const;
virtual QList<MOBase::PluginSetting> settings() const;
virtual unsigned int priority() const;
virtual bool isManualInstaller() const;
virtual bool isArchiveSupported(const MOBase::DirectoryTree &tree) const;
@@ -76,6 +134,51 @@ public:
};
class IPluginModPageWrapper : public MOBase::IPluginModPage, public boost::python::wrapper<MOBase::IPluginModPage>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginModPage)
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
public:
virtual QString displayName() const override;
virtual QIcon icon() const override;
virtual QUrl pageURL() const override;
virtual bool useIntegratedBrowser() const override;
virtual bool handlesDownload(const QUrl &pageURL, const QUrl &downloadURL, MOBase::ModRepositoryFileInfo &fileInfo) const override;
virtual void setParentWidget(QWidget *widget) override;
};
class IPluginPreviewWrapper : public MOBase::IPluginPreview, public boost::python::wrapper<MOBase::IPluginPreview>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginPreview)
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
public:
virtual std::set<QString> supportedExtensions() const override;
virtual QWidget *genFilePreview(const QString &fileName, const QSize &maxSize) const override;
};
class IPluginToolWrapper: public MOBase::IPluginTool, public boost::python::wrapper<MOBase::IPluginTool>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginTool)
COMMON_I_PLUGIN_WRAPPER_DECLARATIONS
public:
virtual QString displayName() const;
virtual QString tooltip() const;
virtual QIcon icon() const;
virtual void setParentWidget(QWidget *parent);
public slots:
virtual void display() const;
};
#endif // PROXYPLUGINWRAPPERS_H
+11
View File
@@ -0,0 +1,11 @@
#ifndef PYCATCH_H
#define PYCATCH_H
#include <utility.h>
#include "error.h"
#define PYCATCH catch (const boost::python::error_already_set &) { reportPythonError(); throw MOBase::MyException("unhandled exception"); }\
catch (...) { throw MOBase::MyException("An unknown exception was thrown in python code"); }
#endif // PYCATCH_H
File diff suppressed because it is too large Load Diff
+16
View File
@@ -0,0 +1,16 @@
#ifndef SIPAPIACCESS_H
#define SIPAPIACCESS_H
#include <sip.h>
static const sipAPIDef *sipAPI()
{
static const sipAPIDef *sipApi = nullptr;
if (sipApi == nullptr) {
sipApi = (const sipAPIDef *)PyCapsule_Import("sip._C_API", 0);
}
return sipApi;
}
#endif // SIPAPIACCESS_H
+15 -47
View File
@@ -21,8 +21,12 @@
#include <idownloadmanager.h>
#include <ipluginlist.h>
#include <imodlist.h>
#include <isavegame.h>
#include <isavegameinfowidget.h>
#include "error.h"
#include "gilock.h"
#include "pycatch.h"
extern MOBase::IOrganizer *s_Organizer;
@@ -434,53 +438,17 @@ struct IModListWrapper: MOBase::IModList, boost::python::wrapper<MOBase::IModLis
};
struct IPluginGameWrapper: MOBase::IPluginGame, boost::python::wrapper<MOBase::IPluginGame> {
virtual QString gameName() const override { return this->get_override("gameName")(); }
virtual void initializeProfile(const QDir &directory, ProfileSettings settings) const override {
this->get_override("initializeProfile")(directory, settings);
}
virtual QString savegameExtension() const override { return this->get_override("savegameExtension")(); }
virtual QString savegameSEExtension() const override { return this->get_override("savegameSEExtension")(); }
virtual bool isInstalled() const override { return this->get_override("isInstalled")(); }
virtual QIcon gameIcon() const override { return this->get_override("gameIcon")(); }
virtual QDir gameDirectory() const override { return this->get_override("gameDirectory")(); }
virtual QDir dataDirectory() const override { return this->get_override("dataDirectory")(); }
virtual void setGamePath(const QString &path) override { this->get_override("setGamePath")(path); }
virtual QDir documentsDirectory() const override { return this->get_override("documentsDirectory")(); }
virtual QDir savesDirectory() const override { return this->get_override("savesDirectory")(); }
virtual QList<MOBase::ExecutableInfo> executables() const override { return this->get_override("executables")(); }
virtual QString steamAPPId() const override { return this->get_override("steamAPPId")(); }
virtual QStringList primaryPlugins() const override { return this->get_override("primaryPlugins")(); }
virtual QStringList gameVariants() const override { return this->get_override("gameVariants")(); }
virtual void setGameVariant(const QString &variant) override { this->get_override("setGameVariant")(variant); }
virtual QString binaryName() const override { return this->get_override("binaryName")(); }
virtual QString gameShortName() const override { return this->get_override("gameShortName")(); }
virtual QStringList validShortNames() const override { return this->get_override("validShortNames")(); }
virtual QString gameNexusName() const override { return this->get_override("gameNexusName")(); }
virtual QStringList iniFiles() const override { return this->get_override("iniFiles")(); }
virtual QStringList DLCPlugins() const override { return this->get_override("DLCPlugins")(); }
virtual QStringList CCPlugins() const override { return this->get_override("CCPlugins")(); }
virtual LoadOrderMechanism loadOrderMechanism() const override { return this->get_override("loadorderMechanism")(); }
virtual SortMechanism sortMechanism() const override { return this->get_override("sortMechanism")(); }
virtual int nexusModOrganizerID() const override { return this->get_override("nexusModOrganizerID")(); }
virtual int nexusGameID() const override { return this->get_override("nexusGameID")(); }
virtual bool looksValid(QDir const &dir) const override { return this->get_override("looksValid")(dir); }
virtual QString gameVersion() const override { return this->get_override("gameVersion")(); }
virtual QString getLauncherName() const override { return this->get_override("getLauncherName")(); }
//Plugin interface. Could this bit be implemented just once?
virtual bool init(MOBase::IOrganizer *moInfo) override { return this->get_override("init")(moInfo); }
virtual QString name() const override { return this->get_override("name")(); }
virtual QString author() const override { return this->get_override("author")(); }
virtual QString description() const override { return this->get_override("description")(); }
virtual MOBase::VersionInfo version() const override { return this->get_override("version")(); }
virtual bool isActive() const override { return this->get_override("isActive")(); }
virtual QList<MOBase::PluginSetting> settings() const override { return this->get_override("settings")(); }
protected:
virtual std::map<std::type_index, boost::any> featureList() const override { return this->get_override("featureList")(); }
// This needs to be extendable in Python, so actually needs a wrapper
// Everything else probably doesn't
class ISaveGameWrapper : public MOBase::ISaveGame, public boost::python::wrapper<MOBase::ISaveGame>
{
public:
virtual QString getFilename() const override { try { return this->get_override("getFilename")(); } PYCATCH };
virtual QDateTime getCreationTime() const override { try { return this->get_override("getCreationTime")(); } PYCATCH };
virtual QString getSaveGroupIdentifier() const override { try { return this->get_override("getSaveGroupIdentifier")(); } PYCATCH };
virtual QStringList allFiles() const override { try { return this->get_override("allFiles")(); } PYCATCH };
virtual bool hasScriptExtenderFile() const override { try { return this->get_override("hasScriptExtenderFile")(); } PYCATCH };
};
#endif // UIBASEWRAPPERS_H