modstatecontroller.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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. QVariantMap localMods;
  24. QStringList recentErrors;
  25. bool addError(QString modname, QString message);
  26. bool removeModDir(QString mod);
  27. public:
  28. ModStateController(std::shared_ptr<ModStateModel> modList);
  29. ~ModStateController();
  30. void appendRepositories(const JsonNode & repositoriesList);
  31. QStringList getErrors();
  32. /// mod management functions. Return true if operation was successful
  33. /// installs mod from zip archive located at archivePath
  34. bool installMod(QString mod, QString archivePath);
  35. bool uninstallMod(QString mod);
  36. bool enableMods(QStringList mod);
  37. bool disableMod(QString mod);
  38. bool canInstallMod(QString mod);
  39. bool canUninstallMod(QString mod);
  40. bool canEnableMod(QString mod);
  41. bool canDisableMod(QString mod);
  42. signals:
  43. void extractionProgress(qint64 currentAmount, qint64 maxAmount);
  44. };