Feature: allow disable welcome-logo resizing

main
Adriaan de Groot 8 years ago
parent c4f955874d
commit 44e6955f19

@ -8,6 +8,10 @@ componentName: default
# same distribution. # same distribution.
welcomeStyleCalamares: false welcomeStyleCalamares: false
# Should the welcome image (productWelcome, below) be scaled
# up beyond its natural size?
welcomeExpandingLogo: true
strings: strings:
productName: Generic GNU/Linux productName: Generic GNU/Linux
shortProductName: Generic shortProductName: Generic

@ -110,6 +110,7 @@ Branding::Branding( const QString& brandingFilePath,
bail( "Syntax error in strings map." ); bail( "Syntax error in strings map." );
m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false ); m_welcomeStyleCalamares = doc[ "welcomeStyleCalamares" ].as< bool >( false );
m_welcomeExpandingLogo = doc[ "welcomeExpandingLogo" ].as< bool >( true );
QVariantMap strings = QVariantMap strings =
CalamaresUtils::yamlMapToVariant( doc[ "strings" ] ).toMap(); CalamaresUtils::yamlMapToVariant( doc[ "strings" ] ).toMap();
@ -276,12 +277,6 @@ Branding::slideshowPath() const
return m_slideshowPath; return m_slideshowPath;
} }
bool
Branding::welcomeStyleCalamares() const
{
return m_welcomeStyleCalamares;
}
void void
Branding::setGlobals( GlobalStorage* globalStorage ) const Branding::setGlobals( GlobalStorage* globalStorage ) const
{ {

@ -88,7 +88,8 @@ public:
QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const; QPixmap image( Branding::ImageEntry imageEntry, const QSize& size ) const;
QString slideshowPath() const; QString slideshowPath() const;
bool welcomeStyleCalamares() const; bool welcomeStyleCalamares() const { return m_welcomeStyleCalamares; }
bool welcomeExpandingLogo() const { return m_welcomeExpandingLogo; }
/** /**
* Creates a map called "branding" in the global storage, and inserts an * Creates a map called "branding" in the global storage, and inserts an
@ -115,6 +116,7 @@ private:
QString m_translationsPathPrefix; QString m_translationsPathPrefix;
bool m_welcomeStyleCalamares; bool m_welcomeStyleCalamares;
bool m_welcomeExpandingLogo;
}; };
template<typename U> inline QString operator*(U e) { return Branding::instance()->string( e ); } template<typename U> inline QString operator*(U e) { return Branding::instance()->string( e ); }

@ -128,13 +128,23 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
imagePath( Calamares::Branding::ProductWelcome ) ); imagePath( Calamares::Branding::ProductWelcome ) );
if ( !theImage.isNull() ) if ( !theImage.isNull() )
{ {
FixedAspectRatioLabel* imageLabel = new FixedAspectRatioLabel; QLabel* imageLabel;
if ( Calamares::Branding::instance()->welcomeExpandingLogo() )
{
FixedAspectRatioLabel *p = new FixedAspectRatioLabel;
p->setPixmap( theImage );
imageLabel = p;
}
else
{
imageLabel = new QLabel;
imageLabel->setPixmap( theImage );
}
imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight() * 3 / 4, 4, 4 ); imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight() * 3 / 4, 4, 4 );
m_mainLayout->addWidget( imageLabel ); m_mainLayout->addWidget( imageLabel );
imageLabel->setAlignment( Qt::AlignCenter ); imageLabel->setAlignment( Qt::AlignCenter );
imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ); imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
imageLabel->setPixmap( theImage );
} }
} }
CALAMARES_RETRANSLATE( CALAMARES_RETRANSLATE(

Loading…
Cancel
Save