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

A QWidget that allows creating and editing tools. More...

#include <edittoolwidget.h>

Inheritance diagram for EditToolWidget:
Collaboration diagram for EditToolWidget:

Signals

void inputValidityChanged (bool is_valid)
 Signals the the validity of current input data has changed.
 

Public Member Functions

 EditToolWidget (QWidget *parent=nullptr)
 Initializes the UI.
 
Tool getTool ()
 Constructs a Tool from the input data.
 
bool hasValidInput () const
 Returns whether or not the current input is valid.
 
void init ()
 Initializes the widget with empty fields.
 
void init (const Tool &tool)
 Initializes the widget with data from given Tool.
 

Private Slots

void modeBoxIndexChanged (int index)
 Updates children visibility according to selected mode.
 
void runtimeBoxIndexChanged (int index)
 Updates children visibility according to selected runtime.
 
void executablePickerClicked ()
 Opens a file dialog to select an executable path.
 
void prefixPickerClicked ()
 Opens a file dialog to select a prefix path.
 
void workingDirPickerClicked ()
 Opens a file dialog to select a working directory.
 
void iconPickerClicked ()
 Opens a file dialog to select an icon path.
 
void environmentVariableRemoved (int row, int col)
 Removes the environment variable in the given row in the environment table from environment_variables.
 
void environmentVariableAdded ()
 Adds a new empty environment variable.
 
void environmentTableCellChanged (int row, int col)
 Updates the environment variable in the given row in the environment table in environment_variables.
 
void textFieldEdited (QString new_text)
 Updates input validity status.
 
void importButtonClicked ()
 Opens an ImportFromSteamDialog.
 
void steamAppImported (QString name, QString app_id, QString install_dir, QString prefix_path, QString icon_path)
 Updates the app id field and if runtime is steam also the icon path field with given data.
 

Private Member Functions

void updateChildrenVisibility ()
 Updates the visibility of child widgets according to the selected mode and runtime.
 
void runFileDialog (QLineEdit *target_field, const QString &title, bool directories_only)
 Shows a file dialog and writes the selected path to the given line edit.
 
void updateEnvironmentTable ()
 Updates the environment table with the data in environment_variables.
 

Private Attributes

QLabel * mode_label_
 Label used for the mode.
 
QComboBox * mode_box_
 Combo box used to select the mode.
 
QLabel * name_label_
 Label used for the name.
 
ValidatingLineEditname_field_
 Input field for the name.
 
QLabel * icon_label_
 Label used for the icon.
 
ValidatingLineEditicon_field_
 Input field for the icon path.
 
QPushButton * icon_picker_
 Push button to open a file dialog for selecting the icon path.
 
QLabel * executable_label_
 Label used for the executable path.
 
ValidatingLineEditexecutable_field_
 Input field for the executable path.
 
QPushButton * executable_picker_
 Push button to open a file dialog for selecting the executable path.
 
QLabel * runtime_label_
 Label used for the runtime.
 
QComboBox * runtime_box_
 Combo box used to select the runtime.
 
QLabel * runtime_version_label_
 Label used for the runtime version.
 
QComboBox * runtime_version_box_
 Combo box used to select the runtime version.
 
QLabel * prefix_label_
 Label used for the prefix path.
 
ValidatingLineEditprefix_field_
 Input field for the prefix path.
 
QPushButton * prefix_picker_
 Push button to open a file dialog for selecting the prefix path.
 
QLabel * app_id_label_
 Label used for the app id.
 
ValidatingLineEditapp_id_field_
 Input field for the app id.
 
QPushButton * app_id_import_button_
 Push button to open the ImportFromSteamDialog.
 
QLabel * working_directory_label_
 Label used for the working directory.
 
ValidatingLineEditworking_directory_field_
 Input field for the working directory.
 
QPushButton * working_directory_picker_
 Push button to open a file dialog for selecting the working directory.
 
QLabel * environment_label_
 Label used for the environment table.
 
QTableWidget * environment_table_
 Table used to display environment variables.
 
QLabel * arguments_label_
 Label used for the arguments.
 
QLineEdit * arguments_field_
 Input field for the arguments.
 
QLabel * protontricks_arguments_label_
 Label used for the protontricks arguments.
 
QLineEdit * protontricks_arguments_field_
 Input field for the protontricks arguments.
 
QLabel * command_label_
 Label used for the command.
 
ValidatingLineEditcommand_field_
 Input field for the command.
 
ImportFromSteamDialogimport_dialog_
 Dialog used to import app ids and icon paths from steam.
 
std::vector< std::pair< QString, QString > > environment_variables
 Contains pairs of environment variables and their assigned values.
 
bool has_valid_input_ = false
 If true: Current input is valid.
 

Static Private Attributes

static constexpr int MODE_GUIDED_INDEX = 0
 Index representing guided mode in the mode box.
 
static constexpr int MODE_MANUAL_INDEX = 1
 Index representing manual mode in the mode box.
 
static constexpr int RUNTIME_NATIVE_INDEX = 0
 Index representing native runtime in the runtime box.
 
static constexpr int RUNTIME_WINE_INDEX = 1
 Index representing wine runtime in the runtime box.
 
static constexpr int RUNTIME_PROTONTRICKS_INDEX = 2
 Index representing protontricks runtime in the runtime box.
 
static constexpr int RUNTIME_STEAM_INDEX = 3
 Index representing steam runtime in the runtime box.
 
static constexpr int ENVIRONMENT_ACTION_COL = 0
 Index representing the action column in the environment table.
 
static constexpr int ENVIRONMENT_VARIABLE_COL = 1
 Index representing the variable column in the environment table.
 
static constexpr int ENVIRONMENT_VALUE_COL = 2
 Index representing the value column in the environment table.
 
static constexpr int VERSION_NATIVE_INDEX = 0
 Index representing native version in the runtime version box.
 
static constexpr int VERSION_FLATPAK_INDEX = 1
 Index representing flatpak version in the runtime version box.
 

Detailed Description

A QWidget that allows creating and editing tools.

Constructor & Destructor Documentation

◆ EditToolWidget()

EditToolWidget::EditToolWidget ( QWidget * parent = nullptr)
explicit

Initializes the UI.

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

Member Function Documentation

◆ environmentTableCellChanged

void EditToolWidget::environmentTableCellChanged ( int row,
int col )
privateslot

Updates the environment variable in the given row in the environment table in environment_variables.

Parameters
rowEdited row.
colEdited column.

◆ environmentVariableRemoved

void EditToolWidget::environmentVariableRemoved ( int row,
int col )
privateslot

Removes the environment variable in the given row in the environment table from environment_variables.

Parameters
rowRow to remove.
colIgnored.

◆ getTool()

Tool EditToolWidget::getTool ( )

Constructs a Tool from the input data.

Returns
The constructed Tool.

◆ hasValidInput()

bool EditToolWidget::hasValidInput ( ) const

Returns whether or not the current input is valid.

Returns
True if valid.

◆ init()

void EditToolWidget::init ( const Tool & tool)

Initializes the widget with data from given Tool.

Parameters
toolSource Tool.

◆ inputValidityChanged

void EditToolWidget::inputValidityChanged ( bool is_valid)
signal

Signals the the validity of current input data has changed.

Parameters
is_validThe validity status.

◆ modeBoxIndexChanged

void EditToolWidget::modeBoxIndexChanged ( int index)
privateslot

Updates children visibility according to selected mode.

Parameters
indexThe new mode.

◆ runFileDialog()

void EditToolWidget::runFileDialog ( QLineEdit * target_field,
const QString & title,
bool directories_only )
private

Shows a file dialog and writes the selected path to the given line edit.

Parameters
target_fieldLine edit to which to write the path.
titleTitle of the file dialog.
directories_onlyIf true: File dialog will only show directories.

◆ runtimeBoxIndexChanged

void EditToolWidget::runtimeBoxIndexChanged ( int index)
privateslot

Updates children visibility according to selected runtime.

Parameters
indexThe new runtime.

◆ steamAppImported

void EditToolWidget::steamAppImported ( QString name,
QString app_id,
QString install_dir,
QString prefix_path,
QString icon_path )
privateslot

Updates the app id field and if runtime is steam also the icon path field with given data.

Parameters
nameIgnored.
app_idImported app id.
install_dirIgnored.
prefix_pathIgnored.
icon_pathImported icon path.

◆ textFieldEdited

void EditToolWidget::textFieldEdited ( QString new_text)
privateslot

Updates input validity status.

Parameters
new_textIgnored.

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