From d3be6aaa27d4a6f84d66b9dc426cf347c91fa1e8 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 25 Jul 2017 10:47:40 +0200 Subject: [PATCH] hmi-demo code uncrustified --- examples/hmi-demo/DefaultSkin.cpp | 22 ++++++------ examples/hmi-demo/DefaultSkin.h | 3 +- examples/hmi-demo/MainWindow.cpp | 9 ++--- examples/hmi-demo/OtherSkin.cpp | 21 ++++++------ examples/hmi-demo/RadioControl.cpp | 5 +-- examples/hmi-demo/RadioControl.h | 2 +- examples/hmi-demo/SoundControl.cpp | 8 +++-- examples/hmi-demo/SoundControl.h | 6 ++-- examples/hmi-demo/main.cpp | 55 +++++++++++++++--------------- 9 files changed, 68 insertions(+), 63 deletions(-) diff --git a/examples/hmi-demo/DefaultSkin.cpp b/examples/hmi-demo/DefaultSkin.cpp index 7bcd83ba..e8d93241 100644 --- a/examples/hmi-demo/DefaultSkin.cpp +++ b/examples/hmi-demo/DefaultSkin.cpp @@ -56,20 +56,20 @@ public: namespace { -static inline QFont qskFont( int pointSize ) -{ - QFont font( "Roboto" ); - font.setPointSize( pointSize / qskDpiScaled( 1.0 ) ); - return font; -} + static inline QFont qskFont( int pointSize ) + { + QFont font( "Roboto" ); + font.setPointSize( pointSize / qskDpiScaled( 1.0 ) ); + return font; + } } -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" ); initHints(); diff --git a/examples/hmi-demo/DefaultSkin.h b/examples/hmi-demo/DefaultSkin.h index 7d817a0e..1a8b6eef 100644 --- a/examples/hmi-demo/DefaultSkin.h +++ b/examples/hmi-demo/DefaultSkin.h @@ -14,7 +14,8 @@ public: void toggleScheme(); void resetColors(); - enum Scheme { + enum Scheme + { Daylight, Nighttime }; diff --git a/examples/hmi-demo/MainWindow.cpp b/examples/hmi-demo/MainWindow.cpp index 5cd82954..c7d07a54 100644 --- a/examples/hmi-demo/MainWindow.cpp +++ b/examples/hmi-demo/MainWindow.cpp @@ -12,15 +12,16 @@ #include #include -namespace { +namespace +{ void addIcon( QskLayout* layout, const QString& fileName ) { - QImage buildIcon( fileName ); - QskGraphic graphic = QskGraphic::fromImage( buildIcon ); + const QImage buildIcon( fileName ); + QskGraphicLabel* buildLabel = new QskGraphicLabel( layout ); buildLabel->setFixedSize( 76, 36 ); buildLabel->setMargins( QMarginsF( 20, 7, 20, 7 ) ); - buildLabel->setGraphic( graphic ); + buildLabel->setGraphic( QskGraphic::fromImage( buildIcon ) ); } } diff --git a/examples/hmi-demo/OtherSkin.cpp b/examples/hmi-demo/OtherSkin.cpp index 9adf0ae9..d07cfc65 100644 --- a/examples/hmi-demo/OtherSkin.cpp +++ b/examples/hmi-demo/OtherSkin.cpp @@ -33,19 +33,19 @@ public: namespace { -static inline QFont qskFont( int pointSize ) -{ - QFont font( "Roboto" ); - font.setPointSize( pointSize / qskDpiScaled( 1.0 ) ); - return font; -} + static inline QFont qskFont( int pointSize ) + { + QFont font( "Roboto" ); + font.setPointSize( 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" ); initHints(); @@ -75,7 +75,6 @@ void OtherSkin::initHints() setColor( BalanceFadeBox::Panel, m_palette->color5 ); setMetric( BalanceFadeBox::Panel | QskAspect::Radius, 15 ); - } OtherSkin::~OtherSkin() diff --git a/examples/hmi-demo/RadioControl.cpp b/examples/hmi-demo/RadioControl.cpp index 0d69a1f9..a549eb90 100644 --- a/examples/hmi-demo/RadioControl.cpp +++ b/examples/hmi-demo/RadioControl.cpp @@ -8,8 +8,9 @@ #include #include -RadioControl::RadioControl( QQuickItem* parent ) : QskControl( parent ) - , m_currentBand( "FM" ) +RadioControl::RadioControl( QQuickItem* parent ): + QskControl( parent ), + m_currentBand( "FM" ) { setMargins( QMarginsF( 40, 30, 40, 30 ) ); setAutoLayoutChildren( true ); diff --git a/examples/hmi-demo/RadioControl.h b/examples/hmi-demo/RadioControl.h index e795b177..b205cd9c 100644 --- a/examples/hmi-demo/RadioControl.h +++ b/examples/hmi-demo/RadioControl.h @@ -6,7 +6,7 @@ class RadioControl : public QskControl { public: - RadioControl( QQuickItem *parent = nullptr ); + RadioControl( QQuickItem* parent = nullptr ); private: QString m_currentBand; diff --git a/examples/hmi-demo/SoundControl.cpp b/examples/hmi-demo/SoundControl.cpp index ed25c95e..916eec33 100644 --- a/examples/hmi-demo/SoundControl.cpp +++ b/examples/hmi-demo/SoundControl.cpp @@ -26,7 +26,7 @@ QskAspect::Subcontrol FilledRectangle::effectiveSubcontrol( QSK_SUBCONTROL( BalanceFadeBox, Panel ) QskAspect::Subcontrol BalanceFadeBox::effectiveSubcontrol( - QskAspect::Subcontrol subControl ) const + QskAspect::Subcontrol subControl ) const { if ( subControl == QskPushButton::Panel ) return BalanceFadeBox::Panel; @@ -36,7 +36,8 @@ QskAspect::Subcontrol BalanceFadeBox::effectiveSubcontrol( class StackedControl : public QskControl { public: - StackedControl( QQuickItem* parent = nullptr ) : QskControl( parent ), + StackedControl( QQuickItem* parent = nullptr ): + QskControl( parent ), m_offset( 0.0, 0.0 ) { } @@ -95,7 +96,8 @@ private: QPointF m_offset; }; -SoundControl::SoundControl( QQuickItem *parent ) : QskControl( parent ) +SoundControl::SoundControl( QQuickItem* parent ): + QskControl( parent ) { setMargins( QMarginsF( 40, 20, 40, 20 ) ); setAutoLayoutChildren( true ); diff --git a/examples/hmi-demo/SoundControl.h b/examples/hmi-demo/SoundControl.h index 2ac431a7..18f177c3 100644 --- a/examples/hmi-demo/SoundControl.h +++ b/examples/hmi-demo/SoundControl.h @@ -12,7 +12,7 @@ class FilledRectangle : public QskPushButton // ### move to some main control fi public: QSK_SUBCONTROLS( Panel ) - FilledRectangle( QQuickItem* parent ) : QskPushButton( parent ) + FilledRectangle( QQuickItem* parent ): QskPushButton( parent ) { setFlat( true ); setFixedWidth( 80 ); // ### style @@ -27,7 +27,7 @@ class BalanceFadeBox : public QskPushButton public: QSK_SUBCONTROLS( Panel ) - BalanceFadeBox( QQuickItem* parent ) : QskPushButton( parent ) + BalanceFadeBox( QQuickItem* parent ): QskPushButton( parent ) { } @@ -38,7 +38,7 @@ public: class SoundControl : public QskControl { public: - SoundControl( QQuickItem *parent = nullptr ); + SoundControl( QQuickItem* parent = nullptr ); }; #endif // SOUNDCONTROL_H diff --git a/examples/hmi-demo/main.cpp b/examples/hmi-demo/main.cpp index 49b997c0..aefd73d9 100644 --- a/examples/hmi-demo/main.cpp +++ b/examples/hmi-demo/main.cpp @@ -12,43 +12,43 @@ namespace { -class SkinFactory : public QskSkinFactory -{ - Q_OBJECT + class SkinFactory : public QskSkinFactory + { + Q_OBJECT public: - SkinFactory() : QskSkinFactory() - { - } + SkinFactory(): QskSkinFactory() + { + } - virtual QStringList skinNames() const override final - { - return { "DefaultSkin", "OtherSkin" }; - } + virtual QStringList skinNames() const override final + { + return { "DefaultSkin", "OtherSkin" }; + } - virtual QskSkin* createSkin( const QString& skinName ) override - { - if ( skinName == "DefaultSkin" ) - return new DefaultSkin( skinName ); + virtual QskSkin* createSkin( const QString& skinName ) override + { + if ( skinName == "DefaultSkin" ) + return new DefaultSkin( skinName ); - if ( skinName == "OtherSkin" ) - return new OtherSkin( skinName ); + if ( skinName == "OtherSkin" ) + return new OtherSkin( skinName ); - return nullptr; - } + return nullptr; + } public Q_SLOTS: - void toggleScheme() - { - DefaultSkin* skin = static_cast< DefaultSkin* >( qskSetup->skin() ); - if ( skin ) - skin->toggleScheme(); - } -}; + void toggleScheme() + { + DefaultSkin* skin = static_cast< DefaultSkin* >( qskSetup->skin() ); + if ( skin ) + skin->toggleScheme(); + } + }; } -int main( int argc, char **argv ) +int main( int argc, char** argv ) { QGuiApplication app( argc, argv ); @@ -59,10 +59,11 @@ int main( int argc, char **argv ) SkinnyShortcut::enable( SkinnyShortcut::DebugBackground | SkinnyShortcut::Quit | SkinnyShortcut::RotateSkin ); QskShortcut::addShortcut( QKeySequence( Qt::CTRL + Qt::Key_T ), &skinFactory, - SLOT( toggleScheme() ), false ); + SLOT(toggleScheme()), false ); MainWindow mainWindow; mainWindow.show(); + return app.exec(); }