forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -230,12 +230,12 @@ void BranchView::slotCustomContextMenu(const QPoint &point)
|
|||||||
contextMenu.addAction(Tr::tr("&Add..."), this, &BranchView::add);
|
contextMenu.addAction(Tr::tr("&Add..."), this, &BranchView::add);
|
||||||
const std::optional<QString> remote = m_model->remoteName(index);
|
const std::optional<QString> remote = m_model->remoteName(index);
|
||||||
if (remote.has_value()) {
|
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);
|
GitClient::instance()->fetch(m_repository, *remote);
|
||||||
});
|
});
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
if (!remote->isEmpty()) {
|
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);
|
GitClient::instance()->removeStaleRemoteBranches(m_repository, *remote);
|
||||||
});
|
});
|
||||||
contextMenu.addSeparator();
|
contextMenu.addSeparator();
|
||||||
|
@@ -113,7 +113,7 @@ AuthenticationDialog::AuthenticationDialog(GerritServer *server)
|
|||||||
m_checkTimer = new QTimer(this);
|
m_checkTimer = new QTimer(this);
|
||||||
m_checkTimer->setSingleShot(true);
|
m_checkTimer->setSingleShot(true);
|
||||||
connect(m_checkTimer, &QTimer::timeout, this, &AuthenticationDialog::checkCredentials);
|
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()) {
|
if (QGuiApplication::clipboard()->text() == m_passwordLineEdit->text()) {
|
||||||
checkCredentials();
|
checkCredentials();
|
||||||
return;
|
return;
|
||||||
|
@@ -114,10 +114,10 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
|
|||||||
m_progressIndicator->attachToWidget(m_treeView->viewport());
|
m_progressIndicator->attachToWidget(m_treeView->viewport());
|
||||||
m_progressIndicator->hide();
|
m_progressIndicator->hide();
|
||||||
|
|
||||||
m_displayButton = addActionButton(Git::Tr::tr("&Show"), [this]() { slotFetchDisplay(); });
|
m_displayButton = addActionButton(Git::Tr::tr("&Show"), [this] { slotFetchDisplay(); });
|
||||||
m_cherryPickButton = addActionButton(Git::Tr::tr("Cherry &Pick"), [this]() { slotFetchCherryPick(); });
|
m_cherryPickButton = addActionButton(Git::Tr::tr("Cherry &Pick"), [this] { slotFetchCherryPick(); });
|
||||||
m_checkoutButton = addActionButton(Git::Tr::tr("C&heckout"), [this]() { slotFetchCheckout(); });
|
m_checkoutButton = addActionButton(Git::Tr::tr("C&heckout"), [this] { slotFetchCheckout(); });
|
||||||
m_refreshButton = addActionButton(Git::Tr::tr("&Refresh"), [this]() { refresh(); });
|
m_refreshButton = addActionButton(Git::Tr::tr("&Refresh"), [this] { refresh(); });
|
||||||
m_refreshButton->setDefault(true);
|
m_refreshButton->setDefault(true);
|
||||||
|
|
||||||
using namespace Layouting;
|
using namespace Layouting;
|
||||||
|
@@ -250,7 +250,7 @@ void GerritPlugin::initialize(ActionContainer *ac)
|
|||||||
|
|
||||||
m_pushToGerritCommand =
|
m_pushToGerritCommand =
|
||||||
ActionManager::registerAction(pushAction, Constants::GERRIT_PUSH);
|
ActionManager::registerAction(pushAction, Constants::GERRIT_PUSH);
|
||||||
connect(pushAction, &QAction::triggered, this, [this]() { push(); });
|
connect(pushAction, &QAction::triggered, this, [this] { push(); });
|
||||||
ac->addAction(m_pushToGerritCommand);
|
ac->addAction(m_pushToGerritCommand);
|
||||||
|
|
||||||
auto options = new GerritOptionsPage(m_parameters, this);
|
auto options = new GerritOptionsPage(m_parameters, this);
|
||||||
|
@@ -207,13 +207,13 @@ public:
|
|||||||
QAction *copyToClipboardAction = new QAction;
|
QAction *copyToClipboardAction = new QAction;
|
||||||
copyToClipboardAction->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon()));
|
copyToClipboardAction->setIcon(QIcon::fromTheme("edit-copy", Utils::Icons::COPY.icon()));
|
||||||
copyToClipboardAction->setToolTip(TextMark::tr("Copy SHA1 to Clipboard"));
|
copyToClipboardAction->setToolTip(TextMark::tr("Copy SHA1 to Clipboard"));
|
||||||
QObject::connect(copyToClipboardAction, &QAction::triggered, [info]() {
|
QObject::connect(copyToClipboardAction, &QAction::triggered, [info] {
|
||||||
Utils::setClipboardAndSelection(info.sha1);
|
Utils::setClipboardAndSelection(info.sha1);
|
||||||
});
|
});
|
||||||
QAction *showAction = new QAction;
|
QAction *showAction = new QAction;
|
||||||
showAction->setIcon(Utils::Icons::ZOOM.icon());
|
showAction->setIcon(Utils::Icons::ZOOM.icon());
|
||||||
showAction->setToolTip(TextMark::tr("Show Commit %1").arg(info.sha1.left(8)));
|
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);
|
GitClient::instance()->show(info.fileName, info.sha1);
|
||||||
});
|
});
|
||||||
return QList<QAction *>{copyToClipboardAction, showAction};
|
return QList<QAction *>{copyToClipboardAction, showAction};
|
||||||
@@ -669,7 +669,7 @@ QAction *GitPluginPrivate::createRepositoryAction(ActionContainer *ac, const QSt
|
|||||||
const Context &context, bool addToLocator,
|
const Context &context, bool addToLocator,
|
||||||
GitClientMemberFunc func, const QKeySequence &keys)
|
GitClientMemberFunc func, const QKeySequence &keys)
|
||||||
{
|
{
|
||||||
auto cb = [this, func]() -> void {
|
auto cb = [this, func] {
|
||||||
QTC_ASSERT(currentState().hasTopLevel(), return);
|
QTC_ASSERT(currentState().hasTopLevel(), return);
|
||||||
(m_gitClient.*func)(currentState().topLevel());
|
(m_gitClient.*func)(currentState().topLevel());
|
||||||
};
|
};
|
||||||
@@ -1575,7 +1575,7 @@ void GitPluginPrivate::instantBlame()
|
|||||||
const VcsCommand *command = GitClient::instance()->vcsExec(
|
const VcsCommand *command = GitClient::instance()->vcsExec(
|
||||||
workingDirectory, {"blame", "-p", "-L", lineString, "--", filePath.toString()},
|
workingDirectory, {"blame", "-p", "-L", lineString, "--", filePath.toString()},
|
||||||
nullptr, false, RunFlags::NoOutput);
|
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 &&
|
if (command->result() == ProcessResult::FinishedWithError &&
|
||||||
command->cleanedStdErr().contains("no such path")) {
|
command->cleanedStdErr().contains("no such path")) {
|
||||||
disconnect(m_blameCursorPosConn);
|
disconnect(m_blameCursorPosConn);
|
||||||
|
@@ -76,7 +76,7 @@ LogChangeWidget::LogChangeWidget(QWidget *parent)
|
|||||||
setSelectionBehavior(QAbstractItemView::SelectRows);
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
setActivationMode(Utils::DoubleClickActivation);
|
setActivationMode(Utils::DoubleClickActivation);
|
||||||
connect(this, &LogChangeWidget::activated, this, &LogChangeWidget::emitCommitActivated);
|
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)
|
bool LogChangeWidget::init(const FilePath &repository, const QString &commit, LogFlags flags)
|
||||||
|
@@ -95,7 +95,7 @@ public:
|
|||||||
Span(2, buttonBox)
|
Span(2, buttonBox)
|
||||||
}.attachTo(this);
|
}.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());
|
buttonBox->button(QDialogButtonBox::Ok)->setEnabled(m_nameEdit->isValid());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -553,7 +553,7 @@ PerforcePluginPrivate::PerforcePluginPrivate()
|
|||||||
connect(m_filelogAction, &QAction::triggered, this, &PerforcePluginPrivate::filelogFile);
|
connect(m_filelogAction, &QAction::triggered, this, &PerforcePluginPrivate::filelogFile);
|
||||||
perforceContainer->addAction(command);
|
perforceContainer->addAction(command);
|
||||||
|
|
||||||
QObject::connect(&m_settings, &AspectContainer::applied, [this] {
|
QObject::connect(&m_settings, &AspectContainer::applied, this, [this] {
|
||||||
m_settings.clearTopLevel();
|
m_settings.clearTopLevel();
|
||||||
applySettings();
|
applySettings();
|
||||||
});
|
});
|
||||||
|
@@ -72,7 +72,7 @@ SubversionSettings::SubversionSettings()
|
|||||||
timeout.setLabelText(tr("Timeout:"));
|
timeout.setLabelText(tr("Timeout:"));
|
||||||
timeout.setSuffix(tr("s"));
|
timeout.setSuffix(tr("s"));
|
||||||
|
|
||||||
QObject::connect(&useAuthentication, &BaseAspect::changed, [this] {
|
QObject::connect(&useAuthentication, &BaseAspect::changed, this, [this] {
|
||||||
userName.setEnabled(useAuthentication.value());
|
userName.setEnabled(useAuthentication.value());
|
||||||
password.setEnabled(useAuthentication.value());
|
password.setEnabled(useAuthentication.value());
|
||||||
});
|
});
|
||||||
|
@@ -40,15 +40,14 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
|
|||||||
setEditorActionHandlers(TextEditorActionHandler::None);
|
setEditorActionHandlers(TextEditorActionHandler::None);
|
||||||
setDuplicatedSupported(false);
|
setDuplicatedSupported(false);
|
||||||
|
|
||||||
setDocumentCreator([parameters]() -> TextDocument* {
|
setDocumentCreator([parameters] {
|
||||||
auto document = new TextDocument(parameters->id);
|
auto document = new TextDocument(parameters->id);
|
||||||
// if (QLatin1String(parameters->mimeType) != QLatin1String(DiffEditor::Constants::DIFF_EDITOR_MIMETYPE))
|
|
||||||
document->setMimeType(QLatin1String(parameters->mimeType));
|
document->setMimeType(QLatin1String(parameters->mimeType));
|
||||||
document->setSuspendAllowed(false);
|
document->setSuspendAllowed(false);
|
||||||
return document;
|
return document;
|
||||||
});
|
});
|
||||||
|
|
||||||
setEditorWidgetCreator([parameters, editorWidgetCreator, describeFunc]() {
|
setEditorWidgetCreator([parameters, editorWidgetCreator, describeFunc] {
|
||||||
auto widget = editorWidgetCreator();
|
auto widget = editorWidgetCreator();
|
||||||
auto editorWidget = Aggregation::query<VcsBaseEditorWidget>(widget);
|
auto editorWidget = Aggregation::query<VcsBaseEditorWidget>(widget);
|
||||||
editorWidget->setDescribeFunc(describeFunc);
|
editorWidget->setDescribeFunc(describeFunc);
|
||||||
@@ -56,7 +55,7 @@ VcsEditorFactory::VcsEditorFactory(const VcsBaseEditorParameters *parameters,
|
|||||||
return widget;
|
return widget;
|
||||||
});
|
});
|
||||||
|
|
||||||
setEditorCreator([]() { return new VcsBaseEditor(); });
|
setEditorCreator([] { return new VcsBaseEditor(); });
|
||||||
setMarksVisible(false);
|
setMarksVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -91,7 +91,7 @@ static void runCleanFiles(QFutureInterface<void> &futureInterface,
|
|||||||
|
|
||||||
static void handleError(const QString &errorMessage)
|
static void handleError(const QString &errorMessage)
|
||||||
{
|
{
|
||||||
QTimer::singleShot(0, VcsOutputWindow::instance(), [errorMessage]() {
|
QTimer::singleShot(0, VcsOutputWindow::instance(), [errorMessage] {
|
||||||
VcsOutputWindow::instance()->appendSilently(errorMessage);
|
VcsOutputWindow::instance()->appendSilently(errorMessage);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -352,7 +352,7 @@ void VcsBaseClient::diff(const FilePath &workingDir, const QStringList &files,
|
|||||||
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
connect(editor, &VcsBaseEditorWidget::diffChunkReverted,
|
||||||
paramWidget, &VcsBaseEditorConfig::executeCommand);
|
paramWidget, &VcsBaseEditorConfig::executeCommand);
|
||||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
||||||
[=] { diff(workingDir, files, extraOptions); } );
|
this, [=] { diff(workingDir, files, extraOptions); });
|
||||||
editor->setEditorConfig(paramWidget);
|
editor->setEditorConfig(paramWidget);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -392,7 +392,7 @@ void VcsBaseClient::log(const FilePath &workingDir,
|
|||||||
if (paramWidget) {
|
if (paramWidget) {
|
||||||
paramWidget->setBaseArguments(extraOptions);
|
paramWidget->setBaseArguments(extraOptions);
|
||||||
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
// editor has been just created, createVcsEditor() didn't set a configuration widget yet
|
||||||
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested,
|
connect(paramWidget, &VcsBaseEditorConfig::commandExecutionRequested, this,
|
||||||
[=] { this->log(workingDir, files, extraOptions, enableAnnotationContextMenu); });
|
[=] { this->log(workingDir, files, extraOptions, enableAnnotationContextMenu); });
|
||||||
editor->setEditorConfig(paramWidget);
|
editor->setEditorConfig(paramWidget);
|
||||||
}
|
}
|
||||||
|
@@ -207,7 +207,7 @@ void VcsBaseSubmitEditor::setParameters(const VcsBaseSubmitEditorParameters &par
|
|||||||
connect(VcsPlugin::instance(), &VcsPlugin::settingsChanged,
|
connect(VcsPlugin::instance(), &VcsPlugin::settingsChanged,
|
||||||
this, &VcsBaseSubmitEditor::slotUpdateEditorSettings);
|
this, &VcsBaseSubmitEditor::slotUpdateEditorSettings);
|
||||||
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
|
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
|
||||||
this, [this]() {
|
this, [this] {
|
||||||
if (Core::EditorManager::currentEditor() == this)
|
if (Core::EditorManager::currentEditor() == this)
|
||||||
updateFileModel();
|
updateFileModel();
|
||||||
});
|
});
|
||||||
|
@@ -131,7 +131,7 @@ void VcsCommandPrivate::installStdCallbacks(QtcProcess *process)
|
|||||||
if (!(m_flags & RunFlags::MergeOutputChannels) && (m_flags & RunFlags::ProgressiveOutput
|
if (!(m_flags & RunFlags::MergeOutputChannels) && (m_flags & RunFlags::ProgressiveOutput
|
||||||
|| m_progressParser || !(m_flags & RunFlags::SuppressStdErr))) {
|
|| m_progressParser || !(m_flags & RunFlags::SuppressStdErr))) {
|
||||||
process->setTextChannelMode(Channel::Error, TextChannelMode::MultiLine);
|
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))
|
if (!(m_flags & RunFlags::SuppressStdErr))
|
||||||
VcsOutputWindow::appendError(text);
|
VcsOutputWindow::appendError(text);
|
||||||
if (m_flags & RunFlags::ProgressiveOutput)
|
if (m_flags & RunFlags::ProgressiveOutput)
|
||||||
@@ -141,7 +141,7 @@ void VcsCommandPrivate::installStdCallbacks(QtcProcess *process)
|
|||||||
if (m_progressParser || m_flags & RunFlags::ProgressiveOutput
|
if (m_progressParser || m_flags & RunFlags::ProgressiveOutput
|
||||||
|| m_flags & RunFlags::ShowStdOut) {
|
|| m_flags & RunFlags::ShowStdOut) {
|
||||||
process->setTextChannelMode(Channel::Output, TextChannelMode::MultiLine);
|
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::ShowStdOut) {
|
||||||
if (m_flags & RunFlags::SilentOutput)
|
if (m_flags & RunFlags::SilentOutput)
|
||||||
VcsOutputWindow::appendSilently(text);
|
VcsOutputWindow::appendSilently(text);
|
||||||
|
Reference in New Issue
Block a user