From 7bce58f6f2dfb3c6aa54094596bab1e561cf547b Mon Sep 17 00:00:00 2001 From: bill-auger Date: Fri, 17 Apr 2020 22:24:33 -0400 Subject: [PATCH] [welcome] add optional branding banner to welcome page --- src/branding/default/branding.desc | 8 +++++++- src/libcalamaresui/Branding.cpp | 7 ++++--- src/libcalamaresui/Branding.h | 7 ++++--- src/modules/welcome/WelcomePage.cpp | 26 ++++++++++++++++++++++---- 4 files changed, 37 insertions(+), 11 deletions(-) diff --git a/src/branding/default/branding.desc b/src/branding/default/branding.desc index b6694d1f4..d9c9e1456 100644 --- a/src/branding/default/branding.desc +++ b/src/branding/default/branding.desc @@ -106,6 +106,11 @@ strings: # These images are loaded from the branding module directory. # +# productBanner is an optional image, which if present, will be shown +# on the welcome page of the application, above the welcome text. +# It is intended to have a width much greater than height. +# It is displayed at 64px height (also on HiDPI). +# Recommended size is 64px tall, and up to 460px wide. # productIcon is used as the window icon, and will (usually) be used # by the window manager to represent the application. This image # should be square, and may be displayed by the window manager @@ -121,8 +126,9 @@ strings: # # These filenames can also use substitutions from os-release (see above). images: - productLogo: "squid.png" + productBanner: "banner.png" productIcon: "squid.png" + productLogo: "squid.png" productWelcome: "languages.png" # The slideshow is displayed during execution steps (e.g. when the diff --git a/src/libcalamaresui/Branding.cpp b/src/libcalamaresui/Branding.cpp index ff7e43fb8..38dee24a8 100644 --- a/src/libcalamaresui/Branding.cpp +++ b/src/libcalamaresui/Branding.cpp @@ -73,10 +73,11 @@ const QStringList Branding::s_stringEntryStrings = const QStringList Branding::s_imageEntryStrings = { - "productLogo", + "productBanner", "productIcon", - "productWelcome", - "productWallpaper" + "productLogo", + "productWallpaper", + "productWelcome" }; const QStringList Branding::s_styleEntryStrings = diff --git a/src/libcalamaresui/Branding.h b/src/libcalamaresui/Branding.h index 023f1a511..847f28d89 100644 --- a/src/libcalamaresui/Branding.h +++ b/src/libcalamaresui/Branding.h @@ -67,10 +67,11 @@ public: enum ImageEntry : short { - ProductLogo, + ProductBanner, ProductIcon, - ProductWelcome, - ProductWallpaper + ProductLogo, + ProductWallpaper, + ProductWelcome }; Q_ENUM( ImageEntry ) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index e4be00fe7..e77924f85 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -51,7 +51,6 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) , m_languages( nullptr ) , m_conf( conf ) { - connect( Calamares::ModuleManager::instance(), &Calamares::ModuleManager::requirementsComplete, m_checkingWidget, @@ -62,7 +61,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) &CheckerContainer::requirementsProgress ); ui->setupUi( this ); - ui->verticalLayout->insertSpacing( 1, CalamaresUtils::defaultFontHeight() * 2 ); + const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); + ui->verticalLayout->insertSpacing( 1, defaultFontHeight * 2 ); initLanguages(); ui->mainText->setAlignment( Qt::AlignCenter ); @@ -77,11 +77,29 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information, CalamaresUtils::Original, - 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) ); + 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox ); - int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); + // insert system-check widget below welcome text + const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); 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 ) ) + { + QPixmap bannerPixmap = QPixmap( bannerPath ); + if ( !bannerPixmap.isNull() ) + { + QLabel* bannerLabel = new QLabel; + bannerLabel->setPixmap( bannerPixmap ); + bannerLabel->setMinimumHeight( 64 ); + bannerLabel->setAlignment( Qt::AlignCenter ); + ui->verticalLayout->insertSpacing( welcome_text_idx, defaultFontHeight ); + ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel ); + } + } } void