modstatemodel.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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 appendRepositories(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. };