hmi-demo code uncrustified

This commit is contained in:
Uwe Rathmann 2017-07-25 10:47:40 +02:00
parent fffc983bb7
commit d3be6aaa27
9 changed files with 68 additions and 63 deletions

View File

@ -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();

View File

@ -14,7 +14,8 @@ public:
void toggleScheme();
void resetColors();
enum Scheme {
enum Scheme
{
Daylight,
Nighttime
};

View File

@ -12,15 +12,16 @@
#include <QDate>
#include <QTimer>
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 ) );
}
}

View File

@ -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()

View File

@ -8,8 +8,9 @@
#include <QskTabButton.h>
#include <QskTextLabel.h>
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 );

View File

@ -6,7 +6,7 @@
class RadioControl : public QskControl
{
public:
RadioControl( QQuickItem *parent = nullptr );
RadioControl( QQuickItem* parent = nullptr );
private:
QString m_currentBand;

View File

@ -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 );

View File

@ -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

View File

@ -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();
}