mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 10:55:46 -05:00
[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
This commit is contained in:
parent
c3941b6e65
commit
1f6752307d
2 changed files with 8 additions and 4 deletions
|
@ -51,6 +51,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
||||||
, m_languages( nullptr )
|
, m_languages( nullptr )
|
||||||
, m_conf( conf )
|
, m_conf( conf )
|
||||||
{
|
{
|
||||||
|
using Branding = Calamares::Branding;
|
||||||
|
|
||||||
const int defaultFontHeight = CalamaresUtils::defaultFontHeight();
|
const int defaultFontHeight = CalamaresUtils::defaultFontHeight();
|
||||||
ui->setupUi( this );
|
ui->setupUi( this );
|
||||||
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
|
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
|
||||||
|
@ -63,10 +65,10 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
||||||
ui->verticalLayout->insertWidget( welcome_text_idx + 1, m_checkingWidget );
|
ui->verticalLayout->insertWidget( welcome_text_idx + 1, m_checkingWidget );
|
||||||
|
|
||||||
// insert optional logo banner image above welcome text
|
// insert optional logo banner image above welcome text
|
||||||
Calamares::Branding::ImageEntry bannerImage = Calamares::Branding::ProductBanner;
|
QString bannerPath = Branding::instance()->imagePath( Branding::ProductBanner );
|
||||||
QString bannerPath = Calamares::Branding::instance()->imagePath( bannerImage );
|
if ( !bannerPath.isEmpty() )
|
||||||
if ( QFile::exists( bannerPath ) )
|
|
||||||
{
|
{
|
||||||
|
// If the name is not empty, the file exists -- Branding checks that at startup
|
||||||
QPixmap bannerPixmap = QPixmap( bannerPath );
|
QPixmap bannerPixmap = QPixmap( bannerPath );
|
||||||
if ( !bannerPixmap.isNull() )
|
if ( !bannerPixmap.isNull() )
|
||||||
{
|
{
|
||||||
|
@ -74,6 +76,8 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
|
||||||
bannerLabel->setPixmap( bannerPixmap );
|
bannerLabel->setPixmap( bannerPixmap );
|
||||||
bannerLabel->setMinimumHeight( 64 );
|
bannerLabel->setMinimumHeight( 64 );
|
||||||
bannerLabel->setAlignment( Qt::AlignCenter );
|
bannerLabel->setAlignment( Qt::AlignCenter );
|
||||||
|
ui->aboveTextSpacer->changeSize( 20, defaultFontHeight ); // Shrink it down
|
||||||
|
ui->aboveTextSpacer->invalidate();
|
||||||
ui->verticalLayout->insertSpacing( welcome_text_idx, defaultFontHeight );
|
ui->verticalLayout->insertSpacing( welcome_text_idx, defaultFontHeight );
|
||||||
ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel );
|
ui->verticalLayout->insertWidget( welcome_text_idx, bannerLabel );
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0">
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="aboveTextSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
|
|
Loading…
Add table
Reference in a new issue