[plasmalnf] Make 'the size of screenshots' available outside ThemeInfo

main
Adriaan de Groot 4 years ago
parent dac590a094
commit cc6611bac4

@ -212,6 +212,14 @@ ThemesModel::showOnlyThemes( const QMap< QString, QString >& onlyThese )
emit dataChanged( index( 0, 0 ), index( m_themes->count() - 1 ), { ShownRole } );
}
QSize
ThemesModel::imageSize()
{
return { qMax( 12 * CalamaresUtils::defaultFontHeight(), 120 ),
qMax( 8 * CalamaresUtils::defaultFontHeight(), 80 ) };
}
/**
* Massage the given @p path to the most-likely
* path that actually contains a screenshot. For
@ -259,8 +267,7 @@ ThemeInfo::loadImage() const
if ( pixmap.isNull() )
{
const QSize image_size { qMax( 12 * CalamaresUtils::defaultFontHeight(), 120 ),
qMax( 8 * CalamaresUtils::defaultFontHeight(), 80 ) };
const QSize image_size( ThemesModel::imageSize() );
const QString path = munge_imagepath( imagePath );
cDebug() << "Loading initial image for" << id << imagePath << "->" << path;

@ -49,6 +49,14 @@ public:
/// @brief Shows the keys in the @p onlyThese map, and hides the rest
void showOnlyThemes( const QMap< QString, QString >& onlyThese );
/** @brief The size of theme Images
*
* The size is dependent on the font size used by Calamares,
* and is constant within one run of Calamares, but may change
* if the font settings do between runs.
*/
static QSize imageSize();
private:
ThemeInfoList* m_themes;
};

Loading…
Cancel
Save