mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
- files moved will now also be treated as "deleted" in the old location so a newly created file with that same name is not created in overwrite - introduced a mechanism by which MO can recognize if it crashed before when attempting to load a plugin. That plugin can be blacklisted so it doesn't get loaded again - plugins can now programaticaly change their settings - plugins can now store data persistently without exposing that data as settings - requesting an unset-setting from a plugin is no longer treated as a bug - clarified warning message for when files are in overwrite directory - the proxyPython plugin will now discover if python initialization crashed MO on a previous session and give the user a chance to fix it or disable the plugin - bugfix: GetModuleFileName modified the buffer past the zero termination. While this doesn't violate the API documentation it is different from the regular windows implementation - bugfix: proxy plugins couldn't access the parent widget - bugfix: when moving a file from overwrite to a mod the in-memory file structure wasn't updated - bugfix: name input dialog for profiles allowed names that weren't valid directory names - bugfix: profile dialog wasn't able to delete profiles if the name started or ended in whitespaces - bugfix: The name-cells for plugin settings could be changed (without effect) - removed a few obsolete files from the repository
76 lines
2.1 KiB
C++
76 lines
2.1 KiB
C++
#ifndef PROXYPYTHON_H
|
|
#define PROXYPYTHON_H
|
|
|
|
|
|
#include <ipluginproxy.h>
|
|
#include <iplugindiagnose.h>
|
|
#include <map>
|
|
#include <Windows.h>
|
|
#include <pythonrunner.h>
|
|
|
|
|
|
class ProxyPython : public QObject, MOBase::IPluginProxy, MOBase::IPluginDiagnose
|
|
{
|
|
Q_OBJECT
|
|
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginProxy MOBase::IPluginDiagnose)
|
|
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
|
|
Q_PLUGIN_METADATA(IID "org.tannin.ProxyPython" FILE "proxypython.json")
|
|
#endif
|
|
|
|
public:
|
|
ProxyPython();
|
|
~ProxyPython();
|
|
|
|
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;
|
|
|
|
QStringList pluginList(const QString &pluginPath) const;
|
|
QObject *instantiate(const QString &pluginName);
|
|
|
|
/**
|
|
* @return the parent widget for newly created dialogs
|
|
* @note needs to be public so it can be exposed to plugins
|
|
*/
|
|
virtual QWidget *getParentWidget() { return parentWidget(); }
|
|
|
|
public: // IPluginDiagnose
|
|
|
|
virtual std::vector<unsigned int> activeProblems() const;
|
|
virtual QString shortDescription(unsigned int key) const;
|
|
virtual QString fullDescription(unsigned int key) const;
|
|
virtual bool hasGuidedFix(unsigned int key) const;
|
|
virtual void startGuidedFix(unsigned int key) const;
|
|
|
|
private:
|
|
|
|
static const unsigned int PROBLEM_PYTHONMISSING = 1;
|
|
static const unsigned int PROBLEM_PYTHONWRONGVERSION = 2;
|
|
static const unsigned int PROBLEM_WRONGPYTHONPATH = 3;
|
|
static const unsigned int PROBLEM_INITFAIL = 4;
|
|
static const unsigned int PROBLEM_PYTHONDETECTION = 5;
|
|
static const char *s_DownloadPythonURL;
|
|
|
|
MOBase::IOrganizer *m_MOInfo;
|
|
QString m_TempRunnerFile;
|
|
HMODULE m_RunnerLib;
|
|
IPythonRunner *m_Runner;
|
|
|
|
enum {
|
|
FAIL_NONE,
|
|
FAIL_NOTINIT,
|
|
FAIL_MISSINGDEPENDENCIES,
|
|
FAIL_INITFAIL,
|
|
FAIL_WRONGPYTHONPATH,
|
|
FAIL_PYTHONDETECTION,
|
|
FAIL_OTHER
|
|
} m_LoadFailure;
|
|
|
|
};
|
|
|
|
#endif // PROXYPYTHON_H
|