2024-11-12 22:00:21 +02:00
|
|
|
/*
|
|
|
|
* modstatemodel.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "modstate.h"
|
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
class JsonNode;
|
|
|
|
class ModManager;
|
|
|
|
VCMI_LIB_NAMESPACE_END
|
|
|
|
|
|
|
|
/// Class that represent current state of available mods
|
|
|
|
/// Provides Qt-based interface to library class ModManager
|
|
|
|
class ModStateModel
|
|
|
|
{
|
2024-11-13 19:25:59 +02:00
|
|
|
std::unique_ptr<JsonNode> repositoryData;
|
2024-11-12 22:00:21 +02:00
|
|
|
std::unique_ptr<ModManager> modManager;
|
|
|
|
|
|
|
|
public:
|
|
|
|
ModStateModel();
|
|
|
|
~ModStateModel();
|
|
|
|
|
2024-11-13 19:25:59 +02:00
|
|
|
void appendRepositories(const JsonNode & repositoriesList);
|
2024-11-15 13:54:43 +02:00
|
|
|
void reloadLocalState();
|
2024-11-13 19:25:59 +02:00
|
|
|
const JsonNode & getRepositoryData() const;
|
2024-11-12 22:00:21 +02:00
|
|
|
|
|
|
|
ModState getMod(QString modName) const;
|
|
|
|
QStringList getAllMods() const;
|
|
|
|
|
2024-11-14 20:22:02 +02:00
|
|
|
QString getInstalledModSizeFormatted(QString modName) const;
|
|
|
|
double getInstalledModSizeMegabytes(QString modName) const;
|
|
|
|
|
2024-11-12 22:00:21 +02:00
|
|
|
bool isModExists(QString modName) const;
|
|
|
|
bool isModInstalled(QString modName) const;
|
|
|
|
bool isModEnabled(QString modName) const;
|
|
|
|
bool isModUpdateAvailable(QString modName) const;
|
|
|
|
bool isModVisible(QString modName) const;
|
2024-11-14 22:56:19 +02:00
|
|
|
|
|
|
|
void doEnableMod(QString modname);
|
|
|
|
void doDisableMod(QString modname);
|
2024-11-18 19:37:45 +02:00
|
|
|
|
|
|
|
bool isSubmod(QString modname);
|
|
|
|
QString getTopParent(QString modname) const;
|
2024-11-12 22:00:21 +02:00
|
|
|
};
|