forked from qt-creator/qt-creator
GitClient: Use Qt5 style connects
Change-Id: Idc7d5d2a52627d8a328c28863bb99174ad0154e5 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include "commitdata.h"
|
#include "commitdata.h"
|
||||||
#include "gitconstants.h"
|
#include "gitconstants.h"
|
||||||
|
#include "giteditor.h"
|
||||||
#include "gitplugin.h"
|
#include "gitplugin.h"
|
||||||
#include "gitsubmiteditor.h"
|
#include "gitsubmiteditor.h"
|
||||||
#include "gitversioncontrol.h"
|
#include "gitversioncontrol.h"
|
||||||
@@ -225,8 +226,7 @@ void GitDiffHandler::postCollectShowDescription(const QString &id)
|
|||||||
auto command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment());
|
auto command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment());
|
||||||
command->setCodec(m_gitClient->encoding(m_workingDirectory,
|
command->setCodec(m_gitClient->encoding(m_workingDirectory,
|
||||||
"i18n.commitEncoding"));
|
"i18n.commitEncoding"));
|
||||||
connect(command, SIGNAL(output(QString)),
|
connect(command, &VcsCommand::output, this, &GitDiffHandler::slotShowDescriptionReceived);
|
||||||
this, SLOT(slotShowDescriptionReceived(QString)));
|
|
||||||
QStringList arguments;
|
QStringList arguments;
|
||||||
arguments << QLatin1String("show")
|
arguments << QLatin1String("show")
|
||||||
<< QLatin1String("-s")
|
<< QLatin1String("-s")
|
||||||
@@ -313,8 +313,7 @@ void GitDiffHandler::postCollectTextualDiffOutput(const QString &gitCommand, con
|
|||||||
m_controller->clear(m_waitMessage);
|
m_controller->clear(m_waitMessage);
|
||||||
auto command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment());
|
auto command = new VcsCommand(gitPath(), m_workingDirectory, processEnvironment());
|
||||||
command->setCodec(EditorManager::defaultTextCodec());
|
command->setCodec(EditorManager::defaultTextCodec());
|
||||||
connect(command, SIGNAL(output(QString)),
|
connect(command, &VcsCommand::output, this, &GitDiffHandler::slotTextualDiffOutputReceived);
|
||||||
this, SLOT(slotTextualDiffOutputReceived(QString)));
|
|
||||||
command->addFlags(diffExecutionFlags());
|
command->addFlags(diffExecutionFlags());
|
||||||
|
|
||||||
for (int i = 0; i < argumentsList.count(); i++)
|
for (int i = 0; i < argumentsList.count(); i++)
|
||||||
@@ -416,7 +415,7 @@ GitDiffEditorReloader::GitDiffEditorReloader()
|
|||||||
void GitDiffEditorReloader::reload()
|
void GitDiffEditorReloader::reload()
|
||||||
{
|
{
|
||||||
auto handler = new GitDiffHandler(controller(), m_workingDirectory);
|
auto handler = new GitDiffHandler(controller(), m_workingDirectory);
|
||||||
connect(handler, SIGNAL(destroyed()), this, SLOT(reloadFinished()));
|
connect(handler, &GitDiffHandler::destroyed, this, &GitDiffEditorReloader::reloadFinished);
|
||||||
|
|
||||||
switch (m_diffType) {
|
switch (m_diffType) {
|
||||||
case DiffRepository:
|
case DiffRepository:
|
||||||
@@ -499,8 +498,8 @@ public:
|
|||||||
QToolButton *diffButton = addToggleButton(QLatin1String("--patch"), tr("Show Diff"),
|
QToolButton *diffButton = addToggleButton(QLatin1String("--patch"), tr("Show Diff"),
|
||||||
tr("Show difference."));
|
tr("Show difference."));
|
||||||
mapSetting(diffButton, settings->boolPointer(GitSettings::logDiffKey));
|
mapSetting(diffButton, settings->boolPointer(GitSettings::logDiffKey));
|
||||||
connect(diffButton, SIGNAL(toggled(bool)), m_patienceButton, SLOT(setVisible(bool)));
|
connect(diffButton, &QToolButton::toggled, m_patienceButton, &QToolButton::setVisible);
|
||||||
connect(diffButton, SIGNAL(toggled(bool)), m_ignoreWSButton, SLOT(setVisible(bool)));
|
connect(diffButton, &QToolButton::toggled, m_ignoreWSButton, &QToolButton::setVisible);
|
||||||
m_patienceButton->setVisible(diffButton->isChecked());
|
m_patienceButton->setVisible(diffButton->isChecked());
|
||||||
m_ignoreWSButton->setVisible(diffButton->isChecked());
|
m_ignoreWSButton->setVisible(diffButton->isChecked());
|
||||||
QStringList graphArguments(QLatin1String("--graph"));
|
QStringList graphArguments(QLatin1String("--graph"));
|
||||||
@@ -525,8 +524,8 @@ public:
|
|||||||
{
|
{
|
||||||
if (parentCommand) {
|
if (parentCommand) {
|
||||||
parentCommand->addFlags(VcsBasePlugin::ExpectRepoChanges);
|
parentCommand->addFlags(VcsBasePlugin::ExpectRepoChanges);
|
||||||
connect(parentCommand, SIGNAL(output(QString)), this, SLOT(readStdOut(QString)));
|
connect(parentCommand, &VcsCommand::output, this, &ConflictHandler::readStdOut);
|
||||||
connect(parentCommand, SIGNAL(errorText(QString)), this, SLOT(readStdErr(QString)));
|
connect(parentCommand, &VcsCommand::errorText, this, &ConflictHandler::readStdErr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -669,7 +668,7 @@ GitClient::GitClient(GitSettings *settings) :
|
|||||||
m_disableEditor(false)
|
m_disableEditor(false)
|
||||||
{
|
{
|
||||||
QTC_CHECK(settings);
|
QTC_CHECK(settings);
|
||||||
connect(ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
|
connect(ICore::instance(), &ICore::saveSettingsRequested, this, &GitClient::saveSettings);
|
||||||
m_gitQtcEditor = QString::fromLatin1("\"%1\" -client -block -pid %2")
|
m_gitQtcEditor = QString::fromLatin1("\"%1\" -client -block -pid %2")
|
||||||
.arg(QCoreApplication::applicationFilePath())
|
.arg(QCoreApplication::applicationFilePath())
|
||||||
.arg(QCoreApplication::applicationPid());
|
.arg(QCoreApplication::applicationPid());
|
||||||
@@ -756,10 +755,10 @@ GitDiffEditorReloader *GitClient::findOrCreateDiffEditor(const QString &document
|
|||||||
QTC_ASSERT(diffEditorDocument, return 0);
|
QTC_ASSERT(diffEditorDocument, return 0);
|
||||||
controller = diffEditorDocument->controller();
|
controller = diffEditorDocument->controller();
|
||||||
|
|
||||||
connect(controller, SIGNAL(chunkActionsRequested(QMenu*,bool)),
|
connect(controller, &DiffEditor::DiffEditorController::chunkActionsRequested,
|
||||||
this, SLOT(slotChunkActionsRequested(QMenu*,bool)), Qt::DirectConnection);
|
this, &GitClient::slotChunkActionsRequested, Qt::DirectConnection);
|
||||||
connect(controller, SIGNAL(expandBranchesRequested(QString)),
|
connect(controller, static_cast<void (DiffEditor::DiffEditorController::*)(const QString &)>(&DiffEditor::DiffEditorController::expandBranchesRequested),
|
||||||
this, SLOT(branchesForCommit(QString)));
|
this, &GitClient::branchesForCommit);
|
||||||
|
|
||||||
reloader = new GitDiffEditorReloader();
|
reloader = new GitDiffEditorReloader();
|
||||||
controller->setReloader(reloader);
|
controller->setReloader(reloader);
|
||||||
@@ -777,9 +776,9 @@ void GitClient::slotChunkActionsRequested(QMenu *menu, bool isValid)
|
|||||||
{
|
{
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
QAction *stageChunkAction = menu->addAction(tr("Stage Chunk"));
|
QAction *stageChunkAction = menu->addAction(tr("Stage Chunk"));
|
||||||
connect(stageChunkAction, SIGNAL(triggered()), this, SLOT(slotStageChunk()));
|
connect(stageChunkAction, &QAction::triggered, this, &GitClient::slotStageChunk);
|
||||||
QAction *unstageChunkAction = menu->addAction(tr("Unstage Chunk"));
|
QAction *unstageChunkAction = menu->addAction(tr("Unstage Chunk"));
|
||||||
connect(unstageChunkAction, SIGNAL(triggered()), this, SLOT(slotUnstageChunk()));
|
connect(unstageChunkAction, &QAction::triggered, this, &GitClient::slotUnstageChunk);
|
||||||
|
|
||||||
m_contextController = qobject_cast<DiffEditor::DiffEditorController *>(sender());
|
m_contextController = qobject_cast<DiffEditor::DiffEditorController *>(sender());
|
||||||
|
|
||||||
@@ -866,8 +865,8 @@ VcsBaseEditorWidget *GitClient::createVcsEditor(
|
|||||||
IEditor *outputEditor = EditorManager::openEditorWithContents(id, &title);
|
IEditor *outputEditor = EditorManager::openEditorWithContents(id, &title);
|
||||||
outputEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
|
outputEditor->document()->setProperty(registerDynamicProperty, dynamicPropertyValue);
|
||||||
rc = VcsBaseEditor::getVcsBaseEditor(outputEditor);
|
rc = VcsBaseEditor::getVcsBaseEditor(outputEditor);
|
||||||
connect(rc, SIGNAL(annotateRevisionRequested(QString,QString,QString,int)),
|
connect(rc, &VcsBaseEditorWidget::annotateRevisionRequested,
|
||||||
this, SLOT(slotBlameRevisionRequested(QString,QString,QString,int)));
|
this, &GitClient::slotBlameRevisionRequested);
|
||||||
QTC_ASSERT(rc, return 0);
|
QTC_ASSERT(rc, return 0);
|
||||||
rc->setSource(source);
|
rc->setSource(source);
|
||||||
if (codecType == CodecSource)
|
if (codecType == CodecSource)
|
||||||
@@ -960,7 +959,7 @@ void GitClient::status(const QString &workingDirectory)
|
|||||||
statusArgs << QLatin1String("status") << QLatin1String("-u");
|
statusArgs << QLatin1String("status") << QLatin1String("-u");
|
||||||
VcsOutputWindow::setRepository(workingDirectory);
|
VcsOutputWindow::setRepository(workingDirectory);
|
||||||
VcsCommand *command = executeGit(workingDirectory, statusArgs, 0, true);
|
VcsCommand *command = executeGit(workingDirectory, statusArgs, 0, true);
|
||||||
connect(command, SIGNAL(finished(bool,int,QVariant)), VcsOutputWindow::instance(), SLOT(clearRepository()),
|
connect(command, &VcsCommand::finished, VcsOutputWindow::instance(), &VcsOutputWindow::clearRepository,
|
||||||
Qt::QueuedConnection);
|
Qt::QueuedConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1660,8 +1659,8 @@ void GitClient::branchesForCommit(const QString &revision)
|
|||||||
auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment());
|
auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment());
|
||||||
command->setCodec(getSourceCodec(currentDocumentPath()));
|
command->setCodec(getSourceCodec(currentDocumentPath()));
|
||||||
|
|
||||||
connect(command, SIGNAL(output(QString)), controller,
|
connect(command, &VcsCommand::output, controller,
|
||||||
SLOT(branchesForCommitReceived(QString)));
|
&DiffEditor::DiffEditorController::branchesForCommitReceived);
|
||||||
|
|
||||||
command->addJob(arguments, -1);
|
command->addJob(arguments, -1);
|
||||||
command->setCookie(workingDirectory);
|
command->setCookie(workingDirectory);
|
||||||
@@ -2059,21 +2058,22 @@ VcsCommand *GitClient::createCommand(const QString &workingDirectory,
|
|||||||
bool useOutputToWindow,
|
bool useOutputToWindow,
|
||||||
int editorLineNumber)
|
int editorLineNumber)
|
||||||
{
|
{
|
||||||
|
GitEditorWidget *gitEditor = qobject_cast<GitEditorWidget *>(editor);
|
||||||
auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment());
|
auto command = new VcsCommand(gitExecutable(), workingDirectory, processEnvironment());
|
||||||
command->setCodec(getSourceCodec(currentDocumentPath()));
|
command->setCodec(getSourceCodec(currentDocumentPath()));
|
||||||
command->setCookie(QVariant(editorLineNumber));
|
command->setCookie(QVariant(editorLineNumber));
|
||||||
if (editor) {
|
if (gitEditor) {
|
||||||
editor->setCommand(command);
|
gitEditor->setCommand(command);
|
||||||
connect(command, SIGNAL(finished(bool,int,QVariant)),
|
connect(command, &VcsCommand::finished,
|
||||||
editor, SLOT(commandFinishedGotoLine(bool,int,QVariant)));
|
gitEditor, &GitEditorWidget::commandFinishedGotoLine);
|
||||||
}
|
}
|
||||||
if (useOutputToWindow) {
|
if (useOutputToWindow) {
|
||||||
command->addFlags(VcsBasePlugin::ShowStdOutInLogWindow);
|
command->addFlags(VcsBasePlugin::ShowStdOutInLogWindow);
|
||||||
command->addFlags(VcsBasePlugin::ShowSuccessMessage);
|
command->addFlags(VcsBasePlugin::ShowSuccessMessage);
|
||||||
if (editor) // assume that the commands output is the important thing
|
if (editor) // assume that the commands output is the important thing
|
||||||
command->addFlags(VcsBasePlugin::SilentOutput);
|
command->addFlags(VcsBasePlugin::SilentOutput);
|
||||||
} else if (editor) {
|
} else if (gitEditor) {
|
||||||
connect(command, SIGNAL(output(QString)), editor, SLOT(setPlainTextFiltered(QString)));
|
connect(command, &VcsCommand::output, gitEditor, &GitEditorWidget::setPlainTextFiltered);
|
||||||
}
|
}
|
||||||
|
|
||||||
return command;
|
return command;
|
||||||
@@ -2225,7 +2225,7 @@ void GitClient::updateSubmodulesIfNeeded(const QString &workingDirectory, bool p
|
|||||||
|
|
||||||
VcsCommand *cmd = executeGit(workingDirectory, arguments, 0, true,
|
VcsCommand *cmd = executeGit(workingDirectory, arguments, 0, true,
|
||||||
VcsBasePlugin::ExpectRepoChanges);
|
VcsBasePlugin::ExpectRepoChanges);
|
||||||
connect(cmd, SIGNAL(finished(bool,int,QVariant)), this, SLOT(finishSubmoduleUpdate()));
|
connect(cmd, &VcsCommand::finished, this, &GitClient::finishSubmoduleUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GitClient::finishSubmoduleUpdate()
|
void GitClient::finishSubmoduleUpdate()
|
||||||
@@ -2524,7 +2524,8 @@ bool GitClient::tryLauchingGitK(const QProcessEnvironment &env,
|
|||||||
process->start(binary, arguments);
|
process->start(binary, arguments);
|
||||||
success = process->waitForStarted();
|
success = process->waitForStarted();
|
||||||
if (success)
|
if (success)
|
||||||
connect(process, SIGNAL(finished(int)), process, SLOT(deleteLater()));
|
connect(process, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
|
||||||
|
process, &QProcess::deleteLater);
|
||||||
else
|
else
|
||||||
delete process;
|
delete process;
|
||||||
} else {
|
} else {
|
||||||
@@ -2974,7 +2975,7 @@ void GitClient::fetch(const QString &workingDirectory, const QString &remote)
|
|||||||
arguments << (remote.isEmpty() ? QLatin1String("--all") : remote);
|
arguments << (remote.isEmpty() ? QLatin1String("--all") : remote);
|
||||||
VcsCommand *command = executeGit(workingDirectory, arguments, 0, true);
|
VcsCommand *command = executeGit(workingDirectory, arguments, 0, true);
|
||||||
command->setCookie(workingDirectory);
|
command->setCookie(workingDirectory);
|
||||||
connect(command, SIGNAL(success(QVariant)), this, SLOT(fetchFinished(QVariant)));
|
connect(command, &VcsCommand::success, this, &GitClient::fetchFinished);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
bool GitClient::executeAndHandleConflicts(const QString &workingDirectory,
|
||||||
|
Reference in New Issue
Block a user