refactor: Refactors AgentRoleDialog's modes handling (#325)

* fix: Fixes `undefined-bool-conversion` compilation warning.

* refactor: Replaces `AgentRoleDialog::m_editMode` with `AgentRoleDialog::m_action`

---------

Co-authored-by: Ivan Lebedev <ilebedev@flightpath3d.com>
This commit is contained in:
lebedeviv1988
2026-03-05 09:48:01 +00:00
committed by GitHub
parent e2e13f0f38
commit b7a9787cc3
3 changed files with 32 additions and 19 deletions

View File

@ -34,8 +34,18 @@ class AgentRoleDialog : public QDialog
Q_OBJECT
public:
explicit AgentRoleDialog(QWidget *parent = nullptr);
explicit AgentRoleDialog(const AgentRole &role, bool editMode = true, QWidget *parent = nullptr);
enum class Action {
Add,
Duplicate,
Edit,
};
explicit AgentRoleDialog(Action action, QWidget *parent = nullptr);
explicit AgentRoleDialog(const AgentRole &role, Action action, QWidget *parent = nullptr)
: AgentRoleDialog{action, parent}
{
setRole(role);
}
AgentRole getRole() const;
void setRole(const AgentRole &role);
@ -49,7 +59,7 @@ private:
QTextEdit *m_descriptionEdit = nullptr;
QTextEdit *m_systemPromptEdit = nullptr;
QDialogButtonBox *m_buttonBox = nullptr;
bool m_editMode = false;
Action m_action;
};
} // namespace QodeAssist::Settings