Git: Minor cleanup in GitSubmitEditorWidget

Accept CommitData struct instead of passing most of its members separately.

Change-Id: I04b3b7ea0c02d12cae87e42d44af3808722b6371
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2022-08-18 08:55:58 +03:00
committed by Orgad Shaneh
parent 33001a866f
commit 4cf75c78ac
3 changed files with 8 additions and 16 deletions

View File

@@ -130,7 +130,7 @@ void GitSubmitEditor::setCommitData(const CommitData &d)
m_amendSHA1 = d.amendSHA1;
GitSubmitEditorWidget *w = submitEditorWidget();
w->initialize(m_commitType, m_workingDirectory, d.panelData, d.panelInfo, d.enablePush);
w->initialize(m_workingDirectory, d);
w->setHasUnmerged(false);
setEmptyFileListEnabled(m_commitType == AmendCommit); // Allow for just correcting the message

View File

@@ -158,18 +158,14 @@ void GitSubmitEditorWidget::setHasUnmerged(bool e)
m_hasUnmerged = e;
}
void GitSubmitEditorWidget::initialize(CommitType commitType,
const FilePath &repository,
const GitSubmitEditorPanelData &data,
const GitSubmitEditorPanelInfo &info,
bool enablePush)
void GitSubmitEditorWidget::initialize(const FilePath &repository, const CommitData &data)
{
if (m_isInitialized)
return;
m_isInitialized = true;
if (commitType != AmendCommit)
if (data.commitType != AmendCommit)
m_gitSubmitPanel->showHeadLabel->hide();
if (commitType == FixupCommit) {
if (data.commitType == FixupCommit) {
auto logChangeGroupBox = new QGroupBox(tr("Select Change"));
auto logChangeLayout = new QVBoxLayout;
logChangeGroupBox->setLayout(logChangeLayout);
@@ -182,10 +178,10 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
hideDescription();
}
insertTopWidget(m_gitSubmitPanel);
setPanelData(data);
setPanelInfo(info);
setPanelData(data.panelData);
setPanelInfo(data.panelInfo);
if (enablePush) {
if (data.enablePush) {
auto menu = new QMenu(this);
connect(menu->addAction(tr("&Commit only")), &QAction::triggered,
this, &GitSubmitEditorWidget::commitOnlySlot);

View File

@@ -64,11 +64,7 @@ public:
GitSubmitEditorPanelData panelData() const;
QString amendSHA1() const;
void setHasUnmerged(bool e);
void initialize(CommitType commitType,
const Utils::FilePath &repository,
const GitSubmitEditorPanelData &data,
const GitSubmitEditorPanelInfo &info,
bool enablePush);
void initialize(const Utils::FilePath &repository, const CommitData &data);
void refreshLog(const Utils::FilePath &repository);
protected: