Skip to content

Commit a991e08

Browse files
committed
Reformated, updated clang-format file
1 parent 2bdc87c commit a991e08

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+345
-265
lines changed

.clang-format

+35-17
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,33 @@
11
---
22
Language: Cpp
3-
43
# BasedOnStyle: LLVM
54
AccessModifierOffset: -4
65
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: true
77
AlignConsecutiveAssignments: false
8+
# AlignConsecutiveBitFields : true
89
AlignConsecutiveDeclarations: false
910
AlignEscapedNewlinesLeft: false
1011
AlignOperands: true
11-
AlignTrailingComments: false
12-
AllowAllConstructorInitializersOnNextLine : true
12+
AlignTrailingComments: true
13+
AllowAllArgumentsOnNextLine: true
14+
AllowAllConstructorInitializersOnNextLine: true
1315
AllowAllParametersOfDeclarationOnNextLine: false
14-
AllowShortBlocksOnASingleLine: false
16+
AllowShortBlocksOnASingleLine: Never
1517
AllowShortCaseLabelsOnASingleLine: false
1618
AllowShortFunctionsOnASingleLine: None
17-
AllowShortIfStatementsOnASingleLine: false
18-
AllowShortLoopsOnASingleLine: true
19+
AllowShortLambdasOnASingleLine: None
20+
AllowShortIfStatementsOnASingleLine: Never
21+
# AllowShortEnumsOnASingleLine: false
22+
AllowShortLoopsOnASingleLine: false
1923
AlwaysBreakAfterDefinitionReturnType: None
2024
AlwaysBreakAfterReturnType: None
2125
AlwaysBreakBeforeMultilineStrings: false
2226
AlwaysBreakTemplateDeclarations: true
2327
BinPackArguments: false
2428
BinPackParameters: false
25-
BraceWrapping:
26-
AfterCaseLabel: false
29+
BraceWrapping:
30+
AfterCaseLabel: true
2731
AfterClass: true
2832
AfterControlStatement: true
2933
AfterEnum: true
@@ -32,47 +36,55 @@ BraceWrapping:
3236
AfterObjCDeclaration: false
3337
AfterStruct: true
3438
AfterUnion: true
39+
AfterExternBlock: false
3540
BeforeCatch: false
3641
BeforeElse: true
3742
IndentBraces: false
3843
SplitEmptyFunction: true
3944
SplitEmptyRecord: true
4045
SplitEmptyNamespace: true
41-
BreakBeforeBinaryOperators: None
46+
BreakBeforeBinaryOperators: NonAssignment
4247
BreakBeforeBraces: Allman
4348
BreakBeforeInheritanceComma: false
4449
BreakInheritanceList: BeforeColon
4550
BreakBeforeTernaryOperators: true
4651
BreakConstructorInitializersBeforeComma: true
47-
BreakConstructorInitializers: BeforeColon
52+
BreakConstructorInitializers: BeforeComma
4853
BreakAfterJavaFieldAnnotations: false
4954
BreakStringLiterals: true
50-
ColumnLimit: 200
55+
ColumnLimit: 180
5156
CommentPragmas: '^ IWYU pragma:'
5257
CompactNamespaces: false
5358
ConstructorInitializerAllOnOneLineOrOnePerLine: false
5459
ConstructorInitializerIndentWidth: 4
5560
ContinuationIndentWidth: 4
5661
Cpp11BracedListStyle: true
62+
DeriveLineEnding: true
5763
DerivePointerAlignment: false
5864
DisableFormat: false
5965
ExperimentalAutoDetectBinPacking: false
6066
FixNamespaceComments: true
61-
ForEachMacros:
67+
ForEachMacros:
6268
- foreach
6369
- Q_FOREACH
6470
- BOOST_FOREACH
6571
IncludeBlocks: Preserve
66-
IncludeCategories:
72+
IncludeCategories:
6773
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
6874
Priority: 2
75+
SortPriority: 0
6976
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
7077
Priority: 3
78+
SortPriority: 0
7179
- Regex: '.*'
7280
Priority: 1
81+
SortPriority: 0
7382
IncludeIsMainRegex: '(Test)?$'
74-
IndentCaseLabels: false
75-
IndentPPDirectives: None
83+
IncludeIsMainSourceRegex: ''
84+
IndentCaseLabels: true
85+
# IndentCaseBlocks: false
86+
IndentGotoLabels: true
87+
IndentPPDirectives: AfterHash
7688
IndentWidth: 4
7789
IndentWrappedFunctionNames: false
7890
JavaScriptQuotes: Leave
@@ -107,16 +119,22 @@ SpaceBeforeCtorInitializerColon: true
107119
SpaceBeforeInheritanceColon: true
108120
SpaceBeforeParens: ControlStatements
109121
SpaceBeforeRangeBasedForLoopColon: true
122+
SpaceInEmptyBlock: false
110123
SpaceInEmptyParentheses: false
111-
SpacesBeforeTrailingComments: 1
124+
SpacesBeforeTrailingComments: 2
112125
SpacesInAngles: false
126+
SpacesInConditionalStatement: false
113127
SpacesInContainerLiterals: true
114128
SpacesInCStyleCastParentheses: false
115129
SpacesInParentheses: false
116130
SpacesInSquareBrackets: false
131+
SpaceBeforeSquareBrackets: false
117132
Standard: Cpp11
118-
StatementMacros:
133+
StatementMacros:
119134
- Q_UNUSED
120135
- QT_REQUIRE_VERSION
121136
TabWidth: 4
137+
UseCRLF: false
122138
UseTab: Never
139+
...
140+

src/editor/codeeditor/codeeditor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ int CodeEditor::search(const QVariant &searchTerm, SearchFlags flags)
490490

491491
controller->update();
492492

493-
return controller->borderedTextRanges()->rangeCount(); // return the number of occurences found
493+
return controller->borderedTextRanges()->rangeCount(); // return the number of occurences found
494494
}
495495

496496
void CodeEditor::searchNext()

src/editor/codeeditor/codeeditor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,4 @@ protected slots:
9696
void notifyModificationChanged();
9797
};
9898

99-
#endif // CODEEDITOR_H
99+
#endif // CODEEDITOR_H

src/editor/codeeditor/codeeditormargindelegate.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ void CodeEditorMarginDelegate::renderAfter(QPainter *painter, int startLine, int
7777
else
7878
{
7979
linearGrad.setFinalStop(QPointF(widthBar, 0));
80-
linearGrad.setColorAt(0, QColor(0, 60, 180, 255)); // blue
80+
linearGrad.setColorAt(0, QColor(0, 60, 180, 255)); // blue
8181
painter->fillRect(QRect(0, start, widthBar, end - start), QBrush(linearGrad));
8282
}
8383
linearGrad.setFinalStop(QPointF(width - 8, 0));
84-
linearGrad.setColorAt(0, QColor(255, 0, 0, 255)); // red
84+
linearGrad.setColorAt(0, QColor(255, 0, 0, 255)); // red
8585
painter->fillRect(QRect(0, l - 1, width - 8, 2), QBrush(linearGrad));
8686
}
8787
else
@@ -98,13 +98,13 @@ void CodeEditorMarginDelegate::renderAfter(QPainter *painter, int startLine, int
9898
l = start;
9999
}
100100
linearGrad.setFinalStop(QPointF(widthBar, 0));
101-
linearGrad.setColorAt(0, QColor(0, 128, 0, 255)); // green
101+
linearGrad.setColorAt(0, QColor(0, 128, 0, 255)); // green
102102
painter->fillRect(QRect(0, l, widthBar, end - l), QBrush(linearGrad));
103103
}
104104
if (l != start)
105105
{
106106
linearGrad.setFinalStop(QPointF(widthBar, 0));
107-
linearGrad.setColorAt(0, QColor(0, 60, 180, 255)); // blue
107+
linearGrad.setColorAt(0, QColor(0, 60, 180, 255)); // blue
108108
painter->fillRect(QRect(0, start, widthBar, l - start), QBrush(linearGrad));
109109
}
110110
}
@@ -128,7 +128,8 @@ void CodeEditorMarginDelegate::mousePressEvent(int line, QMouseEvent *event)
128128
return;
129129
}
130130
QMenu menu;
131-
foreach (QString line, changesForRange.at(0)->removedLines()) menu.addAction(line);
131+
foreach (QString line, changesForRange.at(0)->removedLines())
132+
menu.addAction(line);
132133
menu.exec(event->screenPos().toPoint());
133134
}
134135
}

src/editor/codeeditor/codeeditormargindelegate.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,4 @@ class CodeEditorMarginDelegate : public edbee::TextMarginComponentDelegate
4545
void mousePressEvent(int line, QMouseEvent *event) override;
4646
};
4747

48-
#endif // CODEEDITORMARGINDELEGATE_H
48+
#endif // CODEEDITORMARGINDELEGATE_H

src/editor/codeeditor/codeeditorscrollbar.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ class CodeEditorScrollBar : public QScrollBar
4646
edbee::TextRenderer *_textRender;
4747
};
4848

49-
#endif // CODEEDITORSCROLLBAR_H
49+
#endif // CODEEDITORSCROLLBAR_H

src/editor/codeeditor/htmleditor.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
#include <QDebug>
2222

2323
#ifdef WEBENGINE
24-
#include <QWebEngineView>
24+
# include <QWebEngineView>
2525
#endif
2626
#ifdef WEBKIT
27-
#include <QWebView>
27+
# include <QWebView>
2828
#endif
2929
#ifdef NOWEBKIT
30-
#include <QTextBrowser>
30+
# include <QTextBrowser>
3131
#endif
3232

3333
#include "edbee/models/textdocument.h"

src/editor/codeeditor/htmleditor.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
#include "codeeditor.h"
2323

2424
#ifndef NOWEBKIT
25-
#if !defined(WEBENGINE) && !defined(WEBKIT)
26-
#define NOWEBKIT
27-
#endif
25+
# if !defined(WEBENGINE) && !defined(WEBKIT)
26+
# define NOWEBKIT
27+
# endif
2828
#endif
2929

3030
#ifdef WEBENGINE
@@ -66,4 +66,4 @@ protected slots:
6666
#endif
6767
};
6868

69-
#endif // HTMLEDITOR_H
69+
#endif // HTMLEDITOR_H

src/editor/codeeditor/markdowneditor.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
#include "markdowneditor.h"
2020

2121
#ifdef WEBENGINE
22-
#include <QWebEngineView>
22+
# include <QWebEngineView>
2323
#endif
2424
#ifdef WEBKIT
25-
#include <QWebView>
25+
# include <QWebView>
2626
#endif
2727
#ifdef NOWEBKIT
28-
#include <QTextBrowser>
28+
# include <QTextBrowser>
2929
#endif
3030

3131
#include <QtConcurrent/QtConcurrent>

src/editor/codeeditor/markdowneditor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ protected slots:
4040
QByteArray renderProcess(const QByteArray &textIn);
4141
};
4242

43-
#endif // MARKDOWNEDITOR_H
43+
#endif // MARKDOWNEDITOR_H

src/editor/editor.cpp

+16-16
Original file line numberDiff line numberDiff line change
@@ -312,26 +312,26 @@ Editor *Editor::createEditor(Editor::Type type, Project *project, QWidget *paren
312312
{
313313
switch (type)
314314
{
315-
case Editor::Code:
316-
return new CodeEditor(project, parent);
315+
case Editor::Code:
316+
return new CodeEditor(project, parent);
317317

318-
case Editor::HexFile:
319-
return new HexFileEditor(project, parent);
318+
case Editor::HexFile:
319+
return new HexFileEditor(project, parent);
320320

321-
case Editor::Hexa:
322-
return new HexEditor(project, parent);
321+
case Editor::Hexa:
322+
return new HexEditor(project, parent);
323323

324-
case Editor::HTML:
325-
return new HtmlEditor(project, parent);
324+
case Editor::HTML:
325+
return new HtmlEditor(project, parent);
326326

327-
case Editor::Markdown:
328-
return new MarkdownEditor(project, parent);
327+
case Editor::Markdown:
328+
return new MarkdownEditor(project, parent);
329329

330-
case Editor::Image:
331-
return new ImageEditor(project, parent);
330+
case Editor::Image:
331+
return new ImageEditor(project, parent);
332332

333-
case Editor::ELF:
334-
break;
333+
case Editor::ELF:
334+
break;
335335
}
336336
return nullptr;
337337
}
@@ -380,8 +380,8 @@ Editor::Type Editor::typeFromPath(const QString &filePath)
380380
{
381381
type = Editor::Markdown;
382382
}
383-
else if (mime.name().startsWith("text") || mime.name() == "application/xml" || mime.name() == "application/x-yaml" || mime.name() == "application/x-shellscript" ||
384-
mime.name() == "application/javascript" || mime.name() == "application/json" || mime.name() == "application/x-php" || filePath.endsWith(".eds") || file.size() == 0)
383+
else if (mime.name().startsWith("text") || mime.name() == "application/xml" || mime.name() == "application/x-yaml" || mime.name() == "application/x-shellscript"
384+
|| mime.name() == "application/javascript" || mime.name() == "application/json" || mime.name() == "application/x-php" || filePath.endsWith(".eds") || file.size() == 0)
385385
{
386386
type = Editor::Code;
387387
}

src/editor/editor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,4 @@ protected slots:
145145
virtual int saveFileData(const QString &filePath = QString()) = 0;
146146
};
147147

148-
#endif // EDITOR_H
148+
#endif // EDITOR_H

src/editor/editors.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@
2626
#include "hexfileeditor.h"
2727
#include "imageeditor.h"
2828

29-
#endif // EDITORS_H
29+
#endif // EDITORS_H

src/editor/editortabswitchwidget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ protected slots:
4242
int _id;
4343
};
4444

45-
#endif // EDITORTABSWITCHWIDGET_H
45+
#endif // EDITORTABSWITCHWIDGET_H

src/editor/editortabwidget.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,11 @@ int EditorTabWidget::closeEditor(int id)
275275
const QString &path = QFileInfo(editor->filePath()).absoluteFilePath();
276276
if (editor->isModified())
277277
{
278-
int response = QMessageBox::question(
279-
this, tr("File modified"), tr("File '%1' has been modified, do you want to save it?").arg(editor->fileName()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Abort, QMessageBox::Yes);
278+
int response = QMessageBox::question(this,
279+
tr("File modified"),
280+
tr("File '%1' has been modified, do you want to save it?").arg(editor->fileName()),
281+
QMessageBox::Yes | QMessageBox::No | QMessageBox::Abort,
282+
QMessageBox::Yes);
280283
if (response == QMessageBox::Abort)
281284
{
282285
return -2;
@@ -614,7 +617,8 @@ bool EditorTabWidget::eventFilter(QObject *o, QEvent *e)
614617
if (e->type() == QEvent::KeyPress || e->type() == QEvent::KeyRelease)
615618
{
616619
QKeyEvent *keyEvent = dynamic_cast<QKeyEvent *>(e);
617-
if (!_switchTabActive && e->type() == QEvent::KeyPress && ((keyEvent->modifiers() & Qt::ControlModifier) != 0u) && (keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab))
620+
if (!_switchTabActive && e->type() == QEvent::KeyPress && ((keyEvent->modifiers() & Qt::ControlModifier) != 0u)
621+
&& (keyEvent->key() == Qt::Key_Tab || keyEvent->key() == Qt::Key_Backtab))
618622
{
619623
initiateSwitchTab(!(keyEvent->modifiers() & Qt::ShiftModifier));
620624
}
@@ -686,5 +690,5 @@ void EditorTabWidget::resizeEvent(QResizeEvent *event)
686690

687691
void EditorTabWidget::keyPressEvent(QKeyEvent *event)
688692
{
689-
QWidget::keyPressEvent(event); // disable QTabWidget Ctrl + tab
693+
QWidget::keyPressEvent(event); // disable QTabWidget Ctrl + tab
690694
}

src/editor/editortabwidget.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ protected slots:
104104
void keyPressEvent(QKeyEvent *event) override;
105105
};
106106

107-
#endif // EDITORTABWIDGET_H
107+
#endif // EDITORTABWIDGET_H

src/editor/hexeditor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ protected slots:
5959
void pasteCommand() override;
6060
};
6161

62-
#endif // HEXEDITOR_H
62+
#endif // HEXEDITOR_H

src/editor/hexfile.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,4 @@ class HexFile
3838
unsigned short _checksum;
3939
};
4040

41-
#endif // HEXFILE_H
41+
#endif // HEXFILE_H

src/editor/hexfileeditor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ protected slots:
4242
void updatePos() override;
4343
};
4444

45-
#endif // HEXFILEEDITOR_H
45+
#endif // HEXFILEEDITOR_H

src/editor/imageeditor.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@ class ImageEditor : public Editor
4848
int saveFileData(const QString &filePath = QString()) override;
4949
};
5050

51-
#endif // IMAGEEDITOR_H
51+
#endif // IMAGEEDITOR_H

0 commit comments

Comments
 (0)