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 "fetchdialog.h" 0008 0009 #include "commands/commandfetch.h" 0010 #include "gitmanager.h" 0011 #include "observers/fetchobserver.h" 0012 #include "runnerdialog.h" 0013 0014 #include <QDialogButtonBox> 0015 FetchDialog::FetchDialog(Git::Manager *git, QWidget *parent) 0016 : AppDialog(git, parent) 0017 , mObserver{new Git::FetchObserver{this}} 0018 { 0019 setupUi(this); 0020 0021 comboBoxRemote->addItems(git->remotes()); 0022 comboBoxBranch->addItems(git->branchesNames(Git::Manager::BranchType::LocalBranch)); 0023 0024 comboBoxRemote->setCurrentText(git->currentBranch()); 0025 connect(buttonBox, &QDialogButtonBox::accepted, this, &FetchDialog::slotAccept); 0026 } 0027 0028 void FetchDialog::setBranch(const QString &branch) 0029 { 0030 comboBoxBranch->setCurrentText(branch); 0031 } 0032 0033 void FetchDialog::slotAccept() 0034 { 0035 // mGit->fetch(comboBoxRemote->currentText(), mObserver); 0036 Git::CommandFetch cmd; 0037 0038 cmd.setRemote(comboBoxRemote->currentText()); 0039 0040 if (!checkBoxAllBranches->isChecked()) 0041 cmd.setBranch(comboBoxBranch->currentText()); 0042 cmd.setNoFf(checkBoxNoFastForward->isChecked()); 0043 cmd.setFfOnly(checkBoxFastForwardOnly->isChecked()); 0044 cmd.setNoCommit(checkBoxNoCommit->isChecked()); 0045 cmd.setPrune(checkBoxPrune->isChecked()); 0046 cmd.setTags(checkBoxTags->isChecked()); 0047 0048 RunnerDialog d(mGit, this); 0049 d.run(&cmd); 0050 d.exec(); 0051 0052 accept(); 0053 } 0054 0055 #include "moc_fetchdialog.cpp"