1 | #include "AddSubmoduleDlg.h" |
2 | #include "ui_AddSubmoduleDlg.h" |
3 | |
4 | #include <GitSubmodules.h> |
5 | #include <GitQlientStyles.h> |
6 | |
7 | AddSubmoduleDlg::AddSubmoduleDlg(const QSharedPointer<GitSubmodules> &git, QWidget *parent) |
8 | : QDialog(parent) |
9 | , ui(new Ui::AddSubmoduleDlg) |
10 | , mGit(git) |
11 | { |
12 | setStyleSheet(GitQlientStyles::getStyles()); |
13 | |
14 | ui->setupUi(this); |
15 | |
16 | connect(ui->lePath, &QLineEdit::returnPressed, this, &AddSubmoduleDlg::accept); |
17 | connect(ui->leUrl, &QLineEdit::returnPressed, this, &AddSubmoduleDlg::accept); |
18 | connect(ui->pbAccept, &QPushButton::clicked, this, &AddSubmoduleDlg::accept); |
19 | connect(ui->pbCancel, &QPushButton::clicked, this, &QDialog::reject); |
20 | } |
21 | |
22 | AddSubmoduleDlg::~AddSubmoduleDlg() |
23 | { |
24 | delete ui; |
25 | } |
26 | |
27 | void AddSubmoduleDlg::accept() |
28 | { |
29 | const auto submodulePath = ui->lePath->text(); |
30 | const auto submoduleUrl = ui->leUrl->text(); |
31 | |
32 | const auto ret = mGit->submoduleAdd(submoduleUrl, submodulePath); |
33 | |
34 | if (ret) |
35 | QDialog::accept(); |
36 | } |
37 | |