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

Dialog for creating and editing applications. More...

#include <addappdialog.h>

Inheritance diagram for AddAppDialog:
Collaboration diagram for AddAppDialog:

Signals

void applicationAdded (EditApplicationInfo edit_app_info)
 Signals completion of the dialog in add mode.
 
void applicationEdited (EditApplicationInfo edit_app_info, int app_id)
 Signals completion of the dialog in edit mode.
 

Public Member Functions

 AddAppDialog (bool is_flatpak, QWidget *parent=nullptr)
 Initializes the UI.
 
 ~AddAppDialog ()
 Deletes the UI.
 
void setEditMode (const QString &name, const QString &app_version, const QString &path, const QString &command, const QString &icon_path, int app_id)
 Initializes this dialog to allow editing of an existing application.
 
void setAddMode ()
 Initializes this dialog to allow creating a new application.
 

Private Slots

void on_file_picker_button_clicked ()
 Shows a file dialog for the staging directory path.
 
void on_name_field_textChanged (const QString &text)
 Only enable the OK button if a name has been entered.
 
void on_path_field_textChanged (const QString &text)
 Only enable the OK button if a valid staging directory path has been entered.
 
void on_buttonBox_accepted ()
 Closes the dialog and emits a signal for completion.
 
void on_import_button_clicked ()
 Opens a dialog to import currently installed steam app.
 
void onApplicationImported (QString name, QString app_id, QString install_dir, QString prefix_path, QString icon_path)
 Called when the import steam application dialog has been completed.
 
void onFileDialogAccepted (const QString &path)
 Updates the staging directory path to given path.
 
void on_icon_picker_button_clicked ()
 Called when icon path picker button is clicked.
 
void onIconPathDialogComplete (const QString &path)
 Updates the icon path to the given path if the given path refers to a valid icon.
 

Private Member Functions

void enableOkButton (bool state)
 Set the enabled state of this dialogs OK button.
 
bool pathIsValid ()
 Checks whether the currently entered path exists.
 
bool iconIsValid (const QString &path="")
 Checks whether the currently entered icon path refers to a valid icon file.
 
void initConfigForApp ()
 Initializes default settings for deployers and auto tags from a file named "app_id_.json". If no such file exists, creates generic deployers targeting installation directory and prefix.
 
void initDefaultAppConfig ()
 Initializes deployers targeting the currently selected steam app's installation and, if present, it's prefix directory.
 

Private Attributes

Ui::AddAppDialog * ui
 Contains auto-generated UI elements.
 
bool edit_mode_ = false
 If true: Dialog is used to edit, else: Dialog is used to create.
 
QString name_
 Current name of the edited application.
 
QString path_
 Current staging directory path of the edited application.
 
QString command_
 Current command to run the edited application.
 
int app_id_
 Id of the edited application.
 
QString steam_install_path_ = ""
 Path to imported steam applications installation directory.
 
QString steam_prefix_path_ = ""
 Path to imported steam applications prefix directory.
 
bool dialog_completed_ = false
 Indicates whether the dialog has been completed.
 
std::vector< EditDeployerInfodeployers_
 Contains deployers which will be created upon adding a new application.
 
std::vector< Json::Value > auto_tags_
 Contains Json objects representing imported auto tags.
 
bool is_flatpak_
 Whether or not this application is running as a flatpak.
 
std::unique_ptr< ImportFromSteamDialogimport_from_steam_dialog_
 Reusable dialog for importing data from installed Steam apps.
 

Static Private Attributes

static constexpr std::string JSON_DEPLOYERS_GROUP = "deployers"
 Name of the key used to identify deployers in the apps config file.
 
static constexpr std::string JSON_DEPLOYERS_TYPE = "type"
 Name of the key used to identify deployer type in the apps config file.
 
static constexpr std::string JSON_DEPLOYERS_NAME = "name"
 Name of the key used to identify deployer name in the apps config file.
 
static constexpr std::string JSON_DEPLOYERS_TARGET = "target_dir"
 Name of the key used to identify deployer target dir in the apps config file.
 
static constexpr std::string JSON_DEPLOYERS_MODE = "deploy_mode"
 Name of the key used to identify deployer mode in the apps config file.
 
static constexpr std::string JSON_DEPLOYERS_SOURCE = "source_dir"
 Name of the key used to identify deployer source dir in the apps config file.
 
static constexpr char JSON_DEPLOYERS_SEPARATE_DIRS [] = "uses_separate_dirs"
 Name of the key used to determine whether a reverse deployer uses separate dirctories for profiles.
 
static constexpr char JSON_DEPLOYERS_UPDATE_IGNORE_LIST [] = "update_ignore_list"
 Name of the key used to determine whether a reverse deployer should update the ignore list upon creation.
 
static constexpr std::array< std::string, 4 > JSON_DEPLOYER_MANDATORY_KEYS
 Contains all mandatory valid keys used in a deployer group in the apps config file.
 
static constexpr std::string JSON_AUTO_TAGS_GROUP = "auto_tags"
 Name of the key used to identify auto tags in the apps config file.
 
static constexpr std::string JSON_NAME = "name"
 Name of the key used to identify the apps name in the apps config file.
 

Detailed Description

Dialog for creating and editing applications.

Constructor & Destructor Documentation

◆ AddAppDialog()

AddAppDialog::AddAppDialog ( bool is_flatpak,
QWidget * parent = nullptr )
explicit

Initializes the UI.

Parameters
parentParent for this widget, this is passed to the constructor of QDialog.

Member Function Documentation

◆ applicationAdded

void AddAppDialog::applicationAdded ( EditApplicationInfo edit_app_info)
signal

Signals completion of the dialog in add mode.

Parameters
infoContains all data entered in the dialog.

◆ applicationEdited

void AddAppDialog::applicationEdited ( EditApplicationInfo edit_app_info,
int app_id )
signal

Signals completion of the dialog in edit mode.

Parameters
infoContains all data entered in the dialog.
app_idId of the edited application.

◆ enableOkButton()

void AddAppDialog::enableOkButton ( bool state)
private

Set the enabled state of this dialogs OK button.

Parameters
state

◆ iconIsValid()

bool AddAppDialog::iconIsValid ( const QString & path = "")
private

Checks whether the currently entered icon path refers to a valid icon file.

Parameters
Pathto an icon. If this checked instead of ui->icon_field if this is not empty.

◆ onApplicationImported

void AddAppDialog::onApplicationImported ( QString name,
QString app_id,
QString install_dir,
QString prefix_path,
QString icon_path )
privateslot

Called when the import steam application dialog has been completed.

Parameters
nameName of the imported application.
app_idSteam app_id of the imported application.
install_dirName of the directory under steamapps which contains the new applications files.
prefix_pathPath to the applications Proton prefix, or empty if none exists.
icon_pathPath to the applications icon.

◆ onFileDialogAccepted

void AddAppDialog::onFileDialogAccepted ( const QString & path)
privateslot

Updates the staging directory path to given path.

Parameters
pathThe new path.

◆ onIconPathDialogComplete

void AddAppDialog::onIconPathDialogComplete ( const QString & path)
privateslot

Updates the icon path to the given path if the given path refers to a valid icon.

Parameters
pathThe new path.

◆ setEditMode()

void AddAppDialog::setEditMode ( const QString & name,
const QString & app_version,
const QString & path,
const QString & command,
const QString & icon_path,
int app_id )

Initializes this dialog to allow editing of an existing application.

Parameters
nameCurrent name of the edited application.
app_versionCurrent app app_version.
pathCurrent staging directory path of the edited application.
commandCurrent command to run the edited application.
app_idId of the edited application.

Member Data Documentation

◆ JSON_DEPLOYER_MANDATORY_KEYS

std::array<std::string, 4> AddAppDialog::JSON_DEPLOYER_MANDATORY_KEYS
staticconstexprprivate
Initial value:
static constexpr std::string JSON_DEPLOYERS_TYPE
Name of the key used to identify deployer type in the apps config file.
Definition addappdialog.h:43
static constexpr std::string JSON_DEPLOYERS_NAME
Name of the key used to identify deployer name in the apps config file.
Definition addappdialog.h:45
static constexpr std::string JSON_DEPLOYERS_TARGET
Name of the key used to identify deployer target dir in the apps config file.
Definition addappdialog.h:47
static constexpr std::string JSON_DEPLOYERS_MODE
Name of the key used to identify deployer mode in the apps config file.
Definition addappdialog.h:49

Contains all mandatory valid keys used in a deployer group in the apps config file.


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