modstatemodel.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. * modstatemodel.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include "modstate.h"
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class JsonNode;
  14. class ModManager;
  15. VCMI_LIB_NAMESPACE_END
  16. /// Class that represent current state of available mods
  17. /// Provides Qt-based interface to library class ModManager
  18. class ModStateModel
  19. {
  20. std::unique_ptr<JsonNode> repositoryData;
  21. std::unique_ptr<ModManager> modManager;
  22. public:
  23. ModStateModel();
  24. ~ModStateModel();
  25. void setRepositoryData(const JsonNode & repositoriesList);
  26. void reloadLocalState();
  27. const JsonNode & getRepositoryData() const;
  28. ModState getMod(QString modName) const;
  29. QStringList getAllMods() const;
  30. QString getInstalledModSizeFormatted(QString modName) const;
  31. double getInstalledModSizeMegabytes(QString modName) const;
  32. bool isModExists(QString modName) const;
  33. bool isModInstalled(QString modName) const;
  34. bool isModEnabled(QString modName) const;
  35. bool isModSettingEnabled(QString rootModName, QString modSettingName) const;
  36. bool isModUpdateAvailable(QString modName) const;
  37. bool isModVisible(QString modName) const;
  38. void doEnableMods(QStringList modList);
  39. void doDisableMod(QString modname);
  40. bool isSubmod(QString modname);
  41. QString getTopParent(QString modname) const;
  42. void createNewPreset(const QString & presetName);
  43. void deletePreset(const QString & presetName);
  44. void activatePreset(const QString & presetName);
  45. void renamePreset(const QString & oldPresetName, const QString & newPresetName);
  46. QStringList getAllPresets() const;
  47. QString getActivePreset() const;
  48. JsonNode exportCurrentPreset() const;
  49. std::tuple<QString, QStringList> importPreset(const JsonNode & data);
  50. };