uncrustified

This commit is contained in:
Uwe Rathmann 2019-01-04 13:42:16 +01:00
parent f03f8c1547
commit 4e54d1cb58
44 changed files with 87 additions and 82 deletions

View File

@ -25,8 +25,8 @@
#define QSK_NAMESPACE( name ) namespace name
#define QSK_ENUM( name ) \
inline const QMetaObject *qt_getEnumMetaObject(name) noexcept { return &staticMetaObject; } \
inline constexpr const char *qt_getEnumName(name) noexcept { return #name; }
inline const QMetaObject* qt_getEnumMetaObject(name) noexcept { return &staticMetaObject; } \
inline constexpr const char* qt_getEnumName(name) noexcept { return #name; }
#endif
@ -543,7 +543,7 @@ QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect::Aspect );
const QskAspect::State type::name = \
QskAspect::registerState( &type::staticMetaObject, value, #type "::" #name );
#if !defined(_MSC_VER)
#if !defined( _MSC_VER )
#define QSK_SUBCONTROLS( ... ) static const QskAspect::Subcontrol __VA_ARGS__;
#define QSK_STATES( ... ) static const QskAspect::State __VA_ARGS__;
@ -581,7 +581,7 @@ QSK_EXPORT void qskDebugAspect( QDebug, const QMetaObject*, QskAspect::Aspect );
#define _QSK_EVAL_ARG_N( _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, A, B, C, D, E, F, N, ... ) N
#define _QSK_EVAL_RSEQ_N() F, E, D, C, B, A, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0
#define _QSK_CAT(x,y) x##y
#define _QSK_CAT(x,y) x ## y
#define _QSK_EVAL_( N, m, ... ) _QSK_EXPAND( _QSK_CAT( _QSK_EVAL_, N )( m, __VA_ARGS__ ) )
#define _QSK_EVAL( m, ... ) _QSK_EVAL_( _QSK_EVAL_NARG( __VA_ARGS__ ), m, __VA_ARGS__ )

View File

@ -10,7 +10,7 @@
#include <functional>
#define QSK_DECLARE_OPERATORS_FOR_FLAGS( Flags ) \
constexpr inline Flags operator|( const Flags &a, const Flags &b ) noexcept \
constexpr inline Flags operator|( const Flags& a, const Flags& b ) noexcept \
{ \
using underlying = typename std::underlying_type< Flags >::type; \
return static_cast< Flags >( \

View File

@ -45,10 +45,10 @@
#else
template < typename T >
template< typename T >
struct QskAddConst { typedef const T Type; };
template < typename T >
template< typename T >
constexpr typename QskAddConst< T >::Type& qskAsConst( T& t ) noexcept { return t; }
template< typename T >

View File

@ -377,7 +377,7 @@ QskGradient QskGradient::interpolated(
progress = 1.0 - value;
gradient = this;
}
/*
We interpolate as if the invalid gradient would be
a transparent version of the valid gradient

View File

@ -139,7 +139,7 @@ bool QskMetaFunction::operator==( const QskMetaFunction& other ) const
if ( m_functionCall && other.m_functionCall )
{
if ( m_functionCall->typeInfo() == StaticFunction &&
other.m_functionCall->typeInfo() == StaticFunction )
other.m_functionCall->typeInfo() == StaticFunction )
{
// only static functions can be compared
return m_functionCall->compare(

View File

@ -26,7 +26,7 @@ class QSK_EXPORT QskBoxSkinlet : public QskSkinlet
QRectF subControlRect( const QskSkinnable*,
QskAspect::Subcontrol ) const override;
protected:
protected:
QSGNode* updateSubNode( const QskSkinnable*,
quint8 nodeRole, QSGNode* ) const override;
};

View File

@ -1267,7 +1267,7 @@ void QskControl::setFixedWidth( qreal width )
auto size = d->explicitSizeHint( Qt::PreferredSize );
if ( ( d->sizePolicy.horizontalPolicy() != QskSizePolicy::Fixed ) ||
( size.width() != width ) )
( size.width() != width ) )
{
size.setWidth( width );
@ -1288,7 +1288,7 @@ void QskControl::setFixedHeight( qreal height )
auto size = d->explicitSizeHint( Qt::PreferredSize );
if ( ( d->sizePolicy.verticalPolicy() != QskSizePolicy::Fixed ) ||
( size.height() != height ) )
( size.height() != height ) )
{
size.setHeight( height );
@ -1364,7 +1364,7 @@ void QskControl::resetImplicitSize()
if ( d->controlFlags & QskControl::DeferredLayout )
{
/*
Is there a way to block consecutive calls ?
Is there a way to block consecutive calls ?
When the parent is requesting the preferred size, we could use
d->blockedImplicitSize, but in case of dynamic constraints we don't
have an indication when the event has been processed. TODO ...

View File

@ -22,7 +22,7 @@ class QskGeometryChangeEvent;
class QskWindowChangeEvent;
class QskGestureEvent;
template <typename T> class QVector;
template< typename T > class QVector;
class QSK_EXPORT QskControl : public QQuickItem, public QskSkinnable
{

View File

@ -219,8 +219,8 @@ QVector< QMetaObject::Connection > QskFocusIndicator::connectItem( const QQuickI
{
if ( sender->metaObject()->indexOfSignal( "focusIndicatorRectChanged()" ) >= 0 )
{
c += QObject::connect( sender, SIGNAL( focusIndicatorRectChanged() ),
this, SLOT( onFocusItemGeometryChanged() ) );
c += QObject::connect( sender, SIGNAL(focusIndicatorRectChanged()),
this, SLOT(onFocusItemGeometryChanged()) );
}
}

View File

@ -8,7 +8,7 @@
#include "QskControl.h"
template <typename T> class QVector;
template< typename T > class QVector;
class QSK_EXPORT QskFocusIndicator : public QskControl
{

View File

@ -66,7 +66,7 @@ QRectF QskPageIndicatorSkinlet::bulletRect(
if ( indexDiff > ( indicator->count() - 1 ) )
indexDiff = ( indicator->count() - indicator->currentIndex() ); // wrapping
const qreal sz = ( indexDiff < 1 ) ?
const qreal sz = ( indexDiff < 1 ) ?
( 1 - indexDiff ) * szHighlighted + indexDiff * szNormal : szNormal;
const qreal spacing = indicator->metric( QskPageIndicator::Panel | QskAspect::Spacing );

View File

@ -267,9 +267,9 @@ QSizeF QskPushButton::contentsSizeHint() const
{
if ( !m_data->graphicSource.isEmpty() )
m_data->graphic = loadGraphic( m_data->graphicSource );
m_data->isGraphicSourceDirty = false;
}
}
if ( !m_data->graphic.isEmpty() )
{

View File

@ -68,11 +68,11 @@ class QSK_EXPORT QskPushButton : public QskAbstractButton
QRectF layoutRect() const override;
public Q_SLOTS:
void setText( const QString& text );
void setGraphicSource( const QUrl& url );
void setGraphicSource( const QString& source );
void setText( const QString& );
void setGraphicSource( const QUrl& );
void setGraphicSource( const QString& );
void setGraphic( const QskGraphic& );
void setGraphicSourceSize( const QSizeF & );
void setGraphicSourceSize( const QSizeF& );
Q_SIGNALS:
void cornerChanged();

View File

@ -115,7 +115,7 @@ QRectF QskPushButtonSkinlet::graphicRect( const QskPushButton* button ) const
r.setX( r.center().x() - 0.5 * maxW );
r.setWidth( maxW );
}
if ( maxH >= 0.0 && maxH < r.height() )
{
r.setY( r.center().y() - 0.5 * maxH );

View File

@ -12,14 +12,14 @@
class QQuickItem;
class QSGNode;
class QRectF;
template <typename T> class QList;
template< typename T > class QList;
/*
Exporting methods from QQuickItemPrivate, that should be part
of QQuickItem.
*/
QSK_EXPORT bool qskIsItemComplete( const QQuickItem* item );
QSK_EXPORT bool qskIsItemComplete( const QQuickItem* );
QSK_EXPORT bool qskIsAncestorOf( const QQuickItem* item, const QQuickItem* child );
QSK_EXPORT bool qskIsTransparentForPositioner( const QQuickItem* );
QSK_EXPORT bool qskIsTabFence( const QQuickItem* );

View File

@ -12,7 +12,7 @@ class QSK_EXPORT QskScrollView : public QskControl
{
Q_OBJECT
Q_PROPERTY( QPointF scrollPos READ scrollPos
Q_PROPERTY( QPointF scrollPos READ scrollPos
WRITE setScrollPos NOTIFY scrollPosChanged FINAL )
Q_PROPERTY( Qt::ScrollBarPolicy verticalScrollBarPolicy READ verticalScrollBarPolicy

View File

@ -111,7 +111,7 @@ template< typename T, QskMetaFunctionTraits::IsFunctorOrStaticFunction< T >* >
inline int QskShortcutMap::addShortcut(
QQuickItem* item, const QKeySequence& sequence,
bool autoRepeat, T function )
{
{
return addFunctionT( item, sequence, autoRepeat, nullptr, function );
}
@ -153,26 +153,26 @@ template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* >
inline int QskShortcutMap::addShortcut(
const QKeySequence& sequence, bool autoRepeat,
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function )
{
{
return addFunctionT( nullptr, sequence, autoRepeat, receiver, function );
}
}
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* >
inline int QskShortcutMap::addShortcut(
QQuickItem* item, const QKeySequence& sequence, bool autoRepeat,
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function )
{
{
return addFunctionT( item, sequence, autoRepeat, receiver, function );
}
}
template< typename T, QskMetaFunctionTraits::IsMemberFunction< T >* >
inline int QskShortcutMap::addShortcut(
QQuickWindow* window, const QKeySequence& sequence, bool autoRepeat,
const typename QtPrivate::FunctionPointer< T >::Object* receiver, T function )
{
{
auto item = window ? window->contentItem() : nullptr;
return addFunctionT( item, sequence, autoRepeat, receiver, function );
}
}
template< typename T >
inline int QskShortcutMap::addFunctionT(

View File

@ -130,7 +130,7 @@ class QSK_EXPORT QskSkin : public QObject
protected:
QskSkinHintTable& skinHintTable();
private:
private:
void declareSkinlet( const QMetaObject* controlMetaObject,
const QMetaObject* skinMetaObject );

View File

@ -169,7 +169,7 @@ namespace
void start()
{
m_notifyConnection =
QskAnimator::addAdvanceHandler( this, SLOT( notify( QQuickWindow* ) ) );
QskAnimator::addAdvanceHandler( this, SLOT(notify(QQuickWindow*)) );
for ( auto& it : m_hintAnimatorMap )
it.second.start();

View File

@ -154,7 +154,7 @@ void QskSubWindow::setWindowIcon( const QskGraphic& graphic )
Q_EMIT windowIconChanged();
}
}
}
QskGraphic QskSubWindow::windowIcon() const
{

View File

@ -145,7 +145,7 @@ QRectF QskSubWindowSkinlet::titleRect( const QskSubWindow* subWindow ) const
QskSubWindow::TitleBar | QskAspect::Spacing );
const auto symbolRect = subControlRect( subWindow, QskSubWindow::TitleBarSymbol );
rect.setX( rect.x() + symbolRect.right() + spacing );
rect.setX( rect.x() + symbolRect.right() + spacing );
#if 0
const QFontMetricsF fm( subWindow->effectiveFont( QskSubWindow::TitleBarText ) );

View File

@ -115,8 +115,8 @@ namespace
class Validator final : public QValidator
{
public:
State validate(QString &, int &) const override
public:
State validate( QString&, int& ) const override
{
return QValidator::Acceptable;
}
@ -153,7 +153,7 @@ namespace
return this->event( event );
}
protected:
protected:
void geometryChanged(
const QRectF& newGeometry, const QRectF& oldGeometry ) override
{

View File

@ -136,7 +136,7 @@ void QskTextLabel::setElideMode( Qt::TextElideMode elideMode )
{
auto options = m_data->textOptions;
options.setElideMode( elideMode );
setTextOptions( options );
}

View File

@ -38,7 +38,7 @@ QSGNode* QskTextLabelSkinlet::updateSubNode(
{
case TextRole:
{
return updateTextNode( label, node,
return updateTextNode( label, node,
label->text(), label->textOptions(), QskTextLabel::Text );
}
}

View File

@ -99,7 +99,6 @@ class QSK_EXPORT QskDialog : public QObject
Reverse = 1 << 30
};
enum DialogCode
{
Rejected = 0,

View File

@ -29,7 +29,7 @@ static void qskSendEventTo( QObject* object, QEvent::Type type )
static inline QskDialog::ActionRole qskActionRole( QskDialog::Action action )
{
const auto role = QPlatformDialogHelper::buttonRole(
const auto role = QPlatformDialogHelper::buttonRole(
static_cast< QPlatformDialogHelper::StandardButton >( action ) );
return static_cast< QskDialog::ActionRole >( role );
@ -260,7 +260,7 @@ void QskDialogButtonBox::addButton(
/*
To have a proper ownership. Inserting the buttons
according to the layout rules will be done later
according to the layout rules will be done later
*/
button->setParentItem( m_data->layoutBox );

View File

@ -10,7 +10,7 @@
#include "QskDialog.h"
class QskPushButton;
template <typename T> class QVector;
template< typename T > class QVector;
class QSK_EXPORT QskDialogButtonBox : public QskBox
{

View File

@ -117,7 +117,7 @@ QQuickItem* QskDialogWindow::dialogContentItem() const
void QskDialogWindow::setDefaultButton( QskPushButton* button )
{
if ( !qskIsAncestorOf( m_data->buttonBox, button ) )
{
{
#if defined( QT_DEBUG )
qWarning( "Only buttons of the QskDialogButtonBox can be the default button." );
#endif

View File

@ -74,7 +74,7 @@ class QskMessageSubWindow::PrivateData
public:
QskGraphicLabel* symbolLabel;
QskTextLabel* textLabel;
};
};
QskMessageSubWindow::QskMessageSubWindow( QQuickItem* parent )
: Inherited( parent )

View File

@ -20,7 +20,7 @@ class QSK_EXPORT QskMessageSubWindow : public QskDialogSubWindow
Q_PROPERTY( QskTextOptions textOptions READ textOptions
WRITE setTextOptions NOTIFY textOptionsChanged )
Q_PROPERTY( QUrl symbolSource READ symbolSource WRITE setSymbolSource )
using Inherited = QskDialogSubWindow;
@ -31,20 +31,20 @@ class QSK_EXPORT QskMessageSubWindow : public QskDialogSubWindow
void setTextOptions( const QskTextOptions& );
QskTextOptions textOptions() const;
QString text() const;
void setSymbolSource( const QUrl& url );
QUrl symbolSource() const;
void setSymbolType( int symbolType );
void setSymbol( const QskGraphic& );
QskGraphic symbol() const;
public Q_SLOTS:
void setText( const QString& );
Q_SIGNALS:
void textChanged( const QString& );
void textOptionsChanged( const QskTextOptions& );

View File

@ -75,7 +75,7 @@ class QskMessageWindow::PrivateData
public:
QskGraphicLabel* symbolLabel;
QskTextLabel* textLabel;
};
};
QskMessageWindow::QskMessageWindow( QWindow* parent )
: Inherited( parent )
@ -85,18 +85,18 @@ QskMessageWindow::QskMessageWindow( QWindow* parent )
Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint );
m_data->textLabel = new TextLabel( this );
m_data->symbolLabel = new SymbolLabel( this );
m_data->symbolLabel->hide();
const auto alignment = Qt::AlignTop | Qt::AlignHCenter;
auto box = new QskLinearBox( Qt::Horizontal );
box->setSpacing( 0 );
box->addItem( m_data->symbolLabel, alignment );
box->addItem( m_data->textLabel, alignment );
box->addItem( m_data->symbolLabel, alignment );
box->addItem( m_data->textLabel, alignment );
box->setStretchFactor( m_data->textLabel, 10 );
setDialogContentItem( box );
}

View File

@ -11,8 +11,8 @@
#include "QskTextLabel.h"
#include "QskTextOptions.h"
namespace
{
namespace
{
class TextLabel final : public QskTextLabel
{
public:

View File

@ -206,7 +206,7 @@ class QskInputContext::PrivateData
connect( panel, &QskInputPanel::visibleChanged,
context, &QskInputContext::activeChanged );
connect( panel, &QskInputPanel::localeChanged,
context, [] { qskSendToPlatformContext( QEvent::LocaleChange ); } );

View File

@ -321,7 +321,7 @@ void QskInputPanel::attachInputItem( QQuickItem* item )
const QInputMethodEvent::Attribute attribute(
QInputMethodEvent::Cursor, 0, 0, QVariant() );
QCoreApplication::postEvent( item,
QCoreApplication::postEvent( item,
new QInputMethodEvent( QString(), { attribute } ) );
}
}

View File

@ -394,7 +394,7 @@ void QskLinearBox::rearrange()
QskLayoutItem* layoutItem = engine().layoutItemAt( i );
if ( layoutItem->firstRow( Qt::Horizontal ) != col ||
layoutItem->firstRow( Qt::Vertical ) != row )
layoutItem->firstRow( Qt::Vertical ) != row )
{
engine().removeItem( layoutItem );
@ -464,7 +464,7 @@ QRectF QskLinearBox::alignedLayoutRect( const QRectF& rect ) const
}
if ( ( m_data->extraSpacingAt & Qt::TopEdge ) ||
( m_data->extraSpacingAt & Qt::BottomEdge ) )
( m_data->extraSpacingAt & Qt::BottomEdge ) )
{
bool isExpandable = false;

View File

@ -54,7 +54,7 @@ void QskBoxNode::setBoxData( const QRectF& rect, const QskGradient& fillGradient
QskBoxBorderColors(), fillGradient );
}
void QskBoxNode::setBoxData( const QRectF& rect,
void QskBoxNode::setBoxData( const QRectF& rect,
const QskBoxShapeMetrics& shape, const QskBoxBorderMetrics& borderMetrics,
const QskBoxBorderColors& borderColors, const QskGradient& fillGradient )
{

View File

@ -20,7 +20,7 @@ class QSK_EXPORT QskBoxNode : public QSGGeometryNode
QskBoxNode();
~QskBoxNode() override;
void setBoxData( const QRectF&,
void setBoxData( const QRectF&,
const QskBoxShapeMetrics&, const QskBoxBorderMetrics&,
const QskBoxBorderColors&, const QskGradient& );

View File

@ -467,7 +467,7 @@ namespace
}
while ( !m_iterator[ 1 ].isDone() &&
( m_iterator[ 0 ].value() > m_iterator[ 1 ].value() ) )
( m_iterator[ 0 ].value() > m_iterator[ 1 ].value() ) )
{
m_iterator[ 1 ].advance( metrics, m_curve );
}
@ -498,7 +498,7 @@ namespace
*/
while ( !m_iterator[ 1 ].isDone() &&
( m_iterator[ 0 ].value() > m_iterator[ 1 ].value() ) )
( m_iterator[ 0 ].value() > m_iterator[ 1 ].value() ) )
{
m_iterator[ 1 ].advance( m_metrics, m_curve );
}

View File

@ -188,10 +188,13 @@ namespace
}
}
inline qreal dx1( int pos ) const { return m_inner[ pos] .dx; }
inline qreal dx1( int pos ) const { return m_inner[ pos].dx; }
inline qreal dy1( int pos ) const { return m_inner[ pos ].dy; }
inline qreal dx2( int pos ) const
{ return m_uniform ? m_outer[ 0 ].dx : m_outer[ pos ].dx; }
inline qreal dy2( int pos ) const
{ return m_uniform ? m_outer[ 0 ].dy : m_outer[ pos ].dy; }
@ -541,7 +544,7 @@ namespace
const int stepCount = c[ 0 ].stepCount;
#endif
Line *linesBR, *linesTR, *linesTL, *linesBL;
Line* linesBR, * linesTR, * linesTL, * linesBL;
linesBR = linesTR = linesTL = linesBL = nullptr;
const int numCornerLines = stepCount + 1;
@ -1065,7 +1068,7 @@ QskBoxRenderer::Metrics::Metrics( const QRectF& rect,
c.radiusInnerX = c.radiusX - borderRight;
c.radiusInnerY = c.radiusY - borderTop;
c.isCropped = ( c.centerX >= innerQuad.right ) ||
c.isCropped = ( c.centerX >= innerQuad.right ) ||
( c.centerY <= innerQuad.top );
break;
}

View File

@ -55,7 +55,7 @@ void QskGraphicNode::setGraphic(
{
const auto oldRect = QskTextureNode::rect();
isTextureDirty = ( rect.width() != static_cast< int >( oldRect.width() ) ) ||
( rect.height() != static_cast< int >( oldRect.height() ) );
( rect.height() != static_cast< int >( oldRect.height() ) );
}
QskTextureNode::setRect( rect );

View File

@ -40,7 +40,7 @@ void QskPaintedNode::update(
{
const auto oldRect = QskTextureNode::rect();
isTextureDirty = ( rect.width() != static_cast< int >( oldRect.width() ) ) ||
( rect.height() != static_cast< int >( oldRect.height() ) );
( rect.height() != static_cast< int >( oldRect.height() ) );
}
QskTextureNode::setRect( rect );

View File

@ -11,7 +11,7 @@
#include <qfont.h>
#include <qstring.h>
static inline uint qskHash(
static inline uint qskHash(
const QString& text, const QSizeF& size, const QFont& font,
const QskTextOptions& options, const QskTextColors& colors,
Qt::Alignment alignment, Qsk::TextStyle textStyle )

View File

@ -111,7 +111,7 @@ namespace
auto* materialNew = static_cast< Material* >( newMaterial );
if ( ( materialOld == nullptr ) ||
( materialOld->textureId() != materialNew->textureId() ) )
( materialOld->textureId() != materialNew->textureId() ) )
{
auto funcs = QOpenGLContext::currentContext()->functions();
funcs->glBindTexture( GL_TEXTURE_2D, materialNew->textureId() );

View File

@ -18,6 +18,7 @@ QDebug operator<<( QDebug debug, Color color )
debug << "C" << '(';
debug << color.r << "," << color.g << "," << color.b << "," << color.a;
debug << ')';
return debug;
}
@ -25,7 +26,8 @@ QDebug operator<<( QDebug debug, ColoredLine line )
{
QDebugStateSaver saver( debug );
qDebug() << qRound( line.p1.x ) << qRound( line.p1.y )
<< "->" << qRound( line.p2.x ) << qRound( line.p2.y );
<< "->" << qRound( line.p2.x ) << qRound( line.p2.y );
return debug;
}
@ -33,7 +35,8 @@ QDebug operator<<( QDebug debug, Line line )
{
QDebugStateSaver saver( debug );
qDebug() << qRound( line.p1.x ) << qRound( line.p1.y )
<< "->" << qRound( line.p2.x ) << qRound( line.p2.y );
<< "->" << qRound( line.p2.x ) << qRound( line.p2.y );
return debug;
}