forked from qt-creator/qt-creator
GitEditor: Convert some one-line slots to lambdas
Change-Id: I83326fbbdd5a43bc29924661b51bae57ecbfe0f9 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
André Hartmann
parent
4c69ec5b89
commit
53f0716f16
@@ -189,33 +189,12 @@ void GitEditorWidget::setPlainText(const QString &text)
|
|||||||
textDocument()->setPlainText(modText);
|
textDocument()->setPlainText(modText);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitEditorWidget::checkoutChange()
|
|
||||||
{
|
|
||||||
GitPlugin::client()->checkout(sourceWorkingDirectory(), m_currentChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GitEditorWidget::resetChange(const QByteArray &resetType)
|
void GitEditorWidget::resetChange(const QByteArray &resetType)
|
||||||
{
|
{
|
||||||
GitPlugin::client()->reset(
|
GitPlugin::client()->reset(
|
||||||
sourceWorkingDirectory(), QLatin1String("--" + resetType), m_currentChange);
|
sourceWorkingDirectory(), QLatin1String("--" + resetType), m_currentChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitEditorWidget::cherryPickChange()
|
|
||||||
{
|
|
||||||
GitPlugin::client()->synchronousCherryPick(sourceWorkingDirectory(), m_currentChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GitEditorWidget::revertChange()
|
|
||||||
{
|
|
||||||
GitPlugin::client()->synchronousRevert(sourceWorkingDirectory(), m_currentChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
void GitEditorWidget::logChange()
|
|
||||||
{
|
|
||||||
GitPlugin::client()->log(
|
|
||||||
sourceWorkingDirectory(), QString(), false, {m_currentChange});
|
|
||||||
}
|
|
||||||
|
|
||||||
void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, bool revert)
|
void GitEditorWidget::applyDiffChunk(const DiffChunk& chunk, bool revert)
|
||||||
{
|
{
|
||||||
Utils::TemporaryFile patchFile("git-apply-chunk");
|
Utils::TemporaryFile patchFile("git-apply-chunk");
|
||||||
@@ -313,13 +292,22 @@ void GitEditorWidget::addChangeActions(QMenu *menu, const QString &change)
|
|||||||
m_currentChange = change;
|
m_currentChange = change;
|
||||||
if (contentType() != OtherContent) {
|
if (contentType() != OtherContent) {
|
||||||
connect(menu->addAction(tr("Cherr&y-Pick Change %1").arg(change)), &QAction::triggered,
|
connect(menu->addAction(tr("Cherr&y-Pick Change %1").arg(change)), &QAction::triggered,
|
||||||
this, &GitEditorWidget::cherryPickChange);
|
this, [this]() {
|
||||||
|
GitPlugin::client()->synchronousCherryPick(sourceWorkingDirectory(), m_currentChange);
|
||||||
|
});
|
||||||
connect(menu->addAction(tr("Re&vert Change %1").arg(change)), &QAction::triggered,
|
connect(menu->addAction(tr("Re&vert Change %1").arg(change)), &QAction::triggered,
|
||||||
this, &GitEditorWidget::revertChange);
|
this, [this]() {
|
||||||
|
GitPlugin::client()->synchronousRevert(sourceWorkingDirectory(), m_currentChange);
|
||||||
|
});
|
||||||
connect(menu->addAction(tr("C&heckout Change %1").arg(change)), &QAction::triggered,
|
connect(menu->addAction(tr("C&heckout Change %1").arg(change)), &QAction::triggered,
|
||||||
this, &GitEditorWidget::checkoutChange);
|
this, [this]() {
|
||||||
|
GitPlugin::client()->checkout(sourceWorkingDirectory(), m_currentChange);
|
||||||
|
});
|
||||||
connect(menu->addAction(tr("&Log for Change %1").arg(change)), &QAction::triggered,
|
connect(menu->addAction(tr("&Log for Change %1").arg(change)), &QAction::triggered,
|
||||||
this, &GitEditorWidget::logChange);
|
this, [this]() {
|
||||||
|
GitPlugin::client()->log(
|
||||||
|
sourceWorkingDirectory(), QString(), false, {m_currentChange});
|
||||||
|
});
|
||||||
|
|
||||||
QMenu *resetMenu = new QMenu(tr("&Reset to Change %1").arg(change), menu);
|
QMenu *resetMenu = new QMenu(tr("&Reset to Change %1").arg(change), menu);
|
||||||
connect(resetMenu->addAction(tr("&Hard")), &QAction::triggered,
|
connect(resetMenu->addAction(tr("&Hard")), &QAction::triggered,
|
||||||
|
@@ -42,10 +42,6 @@ public:
|
|||||||
void setPlainText(const QString &text) override;
|
void setPlainText(const QString &text) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void checkoutChange();
|
|
||||||
void cherryPickChange();
|
|
||||||
void revertChange();
|
|
||||||
void logChange();
|
|
||||||
void applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert);
|
void applyDiffChunk(const VcsBase::DiffChunk& chunk, bool revert);
|
||||||
|
|
||||||
void init() override;
|
void init() override;
|
||||||
|
Reference in New Issue
Block a user