forked from qt-creator/qt-creator
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:
committed by
Orgad Shaneh
parent
33001a866f
commit
4cf75c78ac
@@ -130,7 +130,7 @@ void GitSubmitEditor::setCommitData(const CommitData &d)
|
|||||||
m_amendSHA1 = d.amendSHA1;
|
m_amendSHA1 = d.amendSHA1;
|
||||||
|
|
||||||
GitSubmitEditorWidget *w = submitEditorWidget();
|
GitSubmitEditorWidget *w = submitEditorWidget();
|
||||||
w->initialize(m_commitType, m_workingDirectory, d.panelData, d.panelInfo, d.enablePush);
|
w->initialize(m_workingDirectory, d);
|
||||||
w->setHasUnmerged(false);
|
w->setHasUnmerged(false);
|
||||||
|
|
||||||
setEmptyFileListEnabled(m_commitType == AmendCommit); // Allow for just correcting the message
|
setEmptyFileListEnabled(m_commitType == AmendCommit); // Allow for just correcting the message
|
||||||
|
@@ -158,18 +158,14 @@ void GitSubmitEditorWidget::setHasUnmerged(bool e)
|
|||||||
m_hasUnmerged = e;
|
m_hasUnmerged = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitSubmitEditorWidget::initialize(CommitType commitType,
|
void GitSubmitEditorWidget::initialize(const FilePath &repository, const CommitData &data)
|
||||||
const FilePath &repository,
|
|
||||||
const GitSubmitEditorPanelData &data,
|
|
||||||
const GitSubmitEditorPanelInfo &info,
|
|
||||||
bool enablePush)
|
|
||||||
{
|
{
|
||||||
if (m_isInitialized)
|
if (m_isInitialized)
|
||||||
return;
|
return;
|
||||||
m_isInitialized = true;
|
m_isInitialized = true;
|
||||||
if (commitType != AmendCommit)
|
if (data.commitType != AmendCommit)
|
||||||
m_gitSubmitPanel->showHeadLabel->hide();
|
m_gitSubmitPanel->showHeadLabel->hide();
|
||||||
if (commitType == FixupCommit) {
|
if (data.commitType == FixupCommit) {
|
||||||
auto logChangeGroupBox = new QGroupBox(tr("Select Change"));
|
auto logChangeGroupBox = new QGroupBox(tr("Select Change"));
|
||||||
auto logChangeLayout = new QVBoxLayout;
|
auto logChangeLayout = new QVBoxLayout;
|
||||||
logChangeGroupBox->setLayout(logChangeLayout);
|
logChangeGroupBox->setLayout(logChangeLayout);
|
||||||
@@ -182,10 +178,10 @@ void GitSubmitEditorWidget::initialize(CommitType commitType,
|
|||||||
hideDescription();
|
hideDescription();
|
||||||
}
|
}
|
||||||
insertTopWidget(m_gitSubmitPanel);
|
insertTopWidget(m_gitSubmitPanel);
|
||||||
setPanelData(data);
|
setPanelData(data.panelData);
|
||||||
setPanelInfo(info);
|
setPanelInfo(data.panelInfo);
|
||||||
|
|
||||||
if (enablePush) {
|
if (data.enablePush) {
|
||||||
auto menu = new QMenu(this);
|
auto menu = new QMenu(this);
|
||||||
connect(menu->addAction(tr("&Commit only")), &QAction::triggered,
|
connect(menu->addAction(tr("&Commit only")), &QAction::triggered,
|
||||||
this, &GitSubmitEditorWidget::commitOnlySlot);
|
this, &GitSubmitEditorWidget::commitOnlySlot);
|
||||||
|
@@ -64,11 +64,7 @@ public:
|
|||||||
GitSubmitEditorPanelData panelData() const;
|
GitSubmitEditorPanelData panelData() const;
|
||||||
QString amendSHA1() const;
|
QString amendSHA1() const;
|
||||||
void setHasUnmerged(bool e);
|
void setHasUnmerged(bool e);
|
||||||
void initialize(CommitType commitType,
|
void initialize(const Utils::FilePath &repository, const CommitData &data);
|
||||||
const Utils::FilePath &repository,
|
|
||||||
const GitSubmitEditorPanelData &data,
|
|
||||||
const GitSubmitEditorPanelInfo &info,
|
|
||||||
bool enablePush);
|
|
||||||
void refreshLog(const Utils::FilePath &repository);
|
void refreshLog(const Utils::FilePath &repository);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Reference in New Issue
Block a user