Skip to content

Commit

Permalink
playing with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
uwerat committed Aug 3, 2018
1 parent 68bc2f0 commit 0a92cb8
Show file tree
Hide file tree
Showing 335 changed files with 3,834 additions and 3,708 deletions.
116 changes: 116 additions & 0 deletions .clang-format
@@ -0,0 +1,116 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: false
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
#AllowShortFunctionsOnASingleLine: InlineOnly
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: true
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: false
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: true
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: true
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: true
SpacesInParentheses: true
SpacesInSquareBrackets: true
Standard: Cpp11
TabWidth: 4
UseTab: Never
...

10 changes: 5 additions & 5 deletions examples/automotive/ButtonBar.cpp
Expand Up @@ -8,9 +8,9 @@ QSK_SUBCONTROL( ButtonBar, Indicator )

class IndicatorLabel final : public QskGraphicLabel
{
public:
IndicatorLabel( QQuickItem* parentItem = nullptr ):
QskGraphicLabel( parentItem )
public:
IndicatorLabel( QQuickItem* parentItem = nullptr )
: QskGraphicLabel( parentItem )
{
// so the skins are able to colorize them
setGraphicRole( SkinFactory::Indicator );
Expand All @@ -28,8 +28,8 @@ class IndicatorLabel final : public QskGraphicLabel
}
};

ButtonBar::ButtonBar( QQuickItem* parentItem ):
QskLinearBox( parentItem )
ButtonBar::ButtonBar( QQuickItem* parentItem )
: QskLinearBox( parentItem )
{
QColor c( Qt::black );
c.setAlphaF( 0.5 );
Expand Down
4 changes: 2 additions & 2 deletions examples/automotive/ButtonBar.h
Expand Up @@ -5,13 +5,13 @@

class ButtonBar : public QskLinearBox
{
public:
public:
QSK_SUBCONTROLS( Indicator )

ButtonBar( QQuickItem* = nullptr );
void addIndicator( const char* name );

protected:
protected:
QSizeF contentsSizeHint() const override;
};

Expand Down
40 changes: 18 additions & 22 deletions examples/automotive/DefaultSkin.cpp
@@ -1,29 +1,29 @@
#include "DefaultSkin.h"

#include "ButtonBar.h"
#include "SkinFactory.h"
#include "SoundControl.h"
#include "ButtonBar.h"

#include "Speedometer.h"
#include "SpeedometerSkinlet.h"

#include <QskBox.h>
#include <QskBoxBorderColors.h>
#include <QskBoxBorderMetrics.h>
#include <QskColorFilter.h>
#include <QskFunctions.h>
#include <QskMargins.h>
#include <QskPushButton.h>
#include <QskSeparator.h>
#include <QskSkinTransition.h>
#include <QskSlider.h>
#include <QskTextLabel.h>
#include <QskSeparator.h>
#include <QskColorFilter.h>
#include <QskMargins.h>
#include <QskBoxBorderMetrics.h>
#include <QskBoxBorderColors.h>

#include <QDebug>

class Transition final : public QskSkinTransition
{
protected:
protected:
void updateSkin( QskSkin*, QskSkin* newSkin ) override
{
DefaultSkin* skin = static_cast< DefaultSkin* >( newSkin );
Expand All @@ -33,8 +33,7 @@ class Transition final : public QskSkinTransition

class Palette
{
public:

public:
Palette( DefaultSkin::Scheme scheme = DefaultSkin::Daylight )
{
if ( scheme == DefaultSkin::Daylight )
Expand Down Expand Up @@ -62,11 +61,10 @@ class Palette
QColor color3;
QColor color4;
QColor color5;

};

namespace {

namespace
{
static inline QFont qskFont( qreal pointSize )
{
QFont font( "Roboto" );
Expand All @@ -76,11 +74,11 @@ namespace {

} // namespace

DefaultSkin::DefaultSkin( const QString& name, QObject* parent ):
QskSkin( parent ),
m_name( name ),
m_palette( new Palette ),
m_scheme( Daylight )
DefaultSkin::DefaultSkin( const QString& name, QObject* parent )
: QskSkin( parent )
, m_name( name )
, m_palette( new Palette )
, m_scheme( Daylight )
{
setObjectName( "DefaultSkin" );
declareSkinlet< Speedometer, SpeedometerSkinlet >();
Expand Down Expand Up @@ -155,9 +153,9 @@ void DefaultSkin::initHints()

setBoxBorderMetrics( Speedometer::NeedleHead, 2 );
setMetric( Speedometer::NeedleHead | QskAspect::Size, 15 );
setGradient( Speedometer::NeedleHead, QskGradient( QskGradient::Diagonal,
m_palette->color2, m_palette->color1 ) );
// setBoxBorderColors( Speedometer::NeedleHead, m_palette->color4 );
setGradient( Speedometer::NeedleHead,
QskGradient( QskGradient::Diagonal, m_palette->color2, m_palette->color1 ) );
// setBoxBorderColors( Speedometer::NeedleHead, m_palette->color4 );

setMetric( Speedometer::Needle | QskAspect::MinimumWidth, 2 );
setMetric( Speedometer::Needle | QskAspect::Margin, 10 );
Expand All @@ -170,7 +168,6 @@ void DefaultSkin::initHints()
setColor( Speedometer::Labels, m_palette->color4 );
setFontRole( Speedometer::Labels, QskSkin::SmallFont );


// handle expanding, when being pressed
for ( auto state : { QskAspect::NoState, QskSlider::Pressed } )
{
Expand Down Expand Up @@ -217,4 +214,3 @@ void DefaultSkin::resetHints()
m_palette = new Palette( m_scheme );
initHints();
}

4 changes: 2 additions & 2 deletions examples/automotive/DefaultSkin.h
Expand Up @@ -7,7 +7,7 @@ class Palette;

class DefaultSkin : public QskSkin
{
public:
public:
DefaultSkin( const QString& name, QObject* parent = nullptr );
~DefaultSkin() override;

Expand All @@ -20,7 +20,7 @@ class DefaultSkin : public QskSkin
Nighttime
};

private:
private:
void initHints();

QString m_name;
Expand Down
2 changes: 1 addition & 1 deletion examples/automotive/MainWindow.cpp
Expand Up @@ -48,7 +48,7 @@ QQuickItem* MainWindow::headerBar() const
header->addIndicator( "location" );
header->addIndicator( "phone" );

(void) new QskTextLabel( QDate::currentDate().toString(), header );
( void ) new QskTextLabel( QDate::currentDate().toString(), header );

header->addIndicator( "user" );
header->addIndicator( "bookmark" );
Expand Down
4 changes: 2 additions & 2 deletions examples/automotive/MainWindow.h
Expand Up @@ -7,10 +7,10 @@ class QQuickItem;

class MainWindow : public QskWindow
{
public:
public:
MainWindow();

private:
private:
QQuickItem* headerBar() const;
QQuickItem* mainContent() const;
QQuickItem* footerBar() const;
Expand Down
37 changes: 17 additions & 20 deletions examples/automotive/OtherSkin.cpp
@@ -1,30 +1,29 @@
#include "OtherSkin.h"
#include "SkinFactory.h"

#include "SoundControl.h"
#include "ButtonBar.h"
#include "SoundControl.h"

#include "Speedometer.h"
#include "SpeedometerSkinlet.h"

#include <QskBox.h>
#include <QskBoxBorderColors.h>
#include <QskBoxBorderMetrics.h>
#include <QskColorFilter.h>
#include <QskFunctions.h>
#include <QskMargins.h>
#include <QskPushButton.h>
#include <QskSeparator.h>
#include <QskSkinTransition.h>
#include <QskSlider.h>
#include <QskTextLabel.h>
#include <QskSeparator.h>
#include <QskColorFilter.h>
#include <QskMargins.h>
#include <QskBoxBorderColors.h>
#include <QskBoxBorderMetrics.h>

#include <QDebug>

class Palette
{
public:

public:
Palette()
{
// grey-blue-yellow:
Expand All @@ -40,24 +39,22 @@ class Palette
QColor color3;
QColor color4;
QColor color5;

};

namespace {

namespace
{
static inline QFont qskFont( qreal pointSize )
{
QFont font( "Roboto" );
font.setPointSizeF( pointSize / qskDpiScaled( 1.0 ) );
return font;
}

}

OtherSkin::OtherSkin( const QString& name, QObject* parent ):
QskSkin( parent ),
m_name( name ),
m_palette( new Palette )
OtherSkin::OtherSkin( const QString& name, QObject* parent )
: QskSkin( parent )
, m_name( name )
, m_palette( new Palette )
{
setObjectName( "OtherSkin" );
declareSkinlet< Speedometer, SpeedometerSkinlet >();
Expand Down Expand Up @@ -113,8 +110,8 @@ void OtherSkin::initHints()
setGradient( SoundControl::Overlay, overlayColor );

// -- slider control buttons
setBoxBorderMetrics( SoundControl::SliderControl, 0 );
setBoxShape( SoundControl::SliderControl, 4 );
setBoxBorderMetrics( SoundControl::SliderControl, 0 );
setBoxShape( SoundControl::SliderControl, 4 );

setGradient( SoundControl::SliderControl, m_palette->color1 );
setGradient( SoundControl::SliderControl | QskPushButton::Pressed, m_palette->color2 );
Expand Down Expand Up @@ -144,8 +141,8 @@ void OtherSkin::initHints()
// -- speedometers

setBoxBorderMetrics( Speedometer::Panel, 5 );
setGradient( Speedometer::Panel, QskGradient( QskGradient::Vertical,
m_palette->color2, m_palette->color4 ) );
setGradient( Speedometer::Panel,
QskGradient( QskGradient::Vertical, m_palette->color2, m_palette->color4 ) );
setBoxBorderColors( Speedometer::Panel, m_palette->color3 );

setBoxBorderMetrics( Speedometer::NeedleHead, 5 );
Expand Down

0 comments on commit 0a92cb8

Please sign in to comment.