summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2022-12-07 20:48:38 +0100
committerJarek Kobus <jaroslaw.kobus@qt.io>2022-12-07 21:54:39 +0000
commit0313470db0d5333ea5eda2da81e15c682f3ab981 (patch)
tree85173b7a0e028ad134dbd89fe0fe478678b1ad0e
parent0d74be319af9425d6fba12a2f06cd3bc1c6ef28f (diff)
downloadqt-creator-0313470db0d5333ea5eda2da81e15c682f3ab981.tar.gz
VcsBase: Pass context object to lambda connections
Remove some unneeded lambda () brackets. Change-Id: I20e43625793401544e86efb627f5921c395026bb Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
-rw-r--r--src/plugins/git/branchview.cpp4
-rw-r--r--src/plugins/git/gerrit/authenticationdialog.cpp2
-rw-r--r--src/plugins/git/gerrit/gerritdialog.cpp8
-rw-r--r--src/plugins/git/gerrit/gerritplugin.cpp2
-rw-r--r--src/plugins/git/gitplugin.cpp8
-rw-r--r--src/plugins/git/logchangedialog.cpp2
-rw-r--r--src/plugins/git/remotedialog.cpp2
-rw-r--r--src/plugins/perforce/perforceplugin.cpp2
-rw-r--r--src/plugins/subversion/subversionsettings.cpp2
-rw-r--r--src/plugins/vcsbase/basevcseditorfactory.cpp7
-rw-r--r--src/plugins/vcsbase/cleandialog.cpp2
-rw-r--r--src/plugins/vcsbase/vcsbaseclient.cpp6
-rw-r--r--src/plugins/vcsbase/vcsbasesubmiteditor.cpp2
-rw-r--r--src/plugins/vcsbase/vcscommand.cpp4
14 files changed, 26 insertions, 27 deletions
diff --git a/src/plugins/git/branchview.cpp b/src/plugins/git/branchview.cpp
index bc4f48277a..a333013f5f 100644
--- a/src/plugins/git/branchview.cpp
+++ b/src/plugins/git/branchview.cpp
@@ -230,12 +230,12 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
contextMenu.addAction(Tr::tr("&Add..."), this, &BranchView::add);
const std::optional<QString> remote = m_model->remoteName(index);
if (remote.has_value()) {
- contextMenu.addAction(Tr::tr("&Fetch"), this, [this, &remote]() {
+ contextMenu.addAction(Tr::tr("&Fetch"), this, [this, &remote] {
GitClient::instance()->fetch(m_repository, *remote);
});
contextMenu.addSeparator();
if (!remote->isEmpty()) {
- contextMenu.addAction(Tr::tr("Remove &Stale Branches"), this, [this, &remote]() {
+ contextMenu.addAction(Tr::tr("Remove &Stale Branches"), this, [this, &remote] {
GitClient::instance()->removeStaleRemoteBranches(m_repository, *remote);
});
contextMenu.addSeparator();
diff --git a/src/plugins/git/gerrit/authenticationdialog.cpp b/src/plugins/git/gerrit/authenticationdialog.cpp
index 3dacd0d271..8b96528440 100644
--- a/src/plugins/git/gerrit/authenticationdialog.cpp
+++ b/src/plugins/git/gerrit/authenticationdialog.cpp
@@ -113,7 +113,7 @@ AuthenticationDialog::AuthenticationDialog(GerritServer *server)
m_checkTimer = new QTimer(this);
m_checkTimer->setSingleShot(true);
connect(m_checkTimer, &QTimer::timeout, this, &AuthenticationDialog::checkCredentials);
- connect(m_passwordLineEdit, &QLineEdit::textChanged, [this]() {
+ connect(m_passwordLineEdit, &QLineEdit::textChanged, this, [this] {
if (QGuiApplication::clipboard()->text() == m_passwordLineEdit->text()) {
checkCredentials();
return;
diff --git a/src/plugins/git/gerrit/gerritdialog.cpp b/src/plugins/git/gerrit/gerritdialog.cpp
index e6f8307013..7b9c023b9e 100644
--- a/src/plugins/git/gerrit/gerritdialog.cpp
+++ b/src/plugins/git/gerrit/gerritdialog.cpp
@@ -114,10 +114,10 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
m_progressIndicator->attachToWidget(m_treeView->viewport());
m_progressIndicator->hide();
- m_displayButton = addActionButton(Git::Tr::tr("&Show"), [this]() { slotFetchDisplay(); });
- m_cherryPickButton = addActionButton(Git::Tr::tr("Cherry &Pick"), [this]() { slotFetchCherryPick(); });
- m_checkoutButton = addActionButton(Git::Tr::tr("C&heckout"), [this]() { slotFetchCheckout(); });
- m_refreshButton = addActionButton(Git::Tr::tr("&Refresh"), [this]() { refresh(); });
+ m_displayButton = addActionButton(Git::Tr::tr("&Show"), [this] { slotFetchDisplay(); });
+ m_cherryPickButton = addActionButton(Git::Tr::tr("Cherry &Pick"), [this] { slotFetchCherryPick(); });
+ m_checkoutButton = addActionButton(Git::Tr::tr("C&heckout"), [this] { slotFetchCheckout(); });
+ m_refreshButton = addActionButton(Git::Tr::tr("&Refresh"), [this] { refresh(); });
m_refreshButton->setDefault(true);
using namespace Layouting;
diff --git a/src/plugins/git/gerrit/gerritplugin.cpp b/src/plugins/git/gerrit/gerritplugin.cpp
index 31e515636d..a3ec892e0c 100644
--- a/src/plugins/git/gerrit/gerritplugin.cpp
+++ b/src/plugins/git/gerrit/gerritplugin.cpp
@@ -250,7 +250,7 @@ void GerritPlugin::initialize(ActionContainer *ac)
m_pushToGerritCommand =
ActionManager::registerAction(pushAction, Constants::GERRIT_PUSH);
- connect(pushAction, &QAction::triggered, this, [this]() { push(); });
+ connect(pushAction, &QAction::triggered, this, [this] { push(); });
ac->addAction(m_pushToGerritCommand);
auto options = new GerritOptionsPage(m_parameters, this);
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 0a0a3c629c..ae3c98b42b 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -207,13 +207,13 @@ public:
QAction *copyToClipboardAction = new QAction;
copyToClipboardAction->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon()));
copyToClipboardAction->setToolTip(TextMark::tr("Copy SHA1 to Clipboard"));
- QObject::connect(copyToClipboardAction, &QAction::triggered, [info]() {
+ QObject::connect(copyToClipboardAction, &QAction::triggered, [info] {
Utils::setClipboardAndSelection(info.sha1);
});
QAction *showAction = new QAction;
showAction->setIcon(Utils::Icons::ZOOM.icon());
showAction->setToolTip(TextMark::tr("Show Commit %1").arg(info.sha1.left(8)));
- QObject::connect(showAction, &QAction::triggered, [info]() {
+ QObject::connect(showAction, &QAction::triggered, [info] {
GitClient::instance()->show(info.fileName, info.sha1);
});
return QList<QAction *>{copyToClipboardAction, showAction};
@@ -669,7 +669,7 @@ QAction *GitPluginPrivate::createRepositoryAction(ActionContainer *ac, const QSt
const Context &context, bool addToLocator,
GitClientMemberFunc func, const QKeySequence &keys)
{
- auto cb = [this, func]() -> void {
+ auto cb = [this, func] {
QTC_ASSERT(currentState().hasTopLevel(), return);
(m_gitClient.*func)(currentState().topLevel());
};
@@ -1575,7 +1575,7 @@ void GitPluginPrivate::instantBlame()
const VcsCommand *command = GitClient::instance()->vcsExec(
workingDirectory, {"blame", "-p", "-L", lineString, "--", filePath.toString()},
nullptr, false, RunFlags::NoOutput);
- connect(command, &VcsCommand::done, this, [command, filePath, line, this]() {
+ connect(command, &VcsCommand::done, this, [command, filePath, line, this] {
if (command->result() == ProcessResult::FinishedWithError &&
command->cleanedStdErr().contains("no such path")) {
disconnect(m_blameCursorPosConn);
diff --git a/src/plugins/git/logchangedialog.cpp b/src/plugins/git/logchangedialog.cpp
index ef4b2cb734..a6887e078c 100644
--- a/src/plugins/git/logchangedialog.cpp
+++ b/src/plugins/git/logchangedialog.cpp
@@ -76,7 +76,7 @@ LogChangeWidget::LogChangeWidget(QWidget *parent)
setSelectionBehavior(QAbstractItemView::SelectRows);
setActivationMode(Utils::DoubleClickActivation);
connect(this, &LogChangeWidget::activated, this, &LogChangeWidget::emitCommitActivated);
- QTimer::singleShot(0, [this] { setFocus(); });
+ QTimer::singleShot(0, this, [this] { setFocus(); });
}
bool LogChangeWidget::init(const FilePath &repository, const QString &commit, LogFlags flags)
diff --git a/src/plugins/git/remotedialog.cpp b/src/plugins/git/remotedialog.cpp
index f35e8c55d2..9c3d828962 100644
--- a/src/plugins/git/remotedialog.cpp
+++ b/src/plugins/git/remotedialog.cpp
@@ -95,7 +95,7 @@ public:
Span(2, buttonBox)
}.attachTo(this);
- connect(m_nameEdit, &QLineEdit::textChanged, [this, buttonBox] {
+ connect(m_nameEdit, &QLineEdit::textChanged, this, [this, buttonBox] {
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_nameEdit->isValid());
});
diff --git a/src/plugins/perforce/perforceplugin.cpp b/src/plugins/perforce/perforceplugin.cpp
index f588b57af5..1dba20944a 100644
--- a/src/plugins/perforce/perforceplugin.cpp
+++ b/src/plugins/perforce/perforceplugin.cpp
@@ -553,7 +553,7 @@ PerforcePluginPrivate::PerforcePluginPrivate()
connect(m_filelogAction, &QAction::triggered, this, &PerforcePluginPrivate::filelogFile);
perforceContainer->addAction(command);
- QObject::connect(&m_settings, &AspectContainer::applied, [this] {
+ QObject::connect(&m_settings, &AspectContainer::applied, this, [this] {
m_settings.clearTopLevel();
applySettings();
});
diff --git a/src/plugins/subversion/subversionsettings.cpp b/src/plugins/subversion/subversionsettings.cpp
index d7036843bc..f75ef68e6b 100644
--- a/src/plugins/subversion/subversionsettings.cpp
+++ b/src/plugins/subversion/subversionsettings.cpp
@@ -72,7 +72,7 @@ SubversionSettings::SubversionSettings()
timeout.setLabelText(tr("Timeout:"));
timeout.setSuffix(tr("s"));
- QObject::connect(&useAuthentication, &BaseAspect::changed, [this] {
+ QObject::connect(&useAuthentication, &BaseAspect::changed, this, [this] {
userName.setEnabled(useAuthentication.value());
password.setEnabled(useAuthentication.value());
});
diff --git a/src/plugins/vcsbase/basevcseditorfactory.cpp b/src/plugins/vcsbase/basevcseditorfactory.cpp
index c474ccc6f9..55ab18d1fd 100644
--- a/src/plugins/vcsbase/basevcseditorfactory.cpp
+++ b/src/plugins/vcsbase/basevcseditorfactory.cpp
@@ -40,15 +40,14 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
setEditorActionHandlers(TextEditorActionHandler::None);
setDuplicatedSupported(false);
- setDocumentCreator([parameters]() -> TextDocument* {
+ setDocumentCreator([parameters] {
auto document = new TextDocument(parameters->id);
- // if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE))
document->setMimeType(QLatin1String(parameters->mimeType));
document->setSuspendAllowed(false);
return document;
});
- setEditorWidgetCreator([parameters, editorWidgetCreator, describeFunc]() {
+ setEditorWidgetCreator([parameters, editorWidgetCreator, describeFunc] {
auto widget = editorWidgetCreator();
auto editorWidget = Aggregation::query<VcsBaseEditorWidget>(widget);
editorWidget->setDescribeFunc(describeFunc);
@@ -56,7 +55,7 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
return widget;
});
- setEditorCreator([]() { return new VcsBaseEditor(); });
+ setEditorCreator([] { return new VcsBaseEditor(); });
setMarksVisible(false);
}
diff --git a/src/plugins/vcsbase/cleandialog.cpp b/src/plugins/vcsbase/cleandialog.cpp
index ad1add7eb2..3ae7efed07 100644
--- a/src/plugins/vcsbase/cleandialog.cpp
+++ b/src/plugins/vcsbase/cleandialog.cpp
@@ -91,7 +91,7 @@ static void runCleanFiles(QFutureInterface<void> &futureInterface,
static void handleError(const QString &errorMessage)
{
- QTimer::singleShot(0, VcsOutputWindow::instance(), [errorMessage]() {
+ QTimer::singleShot(0, VcsOutputWindow::instance(), [errorMessage] {
VcsOutputWindow::instance()->appendSilently(errorMessage);
});
}
diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp
index 0ba1497cf1..93e829b164 100644
--- a/src/plugins/vcsbase/vcsbaseclient.cpp
+++ b/src/plugins/vcsbase/vcsbaseclient.cpp
@@ -352,7 +352,7 @@ void VcsBaseClient::diff(const FilePath &workingDir, const QStringList &files,
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
paramWidget, &VcsBaseEditorConfig::executeCommand);
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
- [=] { diff(workingDir, files, extraOptions); } );
+ this, [=] { diff(workingDir, files, extraOptions); });
editor->setEditorConfig(paramWidget);
}
}
@@ -392,8 +392,8 @@ void VcsBaseClient::log(const FilePath &workingDir,
if (paramWidget) {
paramWidget->setBaseArguments(extraOptions);
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
- connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
- [=] { this->log(workingDir, files, extraOptions, enableAnnotationContextMenu); } );
+ connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
+ [=] { this->log(workingDir, files, extraOptions, enableAnnotationContextMenu); });
editor->setEditorConfig(paramWidget);
}
}
diff --git a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
index 8df2b314af..83d5a9c801 100644
--- a/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
+++ b/src/plugins/vcsbase/vcsbasesubmiteditor.cpp
@@ -207,7 +207,7 @@ void VcsBaseSubmitEditor::setParameters(const VcsBaseSubmitEditorParameters &par
connect(VcsPlugin::instance(), &VcsPlugin::settingsChanged,
this, &VcsBaseSubmitEditor::slotUpdateEditorSettings);
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
- this, [this]() {
+ this, [this] {
if (Core::EditorManager::currentEditor() == this)
updateFileModel();
});
diff --git a/src/plugins/vcsbase/vcscommand.cpp b/src/plugins/vcsbase/vcscommand.cpp
index a38f6cc793..0610454d8a 100644
--- a/src/plugins/vcsbase/vcscommand.cpp
+++ b/src/plugins/vcsbase/vcscommand.cpp
@@ -131,7 +131,7 @@ void VcsCommandPrivate::installStdCallbacks(QtcProcess *process)
if (!(m_flags & RunFlags::MergeOutputChannels) && (m_flags & RunFlags::ProgressiveOutput
|| m_progressParser || !(m_flags & RunFlags::SuppressStdErr))) {
process->setTextChannelMode(Channel::Error, TextChannelMode::MultiLine);
- connect(process, &QtcProcess::textOnStandardError, [this](const QString &text) {
+ connect(process, &QtcProcess::textOnStandardError, this, [this](const QString &text) {
if (!(m_flags & RunFlags::SuppressStdErr))
VcsOutputWindow::appendError(text);
if (m_flags & RunFlags::ProgressiveOutput)
@@ -141,7 +141,7 @@ void VcsCommandPrivate::installStdCallbacks(QtcProcess *process)
if (m_progressParser || m_flags & RunFlags::ProgressiveOutput
|| m_flags & RunFlags::ShowStdOut) {
process->setTextChannelMode(Channel::Output, TextChannelMode::MultiLine);
- connect(process, &QtcProcess::textOnStandardOutput, [this](const QString &text) {
+ connect(process, &QtcProcess::textOnStandardOutput, this, [this](const QString &text) {
if (m_flags & RunFlags::ShowStdOut) {
if (m_flags & RunFlags::SilentOutput)
VcsOutputWindow::appendSilently(text);