Commit 8c7c1338 authored by Christoph Cullmann's avatar Christoph Cullmann

GIT_SILENT: application of coding style

parent cb9678ca
......@@ -118,9 +118,7 @@ void makeEditorCommandUnique(KateExternalTool *tool, const std::vector<KateExter
static KateExternalTool defaultTool(const QString &actionName, const QVector<KateExternalTool> &defaultTools)
{
auto it = std::find_if(defaultTools.cbegin(), defaultTools.cend(), [actionName](const KateExternalTool &defaultTool) {
return actionName == defaultTool.actionName;
});
auto it = std::find_if(defaultTools.cbegin(), defaultTools.cend(), [actionName](const KateExternalTool &defaultTool) { return actionName == defaultTool.actionName; });
return (it != defaultTools.cend()) ? *it : KateExternalTool();
}
......@@ -168,7 +166,7 @@ KateExternalToolServiceEditor::KateExternalToolServiceEditor(KateExternalTool *t
if (isDefaultTool(tool, m_plugin->defaultTools())) {
ui->buttonBox->setStandardButtons(ui->buttonBox->standardButtons() | QDialogButtonBox::RestoreDefaults);
ui->buttonBox->setToolTip(i18n("Revert tool to default settings"));
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, [this, tool](){
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, [this, tool]() {
const auto t = defaultTool(tool->actionName, m_plugin->defaultTools());
ui->edtName->setText(i18n(t.name.toUtf8().data()));
ui->btnIcon->setIcon(t.icon);
......
......@@ -393,7 +393,7 @@ void KateProjectPlugin::writeConfig()
static KateProjectPlugin *findProjectPlugin()
{
auto plugin = KTextEditor::Editor::instance()->application()->plugin(QStringLiteral("kateprojectplugin"));
return qobject_cast<KateProjectPlugin*>(plugin);
return qobject_cast<KateProjectPlugin *>(plugin);
}
#endif
......@@ -401,37 +401,35 @@ void KateProjectPlugin::registerVariables()
{
#if KTEXTEDITOR_VERSION >= QT_VERSION_CHECK(5, 63, 0)
auto editor = KTextEditor::Editor::instance();
editor->registerVariableMatch(QStringLiteral("Project:Path"), i18n("Full path to current project excluding the file name."),
[](const QStringView &, KTextEditor::View *view) {
if (!view) {
return QString();
}
auto projectPlugin = findProjectPlugin();
if (!projectPlugin) {
return QString();
}
auto kateProject = findProjectPlugin()->projectForUrl(view->document()->url());
if (!kateProject) {
return QString();
}
return QDir(kateProject->baseDir()).absolutePath();
});
editor->registerVariableMatch(QStringLiteral("Project:Path"), i18n("Full path to current project excluding the file name."), [](const QStringView &, KTextEditor::View *view) {
if (!view) {
return QString();
}
auto projectPlugin = findProjectPlugin();
if (!projectPlugin) {
return QString();
}
auto kateProject = findProjectPlugin()->projectForUrl(view->document()->url());
if (!kateProject) {
return QString();
}
return QDir(kateProject->baseDir()).absolutePath();
});
editor->registerVariableMatch(QStringLiteral("Project:NativePath"), i18n("Full path to current project excluding the file name, with native path separator (backslash on Windows)."),
[](const QStringView &, KTextEditor::View *view) {
if (!view) {
return QString();
}
auto projectPlugin = findProjectPlugin();
if (!projectPlugin) {
return QString();
}
auto kateProject = findProjectPlugin()->projectForUrl(view->document()->url());
if (!kateProject) {
return QString();
}
return QDir::toNativeSeparators(QDir(kateProject->baseDir()).absolutePath());
});
editor->registerVariableMatch(QStringLiteral("Project:NativePath"), i18n("Full path to current project excluding the file name, with native path separator (backslash on Windows)."), [](const QStringView &, KTextEditor::View *view) {
if (!view) {
return QString();
}
auto projectPlugin = findProjectPlugin();
if (!projectPlugin) {
return QString();
}
auto kateProject = findProjectPlugin()->projectForUrl(view->document()->url());
if (!kateProject) {
return QString();
}
return QDir::toNativeSeparators(QDir(kateProject->baseDir()).absolutePath());
});
#endif
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment