[welcome] add optional branding banner to welcome page

main
bill-auger 5 years ago
parent 39ed591414
commit 7bce58f6f2

@ -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

@ -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 =

@ -67,10 +67,11 @@ public:
enum ImageEntry : short
{
ProductLogo,
ProductBanner,
ProductIcon,
ProductWelcome,
ProductWallpaper
ProductLogo,
ProductWallpaper,
ProductWelcome
};
Q_ENUM( ImageEntry )

@ -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

Loading…
Cancel
Save