modstatemodel.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. const JsonNode & getRepositoryData() const;
  27. ModState getMod(QString modName) const;
  28. QStringList getAllMods() const;
  29. QString getInstalledModSizeFormatted(QString modName) const;
  30. double getInstalledModSizeMegabytes(QString modName) const;
  31. bool isModExists(QString modName) const;
  32. bool isModInstalled(QString modName) const;
  33. bool isModEnabled(QString modName) const;
  34. bool isModUpdateAvailable(QString modName) const;
  35. bool isModVisible(QString modName) const;
  36. void doEnableMod(QString modname);
  37. void doDisableMod(QString modname);
  38. };