Dialog for installing new mods.
More...
#include <addmoddialog.h>
|
| AddModDialog (QWidget *parent=nullptr) |
| Initializes the UI.
|
|
| ~AddModDialog () |
| Deletes the UI.
|
|
bool | setupDialog (const QString &name, const QStringList &deployers, int cur_deployer, const QStringList &groups, const std::vector< int > &mod_ids, const QString &path, const QStringList &deployer_paths, int app_id, const std::vector< bool > &autonomous_deployers, const QString &app_version, const QString &local_source, const QString &remote_source, int mod_id, const QStringList &mod_names, const QStringList &mod_versions, const QString &version_overwrite, const QString &name_overwrite) |
| Initializes this dialog with data needed for mod installation.
|
|
void | closeEvent (QCloseEvent *event) override |
| Closes the dialog and emits a signal indicating installation has been canceled.
|
|
void | reject () override |
| Closes the dialog and emits a signal indicating installation has been canceled.
|
|
|
void | on_buttonBox_accepted () |
| Closes the dialog and emits a signal for completion.
|
|
void | on_group_check_stateChanged (int state) |
| Enables or disables the group combo box depending on the check box state.
|
|
void | on_buttonBox_rejected () |
| Closes the dialog and emits a signal indicating installation has been canceled.
|
|
void | on_name_text_textChanged (const QString &text) |
| Only enable the OK button if a name has been entered.
|
|
void | on_version_text_textChanged (const QString &text) |
| Only enable the OK button if a version has been entered.
|
|
void | on_root_level_box_valueChanged (int value) |
| Called when the value of the root level box has been changed by a user.
|
|
void | on_installer_box_currentIndexChanged (int index) |
| Enables/ disables ui elements based on chosen installer.
|
|
void | on_group_field_textChanged (const QString &arg1) |
| Updates the Ok buttons enabled state.
|
|
void | on_group_combo_box_currentIndexChanged (int index) |
| Disables the deployer list if the new mod is to replace an existing mod.
|
|
void | onFomodDialogComplete (int app_id, AddModInfo info) |
| Called when the fomod dialog has been completed. Emits addModAccepted.
|
|
void | onFomodDialogAborted () |
| Called when fomod dialog has been canceled. Emits addModAborted.
|
|
|
void | updateOkButton () |
| Updates the enabled state of this dialog's OK button to only be enabled when both a name and a version has been entered and an existing group or no group has been selected.
|
|
int | addTreeNode (QTreeWidget *tree, const std::filesystem::path &cur_path) |
| Adds the root path element of given path as a root node to the given tree. Then adds all subsequent path components as children to the new node.
|
|
int | addTreeNode (QTreeWidgetItem *parent, const std::filesystem::path &cur_path) |
| Adds the root path element of given path as a root node to the given parent node. Then adds all subsequent path components as children to the new node.
|
|
std::filesystem::path | removeRoot (const std::filesystem::path &source) |
| Removes the root path component from the given path.
|
|
void | colorTreeNodes (QTreeWidgetItem *node, int cur_depth, int root_level) |
| Changes the color of the given node and its children, depending on whether or not the nodes depth is less than the given root level.
|
|
void | showError (const std::runtime_error &error) |
| Shows a message box with a message constructed from given exception.
|
|
|
Ui::AddModDialog * | ui |
| Contains auto-generated UI elements.
|
|
std::vector< int > | mod_ids_ |
| Contains mod ids corresponding to entries in the field.
|
|
QString | mod_path_ |
| Source path for the new mod data.
|
|
int | app_id_ |
| Stores the id of the currently active application.
|
|
QList< QButtonGroup * > | option_groups_ |
| Holds radio button groups used to select installation options.
|
|
const QColor | COLOR_KEEP_ { 0x2ca02c } |
| Used to color tree nodes which will not be removed.
|
|
const QColor | COLOR_REMOVE_ { 0xd62728 } |
| Used to color tree nodes which will be removed.
|
|
QStringList | deployer_paths_ |
| Contains target paths for all deployers.
|
|
QString | path_prefix_ |
| Prefix for fomod installer source path.
|
|
QStringList | groups_ |
| Contains names of all available groups.
|
|
std::unique_ptr< QCompleter > | completer_ |
| Completer used for group names.
|
|
std::unique_ptr< FomodDialog > | fomod_dialog_ |
| Dialog for fomod installation.
|
|
QString | app_version_ |
| App version used for fomod conditions.
|
|
QString | local_source_ |
| Path to the source archive for the mod.
|
|
QString | remote_source_ |
| URL from where the mod was downloaded.
|
|
bool | dialog_completed_ = false |
| Indicates whether the dialog has been completed.
|
|
|
static constexpr int | ADD_TO_GROUP_INDEX = 0 |
| Index in ui->group_combo_box representing the option of adding a mod to a group.
|
|
static constexpr int | REPLACE_MOD_INDEX = 1 |
| Index in ui->group_combo_box representing the option of replacing an existing mod.
|
|
Dialog for installing new mods.
◆ AddModDialog()
AddModDialog::AddModDialog |
( |
QWidget * | parent = nullptr | ) |
|
|
explicit |
Initializes the UI.
- Parameters
-
parent | Parent for this widget, this is passed to the constructor of QDialog. |
◆ addModAborted
void AddModDialog::addModAborted |
( |
QString | temp_dir | ) |
|
|
signal |
Signals mod installation has been aborted.
- Parameters
-
temp_dir | Directory used for mod extraction. |
◆ addModAccepted
void AddModDialog::addModAccepted |
( |
int | app_id, |
|
|
AddModInfo | info ) |
|
signal |
Signals dialog completion.
- Parameters
-
app_id | Application for which the new mod is to be installed. |
info | Contains all data needed to install the mod. |
◆ addTreeNode() [1/2]
int AddModDialog::addTreeNode |
( |
QTreeWidget * | tree, |
|
|
const std::filesystem::path & | cur_path ) |
|
private |
Adds the root path element of given path as a root node to the given tree. Then adds all subsequent path components as children to the new node.
- Parameters
-
tree | Target QTreeWidget. |
cur_path | Source path. |
◆ addTreeNode() [2/2]
int AddModDialog::addTreeNode |
( |
QTreeWidgetItem * | parent, |
|
|
const std::filesystem::path & | cur_path ) |
|
private |
Adds the root path element of given path as a root node to the given parent node. Then adds all subsequent path components as children to the new node.
- Parameters
-
tree | Target QTreeWidget. |
cur_path | Source path. |
- Returns
- The depth of the given path.
◆ closeEvent()
void AddModDialog::closeEvent |
( |
QCloseEvent * | event | ) |
|
|
override |
Closes the dialog and emits a signal indicating installation has been canceled.
- Parameters
-
event | The close even sent upon closing the dialog. |
◆ colorTreeNodes()
void AddModDialog::colorTreeNodes |
( |
QTreeWidgetItem * | node, |
|
|
int | cur_depth, |
|
|
int | root_level ) |
|
private |
Changes the color of the given node and its children, depending on whether or not the nodes depth is less than the given root level.
- Parameters
-
node | Node to be colored. |
cur_depth | Depth of current node. |
root_level | Target depth. |
◆ on_group_combo_box_currentIndexChanged
void AddModDialog::on_group_combo_box_currentIndexChanged |
( |
int | index | ) |
|
|
privateslot |
Disables the deployer list if the new mod is to replace an existing mod.
- Parameters
-
◆ on_group_field_textChanged
void AddModDialog::on_group_field_textChanged |
( |
const QString & | arg1 | ) |
|
|
privateslot |
Updates the Ok buttons enabled state.
- Parameters
-
◆ on_installer_box_currentIndexChanged
void AddModDialog::on_installer_box_currentIndexChanged |
( |
int | index | ) |
|
|
privateslot |
Enables/ disables ui elements based on chosen installer.
- Parameters
-
◆ on_root_level_box_valueChanged
void AddModDialog::on_root_level_box_valueChanged |
( |
int | value | ) |
|
|
privateslot |
Called when the value of the root level box has been changed by a user.
- Parameters
-
◆ onFomodDialogComplete
void AddModDialog::onFomodDialogComplete |
( |
int | app_id, |
|
|
AddModInfo | info ) |
|
privateslot |
Called when the fomod dialog has been completed. Emits addModAccepted.
- Parameters
-
app_id | Application for which the new mod is to be installed. |
info | Contains all data needed to install the mod. |
◆ removeRoot()
sfs::path AddModDialog::removeRoot |
( |
const std::filesystem::path & | source | ) |
|
|
private |
Removes the root path component from the given path.
- Parameters
-
- Returns
- source without its root component.
-
The depth of the given path.
◆ setupDialog()
bool AddModDialog::setupDialog |
( |
const QString & | name, |
|
|
const QStringList & | deployers, |
|
|
int | cur_deployer, |
|
|
const QStringList & | groups, |
|
|
const std::vector< int > & | mod_ids, |
|
|
const QString & | path, |
|
|
const QStringList & | deployer_paths, |
|
|
int | app_id, |
|
|
const std::vector< bool > & | autonomous_deployers, |
|
|
const QString & | app_version, |
|
|
const QString & | local_source, |
|
|
const QString & | remote_source, |
|
|
int | mod_id, |
|
|
const QStringList & | mod_names, |
|
|
const QStringList & | mod_versions, |
|
|
const QString & | version_overwrite, |
|
|
const QString & | name_overwrite ) |
Initializes this dialog with data needed for mod installation.
- Parameters
-
name | Default mod name. |
deployers | Contains all available deployers. |
cur_deployer | The currently active Deployer. |
groups | Contains all mod names which act as targets for groups. |
mod_ids | Ids of all currently installed mods. |
path | Source path for the new mod. |
deployer_paths | Contains target paths for all non autonomous deployers. |
app_id | Id of currently active application. |
autonomous_deployers | Vector of bools indicating for each deployer if that deployer is autonomous. |
local_source | Source archive for the mod. |
remote_source | URL from where the mod was downloaded. |
mod_id | If =! -1: Id of the mod to the group of which the new mod should be added by default. |
mod_names | Contains the name of all currently installed mods. |
mod_versions | Contains the versions of all currently installed mods. |
version_overwrite | If not empty: Use this to overwrite the default version. |
name_overwrite | If not empty: Use this to overwrite the default name. |
- Returns
- True if dialog creation was successful.
◆ showError()
void AddModDialog::showError |
( |
const std::runtime_error & | error | ) |
|
|
private |
Shows a message box with a message constructed from given exception.
- Parameters
-
The documentation for this class was generated from the following files: