10#include <QButtonGroup>
47 void setupDialog(
const std::filesystem::path& config_file,
48 const std::filesystem::path& target_path,
49 const QString& app_version,
57 std::vector<std::pair<std::filesystem::path, std::filesystem::path>>
getResult()
const;
83 std::vector<std::pair<std::filesystem::path, std::filesystem::path>>
result_;
103 const QString& description,
104 const QString& image_path)
const;
111 std::optional<std::pair<std::vector<std::vector<bool>>,
fomod::InstallStep>> prev_step = {});
Contains the AddModInfo struct.
void closeEvent(QCloseEvent *event) override
Closes the dialog and emits a signal indicating installation has been canceled.
Definition fomoddialog.cpp:243
bool has_no_steps_
If true: This dialog is non interactive.
Definition fomoddialog.h:85
int app_id_
Application for which the new mod is to be installed.
Definition fomoddialog.h:89
void reject() override
Closes the dialog and emits a signal indicating the dialog has been closed.
Definition fomoddialog.cpp:252
QList< QButtonGroup * > button_groups_
Buttons used to represent plugin options.
Definition fomoddialog.h:72
bool dialog_completed_
Indicates whether the dialog has been completed.
Definition fomoddialog.h:91
QPushButton * next_button_
Button used to advance the dialog.
Definition fomoddialog.h:76
QAbstractButton * makeButton(fomod::PluginGroup::Type type, const QString &text, const QString &description, const QString &image_path) const
Creates a new FomodCheckBox or FomodRatioButton for selection of a plugin.
Definition fomoddialog.cpp:60
std::unique_ptr< fomod::FomodInstaller > installer_
Used to parse the fomod file.
Definition fomoddialog.h:68
std::vector< std::pair< std::filesystem::path, std::filesystem::path > > getResult() const
Returns pairs of source and destinations for every selected file during the installation process.
Definition fomoddialog.cpp:50
void onPluginSelected(bool checked)
Called when a button has been pressed, updates the next button.
Definition fomoddialog.cpp:294
void onBackButtonPressed()
Takes a step back.
Definition fomoddialog.cpp:299
FomodDialog(QWidget *parent=nullptr)
Initializes the UI.
Definition fomoddialog.cpp:16
void addModAccepted(int app_id, AddModInfo info)
Signals dialog completion.
fomod::InstallStep cur_step_
Contains the current step in the installation process.
Definition fomoddialog.h:70
Ui::FomodDialog * ui
Contains auto-generated UI elements.
Definition fomoddialog.h:66
~FomodDialog()
Deletes the UI.
Definition fomoddialog.cpp:29
bool hasSteps() const
Checks if the dialog has any steps.
Definition fomoddialog.cpp:55
void setupDialog(const std::filesystem::path &config_file, const std::filesystem::path &target_path, const QString &app_version, const AddModInfo &info, int app_id)
Initializes the dialog.
Definition fomoddialog.cpp:34
std::vector< std::vector< bool > > getSelection()
For every group, for every plugin: True if plugin is currently selected.
Definition fomoddialog.cpp:214
bool selectionIsValid()
Verifies if the current selection satisfies the requirements to advance to the next step.
Definition fomoddialog.cpp:192
std::vector< std::pair< std::filesystem::path, std::filesystem::path > > result_
Once the installation has been completed, this contains source and destination paths for every file s...
Definition fomoddialog.h:83
void updateInstallStep(std::optional< std::pair< std::vector< std::vector< bool > >, fomod::InstallStep > > prev_step={})
Takes one step forwards or backwards in the installation and updates the UI.
Definition fomoddialog.cpp:71
QList< fomod::PluginGroup::Type > group_types_
Determines selection restrictions for button groups.
Definition fomoddialog.h:74
void updateNextButton()
Updates text and enabled status of next_button_, depending on the step.
Definition fomoddialog.cpp:233
std::set< int > none_groups_
Some button groups require a dummy button. This holds the ids of those groups.
Definition fomoddialog.h:80
QPushButton * back_button_
Button used to step back in the dialog.
Definition fomoddialog.h:78
AddModInfo add_mod_info_
Contains necessary data to install the mod upon dialog completion.
Definition fomoddialog.h:87
void onNextButtonPressed()
Advances the dialog by one step.
Definition fomoddialog.cpp:261
void addModAborted()
Signals mod installation has been aborted.
void on_buttonBox_rejected()
Emits addModAborted.
Definition fomoddialog.cpp:306
Header for the FomodInstaller class.
Stores data needed to install a new mod.
Definition addmodinfo.h:17
A step during installation.
Definition installstep.h:21
Type
Describes restriction on how plugins in a group can be selected.
Definition plugingroup.h:24