File indexing completed on 2025-01-05 05:14:49
0001 /* 0002 SPDX-FileCopyrightText: 2021 Hamed Masafi <hamed.masfi@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #include "pulldialog.h" 0008 #include "runnerdialog.h" 0009 0010 #include "commands/commandpull.h" 0011 #include "gitmanager.h" 0012 #include <QDialogButtonBox> 0013 0014 PullDialog::PullDialog(Git::Manager *git, QWidget *parent) 0015 : AppDialog(git, parent) 0016 { 0017 setupUi(this); 0018 0019 comboBoxRemote->addItems(git->remotes()); 0020 comboBoxBranch->addItems(git->branchesNames(Git::Manager::BranchType::LocalBranch)); 0021 0022 comboBoxBranch->setCurrentText(git->currentBranch()); 0023 connect(buttonBox->button(QDialogButtonBox::Ok), &QPushButton::clicked, this, &PullDialog::slotAccepted); 0024 0025 initComboBox<Git::CommandPull::Rebase>(comboBoxRebase); 0026 initComboBox<Git::CommandPull::FastForward>(comboBoxFastForward); 0027 } 0028 0029 void PullDialog::slotAccepted() 0030 { 0031 Git::CommandPull cmd; 0032 0033 cmd.setRemote(comboBoxRemote->currentText()); 0034 cmd.setBranch(comboBoxBranch->currentText()); 0035 cmd.setSquash(checkBoxSquash->isChecked()); 0036 0037 cmd.setNoCommit(checkBoxNoCommit->isChecked()); 0038 cmd.setPrune(checkBoxPrune->isChecked()); 0039 cmd.setTags(checkBoxTags->isChecked()); 0040 0041 cmd.setRebase(comboBoxCurrentValue<Git::CommandPull::Rebase>(comboBoxRebase)); 0042 cmd.setFastForward(comboBoxCurrentValue<Git::CommandPull::FastForward>(comboBoxFastForward)); 0043 0044 RunnerDialog d(mGit, this); 0045 d.run(&cmd); 0046 d.exec(); 0047 0048 accept(); 0049 } 0050 #include "moc_pulldialog.cpp"