From d0b4b190a63f597195b87b5a8a5c51e16b77bdaa Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Mon, 10 Jun 2019 21:25:23 +0300 Subject: [PATCH] Git: Minor cleanup in ChangeSelectionDialog MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icca80b6588be7a4f1fe5601cae89df19f65e2a5d Reviewed-by: André Hartmann --- src/plugins/git/changeselectiondialog.cpp | 40 +++++------------------ src/plugins/git/changeselectiondialog.h | 6 +--- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/plugins/git/changeselectiondialog.cpp b/src/plugins/git/changeselectiondialog.cpp index 43909108f89..47a55be5c56 100644 --- a/src/plugins/git/changeselectiondialog.cpp +++ b/src/plugins/git/changeselectiondialog.cpp @@ -76,15 +76,15 @@ ChangeSelectionDialog::ChangeSelectionDialog(const QString &workingDirectory, Co connect(m_ui->selectFromHistoryButton, &QPushButton::clicked, this, &ChangeSelectionDialog::selectCommitFromRecentHistory); connect(m_ui->showButton, &QPushButton::clicked, - this, &ChangeSelectionDialog::acceptShow); + this, std::bind(&ChangeSelectionDialog::accept, this, Show)); connect(m_ui->cherryPickButton, &QPushButton::clicked, - this, &ChangeSelectionDialog::acceptCherryPick); + this, std::bind(&ChangeSelectionDialog::accept, this, CherryPick)); connect(m_ui->revertButton, &QPushButton::clicked, - this, &ChangeSelectionDialog::acceptRevert); + this, std::bind(&ChangeSelectionDialog::accept, this, Revert)); connect(m_ui->checkoutButton, &QPushButton::clicked, - this, &ChangeSelectionDialog::acceptCheckout); + this, std::bind(&ChangeSelectionDialog::accept, this, Checkout)); connect(m_ui->archiveButton, &QPushButton::clicked, - this, &ChangeSelectionDialog::acceptArchive); + this, std::bind(&ChangeSelectionDialog::accept, this, Archive)); if (id == "Git.Revert") m_ui->revertButton->setDefault(true); @@ -151,34 +151,10 @@ ChangeCommand ChangeSelectionDialog::command() const return m_command; } -void ChangeSelectionDialog::acceptArchive() +void ChangeSelectionDialog::accept(ChangeCommand command) { - m_command = Archive; - accept(); -} - -void ChangeSelectionDialog::acceptCheckout() -{ - m_command = Checkout; - accept(); -} - -void ChangeSelectionDialog::acceptCherryPick() -{ - m_command = CherryPick; - accept(); -} - -void ChangeSelectionDialog::acceptRevert() -{ - m_command = Revert; - accept(); -} - -void ChangeSelectionDialog::acceptShow() -{ - m_command = Show; - accept(); + m_command = command; + QDialog::accept(); } //! Set commit message in details diff --git a/src/plugins/git/changeselectiondialog.h b/src/plugins/git/changeselectiondialog.h index 9c6290162a6..84e888756b4 100644 --- a/src/plugins/git/changeselectiondialog.h +++ b/src/plugins/git/changeselectiondialog.h @@ -69,11 +69,7 @@ private: void recalculateCompletion(); void recalculateDetails(); void changeTextChanged(const QString &text); - void acceptArchive(); - void acceptCheckout(); - void acceptCherryPick(); - void acceptRevert(); - void acceptShow(); + void accept(ChangeCommand command); void enableButtons(bool b); void terminateProcess();