Limo
A simple mod manager
Loading...
Searching...
No Matches
editmanualtagsdialog.h
Go to the documentation of this file.
1
5
6#pragma once
7
9#include <QDialog>
10#include <vector>
11
12
13namespace Ui
14{
15class EditManualTagsDialog;
16}
17
21class EditManualTagsDialog : public QDialog
22{
23 Q_OBJECT
24
25public:
30 explicit EditManualTagsDialog(QWidget* parent = nullptr);
33
40 void setupDialog(int app_id,
41 const QStringList& tag_names,
42 const std::vector<int> num_mods_per_tag);
47 void closeEvent(QCloseEvent* event) override;
49 void reject() override;
50
51private:
53 static constexpr int ACTION_COL = 0;
55 static constexpr int NAME_COL = 1;
57 static constexpr int NUM_MODS_COL = 2;
58
60 Ui::EditManualTagsDialog* ui;
64 QStringList tag_names_;
66 std::vector<int> num_mods_per_tag_;
68 std::vector<EditManualTagAction> actions_;
70 bool dialog_completed_ = false;
71
73 void updateTable();
74
75private slots:
81 void onTagRemoved(int row, int col);
83 void onTagAdded();
89 void onTableCellEdited(int row, int col);
94
95signals:
102 void manualTagsEdited(int app_id, std::vector<EditManualTagAction> actions);
105};
std::vector< EditManualTagAction > actions_
Contains all actions performed in this dialog. Emitted after dialog completes.
Definition editmanualtagsdialog.h:68
void closeEvent(QCloseEvent *event) override
Emits dialogClosed.
Definition editmanualtagsdialog.cpp:51
Ui::EditManualTagsDialog * ui
Contains auto-generated UI elements.
Definition editmanualtagsdialog.h:60
static constexpr int NUM_MODS_COL
Number of mods column in the tag table.
Definition editmanualtagsdialog.h:57
void manualTagsEdited(int app_id, std::vector< EditManualTagAction > actions)
Signals dialog completion.
~EditManualTagsDialog()
Deletes the UI.
Definition editmanualtagsdialog.cpp:32
static constexpr int ACTION_COL
Action column in the tag table.
Definition editmanualtagsdialog.h:53
QStringList tag_names_
Contains names of all tags. Names are unique.
Definition editmanualtagsdialog.h:64
std::vector< int > num_mods_per_tag_
For every tag: The number of mods to which the tag has been added.
Definition editmanualtagsdialog.h:66
void onTagRemoved(int row, int col)
Removed the tag in the given row of the tag table.
Definition editmanualtagsdialog.cpp:112
void updateTable()
Updates the tag table with data stored in tag_names_ and num_mods_per_tag_.
Definition editmanualtagsdialog.cpp:69
void on_buttonBox_rejected()
Emits a signal that this dialog has been closed without changes.
Definition editmanualtagsdialog.cpp:179
static constexpr int NAME_COL
Tag name column in the tag table.
Definition editmanualtagsdialog.h:55
EditManualTagsDialog(QWidget *parent=nullptr)
Initializes the UI.
Definition editmanualtagsdialog.cpp:11
void reject() override
Closes the dialog and emits a signal indicating the dialog has been closed.
Definition editmanualtagsdialog.cpp:60
void onTableCellEdited(int row, int col)
Renames the tag in the given row.
Definition editmanualtagsdialog.cpp:138
void onTagAdded()
Adds a new tag.
Definition editmanualtagsdialog.cpp:121
void dialogClosed()
Signals tag editing has been cancled without action.
void setupDialog(int app_id, const QStringList &tag_names, const std::vector< int > num_mods_per_tag)
Initializes this dialog with the given data.
Definition editmanualtagsdialog.cpp:37
int app_id_
App for which the tags are to be edited.
Definition editmanualtagsdialog.h:62
bool dialog_completed_
Indicates whether the dialog has been completed.
Definition editmanualtagsdialog.h:70
void on_buttonBox_accepted()
Emits manualTagsEdited with all actions performed in this dialog.
Definition editmanualtagsdialog.cpp:157
Header for the EditManualTagAction class.