aboutsummaryrefslogtreecommitdiff
path: root/libs/installer_omod/src/installerOmod.h
blob: a12235503e87220909340709d9f84ad616191449 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef INSTALLEROMOD_H
#define INSTALLEROMOD_H

#include <QTemporaryFile>

#include <uibase/iplugininstallercustom.h>
#include <uibase/ipluginfilemapper.h>

#include "OMODFrameworkWrapper.h"

class InstallerOMOD : public MOBase::IPluginInstallerCustom, public MOBase::IPluginFileMapper
{
  Q_OBJECT;
  Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerCustom MOBase::IPluginFileMapper);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
  // We should probably buy a domain.
  Q_PLUGIN_METADATA(IID "org.AnyOldName3.InstallerOmod");
#endif

public:
  InstallerOMOD();

  // IPlugin
  bool init(MOBase::IOrganizer* moInfo) override;

  QString name() const override;

  QString localizedName() const override;

  QString author() const override;

  QString description() const override;

  MOBase::VersionInfo version() const override;

  std::vector<std::shared_ptr<const MOBase::IPluginRequirement>> requirements() const override;

  QList<MOBase::PluginSetting> settings() const override;

  // IPluginInstaller

  unsigned int priority() const override;

  bool isManualInstaller() const override;

  void onInstallationEnd(EInstallResult result, MOBase::IModInterface* newMod) override;

  bool isArchiveSupported(std::shared_ptr<const MOBase::IFileTree> tree) const override;

  void setParentWidget(QWidget* parent) override;

  // IPluginInstallerCustom

  bool isArchiveSupported(const QString& archiveName) const override;

  std::set<QString> supportedExtensions() const override;

  EInstallResult install(MOBase::GuessedValue<QString>& modName, QString gameName, const QString& archiveName, const QString& version, int nexusID) override;

  // IPluginFileMapper

  MappingType mappings() const override;

protected:
  void buildSDPs();

  void clearSDPs();

private:
  MOBase::IOrganizer* mMoInfo;
  std::unique_ptr<OMODFrameworkWrapper> mOmodFrameworkWrapper;
  std::map<QString, std::unique_ptr<QTemporaryFile>> mVirtualSDPs;
};

#endif // !INSTALLEROMOD_H