Scale Welcome image correctly, adjust layouts throughout Welcome page.

This commit is contained in:
Teo Mrnjavac 2015-06-20 01:05:55 +02:00
parent 80c76c549f
commit b636d69a45
4 changed files with 17 additions and 25 deletions

View File

@ -94,8 +94,7 @@ WelcomePage::WelcomePage( RequirementsChecker* requirementsChecker, QWidget* par
mb.exec(); mb.exec();
} ); } );
ui->verticalLayout->insertStretch( 3 ); ui->verticalLayout->insertWidget( 3, m_requirementsChecker->widget() );
ui->verticalLayout->insertWidget( 4, m_requirementsChecker->widget() );
} }

View File

@ -15,7 +15,7 @@
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0,0"> <layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0,0,0">
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
@ -45,19 +45,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1,2,1,0"> <layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1,2,1,0">
<item> <item>

View File

@ -20,9 +20,10 @@
#include "CheckItemWidget.h" #include "CheckItemWidget.h"
#include "Branding.h"
#include "utils/CalamaresUtilsGui.h" #include "utils/CalamaresUtilsGui.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include "Branding.h" #include "widgets/FixedAspectRatioLabel.h"
#include <QAbstractButton> #include <QAbstractButton>
#include <QBoxLayout> #include <QBoxLayout>
@ -34,13 +35,13 @@
CheckerWidget::CheckerWidget( QWidget* parent ) CheckerWidget::CheckerWidget( QWidget* parent )
: QWidget( parent ) : QWidget( parent )
{ {
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
QBoxLayout* mainLayout = new QVBoxLayout; m_mainLayout = new QVBoxLayout;
setLayout( mainLayout ); setLayout( m_mainLayout );
QHBoxLayout* spacerLayout = new QHBoxLayout; QHBoxLayout* spacerLayout = new QHBoxLayout;
mainLayout->addLayout( spacerLayout ); m_mainLayout->addLayout( spacerLayout );
m_paddingSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 4, 128 ); m_paddingSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 4, 128 );
spacerLayout->addSpacing( m_paddingSize ); spacerLayout->addSpacing( m_paddingSize );
m_entriesLayout = new QVBoxLayout; m_entriesLayout = new QVBoxLayout;
@ -128,11 +129,11 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
imagePath( Calamares::Branding::ProductWelcome ) ); imagePath( Calamares::Branding::ProductWelcome ) );
if ( !theImage.isNull() ) if ( !theImage.isNull() )
{ {
QLabel* imageLabel = new QLabel; FixedAspectRatioLabel* imageLabel = new FixedAspectRatioLabel;
imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight(), 4, 4 ); imageLabel->setContentsMargins( 4, CalamaresUtils::defaultFontHeight()*0.75, 4, 4 );
m_entriesLayout->addWidget( imageLabel ); m_mainLayout->addWidget( imageLabel );
imageLabel->setAlignment( Qt::AlignCenter ); imageLabel->setAlignment( Qt::AlignCenter );
imageLabel->setScaledContents( false ); imageLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding );
imageLabel->setPixmap( theImage ); imageLabel->setPixmap( theImage );
} }
@ -145,6 +146,10 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
textLabel->setAlignment( Qt::AlignCenter ); textLabel->setAlignment( Qt::AlignCenter );
) )
} }
else
{
m_mainLayout->addStretch();
}
} }

View File

@ -35,6 +35,7 @@ public:
private: private:
void showDetailsDialog( const QList< PrepareEntry >& checkEntries ); void showDetailsDialog( const QList< PrepareEntry >& checkEntries );
QBoxLayout* m_mainLayout;
QBoxLayout* m_entriesLayout; QBoxLayout* m_entriesLayout;
int m_paddingSize; int m_paddingSize;
}; };