Commit 97731d45 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈 Committed by Christoph Cullmann
Browse files

automatic clang-format run (clang 14)

parent 90cb7027
......@@ -289,7 +289,6 @@ AsmView::AsmView(QWidget *parent)
return;
}
model->setFont(Utils::editorFont());
};
QMetaObject::invokeMethod(this, updateColors, Qt::QueuedConnection);
connect(KTextEditor::Editor::instance(), &KTextEditor::Editor::configChanged, this, updateColors);
......
......@@ -154,13 +154,12 @@ void KateExternalTool::load(const KConfigGroup &cg)
hasexec = checkExec();
}
template < class Value >
template<class Value>
static inline void writeEntryMaybe(KConfigGroup &cg, const char *key, const Value &value)
{
if (value.isEmpty()) {
cg.deleteEntry(key);
}
else {
} else {
cg.writeEntry(key, value);
}
}
......
......@@ -815,7 +815,6 @@ void ConfigView::slotBrowseDir()
m_workingDirectory->setText(QFileDialog::getExistingDirectory(this, QString(), dir));
}
void ConfigView::saveCurrentToIndex(int index)
{
if ((index < 0) || (index >= m_targetCombo->count())) {
......
......@@ -345,7 +345,6 @@ void DapDebugView::informStackFrame()
void DapDebugView::onStackTrace(const int /* threadId */, const dap::StackTraceInfo &info)
{
m_currentFrame = std::nullopt;
m_frames = info.stackFrames;
informStackFrame();
......
......@@ -45,7 +45,6 @@ public Q_SLOTS:
* the model index of the copy. */
QModelIndex copyTargetOrSet(const QModelIndex &index);
/** This function deletes the index */
void deleteItem(const QModelIndex &index);
......
......@@ -199,7 +199,8 @@ int SQLManager::storeCredentials(const Connection &conn)
map[QStringLiteral("hostname")] = conn.hostname.toUpper();
map[QStringLiteral("port")] = QString::number(conn.port);
}
const int result = (wallet->writeMap(conn.name, map) == SQLManager::K_WALLET_CONNECTION_SUCCESSFUL) ? SQLManager::K_WALLET_CONNECTION_SUCCESSFUL : SQLManager::K_WALLET_CONNECTION_ERROR;
const int result = (wallet->writeMap(conn.name, map) == SQLManager::K_WALLET_CONNECTION_SUCCESSFUL) ? SQLManager::K_WALLET_CONNECTION_SUCCESSFUL
: SQLManager::K_WALLET_CONNECTION_ERROR;
return result;
}
......
......@@ -18,12 +18,12 @@
#include <QTextBrowser>
#include <QTimer>
#include <KTextEditor/ConfigInterface>
#include <KTextEditor/Editor>
#include <KTextEditor/View>
#include <KSyntaxHighlighting/Definition>
#include <KSyntaxHighlighting/Repository>
#include <KSyntaxHighlighting/SyntaxHighlighter>
#include <KTextEditor/ConfigInterface>
#include <KTextEditor/Editor>
#include <KTextEditor/View>
#include <KWindowSystem>
#include <ktexteditor_utils.h>
......
......@@ -295,8 +295,7 @@ bool KateProjectPlugin::projectHasOpenDocuments(KateProject *project) const
KateProject *KateProjectPlugin::projectForUrl(const QUrl &url)
{
if (url.isEmpty() || !url.isLocalFile()
|| KNetworkMounts::self()->isOptionEnabledForPath(url.toLocalFile(), KNetworkMounts::MediumSideEffectsOptimizations)
) {
|| KNetworkMounts::self()->isOptionEnabledForPath(url.toLocalFile(), KNetworkMounts::MediumSideEffectsOptimizations)) {
return nullptr;
}
......
......@@ -34,10 +34,8 @@
#include <QMimeType>
#include <QStandardPaths>
#include <ktexteditor/editor.h>
#include <ktexteditor/application.h>
#include <ktexteditor/editor.h>
static QString getName()
{
......@@ -149,20 +147,17 @@ void KateProjectTreeViewContextMenu::exec(const QString &filename, const QModelI
job->setUiDelegate(new KIO::JobUiDelegate(KJobUiDelegate::AutoHandlingEnabled, parent));
job->start();
};
auto handleDeleteFile = [parent, index](const QString &path)
{
//message box
auto handleDeleteFile = [parent, index](const QString &path) {
// message box
const QString title = i18n("Delete File");
const QString text = i18n("Do you want to delete the file '%1'?", path);
if (QMessageBox::Yes == QMessageBox::question(parent, title, text, QMessageBox::No | QMessageBox::Yes, QMessageBox::Yes)) {
const QList< KTextEditor::Document* > openDocuments = KTextEditor::Editor::instance()->application()->documents();
//if is open, close
for(auto doc : openDocuments)
{
if(doc->url().adjusted(QUrl::RemoveScheme) == QUrl(path).adjusted(QUrl::RemoveScheme))
{
const QList<KTextEditor::Document *> openDocuments = KTextEditor::Editor::instance()->application()->documents();
// if is open, close
for (auto doc : openDocuments) {
if (doc->url().adjusted(QUrl::RemoveScheme) == QUrl(path).adjusted(QUrl::RemoveScheme)) {
KTextEditor::Editor::instance()->application()->closeDocument(doc);
break;
}
......
......@@ -167,26 +167,23 @@ void KateProjectViewTree::addDirectory(const QModelIndex &idx, const QString &na
item->sortChildren(0);
}
void KateProjectViewTree::removeFile(const QModelIndex& idx, const QString& fullFilePath)
void KateProjectViewTree::removeFile(const QModelIndex &idx, const QString &fullFilePath)
{
auto proxyModel = static_cast<QSortFilterProxyModel *>(model());
auto index = proxyModel->mapToSource(idx);
auto item = m_project->model()->itemFromIndex(index);
QStandardItem* parent = item->parent();
QStandardItem *parent = item->parent();
/**
* Delete file
*/
QFile file(fullFilePath);
if(file.remove())//.moveToTrash()
if (file.remove()) //.moveToTrash()
{
if(parent != nullptr)
{
if (parent != nullptr) {
parent->removeRow(item->row());
parent->sortChildren(0);
}
else
{
} else {
m_project->model()->removeRow(item->row());
m_project->model()->sort(0);
}
......
......@@ -62,7 +62,7 @@ public:
* Add a new directory
*/
void addDirectory(const QModelIndex &idx, const QString &name);
/**
* remove a file, the function isn't closing document before removing'
*/
......
......@@ -438,10 +438,10 @@ QVector<QString> KateProjectWorker::filesFromGit(const QDir &dir, bool recursive
* ls-files untracked
*/
QStringList lsFilesUntrackedArgs{QStringLiteral("ls-files"),
QStringLiteral("-z"),
QStringLiteral("--others"),
QStringLiteral("--exclude-standard"),
QStringLiteral(".")};
QStringLiteral("-z"),
QStringLiteral("--others"),
QStringLiteral("--exclude-standard"),
QStringLiteral(".")};
/**
* for recent enough git versions ensure we don't show duplicated files
......
......@@ -17,7 +17,6 @@ public:
bool filterAcceptsRow(int sourceRow, const QModelIndex &parent) const override;
Q_SLOT void setFilterText(const QString &text);
};
#endif
......@@ -60,15 +60,20 @@ void KatePluginSymbolViewerView::parsePhpSymbols(void)
// defines: https://www.php.net/manual/en/function.define.php
static const QRegularExpression defineRegExp(QLatin1String("(^|\\W)define\\s*\\(\\s*['\"]([^'\"]+)['\"]"), QRegularExpression::CaseInsensitiveOption);
// classes: https://www.php.net/manual/en/language.oop5.php
static const QRegularExpression classRegExp(QLatin1String("^((abstract\\s+|final\\s+)?)class\\s+([\\w_][\\w\\d_]*)\\s*(implements\\s+[\\w\\d_]*|extends\\s+[\\w\\d_]*)?"), QRegularExpression::CaseInsensitiveOption);
static const QRegularExpression classRegExp(
QLatin1String("^((abstract\\s+|final\\s+)?)class\\s+([\\w_][\\w\\d_]*)\\s*(implements\\s+[\\w\\d_]*|extends\\s+[\\w\\d_]*)?"),
QRegularExpression::CaseInsensitiveOption);
// interfaces: https://www.php.net/manual/en/language.oop5.php
static const QRegularExpression interfaceRegExp(QLatin1String("^interface\\s+([\\w_][\\w\\d_]*)"), QRegularExpression::CaseInsensitiveOption);
// classes constants: https://www.php.net/manual/en/language.oop5.constants.php
static const QRegularExpression constantRegExp(QLatin1String("^const\\s+([\\w_][\\w\\d_]*)"), QRegularExpression::CaseInsensitiveOption);
// functions: https://www.php.net/manual/en/language.oop5.constants.php
static const QRegularExpression functionRegExp(QLatin1String("^(\\s*)((public|protected|private)?(\\s*static)?\\s+)?function\\s+&?\\s*([\\w_][\\w\\d_]*)\\s*(.*)$"), QRegularExpression::CaseInsensitiveOption);
static const QRegularExpression functionRegExp(
QLatin1String("^(\\s*)((public|protected|private)?(\\s*static)?\\s+)?function\\s+&?\\s*([\\w_][\\w\\d_]*)\\s*(.*)$"),
QRegularExpression::CaseInsensitiveOption);
// variables: https://www.php.net/manual/en/language.oop5.properties.php
static const QRegularExpression varRegExp(QLatin1String("^((var|public|protected|private)?(\\s*static)?\\s+)?\\$([\\w_][\\w\\d_]*)"), QRegularExpression::CaseInsensitiveOption);
static const QRegularExpression varRegExp(QLatin1String("^((var|public|protected|private)?(\\s*static)?\\s+)?\\$([\\w_][\\w\\d_]*)"),
QRegularExpression::CaseInsensitiveOption);
// function args detection: “function a($b, $c=null)” => “$b, $v”
static const QRegularExpression functionArgsRegExp(QLatin1String("(\\$[\\w_]+)"), QRegularExpression::CaseInsensitiveOption);
......@@ -185,7 +190,8 @@ void KatePluginSymbolViewerView::parsePhpSymbols(void)
if (m_typesOn->isChecked()) {
nameWithTypes = matchClass.captured(3);
if (!matchClass.captured(1).trimmed().isEmpty() && !matchClass.captured(4).trimmed().isEmpty()) {
nameWithTypes += QLatin1String(" [") + matchClass.captured(1).trimmed() + QLatin1Char(',') + matchClass.captured(4).trimmed() + QLatin1Char(']');
nameWithTypes +=
QLatin1String(" [") + matchClass.captured(1).trimmed() + QLatin1Char(',') + matchClass.captured(4).trimmed() + QLatin1Char(']');
} else if (!matchClass.captured(1).trimmed().isEmpty()) {
nameWithTypes += QLatin1String(" [") + matchClass.captured(1).trimmed() + QLatin1Char(']');
} else if (!matchClass.captured(4).trimmed().isEmpty()) {
......
......@@ -42,11 +42,11 @@
#include <KAboutData>
#include <KActionCollection>
#include <KConfigGroup>
#include <KLineEdit>
#include <KPluginFactory>
#include <KSharedConfig>
#include <KToggleAction>
#include <KXMLGUIFactory>
#include <KLineEdit>
#include <QAction>
#include <QLineEdit>
......@@ -398,14 +398,14 @@ void KatePluginSymbolViewerView::slotFilterChange(const QString &text)
{
QString filter = text.trimmed();
for (int i = 0; i < m_symbols->invisibleRootItem()->childCount(); ++i) {
QTreeWidgetItem * group_item = m_symbols->invisibleRootItem()->child(i);
QTreeWidgetItem *group_item = m_symbols->invisibleRootItem()->child(i);
for (int j = 0; j < group_item->childCount(); ++j) {
filterSymbols(group_item->child(j), filter);
}
}
}
bool KatePluginSymbolViewerView::filterSymbols(QTreeWidgetItem * item, const QString & filter)
bool KatePluginSymbolViewerView::filterSymbols(QTreeWidgetItem *item, const QString &filter)
{
bool at_least_one_child_shown = false;
for (int i = 0; i < item->childCount(); ++i) {
......
......@@ -35,11 +35,7 @@
#include <KLocalizedString>
enum class Symbol {
Function,
Class,
Method
};
enum class Symbol { Function, Class, Method };
class KLineEdit;
......
......@@ -79,8 +79,7 @@ void KatePluginSymbolViewerView::parsePythonSymbols(void)
} else {
match = function_regexp.match(cl);
if (match.hasMatch()) {
if (match.captured(1).isEmpty() ||
current_class_name.isEmpty() // case where function is declared inside a block
if (match.captured(1).isEmpty() || current_class_name.isEmpty() // case where function is declared inside a block
) {
type = Symbol::Function;
current_class_name.clear();
......
......@@ -433,7 +433,6 @@ void Sidebar::updateLastSizeOnResize()
ToolView *Sidebar::addWidget(const QIcon &icon, const QString &text, ToolView *widget)
{
if (widget) {
if (widget->sidebar() == this) {
return widget;
......
Supports Markdown
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