modstatemodel.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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 isModUpdateAvailable(QString modName) const;
  36. bool isModVisible(QString modName) const;
  37. void doEnableMods(QStringList modList);
  38. void doDisableMod(QString modname);
  39. bool isSubmod(QString modname);
  40. QString getTopParent(QString modname) const;
  41. };