modstatecontroller.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * modstatecontroller.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 <QVector>
  12. VCMI_LIB_NAMESPACE_BEGIN
  13. class JsonNode;
  14. VCMI_LIB_NAMESPACE_END
  15. class ModStateModel;
  16. class ModStateController : public QObject, public boost::noncopyable
  17. {
  18. Q_OBJECT
  19. std::shared_ptr<ModStateModel> modList;
  20. // check-free version of public method
  21. bool doInstallMod(QString mod, QString archivePath);
  22. bool doUninstallMod(QString mod);
  23. QStringList recentErrors;
  24. bool addError(QString modname, QString message);
  25. bool removeModDir(QString mod);
  26. public:
  27. ModStateController(std::shared_ptr<ModStateModel> modList);
  28. ~ModStateController();
  29. void setRepositoryData(const JsonNode & repositoriesList);
  30. QStringList getErrors();
  31. /// mod management functions. Return true if operation was successful
  32. /// installs mod from zip archive located at archivePath
  33. bool installMod(QString mod, QString archivePath);
  34. bool uninstallMod(QString mod);
  35. bool enableMods(QStringList mod);
  36. bool disableMod(QString mod);
  37. bool canInstallMod(QString mod);
  38. bool canUninstallMod(QString mod);
  39. bool canEnableMod(QString mod);
  40. bool canDisableMod(QString mod);
  41. signals:
  42. void extractionProgress(qint64 currentAmount, qint64 maxAmount);
  43. };