From 1f6752307de1bd5050b525f188238ccff530ea20 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 22 Apr 2020 14:36:09 +0200 Subject: [PATCH] [welcome] Massage layout when banner is used - simplify handling of image loading (if the image doesn't exist, Branding will bail out on startup) - reduce space above the banner if it is in use --- src/modules/welcome/WelcomePage.cpp | 10 +++++++--- src/modules/welcome/WelcomePage.ui | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index d71ad70a8..89fde33a0 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -51,6 +51,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) , m_languages( nullptr ) , m_conf( conf ) { + using Branding = Calamares::Branding; + const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); ui->setupUi( this ); ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( @@ -63,10 +65,10 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) ui->verticalLayout->insertWidget( welcome_text_idx + 1, m_checkingWidget ); // insert optional logo banner image above welcome text - Calamares::Branding::ImageEntry bannerImage = Calamares::Branding::ProductBanner; - QString bannerPath = Calamares::Branding::instance()->imagePath( bannerImage ); - if ( QFile::exists( bannerPath ) ) + QString bannerPath = Branding::instance()->imagePath( Branding::ProductBanner ); + if ( !bannerPath.isEmpty() ) { + // If the name is not empty, the file exists -- Branding checks that at startup QPixmap bannerPixmap = QPixmap( bannerPath ); if ( !bannerPixmap.isNull() ) { @@ -74,6 +76,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) bannerLabel->setPixmap( bannerPixmap ); bannerLabel->setMinimumHeight( 64 ); bannerLabel->setAlignment( Qt::AlignCenter ); + ui->aboveTextSpacer->changeSize( 20, defaultFontHeight ); // Shrink it down + ui->aboveTextSpacer->invalidate(); ui->verticalLayout->insertSpacing( welcome_text_idx, defaultFontHeight ); ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel ); } diff --git a/src/modules/welcome/WelcomePage.ui b/src/modules/welcome/WelcomePage.ui index 6c0d4c338..04b89f256 100644 --- a/src/modules/welcome/WelcomePage.ui +++ b/src/modules/welcome/WelcomePage.ui @@ -17,7 +17,7 @@ - + Qt::Vertical