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

Dialog used to add, remove and edit auto tags. More...

#include <editautotagsdialog.h>

Inheritance diagram for EditAutoTagsDialog:
Collaboration diagram for EditAutoTagsDialog:

Signals

void tagsEdited (int app_id, std::vector< EditAutoTagAction > actions)
 Signals dialog completion.
 
void dialogClosed ()
 Signales dialog has been closed without performing any actions.
 

Public Member Functions

 EditAutoTagsDialog (QWidget *parent=nullptr)
 Initializes the ui and generates actions and combo box entries.
 
 ~EditAutoTagsDialog ()
 Deletes the ui.
 
void setupDialog (int app_id, const std::map< std::string, std::pair< std::string, std::vector< TagCondition > > > &auto_tags)
 Initializes the dialog with the given tags.
 
void closeEvent (QCloseEvent *event) override
 Emits dialogClosed.
 
void reject () override
 Closes the dialog and emits a signal indicating the dialog has been closed.
 

Private Slots

void updateConditionTable ()
 Updates the currently displayed expression and conditions to match the selected tag.
 
void onConditionRemoved (int row, int col)
 Called when a remove button inside the condition table has been pressed. Removes the respective condition.
 
void onConditionAdded ()
 Adds a new condition to the condition table.
 
void onConditionEdited ()
 Updates the conditions for the current tag in the auto_tags_ map according to the settings in the condition table.
 
void on_connection_cb_currentIndexChanged (int index)
 Updates the help label and hides/ shows the expression line edit if needed.
 
void onTagRemoved ()
 Removes the currently active tag.
 
void on_tag_cb_currentIndexChanged (int index)
 Updates the ui to show data for the new tag.
 
void onTagAdded ()
 Shows a dialog for adding a new tag. Creates the new tag if the dialog was accepted.
 
void onTagRenamed ()
 Show a dialog for renaming a tag. Renames the tag if the dialog was accepted.
 
void on_expression_line_edit_textEdited (const QString &expression)
 Checks if the given expression is valid and disables/ enables the Ok button.
 
void on_buttonBox_accepted ()
 Constructs all missing editing actions and emits tagsEdited.
 
void on_buttonBox_rejected ()
 Emits dialogClosed.
 

Private Member Functions

void enableInteraction (bool enable)
 Enables/ disables interactive elements in the ui.
 
bool eventFilter (QObject *object, QEvent *event) override
 Catches mouse wheel events if the target is a combo box.
 
QString createExpression (QString op, int length)
 Creates a boolean expression where variables are every integer in [0, length) and every operator is os.
 
void updateExpressionBox ()
 Updates the expresssion line edit and combo box for the currently selected tag.
 
void updateOkButton ()
 Enables/ disables the Ok button, depending on the current ui state.
 

Private Attributes

Ui::EditAutoTagsDialog * ui
 Contains auto generated ui elements.
 
std::map< std::string, std::pair< std::string, std::vector< TagCondition > > > auto_tags_
 Maps tags to a pair of expression and conditions.
 
std::set< std::string > tags_with_updated_conditions_
 Contains all tags for which the conditions have been modified.
 
std::unique_ptr< QAction > add_tag_action_
 Action for adding a new tag.
 
std::unique_ptr< QAction > remove_tag_action_
 Action for removing a tag.
 
std::unique_ptr< QAction > rename_tag_action_
 Action for renaming a tag.
 
std::map< QString, int > connection_index_map_
 Maps tags to their selected connection type.
 
bool ignore_index_changes_ = false
 If true: Connection box index changes will not count as condition updates.
 
std::vector< EditAutoTagActionedit_actions_
 Contains all editing actions performed in this dialog.
 
int app_id_
 Target ModdedApplication.
 
bool dialog_completed_ = false
 Indicates whether the dialog has been completed.
 

Static Private Attributes

static constexpr int connection_cb_any_index = 0
 Any index for the connection type check box.
 
static constexpr int connection_cb_all_index = 1
 All index for the connection type check box.
 
static constexpr int connection_cb_advanced_index = 2
 Advanced index for the connection type check box.
 
static constexpr int action_col = 0
 Action column in the condition table.
 
static constexpr int id_col = 1
 Id column in the condition table.
 
static constexpr int target_col = 2
 Target column in the condition table.
 
static constexpr int invert_col = 3
 Invert column in the condition table.
 
static constexpr int matcher_col = 4
 Matcher column in the condition table.
 
static constexpr int string_col = 5
 String column in the condition table.
 
static constexpr int target_file_index = 0
 File name index of the checkbox for target selection.
 
static constexpr int target_path_index = 1
 Full path index of the checkbox for target selection.
 
static constexpr int invert_false_index = 0
 False index of the checkbox for inverting a condition.
 
static constexpr int invert_true_index = 1
 True index of the checkbox for inverting a condition.
 
static constexpr int matcher_string_index = 0
 String index of the checkbox for matcher selection.
 
static constexpr int matcher_regex_index = 1
 Regex index of the checkbox for matcher selection.
 

Detailed Description

Dialog used to add, remove and edit auto tags.

Constructor & Destructor Documentation

◆ EditAutoTagsDialog()

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

Initializes the ui and generates actions and combo box entries.

Parameters
parentParent of this widget. Passed to the constructor of QDialog.

Member Function Documentation

◆ closeEvent()

void EditAutoTagsDialog::closeEvent ( QCloseEvent * event)
override

Emits dialogClosed.

Parameters
eventThe close event sent upon closing the dialog.

◆ createExpression()

QString EditAutoTagsDialog::createExpression ( QString op,
int length )
private

Creates a boolean expression where variables are every integer in [0, length) and every operator is os.

Parameters
opOperator to use.
lengthNumber of variables.
Returns
The expression.

◆ enableInteraction()

void EditAutoTagsDialog::enableInteraction ( bool enable)
private

Enables/ disables interactive elements in the ui.

Parameters
enableThe new enabled status.

◆ eventFilter()

bool EditAutoTagsDialog::eventFilter ( QObject * object,
QEvent * event )
overrideprivate

Catches mouse wheel events if the target is a combo box.

Parameters
objectEvent object.
eventThe source event.
Returns
True if event was handled, else false.

◆ on_connection_cb_currentIndexChanged

void EditAutoTagsDialog::on_connection_cb_currentIndexChanged ( int index)
privateslot

Updates the help label and hides/ shows the expression line edit if needed.

Parameters
indexThe new index.

◆ on_expression_line_edit_textEdited

void EditAutoTagsDialog::on_expression_line_edit_textEdited ( const QString & expression)
privateslot

Checks if the given expression is valid and disables/ enables the Ok button.

Parameters
expressionNew expression.

◆ onConditionRemoved

void EditAutoTagsDialog::onConditionRemoved ( int row,
int col )
privateslot

Called when a remove button inside the condition table has been pressed. Removes the respective condition.

Parameters
rowCondition index.
colNot used.

◆ setupDialog()

void EditAutoTagsDialog::setupDialog ( int app_id,
const std::map< std::string, std::pair< std::string, std::vector< TagCondition > > > & auto_tags )

Initializes the dialog with the given tags.

Parameters
auto_tagsMaps tags to a pair of expression and conditions.

◆ tagsEdited

void EditAutoTagsDialog::tagsEdited ( int app_id,
std::vector< EditAutoTagAction > actions )
signal

Signals dialog completion.

Parameters
actionsEditing actions performed.

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