forked from qt-creator/qt-creator
GitClient: Avoid using sender()
Change-Id: I844b7c6545ae2244e5e45907e775fef53dd12931 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -30,10 +30,8 @@
|
|||||||
#include "gitconstants.h"
|
#include "gitconstants.h"
|
||||||
#include "giteditor.h"
|
#include "giteditor.h"
|
||||||
#include "gitplugin.h"
|
#include "gitplugin.h"
|
||||||
#include "gitsubmiteditor.h"
|
|
||||||
#include "mergetool.h"
|
#include "mergetool.h"
|
||||||
#include "branchadddialog.h"
|
#include "branchadddialog.h"
|
||||||
#include "gerrit/gerritplugin.h"
|
|
||||||
|
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
@@ -61,6 +59,7 @@
|
|||||||
#include <vcsbase/vcsbaseeditor.h>
|
#include <vcsbase/vcsbaseeditor.h>
|
||||||
#include <vcsbase/vcsbaseeditorconfig.h>
|
#include <vcsbase/vcsbaseeditorconfig.h>
|
||||||
#include <vcsbase/vcsbaseplugin.h>
|
#include <vcsbase/vcsbaseplugin.h>
|
||||||
|
#include <vcsbase/vcsbasesubmiteditor.h>
|
||||||
#include <vcsbase/vcsoutputwindow.h>
|
#include <vcsbase/vcsoutputwindow.h>
|
||||||
|
|
||||||
#include <diffeditor/descriptionwidgetwatcher.h>
|
#include <diffeditor/descriptionwidgetwatcher.h>
|
||||||
@@ -965,11 +964,11 @@ QTextCodec *GitClient::codecFor(GitClient::CodecType codecType, const FilePath &
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::chunkActionsRequested(QMenu *menu, int fileIndex, int chunkIndex,
|
void GitClient::chunkActionsRequested(DiffEditor::DiffEditorController *controller,
|
||||||
const DiffEditor::ChunkSelection &selection)
|
QMenu *menu, int fileIndex, int chunkIndex,
|
||||||
|
const DiffEditor::ChunkSelection &selection) const
|
||||||
{
|
{
|
||||||
QPointer<DiffEditor::DiffEditorController> diffController
|
QPointer<DiffEditor::DiffEditorController> diffController(controller);
|
||||||
= qobject_cast<DiffEditorController *>(sender());
|
|
||||||
|
|
||||||
auto stageChunk = [this](QPointer<DiffEditor::DiffEditorController> diffController,
|
auto stageChunk = [this](QPointer<DiffEditor::DiffEditorController> diffController,
|
||||||
int fileIndex, int chunkIndex, DiffEditorController::PatchOptions options,
|
int fileIndex, int chunkIndex, DiffEditorController::PatchOptions options,
|
||||||
@@ -1021,7 +1020,7 @@ void GitClient::chunkActionsRequested(QMenu *menu, int fileIndex, int chunkIndex
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::stage(DiffEditor::DiffEditorController *diffController,
|
void GitClient::stage(DiffEditor::DiffEditorController *diffController,
|
||||||
const QString &patch, bool revert)
|
const QString &patch, bool revert) const
|
||||||
{
|
{
|
||||||
TemporaryFile patchFile("git-patchfile");
|
TemporaryFile patchFile("git-patchfile");
|
||||||
if (!patchFile.open())
|
if (!patchFile.open())
|
||||||
@@ -1071,8 +1070,11 @@ void GitClient::requestReload(const QString &documentId, const QString &source,
|
|||||||
controller->setWorkingDirectory(workingDirectory);
|
controller->setWorkingDirectory(workingDirectory);
|
||||||
controller->initialize();
|
controller->initialize();
|
||||||
|
|
||||||
connect(controller, &DiffEditorController::chunkActionsRequested,
|
using namespace std::placeholders;
|
||||||
this, &GitClient::chunkActionsRequested, Qt::DirectConnection);
|
|
||||||
|
connect(controller, &DiffEditorController::chunkActionsRequested, this,
|
||||||
|
std::bind(&GitClient::chunkActionsRequested, this, controller, _1, _2, _3, _4),
|
||||||
|
Qt::DirectConnection);
|
||||||
|
|
||||||
VcsBase::setSource(document, sourceCopy);
|
VcsBase::setSource(document, sourceCopy);
|
||||||
EditorManager::activateEditorForDocument(document);
|
EditorManager::activateEditorForDocument(document);
|
||||||
@@ -2249,7 +2251,7 @@ bool GitClient::synchronousCleanList(const FilePath &workingDirectory, const QSt
|
|||||||
|
|
||||||
bool GitClient::synchronousApplyPatch(const FilePath &workingDirectory,
|
bool GitClient::synchronousApplyPatch(const FilePath &workingDirectory,
|
||||||
const QString &file, QString *errorMessage,
|
const QString &file, QString *errorMessage,
|
||||||
const QStringList &extraArguments)
|
const QStringList &extraArguments) const
|
||||||
{
|
{
|
||||||
QStringList arguments = {"apply", "--whitespace=fix"};
|
QStringList arguments = {"apply", "--whitespace=fix"};
|
||||||
arguments << extraArguments << file;
|
arguments << extraArguments << file;
|
||||||
|
@@ -202,7 +202,7 @@ public:
|
|||||||
bool synchronousCleanList(const Utils::FilePath &workingDirectory, const QString &modulePath,
|
bool synchronousCleanList(const Utils::FilePath &workingDirectory, const QString &modulePath,
|
||||||
QStringList *files, QStringList *ignoredFiles, QString *errorMessage);
|
QStringList *files, QStringList *ignoredFiles, QString *errorMessage);
|
||||||
bool synchronousApplyPatch(const Utils::FilePath &workingDirectory, const QString &file,
|
bool synchronousApplyPatch(const Utils::FilePath &workingDirectory, const QString &file,
|
||||||
QString *errorMessage, const QStringList &extraArguments = {});
|
QString *errorMessage, const QStringList &extraArguments = {}) const;
|
||||||
bool synchronousInit(const Utils::FilePath &workingDirectory);
|
bool synchronousInit(const Utils::FilePath &workingDirectory);
|
||||||
bool synchronousCheckoutFiles(const Utils::FilePath &workingDirectory, QStringList files = {},
|
bool synchronousCheckoutFiles(const Utils::FilePath &workingDirectory, QStringList files = {},
|
||||||
QString revision = {}, QString *errorMessage = nullptr,
|
QString revision = {}, QString *errorMessage = nullptr,
|
||||||
@@ -375,11 +375,12 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void finishSubmoduleUpdate();
|
void finishSubmoduleUpdate();
|
||||||
void chunkActionsRequested(QMenu *menu, int fileIndex, int chunkIndex,
|
void chunkActionsRequested(DiffEditor::DiffEditorController *controller,
|
||||||
const DiffEditor::ChunkSelection &selection);
|
QMenu *menu, int fileIndex, int chunkIndex,
|
||||||
|
const DiffEditor::ChunkSelection &selection) const;
|
||||||
|
|
||||||
void stage(DiffEditor::DiffEditorController *diffController,
|
void stage(DiffEditor::DiffEditorController *diffController,
|
||||||
const QString &patch, bool revert);
|
const QString &patch, bool revert) const;
|
||||||
|
|
||||||
enum CodecType { CodecSource, CodecLogOutput, CodecNone };
|
enum CodecType { CodecSource, CodecLogOutput, CodecNone };
|
||||||
QTextCodec *codecFor(CodecType codecType, const Utils::FilePath &source = {}) const;
|
QTextCodec *codecFor(CodecType codecType, const Utils::FilePath &source = {}) const;
|
||||||
|
Reference in New Issue
Block a user