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;
|
2024-11-21 23:11:02 +02:00
|
|
|
bool isModSettingEnabled(QString rootModName, QString modSettingName) const;
|
2024-11-12 22:00:21 +02:00
|
|
|
bool isModUpdateAvailable(QString modName) const;
|
|
|
|
bool isModVisible(QString modName) const;
|
2024-11-14 22:56:19 +02:00
|
|
|
|
2024-11-20 00:15:05 +02:00
|
|
|
void doEnableMods(QStringList modList);
|
2024-11-14 22:56:19 +02:00
|
|
|
void doDisableMod(QString modname);
|
2024-11-18 19:37:45 +02:00
|
|
|
|
|
|
|
bool isSubmod(QString modname);
|
|
|
|
QString getTopParent(QString modname) const;
|
2024-12-08 22:56:19 +02:00
|
|
|
|
|
|
|
void createNewPreset(const QString & presetName);
|
|
|
|
void deletePreset(const QString & presetName);
|
|
|
|
void activatePreset(const QString & presetName);
|
|
|
|
void renamePreset(const QString & oldPresetName, const QString & newPresetName);
|
|
|
|
|
|
|
|
QStringList getAllPresets() const;
|
|
|
|
QString getActivePreset() const;
|
2024-11-12 22:00:21 +02:00
|
|
|
};
|