Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clang format #423

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# .clang-format for Qt Creator
#
# This is for clang-format >= 5.0.
#
# The configuration below follows the Qt Creator Coding Rules [1] as closely as
# possible. For documentation of the options, see [2].
#
# Use ../../tests/manual/clang-format-for-qtc/test.cpp for documenting problems
# or testing changes.
#
# In case you update this configuration please also update the qtcStyle() in src\plugins\clangformat\clangformatutils.cpp
#
# [1] https://doc-snapshots.qt.io/qtcreator-extending/coding-style.html
# [2] https://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- forever # avoids { wrapped to next line
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
# Do not add QT_BEGIN_NAMESPACE/QT_END_NAMESPACE as this will indent lines in between.
MacroBlockBegin: ""
MacroBlockEnd: ""
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 150
PenaltyBreakBeforeFirstCallParameter: 300
PenaltyBreakComment: 500
PenaltyBreakFirstLessLess: 400
PenaltyBreakString: 600
PenaltyExcessCharacter: 50
PenaltyReturnTypeOnItsOwnLine: 300
PointerAlignment: Right
ReflowComments: false
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never
3 changes: 3 additions & 0 deletions format_source_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
find . -regex './src/.*\(cpp\|h\)' -exec clang-format -style=file -i {} \;

6 changes: 3 additions & 3 deletions src/project_manager/remove_directory_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

using namespace Core;

RemoveDirectoryDialog::RemoveDirectoryDialog(const QString &filePath, QWidget *parent) :
QDialog(parent),
m_ui(new Ui::RemoveDirectoryDialog)
RemoveDirectoryDialog::RemoveDirectoryDialog(const QString &filePath, QWidget *parent)
: QDialog(parent)
, m_ui(new Ui::RemoveDirectoryDialog)
{
m_ui->setupUi(this);
m_ui->directoryNameLabel->setText(QDir::toNativeSeparators(filePath));
Expand Down
23 changes: 12 additions & 11 deletions src/project_manager/remove_directory_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,36 @@
#include <QDialog>

namespace Core {
namespace Ui { class RemoveDirectoryDialog;}
namespace Ui {
class RemoveDirectoryDialog;
}

/**
* @brief This a remove directory dialog for deleting directories.
*/
class CORE_EXPORT RemoveDirectoryDialog : public QDialog
{
Q_OBJECT
Q_OBJECT
public:
explicit RemoveDirectoryDialog(const QString &filePath, QWidget *parent = 0);
virtual ~RemoveDirectoryDialog();
explicit RemoveDirectoryDialog(const QString &filePath, QWidget *parent = 0);
virtual ~RemoveDirectoryDialog();

/**
/**
* @brief Set whether to display the checkbox allowing the user to permanently delete the directory/
* @param visible a bool.
*/
void setDeleteDirectoryVisible(bool visible);
void setDeleteDirectoryVisible(bool visible);

/**
/**
* @brief Get the status of the permanent delete checkbox.
* @return a bool.
*/
bool isDeleteDirectoryChecked() const;
bool isDeleteDirectoryChecked() const;

private:
Ui::RemoveDirectoryDialog *m_ui; /**< The remove directory Ui */

Ui::RemoveDirectoryDialog *m_ui; /**< The remove directory Ui */
};

}
} // namespace Core

#endif // REMOVE_DIRECTORY_DIALOG_H
Loading