[libcalamaresui] Apply coding style to utils/
This commit is contained in:
parent
1b6aed8c40
commit
6f74463a80
@ -34,11 +34,10 @@
|
||||
namespace CalamaresUtils
|
||||
{
|
||||
|
||||
static int s_defaultFontSize = 0;
|
||||
static int s_defaultFontSize = 0;
|
||||
static int s_defaultFontHeight = 0;
|
||||
|
||||
|
||||
|
||||
QPixmap
|
||||
defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
|
||||
{
|
||||
@ -152,11 +151,15 @@ createRoundedImage( const QPixmap& pixmap, const QSize& size, float frameWidthPc
|
||||
}
|
||||
|
||||
if ( !height || !width )
|
||||
{
|
||||
return QPixmap();
|
||||
}
|
||||
|
||||
QPixmap scaledAvatar = pixmap.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
||||
if ( frameWidthPct == 0.00f )
|
||||
{
|
||||
return scaledAvatar;
|
||||
}
|
||||
|
||||
QPixmap frame( width, height );
|
||||
frame.fill( Qt::transparent );
|
||||
@ -172,7 +175,8 @@ createRoundedImage( const QPixmap& pixmap, const QSize& size, float frameWidthPc
|
||||
|
||||
painter.setBrush( brush );
|
||||
painter.setPen( pen );
|
||||
painter.drawRoundedRect( outerRect, qreal( frameWidthPct ) * 100.0, qreal( frameWidthPct ) * 100.0, Qt::RelativeSize );
|
||||
painter.drawRoundedRect(
|
||||
outerRect, qreal( frameWidthPct ) * 100.0, qreal( frameWidthPct ) * 100.0, Qt::RelativeSize );
|
||||
|
||||
return frame;
|
||||
}
|
||||
@ -189,7 +193,9 @@ unmarginLayout( QLayout* layout )
|
||||
{
|
||||
QLayout* childLayout = layout->itemAt( i )->layout();
|
||||
if ( childLayout )
|
||||
{
|
||||
unmarginLayout( childLayout );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -255,13 +261,17 @@ clearLayout( QLayout* layout )
|
||||
while ( QLayoutItem* item = layout->takeAt( 0 ) )
|
||||
{
|
||||
if ( QWidget* widget = item->widget() )
|
||||
{
|
||||
widget->deleteLater();
|
||||
}
|
||||
|
||||
if ( QLayout* childLayout = item->layout() )
|
||||
{
|
||||
clearLayout( childLayout );
|
||||
}
|
||||
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace CalamaresUtils
|
||||
|
@ -56,7 +56,7 @@ enum ImageType : int
|
||||
PartitionTable,
|
||||
BootEnvironment,
|
||||
Squid,
|
||||
StatusOk, // Icons for the requirements checker
|
||||
StatusOk, // Icons for the requirements checker
|
||||
StatusWarning,
|
||||
StatusError
|
||||
};
|
||||
@ -94,9 +94,7 @@ UIDLLEXPORT QPixmap defaultPixmap( ImageType type,
|
||||
* @return the transformed pixmap.
|
||||
* This one is currently unused.
|
||||
*/
|
||||
UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar,
|
||||
const QSize& size,
|
||||
float frameWidthPct = 0.20f );
|
||||
UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size, float frameWidthPct = 0.20f );
|
||||
|
||||
/**
|
||||
* @brief unmarginLayout recursively walks the QLayout tree and removes all margins.
|
||||
@ -112,8 +110,8 @@ UIDLLEXPORT void unmarginLayout( QLayout* layout );
|
||||
UIDLLEXPORT void clearLayout( QLayout* layout );
|
||||
|
||||
UIDLLEXPORT void setDefaultFontSize( int points );
|
||||
UIDLLEXPORT int defaultFontSize(); // in points
|
||||
UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific
|
||||
UIDLLEXPORT int defaultFontSize(); // in points
|
||||
UIDLLEXPORT int defaultFontHeight(); // in pixels, DPI-specific
|
||||
UIDLLEXPORT QFont defaultFont();
|
||||
UIDLLEXPORT QFont largeFont();
|
||||
UIDLLEXPORT QSize defaultIconSize();
|
||||
@ -128,4 +126,4 @@ constexpr int windowPreferredHeight = 520;
|
||||
|
||||
} // namespace CalamaresUtils
|
||||
|
||||
#endif // CALAMARESUTILSGUI_H
|
||||
#endif // CALAMARESUTILSGUI_H
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPLv3+
|
||||
* License-Filename: LICENSES/GPLv3+-ImageRegistry
|
||||
*
|
||||
*
|
||||
* Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||
*/
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
*
|
||||
* SPDX-License-Identifier: GPLv3+
|
||||
* License-Filename: LICENSES/GPLv3+-ImageRegistry
|
||||
*
|
||||
*
|
||||
* Copyright 2019, Adriaan de Groot <groot@kde.org>
|
||||
*/
|
||||
|
||||
|
@ -34,11 +34,13 @@ lookupAndCall( PyObject* object,
|
||||
{
|
||||
PythonQtObjectPtr callable = PythonQt::self()->lookupCallable( object, name );
|
||||
if ( callable )
|
||||
{
|
||||
return callable.call( args, kwargs );
|
||||
}
|
||||
}
|
||||
|
||||
// If we haven't found a callable with the given names, we force an error:
|
||||
return PythonQt::self()->call( object, candidateNames.first(), args, kwargs );
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace CalamaresUtils
|
||||
|
@ -33,6 +33,6 @@ QVariant lookupAndCall( PyObject* object,
|
||||
const QVariantList& args = QVariantList(),
|
||||
const QVariantMap& kwargs = QVariantMap() );
|
||||
|
||||
} //ns
|
||||
} // namespace CalamaresUtils
|
||||
|
||||
#endif // PYTHONQTUTILS_H
|
||||
#endif // PYTHONQTUTILS_H
|
||||
|
Loading…
Reference in New Issue
Block a user