cmodmanager.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /*
  2. * cmodmanager.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 "cmodlist.h"
  12. class CModManager : public QObject
  13. {
  14. Q_OBJECT
  15. CModList * modList;
  16. QString settingsPath();
  17. // check-free version of public method
  18. bool doEnableMod(QString mod, bool on);
  19. bool doInstallMod(QString mod, QString archivePath);
  20. bool doUninstallMod(QString mod);
  21. QVariantMap modSettings;
  22. QVariantMap localMods;
  23. QStringList recentErrors;
  24. bool addError(QString modname, QString message);
  25. bool removeModDir(QString mod);
  26. public:
  27. CModManager(CModList * modList);
  28. void resetRepositories();
  29. void loadRepositories(QVector<QVariantMap> repomap);
  30. void loadModSettings();
  31. void loadMods();
  32. QStringList getErrors();
  33. /// mod management functions. Return true if operation was successful
  34. /// installs mod from zip archive located at archivePath
  35. bool installMod(QString mod, QString archivePath);
  36. bool uninstallMod(QString mod);
  37. bool enableMod(QString mod);
  38. bool disableMod(QString mod);
  39. bool canInstallMod(QString mod);
  40. bool canUninstallMod(QString mod);
  41. bool canEnableMod(QString mod);
  42. bool canDisableMod(QString mod);
  43. signals:
  44. void extractionProgress(qint64 currentAmount, qint64 maxAmount);
  45. };