51 std::string
name =
"",
53 std::filesystem::path icon_path =
"",
54 std::string app_version =
"");
84 void uninstallMods(
const std::vector<int>& mod_ids,
const std::string& installer_type =
"");
101 bool update_conflicts =
true,
102 std::optional<ProgressNode*> progress_node = {});
112 bool update_conflicts =
true,
113 std::optional<ProgressNode*> progress_node = {});
120 void setModStatus(
int deployer,
int mod_id,
bool status);
148 std::vector<std::tuple<int, bool>>
getLoadorder(
int deployer)
const;
166 void setStagingDir(std::string staging_dir,
bool move_existing);
171 const std::string&
name()
const;
176 void setName(
const std::string& newName);
201 std::vector<ConflictInfo>
getFileConflicts(
int deployer,
int mod_id,
bool show_disabled)
const;
211 void addTool(
const Tool& tool);
226 const std::string&
command()
const;
231 void setCommand(
const std::string& newCommand);
237 void editDeployer(
int deployer,
const EditDeployerInfo& info);
271 void editProfile(
int profile,
const EditProfileInfo& info);
277 void editTool(
int tool_id,
const Tool& new_tool);
293 void addModToGroup(
int mod_id,
int group, std::optional<ProgressNode*> progress_node = {});
301 bool update_conflicts =
true,
302 std::optional<ProgressNode*> progress_node = {});
312 std::optional<ProgressNode*> progress_node = {});
321 std::optional<ProgressNode*> progress_node = {});
362 void updateModDeployers(
const std::vector<int>& mod_ids,
const std::vector<bool>& deployers);
364 std::filesystem::path
iconPath()
const;
369 void setIconPath(
const std::filesystem::path& icon_path);
383 void extractArchive(
const std::filesystem::path& source,
const std::filesystem::path& target);
398 const std::string&
name,
399 const std::vector<std::string>& backup_names);
418 void addBackup(
int target_id,
const std::string&
name,
int source);
456 void overwriteBackup(
int target_id,
int source_backup,
int dest_backup);
481 void removeManualTag(
const std::string& tag_name,
bool update_map =
true);
491 const std::string& new_name,
492 bool update_map =
true);
498 void addTagsToMods(
const std::vector<std::string>& tag_names,
const std::vector<int>& mod_ids);
505 const std::vector<int>& mod_ids);
511 void setTagsForMods(
const std::vector<std::string>& tag_names,
const std::vector<int> mod_ids);
516 void editManualTags(
const std::vector<EditManualTagAction>& actions);
526 const std::string& expression,
527 const std::vector<TagCondition>& conditions,
535 void addAutoTag(
const Json::Value& json_tag,
bool update);
541 void removeAutoTag(
const std::string& tag_name,
bool update);
550 void renameAutoTag(
const std::string& old_name,
const std::string& new_name,
bool update);
559 const std::string& expression,
560 const std::vector<TagCondition>& conditions,
566 void editAutoTags(
const std::vector<EditAutoTagAction>& actions);
587 void setModSources(
int mod_id,
const std::string& local_source,
const std::string& remote_source);
631 std::string
downloadMod(
const std::string& url, std::function<
void(
float)> progress_callback);
658 const std::vector<std::string>& auto_tags);
709 const std::string& b) {};
776 void splitMod(
int mod_id,
int deployer);
Contains the AddModInfo struct.
Header for the nexus::Api class.
Contains the AppInfo struct.
Header for the AutoTag class.
Header for the BackupManager class.
Handles creation of, deletion of and switching between, bachups.
Definition backupmanager.h:20
void removeTool(int tool_id)
Removes a tool.
Definition moddedapplication.cpp:502
std::vector< ModInfo > getModInfo() const
Creates a vector containing information about all installed mods, stored in ModInfo objects.
Definition moddedapplication.cpp:344
void performUpdateCheck(const std::vector< int > &target_mod_indices)
Checks for available updates for mods with the given index in installed_mods_.
Definition moddedapplication.cpp:2249
int getNumDeployers() const
Returns the number of Deployer objects for this application.
Definition moddedapplication.cpp:432
Json::Value json_settings_
Contains the internal state of this object.
Definition moddedapplication.h:682
void changeLoadorder(int deployer, int from_index, int to_index)
Moves a mod from one position in the load order to another for given Deployer.
Definition moddedapplication.cpp:237
std::filesystem::path icon_path_
Path to this applications icon.
Definition moddedapplication.h:706
void changeModName(int mod_id, const std::string &new_name)
Changes the name of an installed mod.
Definition moddedapplication.cpp:442
void changeManualTagName(const std::string &old_name, const std::string &new_name, bool update_map=true)
Changes the name of the given tag to the given new name. Fails if a tag by the given name exists.
Definition moddedapplication.cpp:1100
void cleanupFailedInstallation()
Performs a cleanup for the previous installation.
Definition moddedapplication.cpp:1049
std::vector< std::unique_ptr< Deployer > > deployers_
Contains every Deployer used by this application.
Definition moddedapplication.h:688
void removeDeployer(int deployer, bool cleanup)
Removes a Deployer.
Definition moddedapplication.cpp:328
void addTagsToMods(const std::vector< std::string > &tag_names, const std::vector< int > &mod_ids)
Adds the given tags to all given mods.
Definition moddedapplication.cpp:1119
std::function< void(float)> progress_callback_
Callback used to inform about the current task's progress.
Definition moddedapplication.h:730
void deployModsFor(std::vector< int > deployers)
Deploys mods using Deployer objects with given ids.
Definition moddedapplication.cpp:44
std::tuple< int, std::string, std::string > verifyDeployerDirectories()
Checks if files can be deployed.
Definition moddedapplication.cpp:631
void overwriteBackup(int target_id, int source_backup, int dest_backup)
Deletes all files in the dest backup and replaces them with the files from the source backup.
Definition moddedapplication.cpp:1042
void changeAutoTagEvaluator(const std::string &tag_name, const std::string &expression, const std::vector< TagCondition > &conditions, bool update)
Changes the given tags evaluator according to the given expression and conditions.
Definition moddedapplication.cpp:1265
std::map< int, int > group_map_
Maps mods to their groups.
Definition moddedapplication.h:700
void fixInvalidHardLinkDeployers()
For all deployers: If using hard links that can't be created, switch to sym links.
Definition moddedapplication.cpp:1575
void addModToDeployer(int deployer, int mod_id, bool update_conflicts=true, std::optional< ProgressNode * > progress_node={})
Appends a new mod to the load order for given Deployer.
Definition moddedapplication.cpp:243
void addAutoTag(const std::string &tag_name, const std::string &expression, const std::vector< TagCondition > &conditions, bool update)
Adds a new auto tag.
Definition moddedapplication.cpp:1193
void writeSettings() const
Writes json_settings_ to a file at app_mod_dir_/CONFIG_FILE_NAME.
Definition moddedapplication.cpp:1767
void setBackupName(int target_id, int backup_id, const std::string &name)
Changes the name of the given backup for the given target.
Definition moddedapplication.cpp:1027
std::vector< std::string > app_versions_
For every profile: The version of the app managed by that profile.
Definition moddedapplication.h:728
void updateAutoTagMap()
Updates auto_tag_map_ with the information contained in auto_tags_.
Definition moddedapplication.cpp:2237
std::vector< std::string > getDeployerNames() const
Creates a vector containing the names of all Deployer objects.
Definition moddedapplication.cpp:336
void removeModFromGroup(int mod_id, bool update_conflicts=true, std::optional< ProgressNode * > progress_node={})
Removes a mod from it's group.
Definition moddedapplication.cpp:659
const std::string & name() const
Getter for the name of this application.
Definition moddedapplication.cpp:421
void updateModDeployers(const std::vector< int > &mod_ids, const std::vector< bool > &deployers)
Updates which deployer should manage given mods.
Definition moddedapplication.cpp:810
void removeModFromDeployer(int deployer, int mod_id, bool update_conflicts=true, std::optional< ProgressNode * > progress_node={})
Removes a mod from the load order for given Deployer.
Definition moddedapplication.cpp:264
void readSettings()
Reads json_settings_ from a file at app_mod_dir_/CONFIG_FILE_NAME.
Definition moddedapplication.cpp:1778
void setModStatus(int deployer, int mod_id, bool status)
Enables or disables the given mod in the load order for given Deployer.
Definition moddedapplication.cpp:284
void updateManualTagMap()
Updates manual_tag_map_ with the information contained in manual_tags_.
Definition moddedapplication.cpp:2225
void setTagsForMods(const std::vector< std::string > &tag_names, const std::vector< int > mod_ids)
Sets the tags for all given mods to the given tags.
Definition moddedapplication.cpp:1149
void uninstallMods(const std::vector< int > &mod_ids, const std::string &installer_type="")
Uninstalls the given mods, this includes deleting all installed files.
Definition moddedapplication.cpp:179
void setStagingDir(std::string staging_dir, bool move_existing)
Setter for the path to the staging directory. This is where all installed mods are stored.
Definition moddedapplication.cpp:404
std::vector< AutoTag > auto_tags_
Contains all known auto tags.
Definition moddedapplication.h:719
std::string getModName(int mod_id) const
Returns the name of a mod.
Definition moddedapplication.cpp:2001
void editManualTags(const std::vector< EditManualTagAction > &actions)
Performs the given editing actions on the manual tags.
Definition moddedapplication.cpp:1169
std::vector< std::tuple< int, bool > > getLoadorder(int deployer) const
Getter for the current mod load order of one Deployer.
Definition moddedapplication.cpp:394
void updateSteamIconPath()
If the icon path is a steam path: Update it to the new format.
Definition moddedapplication.cpp:2298
std::map< int, std::vector< std::string > > manual_tag_map_
Maps mod ids to a vector of manual tags associated with that mod.
Definition moddedapplication.h:717
void setAppVersion(const std::string &app_version)
Sets the app version of the currently active profile to the given version.
Definition moddedapplication.cpp:1393
void updateDeployerGroups(std::optional< ProgressNode * > progress_node={})
Updates the load order for every Deployer to reflect the current mod groups.
Definition moddedapplication.cpp:2010
void editDeployer(int deployer, const EditDeployerInfo &info)
Used to set type, name and target directory for one deployer.
Definition moddedapplication.cpp:527
void addBackupTarget(const std::filesystem::path &path, const std::string &name, const std::vector< std::string > &backup_names)
Adds a new target file or directory to be managed by the BackupManager.
Definition moddedapplication.cpp:977
void installMod(const AddModInfo &info)
Installs a new mod using the given Installer type.
Definition moddedapplication.cpp:119
void addTool(const Tool &tool)
Adds a new tool to this application.
Definition moddedapplication.cpp:496
void setIconPath(const std::filesystem::path &icon_path)
Setter for icon_path_.
Definition moddedapplication.cpp:1670
void updateSettings(bool write=false)
Updates json_settings_ with the current state of this object.
Definition moddedapplication.cpp:1676
std::filesystem::path staging_dir_
The path to the staging directory containing all installed mods.
Definition moddedapplication.h:684
void splitMod(int mod_id, int deployer)
If given mod contains a sub-directory managed by a deployer that is not the given deployer,...
Definition moddedapplication.cpp:2068
void changeModVersion(int mod_id, const std::string &new_version)
Sets the given mod's version to the given new version.
Definition moddedapplication.cpp:771
void removeAllBackupTargets()
Removes all targets by deleting all backups, except for the active ones, and all config files.
Definition moddedapplication.cpp:993
std::vector< std::vector< int > > getConflictGroups(int deployer)
Returns the conflicts groups for the current profile of given deployer.
Definition moddedapplication.cpp:805
void unDeployMods()
Undeploys mods for all managed deployers.
Definition moddedapplication.cpp:85
void suppressUpdateNotification(const std::vector< int > &mod_ids)
Temporarily disables update notifications for the given mods. This is done by setting the mods remote...
Definition moddedapplication.cpp:1444
const std::string & getConfigFileName() const
Getter for the name of the file used to store this objects internal state.
Definition moddedapplication.cpp:437
DeployerInfo getDeployerInfo(int deployer)
Creates DeployerInfo for one Deployer.
Definition moddedapplication.cpp:862
void uninstallGroupMembers(const std::vector< int > &mod_ids)
Uninstalls all mods which are inactive group members of any group which contains any of the given mod...
Definition moddedapplication.cpp:1065
void reapplyAutoTags()
Reapply all auto tags to all mods.
Definition moddedapplication.cpp:1342
void replaceMod(const AddModInfo &info)
Replaces an existing mod with the mod specified by the given argument.
Definition moddedapplication.cpp:2131
void editAutoTags(const std::vector< EditAutoTagAction > &actions)
Performs the given editing actions on the auto tags.
Definition moddedapplication.cpp:1284
std::vector< std::string > profile_names_
Contains names of all profiles.
Definition moddedapplication.h:696
std::string getNexusPageUrl(const std::string &nxm_url)
Generates a NexusMods mod page URL from the given nxm URL.
Definition moddedapplication.cpp:1468
void deleteAllData()
Deletes all data for this app.
Definition moddedapplication.cpp:1383
void addDeployer(const EditDeployerInfo &info)
Adds a new Deployer of given type.
Definition moddedapplication.cpp:290
std::string downloadMod(const std::string &url, std::function< void(float)> progress_callback)
Downloads the file from the given url to staging_dir_ / _download.
Definition moddedapplication.cpp:1473
void createGroup(int first_mod_id, int second_mod_id, std::optional< ProgressNode * > progress_node={})
Creates a new group containing the two given mods. A group is a set of mods where only one member,...
Definition moddedapplication.cpp:734
void updateIgnoredFiles(int deployer)
Updates the file ignore list for ReverseDeployers.
Definition moddedapplication.cpp:1637
int getNumGroups()
Returns the number of groups.
Definition moddedapplication.cpp:781
int getModGroup(int mod_id)
Returns the group to which the given mod belongs.
Definition moddedapplication.cpp:791
void addModToGroup(int mod_id, int group, std::optional< ProgressNode * > progress_node={})
Adds a mod to an existing group and makes the mod the active member of that group.
Definition moddedapplication.cpp:645
void addModToIgnoreList(int deployer, int mod_id)
Adds the given mod to the ignore list of the given ReverseDeployer.
Definition moddedapplication.cpp:1648
std::vector< ConflictInfo > getFileConflicts(int deployer, int mod_id, bool show_disabled) const
Checks for file conflicts of given mod with all other mods in the load order for one Deployer.
Definition moddedapplication.cpp:452
std::string export_file_name
File name used to store exported deployers and auto tags.
Definition moddedapplication.h:734
const std::filesystem::path & getStagingDir() const
Getter for the path to the staging directory. This is where all installed mods are stored.
Definition moddedapplication.cpp:399
void applyModAction(int deployer, int action, int mod_id)
Applies the given mod action to the given mod.
Definition moddedapplication.cpp:1659
int current_profile_
The currently active profile id.
Definition moddedapplication.h:694
std::string name_
The name of this application.
Definition moddedapplication.h:680
nexus::Page getNexusPage(int mod_id)
Fetches data from NexusMods for the given mod.
Definition moddedapplication.cpp:1412
std::vector< Tool > tools_
Contains all tools for this application.
Definition moddedapplication.h:690
std::string command_
The command used to run this application.
Definition moddedapplication.h:692
std::unordered_set< int > getModConflicts(int deployer, int mod_id)
Checks for conflicts with other mods for one Deployer. Two mods are conflicting if they share at leas...
Definition moddedapplication.cpp:568
std::vector< std::string > getProfileNames() const
Returns a vector containing the names of all profiles.
Definition moddedapplication.cpp:610
BackupManager bak_man_
Manages all backups for this application.
Definition moddedapplication.h:711
void checkForModUpdates()
Checks for updates for all mods.
Definition moddedapplication.cpp:1421
void setName(const std::string &newName)
Setter for the name of this application.
Definition moddedapplication.cpp:426
std::vector< ManualTag > manual_tags_
Contains all known manually managed tags.
Definition moddedapplication.h:715
void removeManualTag(const std::string &tag_name, bool update_map=true)
Removes the tag with the given name, if it exists.
Definition moddedapplication.cpp:1090
void addProfile(const EditProfileInfo &info)
Adds a new profile and optionally copies it's load order from an existing profile.
Definition moddedapplication.cpp:584
void deployMods()
Deploys mods using all Deployer objects of this application.
Definition moddedapplication.cpp:36
void keepOrRevertFileModifications(int deployer, const FileChangeChoices &changes_to_keep) const
Currently only supports hard link deployment. For every given file: Moves the modified file into the ...
Definition moddedapplication.cpp:1568
void setProgressCallback(const std::function< void(float)> &progress_callback)
Sets the callback function used to inform about the current task's progress.
Definition moddedapplication.cpp:1060
std::string generalizeSteamPath(const std::string &path)
Checks if the given path belongs to a steam installation or prefix directory. Replaces installation o...
Definition moddedapplication.cpp:2281
void exportConfiguration(const std::vector< int > &deployers, const std::vector< std::string > &auto_tags)
Exports configurations for the given deployers and the given auto tags to a json file....
Definition moddedapplication.cpp:1581
static const std::string CONFIG_FILE_NAME
Name of the file used to store this objects internal state.
Definition moddedapplication.h:57
void setLog(const std::function< void(Log::LogLevel, const std::string &)> &newLog)
Setter for log callback.
Definition moddedapplication.cpp:970
std::map< int, std::vector< std::string > > auto_tag_map_
Maps mod ids to a vector of auto tags associated with that mod.
Definition moddedapplication.h:721
std::vector< Mod > installed_mods_
Contains all currently installed mods.
Definition moddedapplication.h:686
std::map< int, std::string > installer_map_
Maps mods to the installer used during their installation.
Definition moddedapplication.h:704
std::vector< BackupTarget > getBackupTargets() const
Returns a vector containing information about all managed backup targets.
Definition moddedapplication.cpp:1022
bool modHasGroup(int mod_id)
Checks if given mod belongs to any group.
Definition moddedapplication.cpp:786
void sortModsByConflicts(int deployer)
Sorts the load order by grouping mods which contain conflicting files.
Definition moddedapplication.cpp:798
void removeProfile(int profile)
Removes a profile.
Definition moddedapplication.cpp:594
void removeTagsFromMods(const std::vector< std::string > &tag_names, const std::vector< int > &mod_ids)
Removes the given tags from the given mods.
Definition moddedapplication.cpp:1134
void updateState(bool read=false)
Updates the internal state of this object to the state stored in json_settings_.
Definition moddedapplication.cpp:1789
static int verifyStagingDir(std::filesystem::path staging_dir)
Verifies if reading/ writing to the staging directory is possible and if the JSON file containing inf...
Definition moddedapplication.cpp:835
void addManualTag(const std::string &tag_name)
Adds a new tag with the given name. Fails if a tag by that name already exists.
Definition moddedapplication.cpp:1081
void checkModsForUpdates(const std::vector< int > &mod_ids)
Checks for updates for mods with the given ids.
Definition moddedapplication.cpp:1432
void setModSources(int mod_id, const std::string &local_source, const std::string &remote_source)
Sets the given mods local and remote sources to the given paths.
Definition moddedapplication.cpp:1399
std::function< void(Log::LogLevel, const std::string &)> log_
Callback for logging.
Definition moddedapplication.h:708
const std::string & command() const
Getter for the command used to run this application.
Definition moddedapplication.cpp:516
ModdedApplication(std::filesystem::path staging_dir, std::string name="", std::string command="", std::filesystem::path icon_path="", std::string app_version="")
If a JSON settings file already exists in app_mod_dir, it is used to construct this object.
Definition moddedapplication.cpp:17
std::vector< std::vector< int > > groups_
For every group: A vector containing every mod in that group.
Definition moddedapplication.h:698
void setBackupTargetName(int target_id, const std::string &name)
Changes the name of the given backup target.
Definition moddedapplication.cpp:1035
std::string getDownloadUrl(const std::string &nxm_url)
Generates a download URL from the given NexusMods nxm Url.
Definition moddedapplication.cpp:1458
void removeBackup(int target_id, int backup_id)
Deletes the given backup for given target.
Definition moddedapplication.cpp:1006
std::vector< Tool > getTools() const
Getter for the tools of this application.
Definition moddedapplication.cpp:511
void editTool(int tool_id, const Tool &new_tool)
Used to replace an existing tool with a new tool.
Definition moddedapplication.cpp:624
std::filesystem::path iconPath() const
Getter for icon_path_.
Definition moddedapplication.cpp:1665
void removeAutoTag(const std::string &tag_name, bool update)
Removes the given auto tag.
Definition moddedapplication.cpp:1231
void removeBackupTarget(int target_id)
Removes the given backup target by deleting all backups, except for the active one,...
Definition moddedapplication.cpp:985
void setActiveBackup(int target_id, int backup_id)
Changes the currently active backup for the given target.
Definition moddedapplication.cpp:1014
std::string download_dir_
The subdirectory used to store downloads.
Definition moddedapplication.h:732
AppInfo getAppInfo() const
Fills an AppInfo object with information about this object.
Definition moddedapplication.cpp:468
void changeActiveGroupMember(int group, int mod_id, std::optional< ProgressNode * > progress_node={})
Changes the active member of given group to given mod.
Definition moddedapplication.cpp:758
std::vector< int > active_group_members_
Contains the active member of every group.
Definition moddedapplication.h:702
std::string getDownloadUrlForFile(int nexus_file_id, const std::string &mod_url)
Generates a download URL from the given NexusMods mod id and file id.
Definition moddedapplication.cpp:1463
void updateAutoTags(const std::vector< int > mod_ids)
Reapplies auto tags to the specified mods.
Definition moddedapplication.cpp:1363
void setCommand(const std::string &newCommand)
Setter for the command used to run this application.
Definition moddedapplication.cpp:521
void editProfile(int profile, const EditProfileInfo &info)
Used to set the name of a profile.
Definition moddedapplication.cpp:615
void setProfile(int profile)
Sets the currently active profile.
Definition moddedapplication.cpp:574
void unDeployModsFor(std::vector< int > deployers)
Undeploys mods for the given deployers.
Definition moddedapplication.cpp:93
void addBackup(int target_id, const std::string &name, int source)
Adds a new backup for the given target by copying the currently active backup.
Definition moddedapplication.cpp:999
void extractArchive(const std::filesystem::path &source, const std::filesystem::path &target)
Extracts the given archive to the given location.
Definition moddedapplication.cpp:856
int last_mod_id_
Id of the most recently installed mod.
Definition moddedapplication.h:713
void renameAutoTag(const std::string &old_name, const std::string &new_name, bool update)
Changes the name of the given auto tag to the given new name. Fails if a tag by the given name exists...
Definition moddedapplication.cpp:1244
ExternalChangesInfo getExternalChanges(int deployer)
Checks if files deployed by the given deployer have been externally overwritten.
Definition moddedapplication.cpp:1558
Header for the Deployer class.
Contains the DeployerInfo struct.
Header for the EditAutoTagAction class.
Contains the EditDeployerInfo struct.
Header for the EditManualTagAction class.
Contains the EditProfileInfo struct.
Contains the ExternalChangesInfo struct.
Header for the Log namespace.
char path[256]
Path to which to extract the file.
Definition lspakfilelistentry.h:1
Header for the ManualTag class.
Contains the ModInfo struct.
LogLevel
Represents the importance of a log message.
Definition log.h:19
Stores data needed to install a new mod.
Definition addmodinfo.h:17