Limo
A simple mod manager
Loading...
Searching...
No Matches
ApplicationManager Class Reference

Contains several ModdedApplication objects and provides access to their functions using Qt's signal/ slot mechanism. More...

#include <applicationmanager.h>

Inheritance diagram for ApplicationManager:
Collaboration diagram for ApplicationManager:

Public Slots

void addApplication (EditApplicationInfo info)
 Adds a new application.
 
void removeApplication (int app_id, bool cleanup)
 Removes an application and optionally deletes all installed mods and the settings file in the application's staging directory.
 
void deployMods (int app_id)
 Deploys mods using all Deployer objects of one application.
 
void deployModsFor (int app_id, std::vector< int > deployer_ids)
 Deploys mods for given deployers and given application.
 
void unDeployMods (int app_id)
 Undeploys mods using all Deployer objects of one application.
 
void unDeployModsFor (int app_id, std::vector< int > deployer_ids)
 Undeploys mods for given deployers and given application.
 
void installMod (int app_id, AddModInfo info)
 Installs a new mod for one application using the given Installer type.
 
void uninstallMods (int app_id, std::vector< int > mod_ids, std::string installer_type)
 Uninstalls the given mods for one application, this includes deleting all installed files.
 
void changeLoadorder (int app_id, int deployer, int from_idx, int to_idx)
 Moves a mod from one position in the load order to another for given Deployer for given application.
 
void updateModDeployers (int app_id, std::vector< int > mod_ids, std::vector< bool >)
 Updates which deployer should manage given mods.
 
void removeModFromDeployer (int app_id, int deployer, int mod_id)
 Removes a mod from the load order for given Deployer for given application.
 
void setModStatus (int app_id, int deployer, int mod_id, bool status)
 Enables or disables the given mod in the load order for given Deployer for given application.
 
void addDeployer (int app_id, EditDeployerInfo info)
 Adds a new Deployer of given type to given application.
 
void removeDeployer (int app_id, int deployer, bool cleanup)
 Removes a Deployer from an application.
 
void getDeployerNames (int app_id, bool is_new)
 Creates a vector containing the names of all Deployer objects for one application. Emits sendDeployerNames.
 
void getModInfo (int app_id)
 Creates a vector containing information about all installed mods, stored in ModInfo objects for one application. Emits sendModInfo.
 
void getDeployerInfo (int app_id, int deployer)
 Creates DeployerInfo for one Deployer for one application. Emits sendDeployerInfo.
 
void getApplicationNames (bool is_new)
 Emits sendApplicationNames.
 
void changeModName (int app_id, int mod_id, QString new_name)
 Setter for a mod name.
 
void getFileConflicts (int app_id, int deployer, int mod_id, bool show_disabled)
 Checks for file conflicts of given mod with all other mods in the load order for one Deployer of one application. Emits sendFileConflicts.
 
void getAppInfo (int app_id)
 Creates AppInfo for given application. Emits sendAppInfo.
 
void addTool (int app_id, Tool tool)
 Adds a new tool to given application.
 
void removeTool (int app_id, int tool_id)
 Removes a tool from given application.
 
void editApplication (EditApplicationInfo info, int app_id)
 Edits an application and optionally moves all of it's mods to a new directory.
 
void editDeployer (EditDeployerInfo info, int app_id, int deployer)
 Used to set type, name and target directory for one deployer of one application.
 
void getModConflicts (int app_id, int deployer, int mod_id)
 Checks for conflicts with other mods for one Deployer of one application. Two mods are conflicting if they share at least one file. Emits sendModConflicts.
 
void setProfile (int app_id, int profile)
 Sets the currently active profile for given application.
 
void addProfile (int app_id, EditProfileInfo info)
 Adds a new profile to one application and optionally copies it's load order from an existing profile.
 
void removeProfile (int app_id, int profile)
 Removes a profile from an application.
 
void getProfileNames (int app_id, bool is_new)
 Creates a vector containing the names of all profiles of one application. Emits sendProfileNames.
 
void editProfile (int app_id, int profile, EditProfileInfo info)
 Used to set the name of a profile for one application.
 
void editTool (int app_id, int tool_id, Tool new_tool)
 Used to replace an existing to with a now one for a application.
 
void addModToGroup (int app_id, int mod_id, int group)
 Adds a mod to an existing group of an application.
 
void removeModFromGroup (int app_id, int mod_id)
 Removes a mod from it's group for one application.
 
void createGroup (int app_id, int first_mod_id, int second_mod_id)
 Creates a new group containing the two given mods for one application. A group is a set of mods where only one member, the active member, will be deployed.
 
void changeActiveGroupMember (int app_id, int group, int mod_id)
 Changes the active member of given group of an application to given mod.
 
void changeModVersion (int app_id, int mod_id, QString new_version)
 Sets the given mod's version to the given new version for one application.
 
void sortModsByConflicts (int app_id, int deployer)
 Sorts the load order by grouping mods which contain conflicting files.
 
void extractArchive (int app_id, int mod_id, QString source, QString target, QString remote_source, QString version, QString name)
 Extracts the given archive to the given location.
 
void addBackupTarget (int app_id, QString path, QString name, QString default_backup, QString first_backup)
 Adds a new target file or directory to be managed by the BackupManager of given ModdedApplication.
 
void removeBackupTarget (int app_id, int target_id)
 Removes the given backup target from the given ModdedApplication by deleting all relevant backups and config files.
 
void addBackup (int app_id, int target_id, QString name, int source)
 Adds a new backup for the given target for the given ModdedApplication by copying the currently active backup.
 
void removeBackup (int app_id, int target_id, int backup_id)
 Deletes the given backup for given target for given ModdedApplication.
 
void setActiveBackup (int app_id, int target_id, int backup_id)
 Changes the currently active backup for the given target for the given ModdedApplication.
 
void getBackupTargets (int app_id)
 Returns a vector containing information about all managed backup targets of given ModdedApplication. Emits sendBackupTargets.
 
void setBackupName (int app_id, int target_id, int backup_id, QString name)
 Changes the name of the given backup for the given target for the given ModdedApplication.
 
void setBackupTargetName (int app_id, int target_id, QString name)
 Changes the name of the given backup target for the given ModdedApplication.
 
void overwriteBackup (int app_id, 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 for the given ModdedApplication.
 
void onScrollLists ()
 Used to synchronize scrolling in lists with the event queue.
 
void uninstallGroupMembers (int app_id, const std::vector< int > &mod_ids)
 Uninstalls all mods which are inactive group members of any group which contains any of the given mods for the given ModdedApplication.
 
void addManualTag (int app_id, QString tag_name)
 Adds a new tag with the given name to the given ModdedApplication. Fails if a tag by that name already exists.
 
void removeManualTag (int app_id, QString tag_name)
 Removes the tag with the given name, if it exists, from the given ModdedApplication.
 
void changeManualTagName (int app_id, QString old_name, QString new_name)
 Changes the name of the given tag to the given new name for the given ModdedApplication. Fails if a tag by the given name exists.
 
void addTagsToMods (int app_id, QStringList tag_names, const std::vector< int > &mod_ids)
 Adds the given tag to all given mods for the given ModdedApplication.
 
void removeTagsFromMods (int app_id, QStringList tag_names, const std::vector< int > &mod_ids)
 Removes the given tag from the given mods for the given ModdedApplication.
 
void setTagsForMods (int app_id, QStringList tag_names, const std::vector< int > &mod_ids)
 Sets the tags for all given mods to the given tags for the given ModdedApplication.
 
void editManualTags (int app_id, std::vector< EditManualTagAction > actions)
 Performes the given tag editing actions for the given ModdedApplication.
 
void editAutoTags (int app_id, std::vector< EditAutoTagAction > actions)
 Performes the given tag editing actions for the given ModdedApplication.
 
void reapplyAutoTags (int app_id)
 Reapplies all auto tags for all mods for the given ModdedApplication.
 
void updateAutoTags (int app_id, std::vector< int > mod_ids)
 Reapplies all auto tags to the given mods for the given ModdedApplication.
 
void editModSources (int app_id, int mod_id, QString local_source, QString remote_source)
 Sets a mods local and remote source to the given values for the given ModdedApplication.
 
void getNexusPage (int app_id, int mod_id)
 Fetches data for the given mod from NexusMods.
 
void downloadMod (int app_id, QString nxm_url)
 Downloads a mod from nexusmods using the given nxm_url.
 
void downloadModFile (int app_id, int mod_id, int nexus_file_id, QString mod_url)
 Downloads the file with the given id for the given mod url from nexusmods.
 
void checkForModUpdates (int app_id)
 Checks for available mod updates on NexusMods.
 
void checkModsForUpdates (int app_id, const std::vector< int > &mod_ids)
 Checks for available updates for the given mod for the given app.
 
void suppressUpdateNotification (int app_id, const std::vector< int > &mod_ids)
 Temporarily disables update notifications for the given mods.
 
void getExternalChanges (int app_id, int deployer, bool deploy)
 Checks if files deployed by the given app by the given deployer have been externally overwritten.
 
void keepOrRevertFileModifications (int app_id, int deployer, const FileChangeChoices &changes_to_keep, bool deploy)
 Keeps or reverts external changes for one app for one deployer. For every given file: Moves the modified file into the source mods directory and links it back in, if the changes are to be kept. Else: Deletes that file and restores the original link.
 
void exportAppConfiguration (int app_id, std::vector< int > deployers, QStringList auto_tags)
 Exports configurations for the given deployers and the given auto tags to a json file. Does not include mods.
 
void updateIgnoredFiles (int app_id, int deployer)
 Updates the file ignore list for ReverseDeployers.
 
void addModToIgnoreList (int app_id, int deployer, int mod_id)
 Adds the given mod to the ignore list of the given ReverseDeployer.
 
void applyModAction (int app_id, int deployer, int action, int mod_id)
 Applies the given mod action to the given mod.
 

Signals

void sendDeployerNames (QStringList names, bool is_new)
 Sends the names of all deployers.
 
void sendModInfo (std::vector< ModInfo > mod_info)
 Sends ModInfo for one application.
 
void sendLoadorder (std::vector< std::tuple< int, bool > > loadorder)
 Sends the load order for one deployer of one application.
 
void sendDeployerInfo (DeployerInfo depl_info)
 Sends DeployerInfo for one deployer of one application.
 
void sendApplicationNames (QStringList names, QStringList icon_paths, bool is_new)
 Sends a list containing all application names.
 
void completedOperations (QString message="")
 Emitted after potentially slow operations, e.g. installing a mod, are completed.
 
void sendFileConflicts (std::vector< ConflictInfo > conflicts)
 Sends file conflicts for one mod for one deployer of one application.
 
void sendAppInfo (AppInfo app_info)
 Sends AppInfo for one application.
 
void sendModConflicts (std::unordered_set< int > conflicts)
 Sends mod conflicts for one mod for one deployer of one application.
 
void sendProfileNames (QStringList names, bool is_new)
 Sends a list of all profile names for one application.
 
void sendError (QString title, QString message)
 Sends an error message.
 
void extractionComplete (int app_id, int mod_id, bool success, QString extracted_path, QString local_source, QString remote_source, QString version, QString name)
 Emitted after archive extraction is complete.
 
void logMessage (Log::LogLevel log_level, QString message)
 Sends a log message to the logging window.
 
void sendBackupTargets (std::vector< BackupTarget > targets)
 Sends a vector containing info about all backup targets managed by given ModdedApplication.
 
void scrollLists ()
 Used to synchronize scrolling in lists with the event queue.
 
void updateProgress (float progress)
 Informs about the progress in the current task.
 
void sendNexusPage (int app_id, int mod_id, nexus::Page page)
 Sends NexusMods data for a specific mod.
 
void downloadComplete (int app_id, int mod_id, QString file_path, QString mod_url)
 Signals successful completion of a mod download.
 
void downloadFailed ()
 Signals a failed download.
 
void modInstallationComplete (bool success)
 Signals mod installation has been completed.
 
void sendExternalChangesInfo (int app_id, ExternalChangesInfo info, int num_deployers, bool deploy)
 Sends data about externally modified files for one app for one deployer.
 
void externalChangesHandled (int app_id, int deployer, int num_deployers, bool deploy)
 Signals that external changes to files for given app for given deployer have been handled.
 

Public Member Functions

 ApplicationManager (QObject *parent=nullptr)
 Constructor. Only one instance of this class is support at a time.
 
virtual ~ApplicationManager ()
 Decreases the static number of instances counter.
 
void init ()
 If a JSON file with settings already exists for this user: Restores the internal state from that file. Else: Creates a new settings file.
 
void sendLogMessage (Log::LogLevel log_level, const std::string &message)
 Sends a log message to the logging window.
 
std::string toString () const
 Generates a string which contains the ids and names of every application as well as their profiles.
 
int getNumApplications () const
 Returns the number of managed \ModdedApplication "applications".
 
int getNumProfiles (int app_id) const
 Returns the number of profiles for one application.
 
void enableExceptions (bool enabled)
 Enable or disable throwing exceptions.
 

Private Member Functions

template<auto f, typename... Args>
bool handleExceptions (int app_id, Args &&... args)
 Wrapper for member functions of ModdedApplication. Calls the function specified in the template for the ModdedApplication stored at apps_[app_id] with the given arguments and handles all exceptions thrown by the target function.
 
template<typename Func, typename Obj, typename... Args>
auto handleExceptions (Func &&f, Obj &&obj, Args &&... args) -> std::optional< decltype((obj.*f)(std::forward< Args >(args)...))>
 Wrapper for class member functions. Catches specific exception types and sends an error message to the gui if an exception was thrown.
 
void updateSettings ()
 Updates the settings file with the current state of this object.
 
void updateState ()
 Updates the internal state of this object to the state stored in the settings file.
 
bool appIndexIsValid (int app_id, bool show_error=true)
 Checks if given app_id is part of apps_ and optionally emits an error signal.
 
bool deployerIndexIsValid (int app_id, int deployer, bool show_error=true)
 Checks if given deployer id is valid for given app and optionally emits an error signal.
 
void handleAddAppError (int code, std::filesystem::path staging_dir)
 If the code indicates an error: Create an error message and emit it using sendError.
 
void handleAddDeployerError (int code, std::filesystem::path staging_dir, std::filesystem::path dest_dir, const std::string &error_message)
 If the code indicates an error: Create an error message and emit it using sendError.
 
void handleParseError (std::string path, std::string message)
 Emits an error message indicating a parsing error using sendError.
 
void sendUpdateProgress (float progress)
 Informs about the progress in the current task by emitting updateProgress.
 
void sendLogMessage (Log::LogLevel level, QString message)
 Emits logMessage with the given data.
 

Private Attributes

std::vector< ModdedApplicationapps_
 Contains every ModdedApplication handled by this object.
 
bool throw_exceptions_ = false
 If true: Do not catch exceptions.
 

Static Private Attributes

static int number_of_instances_ = 0
 Counter for the number of instances of this class.
 

Detailed Description

Contains several ModdedApplication objects and provides access to their functions using Qt's signal/ slot mechanism.

This is intended to be run inside of a worker thread, therefore public functions are implemented as Qt slots and emit Qt signals instead of returning a value directly. The internal state of this object is stored in a JSON file in the user directory, usually in "~/.local/share/linux_mod_manager/lmm_apps.json". Warning: To ensure all actions are completed as intended, use Qt::QueuedConnection as type for all connections. Do not instantiate more than one object of this class.

Constructor & Destructor Documentation

◆ ApplicationManager()

ApplicationManager::ApplicationManager ( QObject * parent = nullptr)
explicit

Constructor. Only one instance of this class is support at a time.

Parameters
parentThis is passed to the constructor of QObject.
Exceptions
std::runtime_errorIndicates that another instance of this class exists.

Member Function Documentation

◆ addApplication

void ApplicationManager::addApplication ( EditApplicationInfo info)
slot

Adds a new application.

Parameters
infoContains all data needed to add a new application, e.g. its name.

◆ addBackup

void ApplicationManager::addBackup ( int app_id,
int target_id,
QString name,
int source )
slot

Adds a new backup for the given target for the given ModdedApplication by copying the currently active backup.

Parameters
app_idTarget app.
target_idTarget for which to create a new backup.
nameDisplay name for the new backup.
sourceBackup from which to copy files to create the new backup. If -1: copy currently active backup.

◆ addBackupTarget

void ApplicationManager::addBackupTarget ( int app_id,
QString path,
QString name,
QString default_backup,
QString first_backup )
slot

Adds a new target file or directory to be managed by the BackupManager of given ModdedApplication.

Parameters
app_idTarget app.
pathPath to the target file or directory.
nameDisplay name for this target.
default_backupDisplay name for the currently active version of the target.
first_backupIf not empty: Create a backup of the target with this as name.

◆ addDeployer

void ApplicationManager::addDeployer ( int app_id,
EditDeployerInfo info )
slot

Adds a new Deployer of given type to given application.

Parameters
app_idThe target application.
infoContains all data needed to add a new deployer, e.g. its name.

◆ addManualTag

void ApplicationManager::addManualTag ( int app_id,
QString tag_name )
slot

Adds a new tag with the given name to the given ModdedApplication. Fails if a tag by that name already exists.

Parameters
app_idTarget app.
tag_nameName for the new tag.
Exceptions
std::runtime_errorIf a tag by that name exists.

◆ addModToGroup

void ApplicationManager::addModToGroup ( int app_id,
int mod_id,
int group )
slot

Adds a mod to an existing group of an application.

Parameters
app_idThe target application.
mod_idThe mod's id.
groupThe target group.

◆ addModToIgnoreList

void ApplicationManager::addModToIgnoreList ( int app_id,
int deployer,
int mod_id )
slot

Adds the given mod to the ignore list of the given ReverseDeployer.

Parameters
app_idTarget app.
deployerTarget deployer.
mod_idMod to be ignored.

◆ addProfile

void ApplicationManager::addProfile ( int app_id,
EditProfileInfo info )
slot

Adds a new profile to one application and optionally copies it's load order from an existing profile.

Parameters
app_idThe target application.
infoContains data for the new profile.

◆ addTagsToMods

void ApplicationManager::addTagsToMods ( int app_id,
QStringList tag_names,
const std::vector< int > & mod_ids )
slot

Adds the given tag to all given mods for the given ModdedApplication.

Parameters
app_idTarget app.
tag_nameTarget tags name.
mod_idsTarget mod ids.

◆ addTool

void ApplicationManager::addTool ( int app_id,
Tool tool )
slot

Adds a new tool to given application.

Parameters
app_idThe target application.
toolThe new Tool.

◆ appIndexIsValid()

bool ApplicationManager::appIndexIsValid ( int app_id,
bool show_error = true )
private

Checks if given app_id is part of apps_ and optionally emits an error signal.

Parameters
app_idTarget app id.
show_errorIf true: Emit sendError. if app id is invalid.
Returns
True if app id is valid, else false.

◆ applyModAction

void ApplicationManager::applyModAction ( int app_id,
int deployer,
int action,
int mod_id )
slot

Applies the given mod action to the given mod.

Parameters
app_idTarget app.
deployerTarget deployer.
actionAction to be applied.
mod_idTarget mod.

◆ changeActiveGroupMember

void ApplicationManager::changeActiveGroupMember ( int app_id,
int group,
int mod_id )
slot

Changes the active member of given group of an application to given mod.

Parameters
app_idThe target application.
groupTarget group.
mod_idThe new active member.

◆ changeLoadorder

void ApplicationManager::changeLoadorder ( int app_id,
int deployer,
int from_idx,
int to_idx )
slot

Moves a mod from one position in the load order to another for given Deployer for given application.

Parameters
app_idThe target application.
deployerThe target Deployer.
from_indexIndex of mod to be moved.
to_indexDestination index.

◆ changeManualTagName

void ApplicationManager::changeManualTagName ( int app_id,
QString old_name,
QString new_name )
slot

Changes the name of the given tag to the given new name for the given ModdedApplication. Fails if a tag by the given name exists.

Parameters
app_idTarget app.
old_nameName of the target tag.
new_nameTarget tags new name.
Exceptions
std::runtime_errorIf a tag with the given new_name exists.

◆ changeModName

void ApplicationManager::changeModName ( int app_id,
int mod_id,
QString new_name )
slot

Setter for a mod name.

Parameters
app_idThe target application.
mod_idTarget mod.
new_nameThe new name.

◆ changeModVersion

void ApplicationManager::changeModVersion ( int app_id,
int mod_id,
QString new_version )
slot

Sets the given mod's version to the given new version for one application.

Parameters
app_idThe target application.
mod_idTarget mod.
new_versionThe new version.

◆ checkForModUpdates

void ApplicationManager::checkForModUpdates ( int app_id)
slot

Checks for available mod updates on NexusMods.

Parameters
app_idApp for which mod updates are to be checked.

◆ checkModsForUpdates

void ApplicationManager::checkModsForUpdates ( int app_id,
const std::vector< int > & mod_ids )
slot

Checks for available updates for the given mod for the given app.

Parameters
app_idTarget app.
mod_idsIds of the mods for which to check for updates.

◆ completedOperations

void ApplicationManager::completedOperations ( QString message = "")
signal

Emitted after potentially slow operations, e.g. installing a mod, are completed.

Parameters
messageStatus message to show in the main window.

◆ createGroup

void ApplicationManager::createGroup ( int app_id,
int first_mod_id,
int second_mod_id )
slot

Creates a new group containing the two given mods for one application. A group is a set of mods where only one member, the active member, will be deployed.

Parameters
app_idThe target application.
first_mod_idFirst mod. This will be the active member of the new group.
second_mod_idSecond mod.

◆ deployerIndexIsValid()

bool ApplicationManager::deployerIndexIsValid ( int app_id,
int deployer,
bool show_error = true )
private

Checks if given deployer id is valid for given app and optionally emits an error signal.

Parameters
app_idTarget app id.
deployerTarget deployer.
show_errorIf true: Emit sendError. if deployer id is invalid.
Returns
True if deployer id is valid, else false.

◆ deployMods

void ApplicationManager::deployMods ( int app_id)
slot

Deploys mods using all Deployer objects of one application.

Parameters
app_idThe target application.

◆ deployModsFor

void ApplicationManager::deployModsFor ( int app_id,
std::vector< int > deployer_ids )
slot

Deploys mods for given deployers and given application.

Parameters
app_idTarget application.
deployer_idsTarget deployers.

◆ downloadComplete

void ApplicationManager::downloadComplete ( int app_id,
int mod_id,
QString file_path,
QString mod_url )
signal

Signals successful completion of a mod download.

Parameters
app_idApp for which the mod has been downloaded.
mod_idId of the mod for which the file is to be downloaded. This is the limo internal mod id, NOT the NexusMods id.
file_pathPath to the downloaded file.
mod_urlUrl from which the mod was downloaded.

◆ downloadMod

void ApplicationManager::downloadMod ( int app_id,
QString nxm_url )
slot

Downloads a mod from nexusmods using the given nxm_url.

Parameters
app_idApp for which the mod is to be downloaded. The mod is downloaded to the apps staging directory.
nxm_urlUrl containing all information needed for the download.

◆ downloadModFile

void ApplicationManager::downloadModFile ( int app_id,
int mod_id,
int nexus_file_id,
QString mod_url )
slot

Downloads the file with the given id for the given mod url from nexusmods.

Parameters
app_idApp for which the mod is to be downloaded. The mod is downloaded to the apps staging directory.
mod_idId of the mod for which the file is to be downloaded. This is the Limo internal mod id, NOT the NexusMods id.
nexus_file_idFile id of the mod.
mod_urlUrl to the mod page on NexusMods.

◆ editApplication

void ApplicationManager::editApplication ( EditApplicationInfo info,
int app_id )
slot

Edits an application and optionally moves all of it's mods to a new directory.

Parameters
infoContains all data needed to edit an application, e.g. its new name.
app_idThe target application.

◆ editAutoTags

void ApplicationManager::editAutoTags ( int app_id,
std::vector< EditAutoTagAction > actions )
slot

Performes the given tag editing actions for the given ModdedApplication.

Parameters
app_idTarget app.
actionsEditing actions.

◆ editDeployer

void ApplicationManager::editDeployer ( EditDeployerInfo info,
int app_id,
int deployer )
slot

Used to set type, name and target directory for one deployer of one application.

Parameters
infoContains all data needed to edit a deployer, e.g. its new name.
app_idThe target application.
deployerTarget Deployer.

◆ editManualTags

void ApplicationManager::editManualTags ( int app_id,
std::vector< EditManualTagAction > actions )
slot

Performes the given tag editing actions for the given ModdedApplication.

Parameters
app_idTarget app.
actionsEditing actions.

◆ editModSources

void ApplicationManager::editModSources ( int app_id,
int mod_id,
QString local_source,
QString remote_source )
slot

Sets a mods local and remote source to the given values for the given ModdedApplication.

Parameters
app_idApp to which the edited mod belongs.
mod_idTarget mod id.
local_sourcePath to a local archive or directory used for mod installation.
remote_sourceRemote URL from which the mod was downloaded.

◆ editProfile

void ApplicationManager::editProfile ( int app_id,
int profile,
EditProfileInfo info )
slot

Used to set the name of a profile for one application.

Parameters
app_idThe target application.
profileTarget Profile
infoContains the new data for the profile.

◆ editTool

void ApplicationManager::editTool ( int app_id,
int tool_id,
Tool new_tool )
slot

Used to replace an existing to with a now one for a application.

Parameters
app_idThe target application.
tool_idTarget tool.
new_toolThe new tool.

◆ enableExceptions()

void ApplicationManager::enableExceptions ( bool enabled)

Enable or disable throwing exceptions.

Parameters
enabledNew status.

◆ exportAppConfiguration

void ApplicationManager::exportAppConfiguration ( int app_id,
std::vector< int > deployers,
QStringList auto_tags )
slot

Exports configurations for the given deployers and the given auto tags to a json file. Does not include mods.

Parameters
app_idTarget app.
deployersDeployers to export.
auto_tagsAuto tags to export.

◆ externalChangesHandled

void ApplicationManager::externalChangesHandled ( int app_id,
int deployer,
int num_deployers,
bool deploy )
signal

Signals that external changes to files for given app for given deployer have been handled.

Parameters
app_idTarget app.
deployerTarget deployer.
num_deployersThe total number of deployers for the target app.
deployIf True: Deploy mods after checking, else: Undeploy mods.

◆ extractArchive

void ApplicationManager::extractArchive ( int app_id,
int mod_id,
QString source,
QString target,
QString remote_source,
QString version,
QString name )
slot

Extracts the given archive to the given location.

Parameters
app_idapplication for which the mod is to be extracted.
mod_idId of the mod for which the file is to be extracted or -1 if this is a new mod.
sourceSource path.
targetExtraction target path.
remote_sourceURL from where the mod was downloaded.
versionIf not empty: Use this to overwrite the default version.
nameIf not empty: Use this to overwrite the default name.

◆ extractionComplete

void ApplicationManager::extractionComplete ( int app_id,
int mod_id,
bool success,
QString extracted_path,
QString local_source,
QString remote_source,
QString version,
QString name )
signal

Emitted after archive extraction is complete.

Parameters
app_idapplication for which the mod has been extracted.
mod_idId of the mod for which the file was to be extracted or -1 if this is a new mod.
successFalse if exception has been thrown.
extracted_pathPath to which the mod was extracted.
local_sourceSource archive for the mod.
remote_sourceURL from where the mod was downloaded.
versionIf not empty: Use this to overwrite the default version.
nameIf not empty: Use this to overwrite the default name.

◆ getAppInfo

void ApplicationManager::getAppInfo ( int app_id)
slot

Creates AppInfo for given application. Emits sendAppInfo.

Parameters
app_idThe target application.

◆ getApplicationNames

void ApplicationManager::getApplicationNames ( bool is_new)
slot

Emits sendApplicationNames.

Parameters
is_newIndicates whether this was called after adding a new application.

◆ getBackupTargets

void ApplicationManager::getBackupTargets ( int app_id)
slot

Returns a vector containing information about all managed backup targets of given ModdedApplication. Emits sendBackupTargets.

Parameters
app_idTarget app.

◆ getDeployerInfo

void ApplicationManager::getDeployerInfo ( int app_id,
int deployer )
slot

Creates DeployerInfo for one Deployer for one application. Emits sendDeployerInfo.

Parameters
app_idThe target application.
deployerTarget deployer.

◆ getDeployerNames

void ApplicationManager::getDeployerNames ( int app_id,
bool is_new )
slot

Creates a vector containing the names of all Deployer objects for one application. Emits sendDeployerNames.

Parameters
app_idThe target application.
is_newIndicates if this was called after a new deployer was added.

◆ getExternalChanges

void ApplicationManager::getExternalChanges ( int app_id,
int deployer,
bool deploy )
slot

Checks if files deployed by the given app by the given deployer have been externally overwritten.

Parameters
app_idTarget app.
deployerDeployer to check.
deployIf True: Deploy mods after checking, else: Undeploy mods.

◆ getFileConflicts

void ApplicationManager::getFileConflicts ( int app_id,
int deployer,
int mod_id,
bool show_disabled )
slot

Checks for file conflicts of given mod with all other mods in the load order for one Deployer of one application. Emits sendFileConflicts.

Parameters
app_idThe target application.
deployerThe target Deployer
mod_idMod to be checked.
show_disabledIf true: Also check for conflicts with disabled mods.

◆ getModConflicts

void ApplicationManager::getModConflicts ( int app_id,
int deployer,
int mod_id )
slot

Checks for conflicts with other mods for one Deployer of one application. Two mods are conflicting if they share at least one file. Emits sendModConflicts.

Parameters
app_idThe target application.
deployerTarget Deployer.
mod_idThe mod to be checked.

◆ getModInfo

void ApplicationManager::getModInfo ( int app_id)
slot

Creates a vector containing information about all installed mods, stored in ModInfo objects for one application. Emits sendModInfo.

Parameters
app_idThe target application.

◆ getNexusPage

void ApplicationManager::getNexusPage ( int app_id,
int mod_id )
slot

Fetches data for the given mod from NexusMods.

Parameters
app_idApp to which the mod belongs.
mod_idTarget mod id.

◆ getNumProfiles()

int ApplicationManager::getNumProfiles ( int app_id) const

Returns the number of profiles for one application.

Parameters
app_idApplication for which to get the number of profiles.
Returns
The number.

◆ getProfileNames

void ApplicationManager::getProfileNames ( int app_id,
bool is_new )
slot

Creates a vector containing the names of all profiles of one application. Emits sendProfileNames.

Parameters
app_idThe target application.

◆ handleAddAppError()

void ApplicationManager::handleAddAppError ( int code,
std::filesystem::path staging_dir )
private

If the code indicates an error: Create an error message and emit it using sendError.

Parameters
codeThe error code.
staging_dirThe applications staging directory.

◆ handleAddDeployerError()

void ApplicationManager::handleAddDeployerError ( int code,
std::filesystem::path staging_dir,
std::filesystem::path dest_dir,
const std::string & error_message )
private

If the code indicates an error: Create an error message and emit it using sendError.

Parameters
codeThe error code.
staging_dirThe application's staging directory.
dest_dirThe Deployer's target directory.
error_messageA more detailed error message (if an error occured).

◆ handleExceptions() [1/2]

template<typename Func, typename Obj, typename... Args>
auto ApplicationManager::handleExceptions ( Func && f,
Obj && obj,
Args &&... args ) -> std::optional<decltype((obj.*f)(std::forward<Args>(args)...))>
inlineprivate

Wrapper for class member functions. Catches specific exception types and sends an error message to the gui if an exception was thrown.

Parameters
fFunction to run.
objObject of a class that contains f as member function.
argsArguments for the function.
Returns
If no exception was thrown: The return value of the function, else: An empty optional.

◆ handleExceptions() [2/2]

template<auto f, typename... Args>
bool ApplicationManager::handleExceptions ( int app_id,
Args &&... args )
inlineprivate

Wrapper for member functions of ModdedApplication. Calls the function specified in the template for the ModdedApplication stored at apps_[app_id] with the given arguments and handles all exceptions thrown by the target function.

Parameters
app_idTarget app id.
argsArguments which are passed to the function.
Returns
True iff an exception has been thrown.

◆ handleParseError()

void ApplicationManager::handleParseError ( std::string path,
std::string message )
private

Emits an error message indicating a parsing error using sendError.

Parameters
pathPath to the file causing this error.
messageMessage of the exception thrown during parsing.

◆ installMod

void ApplicationManager::installMod ( int app_id,
AddModInfo info )
slot

Installs a new mod for one application using the given Installer type.

Parameters
app_idThe target application.
infoContains all data needed to install the mod.

◆ keepOrRevertFileModifications

void ApplicationManager::keepOrRevertFileModifications ( int app_id,
int deployer,
const FileChangeChoices & changes_to_keep,
bool deploy )
slot

Keeps or reverts external changes for one app for one deployer. For every given file: Moves the modified file into the source mods directory and links it back in, if the changes are to be kept. Else: Deletes that file and restores the original link.

Parameters
app_idTarget app.
deployerTarget deployer.
changes_to_keepContains paths to modified files, the id of the mod currently responsible for that file and a bool which indicates whether or not changes to that file should be kept.
deployIf True: Deploy mods after checking, else: Undeploy mods.

◆ logMessage

void ApplicationManager::logMessage ( Log::LogLevel log_level,
QString message )
signal

Sends a log message to the logging window.

Parameters
log_levelType of message.
messageMessage to be displayed.

◆ modInstallationComplete

void ApplicationManager::modInstallationComplete ( bool success)
signal

Signals mod installation has been completed.

Parameters
successIf true: Installation was successful.

◆ overwriteBackup

void ApplicationManager::overwriteBackup ( int app_id,
int target_id,
int source_backup,
int dest_backup )
slot

Deletes all files in the dest backup and replaces them with the files from the source backup for the given ModdedApplication.

Parameters
app_idTarget app.
target_idBackup target.
source_backupBackup from which to copy files.
dest_backupTarget for data deletion.

◆ reapplyAutoTags

void ApplicationManager::reapplyAutoTags ( int app_id)
slot

Reapplies all auto tags for all mods for the given ModdedApplication.

Parameters
app_idTarget app.

◆ removeApplication

void ApplicationManager::removeApplication ( int app_id,
bool cleanup )
slot

Removes an application and optionally deletes all installed mods and the settings file in the application's staging directory.

Parameters
app_idThe target application.
cleanupIndicates if mods and settings file should be deleted.

◆ removeBackup

void ApplicationManager::removeBackup ( int app_id,
int target_id,
int backup_id )
slot

Deletes the given backup for given target for given ModdedApplication.

Parameters
app_idTarget app.
target_idTarget from which to delete a backup.
backup_idBackup to remove.

◆ removeBackupTarget

void ApplicationManager::removeBackupTarget ( int app_id,
int target_id )
slot

Removes the given backup target from the given ModdedApplication by deleting all relevant backups and config files.

Parameters
app_idTarget app.
target_idTarget to remove.

◆ removeDeployer

void ApplicationManager::removeDeployer ( int app_id,
int deployer,
bool cleanup )
slot

Removes a Deployer from an application.

Parameters
app_idTarget application.
deployerTarget Deployer.
cleanupIf true: Remove all currently deployed files and restore backups.

◆ removeManualTag

void ApplicationManager::removeManualTag ( int app_id,
QString tag_name )
slot

Removes the tag with the given name, if it exists, from the given ModdedApplication.

Parameters
app_idTarget app.
tag_nameTag to be removed.

◆ removeModFromDeployer

void ApplicationManager::removeModFromDeployer ( int app_id,
int deployer,
int mod_id )
slot

Removes a mod from the load order for given Deployer for given application.

Parameters
app_idThe target application.
deployerThe target Deployer
mod_idId of the mod to be removed.

◆ removeModFromGroup

void ApplicationManager::removeModFromGroup ( int app_id,
int mod_id )
slot

Removes a mod from it's group for one application.

Parameters
app_idThe target application.
mod_idTarget mod.

◆ removeProfile

void ApplicationManager::removeProfile ( int app_id,
int profile )
slot

Removes a profile from an application.

Parameters
app_idThe target application.
profileThe profile to be removed.

◆ removeTagsFromMods

void ApplicationManager::removeTagsFromMods ( int app_id,
QStringList tag_names,
const std::vector< int > & mod_ids )
slot

Removes the given tag from the given mods for the given ModdedApplication.

Parameters
app_idTarget app.
tag_nameTarget tags name.
mod_idsTarget mod ids.

◆ removeTool

void ApplicationManager::removeTool ( int app_id,
int tool_id )
slot

Removes a tool from given application.

Parameters
app_idThe target application.
tool_idThe tool's id.

◆ sendAppInfo

void ApplicationManager::sendAppInfo ( AppInfo app_info)
signal

Sends AppInfo for one application.

Parameters
TheAppInfo.

◆ sendApplicationNames

void ApplicationManager::sendApplicationNames ( QStringList names,
QStringList icon_paths,
bool is_new )
signal

Sends a list containing all application names.

Parameters
namesThe list of names.
icon_pathsPaths to application icons.
is_newIndicates whether this was emitted after adding a new application.

◆ sendBackupTargets

void ApplicationManager::sendBackupTargets ( std::vector< BackupTarget > targets)
signal

Sends a vector containing info about all backup targets managed by given ModdedApplication.

Parameters
targetsThe targets.

◆ sendDeployerInfo

void ApplicationManager::sendDeployerInfo ( DeployerInfo depl_info)
signal

Sends DeployerInfo for one deployer of one application.

Parameters
depl_infoThe DeployerInfo.

◆ sendDeployerNames

void ApplicationManager::sendDeployerNames ( QStringList names,
bool is_new )
signal

Sends the names of all deployers.

Parameters
namesThe deployer names.
is_newIndicates whether this signal was emitted after adding a new deployer.

◆ sendError

void ApplicationManager::sendError ( QString title,
QString message )
signal

Sends an error message.

Parameters
titleThe title of the message window.
messageThe error message.

◆ sendExternalChangesInfo

void ApplicationManager::sendExternalChangesInfo ( int app_id,
ExternalChangesInfo info,
int num_deployers,
bool deploy )
signal

Sends data about externally modified files for one app for one deployer.

Parameters
app_idTarget app.
infoContains data about modified files.
num_deployersThe total number of deployers for the target app.
deployIf True: Deploy mods after checking, else: Undeploy mods.

◆ sendFileConflicts

void ApplicationManager::sendFileConflicts ( std::vector< ConflictInfo > conflicts)
signal

Sends file conflicts for one mod for one deployer of one application.

Parameters
conflictsA vector containing the conflicts information.

◆ sendLoadorder

void ApplicationManager::sendLoadorder ( std::vector< std::tuple< int, bool > > loadorder)
signal

Sends the load order for one deployer of one application.

Parameters
loadorderThe load order.

◆ sendLogMessage() [1/2]

void ApplicationManager::sendLogMessage ( Log::LogLevel level,
QString message )
private

Emits logMessage with the given data.

Parameters
levelLog level.
messageLog message.

◆ sendLogMessage() [2/2]

void ApplicationManager::sendLogMessage ( Log::LogLevel log_level,
const std::string & message )

Sends a log message to the logging window.

Parameters
log_levelType of message.
messageMessage to be displayed.

◆ sendModConflicts

void ApplicationManager::sendModConflicts ( std::unordered_set< int > conflicts)
signal

Sends mod conflicts for one mod for one deployer of one application.

Parameters
Containsevery mod id in conflict.

◆ sendModInfo

void ApplicationManager::sendModInfo ( std::vector< ModInfo > mod_info)
signal

Sends ModInfo for one application.

Parameters
mod_infoThe mod info.

◆ sendNexusPage

void ApplicationManager::sendNexusPage ( int app_id,
int mod_id,
nexus::Page page )
signal

Sends NexusMods data for a specific mod.

Parameters
app_idApp to which the mod belongs.
mod_idTarget mod id.
pageContains all data for the mod.

◆ sendProfileNames

void ApplicationManager::sendProfileNames ( QStringList names,
bool is_new )
signal

Sends a list of all profile names for one application.

Parameters
namesThe profile names.
is_newIndicates whether this was emitted after adding a new profile.

◆ sendUpdateProgress()

void ApplicationManager::sendUpdateProgress ( float progress)
private

Informs about the progress in the current task by emitting updateProgress.

Parameters
progressThe progress.

◆ setActiveBackup

void ApplicationManager::setActiveBackup ( int app_id,
int target_id,
int backup_id )
slot

Changes the currently active backup for the given target for the given ModdedApplication.

Parameters
app_idTarget app.
target_idTarget for which to change the active backup.
backup_idNew active backup.

◆ setBackupName

void ApplicationManager::setBackupName ( int app_id,
int target_id,
int backup_id,
QString name )
slot

Changes the name of the given backup for the given target for the given ModdedApplication.

Parameters
app_idTarget app.
target_idBackup target.
backup_idBackup to be edited.
nameThe new name.

◆ setBackupTargetName

void ApplicationManager::setBackupTargetName ( int app_id,
int target_id,
QString name )
slot

Changes the name of the given backup target for the given ModdedApplication.

Parameters
app_idTarget app.
target_idBackup target.
nameThe new name.

◆ setModStatus

void ApplicationManager::setModStatus ( int app_id,
int deployer,
int mod_id,
bool status )
slot

Enables or disables the given mod in the load order for given Deployer for given application.

Parameters
app_idThe target application.
deployerThe target Deployer
mod_idMod to be edited.
statusThe new status.

◆ setProfile

void ApplicationManager::setProfile ( int app_id,
int profile )
slot

Sets the currently active profile for given application.

Parameters
app_idThe target application.
profileThe new profile.

◆ setTagsForMods

void ApplicationManager::setTagsForMods ( int app_id,
QStringList tag_names,
const std::vector< int > & mod_ids )
slot

Sets the tags for all given mods to the given tags for the given ModdedApplication.

Parameters
app_idTarget app.
tag_namesNames of the new tags.
mod_idsTarget mod ids.

◆ sortModsByConflicts

void ApplicationManager::sortModsByConflicts ( int app_id,
int deployer )
slot

Sorts the load order by grouping mods which contain conflicting files.

Parameters
app_idTarget app.
deployerTarget deployer.

◆ suppressUpdateNotification

void ApplicationManager::suppressUpdateNotification ( int app_id,
const std::vector< int > & mod_ids )
slot

Temporarily disables update notifications for the given mods.

Parameters
app_idTarget app.
mod_idsIds of the mods for which update notifications are to be disabled.

◆ unDeployMods

void ApplicationManager::unDeployMods ( int app_id)
slot

Undeploys mods using all Deployer objects of one application.

Parameters
app_idThe target application.

◆ unDeployModsFor

void ApplicationManager::unDeployModsFor ( int app_id,
std::vector< int > deployer_ids )
slot

Undeploys mods for given deployers and given application.

Parameters
app_idTarget application.
deployer_idsTarget deployers.

◆ uninstallGroupMembers

void ApplicationManager::uninstallGroupMembers ( int app_id,
const std::vector< int > & mod_ids )
slot

Uninstalls all mods which are inactive group members of any group which contains any of the given mods for the given ModdedApplication.

Parameters
app_idTarget app.
mod_idsIds of the mods for which to uninstall group members.

◆ uninstallMods

void ApplicationManager::uninstallMods ( int app_id,
std::vector< int > mod_ids,
std::string installer_type )
slot

Uninstalls the given mods for one application, this includes deleting all installed files.

Parameters
app_idThe target application.
mod_idsIds of the mods to be uninstalled.
installer_typeThe Installer type used. If an empty string is given, the Installer used during installation is used.

◆ updateAutoTags

void ApplicationManager::updateAutoTags ( int app_id,
std::vector< int > mod_ids )
slot

Reapplies all auto tags to the given mods for the given ModdedApplication.

Parameters
app_idTarget app.
mod_idsIds of the mods to which auto tags are to be reapplied.

◆ updateIgnoredFiles

void ApplicationManager::updateIgnoredFiles ( int app_id,
int deployer )
slot

Updates the file ignore list for ReverseDeployers.

Parameters
app_idTarget app.
deployerTarget deployer.

◆ updateModDeployers

void ApplicationManager::updateModDeployers ( int app_id,
std::vector< int > mod_ids,
std::vector< bool > deployers )
slot

Updates which deployer should manage given mods.

Parameters
app_idThe target application.
mod_idVector of mod ids to be added.
deployersBool for every deployer, indicating if the mods should be managed by that deployer.

◆ updateProgress

void ApplicationManager::updateProgress ( float progress)
signal

Informs about the progress in the current task.

Parameters
progressThe progress.

The documentation for this class was generated from the following files: