uncrustified

This commit is contained in:
Uwe Rathmann 2022-03-23 11:54:34 +01:00
parent 7f5d289808
commit 1cc0dff8d5
27 changed files with 1514 additions and 607 deletions

File diff suppressed because it is too large Load Diff

View File

@ -165,7 +165,8 @@ bool LightDisplay::arcContainsPoint( const QRectF& rect, const QPointF& point )
const int tolerance = 20; const int tolerance = 20;
// 1. check angle // 1. check angle
QPointF circlePos( point.x() - rect.center().x(), QPointF circlePos(
point.x() - rect.center().x(),
rect.center().y() - point.y() ); rect.center().y() - point.y() );
const qreal angle = angleFromPoint( rect, point ); const qreal angle = angleFromPoint( rect, point );

View File

@ -33,15 +33,15 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
QRectF rect = contentsRect; QRectF rect = contentsRect;
const qreal ticksSpacing = 4; // space between the ticks and the arc const qreal ticksSpacing = 4; // space between the ticks and the arc
if( subControl == LightDisplay::Groove if( subControl == LightDisplay::Groove || subControl == LightDisplay::Panel )
|| subControl == LightDisplay::Panel )
{ {
QSizeF textSize = textLabelsSize( display ); QSizeF textSize = textLabelsSize( display );
QskArcMetrics arcMetrics = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ); QskArcMetrics arcMetrics = display->arcMetricsHint( LightDisplay::ColdAndWarmArc );
const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing; const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing;
const qreal x = textSize.width() + arcMetrics.width() + ticksWidth; const qreal x = textSize.width() + arcMetrics.width() + ticksWidth;
const qreal w = contentsRect.width() - ( 2 * ( textSize.width() + arcMetrics.width() + ticksWidth ) ); const qreal w = contentsRect.width() -
( 2 * ( textSize.width() + arcMetrics.width() + ticksWidth ) );
const qreal y = arcMetrics.width() + ticksWidth; const qreal y = arcMetrics.width() + ticksWidth;
const qreal h = contentsRect.height() - 2 * ( arcMetrics.width() + ticksWidth ); const qreal h = contentsRect.height() - 2 * ( arcMetrics.width() + ticksWidth );
@ -52,24 +52,24 @@ QRectF LightDisplaySkinlet::subControlRect( const QskSkinnable* skinnable,
} }
else if( subControl == LightDisplay::ColdAndWarmArc ) else if( subControl == LightDisplay::ColdAndWarmArc )
{ {
const QRectF panelRect = subControlRect( skinnable, contentsRect, const QRectF panelRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel );
LightDisplay::Panel );
auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width(); auto barWidth = display->arcMetricsHint( LightDisplay::ColdAndWarmArc ).width();
auto rect = panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } ); auto rect = panelRect.marginsAdded( { barWidth, barWidth, barWidth, barWidth } );
return rect; return rect;
} }
else if( subControl == LightDisplay::Tickmarks ) else if( subControl == LightDisplay::Tickmarks )
{ {
const QRectF arcRect = subControlRect( skinnable, contentsRect, const QRectF arcRect = subControlRect(
LightDisplay::ColdAndWarmArc ); skinnable, contentsRect, LightDisplay::ColdAndWarmArc );
const qreal ticksWidth = display->arcMetricsHint( LightDisplay::Tickmarks ).width() + ticksSpacing; const qreal ticksWidth = display->arcMetricsHint(
const QRectF rect = arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } ); LightDisplay::Tickmarks ).width() + ticksSpacing;
const QRectF rect =
arcRect.marginsAdded( { ticksWidth, ticksWidth, ticksWidth, ticksWidth } );
return rect; return rect;
} }
else if( subControl == LightDisplay::ValueText ) else if( subControl == LightDisplay::ValueText )
{ {
QRectF valueTextRect = subControlRect( skinnable, contentsRect, QRectF valueTextRect = subControlRect( skinnable, contentsRect, LightDisplay::Panel );
LightDisplay::Panel );
const QFontMetricsF fm( skinnable->effectiveFont( subControl ) ); const QFontMetricsF fm( skinnable->effectiveFont( subControl ) );
const qreal fontWidth = fm.width( QStringLiteral( "100 %" ) ); const qreal fontWidth = fm.width( QStringLiteral( "100 %" ) );
const QPointF center = valueTextRect.center(); const QPointF center = valueTextRect.center();

View File

@ -125,7 +125,7 @@ QColor ShadowedBox::shadowColor() const
return m_shadowColor; return m_shadowColor;
} }
QRectF ShadowedBox::layoutRectForSize( const QSizeF &size ) const QRectF ShadowedBox::layoutRectForSize( const QSizeF& size ) const
{ {
auto padding = paddingHint( Panel ); auto padding = paddingHint( Panel );
return { padding.left() / 2, padding.top() / 2, return { padding.left() / 2, padding.top() / 2,

View File

@ -46,9 +46,9 @@ namespace
int compare( const QSGMaterial* other ) const override; int compare( const QSGMaterial* other ) const override;
QVector2D aspect = QVector2D{1.0, 1.0}; QVector2D aspect = QVector2D{ 1.0, 1.0 };
float blurExtent = 0.0; float blurExtent = 0.0;
QVector4D radius = QVector4D{0.0, 0.0, 0.0, 0.0}; QVector4D radius = QVector4D{ 0.0, 0.0, 0.0, 0.0 };
QColor color = Qt::black; QColor color = Qt::black;
}; };

View File

@ -46,9 +46,9 @@ namespace
int compare( const QSGMaterial* other ) const override; int compare( const QSGMaterial* other ) const override;
QVector2D aspect = QVector2D{1.0, 1.0}; QVector2D aspect = QVector2D{ 1.0, 1.0 };
float blurExtent = 0.0; float blurExtent = 0.0;
QVector4D radius = QVector4D{0.0, 0.0, 0.0, 0.0}; QVector4D radius = QVector4D{ 0.0, 0.0, 0.0, 0.0 };
QColor color = Qt::black; QColor color = Qt::black;
}; };

View File

@ -122,7 +122,7 @@ QRectF qskValidOrEmptyInnerRect( const QRectF& rect, const QMarginsF& margins )
return QRectF( x, y, w, h ); return QRectF( x, y, w, h );
} }
QRectF qskInterpolatedRect( const QRectF &from, const QRectF &to, qreal progress ) QRectF qskInterpolatedRect( const QRectF& from, const QRectF& to, qreal progress )
{ {
if ( progress <= 0.0 ) if ( progress <= 0.0 )
return from; return from;
@ -138,7 +138,7 @@ QRectF qskInterpolatedRect( const QRectF &from, const QRectF &to, qreal progress
return QRectF( x, y, w, h ); return QRectF( x, y, w, h );
} }
QSizeF qskInterpolatedSize( const QSizeF &from, const QSizeF &to, qreal progress ) QSizeF qskInterpolatedSize( const QSizeF& from, const QSizeF& to, qreal progress )
{ {
if ( progress <= 0.0 ) if ( progress <= 0.0 )
return from; return from;

View File

@ -119,7 +119,7 @@ bool qskIsStandardKeyInput( const QKeyEvent* event, QKeySequence::StandardKey ke
#if 1 #if 1
return event->matches( key ); return event->matches( key );
#else #else
constexpr auto mask = ~(Qt::KeypadModifier | Qt::GroupSwitchModifier); constexpr auto mask = ~( Qt::KeypadModifier | Qt::GroupSwitchModifier );
// We should route this call through the skin. TODO // We should route this call through the skin. TODO
const auto theme = QGuiApplicationPrivate::platformTheme(); const auto theme = QGuiApplicationPrivate::platformTheme();

View File

@ -52,6 +52,7 @@ class QskMenuSkinlet::PrivateData
{ {
m_data->enableCache( false ); m_data->enableCache( false );
} }
private: private:
PrivateData* m_data; PrivateData* m_data;
}; };

View File

@ -382,7 +382,7 @@ bool QskPopup::hasFaderEffect() const
void QskPopup::setPopupFlags( PopupFlags flags ) void QskPopup::setPopupFlags( PopupFlags flags )
{ {
if ( static_cast<int>(flags) != m_data->flags ) if ( static_cast< int >( flags ) != m_data->flags )
{ {
m_data->flags = flags; m_data->flags = flags;
updateInputGrabber(); updateInputGrabber();

View File

@ -209,8 +209,7 @@ static inline QskAspect qskSubstitutedAspect(
if ( aspect.hasStates() ) if ( aspect.hasStates() )
{ {
qWarning() << "QskSkinnable::(re)setSkinHint: setting hints with states " qWarning() << "QskSkinnable::(re)setSkinHint: setting hints with states "
"is discouraged - use QskSkinTableEditor if you are " "is discouraged - use QskSkinTableEditor if you are sure, that you need this.";
"sure, that you need this.";
qWarning() << "QskAspect:" << aspect.stateless() qWarning() << "QskAspect:" << aspect.stateless()
<< skinnable->skinStatesAsPrintable( aspect.states() ); << skinnable->skinStatesAsPrintable( aspect.states() );

View File

@ -572,8 +572,8 @@ bool QskDialogButtonBox::isDefaultButtonKeyEvent( const QKeyEvent* event )
} }
else else
{ {
return ( event->key() == Qt::Key_Enter ) || return ( event->key() == Qt::Key_Enter )
( event->key() == Qt::Key_Return ); || ( event->key() == Qt::Key_Return );
} }
} }

View File

@ -19,7 +19,8 @@ class QskHunspellTextPredictor::PrivateData
QLocale locale; QLocale locale;
}; };
QskHunspellTextPredictor::QskHunspellTextPredictor( const QLocale &locale, QObject* object ) QskHunspellTextPredictor::QskHunspellTextPredictor(
const QLocale& locale, QObject* object )
: Inherited( object ) : Inherited( object )
, m_data( new PrivateData() ) , m_data( new PrivateData() )
{ {
@ -43,7 +44,8 @@ void QskHunspellTextPredictor::reset()
} }
} }
QPair< QString, QString > QskHunspellTextPredictor::affAndDicFile( const QString& path, const QLocale& locale ) QPair< QString, QString > QskHunspellTextPredictor::affAndDicFile(
const QString& path, const QLocale& locale )
{ {
QString prefix = QStringLiteral( "%1/%2" ).arg( path, locale.name() ); QString prefix = QStringLiteral( "%1/%2" ).arg( path, locale.name() );
QString affFile = prefix + QStringLiteral( ".aff" ); QString affFile = prefix + QStringLiteral( ".aff" );
@ -63,7 +65,7 @@ void QskHunspellTextPredictor::loadDictionaries()
{ {
QString userPaths = QString::fromUtf8( qgetenv( "QSK_HUNSPELL_PATH" ) ); QString userPaths = QString::fromUtf8( qgetenv( "QSK_HUNSPELL_PATH" ) );
#if defined(Q_OS_WIN32) #if defined( Q_OS_WIN32 )
QChar separator( ';' ); QChar separator( ';' );
QStringList defaultPaths; QStringList defaultPaths;
#else #else
@ -106,7 +108,7 @@ void QskHunspellTextPredictor::request( const QString& text )
char** suggestions; char** suggestions;
QTextCodec *codec = QTextCodec::codecForName( m_data->hunspellEncoding ); const auto codec = QTextCodec::codecForName( m_data->hunspellEncoding );
const QByteArray word = codec ? codec->fromUnicode( text ) : text.toUtf8(); const QByteArray word = codec ? codec->fromUnicode( text ) : text.toUtf8();
const int count = Hunspell_suggest( const int count = Hunspell_suggest(

View File

@ -318,7 +318,7 @@ QskInputContextFactory* QskInputContext::factory() const
return m_data->factory; return m_data->factory;
} }
std::shared_ptr<QskTextPredictor> QskInputContext::textPredictor( const QLocale& locale ) std::shared_ptr< QskTextPredictor > QskInputContext::textPredictor( const QLocale& locale )
{ {
if ( m_data->factory ) if ( m_data->factory )
return m_data->factory->setupPredictor( locale ); return m_data->factory->setupPredictor( locale );

View File

@ -369,10 +369,7 @@ QskInputPanel::QskInputPanel( QQuickItem* parent )
this, &QskInputPanel::updateLocale ); this, &QskInputPanel::updateLocale );
connect( &m_data->keyProcessor, &KeyProcessor::keyProcessingFinished, connect( &m_data->keyProcessor, &KeyProcessor::keyProcessingFinished,
this, [this]( const Result& result ) this, [this]( const Result& result ) { m_data->handleKeyProcessingFinished( result ); } );
{
m_data->handleKeyProcessingFinished( result );
} );
updateLocale( locale() ); updateLocale( locale() );
} }

View File

@ -53,7 +53,7 @@ class QSK_EXPORT QskInputPanel : public QskControl
virtual void attachItem( QQuickItem* ) = 0; virtual void attachItem( QQuickItem* ) = 0;
private: private:
void updatePrediction( const QString &text, const QStringList &candidates ); void updatePrediction( const QString&, const QStringList& candidates );
void resetPredictor( const QLocale& ); void resetPredictor( const QLocale& );
void updateLocale( const QLocale& ); void updateLocale( const QLocale& );

View File

@ -561,8 +561,9 @@ namespace
{ {
} }
void addAdditionalLines( float x11, float y11, float x12, float y12, // start line void addAdditionalLines(
float x21,float y21, float x22, float y22, // end line float x11, float y11, float x12, float y12, // start line
float x21, float y21, float x22, float y22, // end line
const QskGradient& gradient, Line* lines ) const QskGradient& gradient, Line* lines )
{ {
int additionalStopCount = additionalGradientStops( gradient ); int additionalStopCount = additionalGradientStops( gradient );
@ -721,7 +722,8 @@ namespace
x2TL = c[ TopLeft ].centerX - v.dx2( TopLeft ), x2TL = c[ TopLeft ].centerX - v.dx2( TopLeft ),
y2TL = c[ TopLeft ].centerY - v.dy2( TopLeft ); y2TL = c[ TopLeft ].centerY - v.dy2( TopLeft );
addAdditionalLines( x1TR, y1TR, x2TR, y2TR, addAdditionalLines(
x1TR, y1TR, x2TR, y2TR,
x1TL, y1TL, x2TL, y2TL, x1TL, y1TL, x2TL, y2TL,
borderMapTR.gradient(), linesTR + k ); borderMapTR.gradient(), linesTR + k );
} }
@ -738,7 +740,8 @@ namespace
x2BR = c[ BottomRight ].centerX + v.dx2( BottomRight ), x2BR = c[ BottomRight ].centerX + v.dx2( BottomRight ),
y2BR = c[ BottomRight ].centerY + v.dy2( BottomRight ); y2BR = c[ BottomRight ].centerY + v.dy2( BottomRight );
addAdditionalLines( x1BL, y1BL, x2BL, y2BL, addAdditionalLines(
x1BL, y1BL, x2BL, y2BL,
x1BR, y1BR, x2BR, y2BR, x1BR, y1BR, x2BR, y2BR,
borderMapBL.gradient(), linesBL + k ); borderMapBL.gradient(), linesBL + k );
} }
@ -758,7 +761,8 @@ namespace
x2BL = c[ BottomLeft ].centerX - v.dx2( BottomLeft ), x2BL = c[ BottomLeft ].centerX - v.dx2( BottomLeft ),
y2BL = c[ BottomLeft ].centerY + v.dy2( BottomLeft ); y2BL = c[ BottomLeft ].centerY + v.dy2( BottomLeft );
addAdditionalLines( x1TL, y1TL, x2TL, y2TL, addAdditionalLines(
x1TL, y1TL, x2TL, y2TL,
x1BL, y1BL, x2BL, y2BL, x1BL, y1BL, x2BL, y2BL,
borderMapTL.gradient(), linesTL + j ); borderMapTL.gradient(), linesTL + j );
} }
@ -775,7 +779,8 @@ namespace
x2TR = c[ TopRight ].centerX + v.dx2( TopRight ), x2TR = c[ TopRight ].centerX + v.dx2( TopRight ),
y2TR = c[ TopRight ].centerY - v.dy2( TopRight ); y2TR = c[ TopRight ].centerY - v.dy2( TopRight );
addAdditionalLines( x1BR, y1BR, x2BR, y2BR, addAdditionalLines(
x1BR, y1BR, x2BR, y2BR,
x1TR, y1TR, x2TR, y2TR, x1TR, y1TR, x2TR, y2TR,
borderMapBR.gradient(), linesBR + j ); borderMapBR.gradient(), linesBR + j );
} }
@ -1014,14 +1019,10 @@ static inline void qskRenderBorder( const QskBoxRenderer::Metrics& metrics,
right = c.gradient( Qsk::Right ), bottom = c.gradient( Qsk::Bottom ); right = c.gradient( Qsk::Right ), bottom = c.gradient( Qsk::Bottom );
qskRenderBorderLines( metrics, orientation, line, qskRenderBorderLines( metrics, orientation, line,
BorderMapGradient( stepCount, qskRgbGradientStart( top ), BorderMapGradient( stepCount, qskRgbGradientStart( top ), qskRgbGradientEnd( left ), left ),
qskRgbGradientEnd( left ), left ), BorderMapGradient( stepCount, qskRgbGradientStart( right ), qskRgbGradientEnd( top ), top ),
BorderMapGradient( stepCount, qskRgbGradientStart( right ), BorderMapGradient( stepCount, qskRgbGradientStart( left ), qskRgbGradientEnd( bottom ), bottom ),
qskRgbGradientEnd( top ), top ), BorderMapGradient( stepCount, qskRgbGradientStart( bottom ), qskRgbGradientEnd( right ), right ) );
BorderMapGradient( stepCount, qskRgbGradientStart( left ),
qskRgbGradientEnd( bottom ), bottom ),
BorderMapGradient( stepCount, qskRgbGradientStart( bottom ),
qskRgbGradientEnd( right ), right ) );
} }
} }
@ -1073,14 +1074,10 @@ static inline void qskRenderBoxRandom(
auto left = bc.gradient( Qsk::Left ), top = bc.gradient( Qsk::Top ), auto left = bc.gradient( Qsk::Left ), top = bc.gradient( Qsk::Top ),
right = bc.gradient( Qsk::Right ), bottom = bc.gradient( Qsk::Bottom ); right = bc.gradient( Qsk::Right ), bottom = bc.gradient( Qsk::Bottom );
const BorderMapGradient tl( n, qskRgbGradientStart( top.startColor() ), const BorderMapGradient tl( n, qskRgbGradientStart( top.startColor() ), qskRgbGradientEnd( left.endColor() ), left );
qskRgbGradientEnd( left.endColor() ), left ); const BorderMapGradient tr( n, qskRgbGradientStart( right ), qskRgbGradientEnd( top ), top );
const BorderMapGradient tr( n, qskRgbGradientStart( right ), const BorderMapGradient bl( n, qskRgbGradientStart( left ), qskRgbGradientEnd( bottom ), bottom );
qskRgbGradientEnd( top ), top ); const BorderMapGradient br( n, qskRgbGradientStart( bottom ), qskRgbGradientEnd( right ), right );
const BorderMapGradient bl( n, qskRgbGradientStart( left ),
qskRgbGradientEnd( bottom ), bottom );
const BorderMapGradient br( n, qskRgbGradientStart( bottom ),
qskRgbGradientEnd( right ), right );
if ( gradient.isMonochrome() ) if ( gradient.isMonochrome() )
{ {

View File

@ -623,10 +623,15 @@ void QskBoxRenderer::renderRect(
auto fillLines = line + fillLineCount; auto fillLines = line + fillLineCount;
if ( bc.isMonochrome() ) if ( bc.isMonochrome() )
qskCreateBorderMonochrome( rect, in, bc.gradient( Qsk::Left ).startColor().rgba(), fillLines ); {
const auto rgb = bc.gradient( Qsk::Left ).startColor().rgba();
qskCreateBorderMonochrome( rect, in, rgb, fillLines );
}
else else
{
qskCreateBorder( rect, in, bc, fillLines ); qskCreateBorder( rect, in, bc, fillLines );
} }
}
} }
void QskBoxRenderer::renderRectFill( const QskBoxRenderer::Quad& rect, void QskBoxRenderer::renderRectFill( const QskBoxRenderer::Quad& rect,