Formatting in Summary page.

This commit is contained in:
Teo Mrnjavac 2015-04-09 17:49:00 +02:00
parent be2083e2bf
commit 69f6a2c73c
2 changed files with 46 additions and 9 deletions

View File

@ -177,15 +177,19 @@ PartitionViewStep::createSummaryWidget() const
widget->setLayout( mainLayout );
mainLayout->setMargin( 0 );
QFormLayout* formLayout = new QFormLayout( widget );
formLayout->setMargin( 0 );
const int MARGIN = CalamaresUtils::defaultFontHeight() / 2;
formLayout->setContentsMargins( MARGIN, 0, MARGIN, MARGIN );
mainLayout->addLayout( formLayout );
QList< PartitionCoreModule::SummaryInfo > list = m_core->createSummaryInfo();
for ( const auto& info : list )
{
PartitionPreview* preview;
QLabel* diskInfoLabel = new QLabel( tr( "Disk <b>%1</b> (%2)" )
.arg( info.deviceNode )
.arg( info.deviceName ) );
formLayout->addRow( diskInfoLabel );
formLayout->addRow( new QLabel( info.deviceName ) );
PartitionPreview* preview;
preview = new PartitionPreview;
preview->setModel( info.partitionModelBefore );
@ -205,8 +209,13 @@ PartitionViewStep::createSummaryWidget() const
if ( !job->prettyDescription().isEmpty() )
jobsLines.append( job->prettyDescription() );
}
jobsLabel->setText( tr( "Operations:<br/>%1" )
.arg( jobsLines.join( "<br/>" ) ) );
jobsLabel->setText( jobsLines.join( "<br/>" ) );
int m = CalamaresUtils::defaultFontHeight() / 2;
jobsLabel->setMargin( CalamaresUtils::defaultFontHeight() / 2 );
QPalette pal;
pal.setColor( QPalette::Background, pal.background().color().lighter( 108 ) );
jobsLabel->setAutoFillBackground( true );
jobsLabel->setPalette( pal );
return widget;
}

View File

@ -20,6 +20,8 @@
#include "ViewManager.h"
#include "viewpages/ViewStep.h"
#include "utils/Retranslator.h"
#include "utils/CalamaresUtilsGui.h"
#include <QBoxLayout>
#include <QLabel>
@ -31,6 +33,13 @@ SummaryPage::SummaryPage( QWidget* parent )
{
QVBoxLayout* layout = new QVBoxLayout( this );
layout->setContentsMargins( 0, 0, 0, 0 );
QLabel* headerLabel = new QLabel( this );
CALAMARES_RETRANSLATE(
headerLabel->setText( tr( "This is an overview of what will happen once you start "
"the install procedure." ) );
)
layout->addWidget( headerLabel );
}
@ -56,10 +65,18 @@ SummaryPage::onActivate()
m_layout->addSpacing( SECTION_SPACING );
m_layout->addWidget( createTitleLabel( step->prettyName() ) );
QHBoxLayout* itemBodyLayout = new QHBoxLayout;
m_layout->addSpacing( CalamaresUtils::defaultFontHeight() / 2 );
m_layout->addLayout( itemBodyLayout );
itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 );
QVBoxLayout* itemBodyCoreLayout = new QVBoxLayout;
itemBodyLayout->addLayout( itemBodyCoreLayout );
CalamaresUtils::unmarginLayout( itemBodyLayout );
if ( !text.isEmpty() )
m_layout->addWidget( createBodyLabel( text ) );
itemBodyCoreLayout->addWidget( createBodyLabel( text ) );
if ( widget )
m_layout->addWidget( widget );
itemBodyCoreLayout->addWidget( widget );
itemBodyLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 );
}
m_layout->addStretch();
}
@ -70,6 +87,7 @@ SummaryPage::createContentWidget()
delete m_contentWidget;
m_contentWidget = new QWidget;
m_layout = new QVBoxLayout( m_contentWidget );
CalamaresUtils::unmarginLayout( m_layout );
layout()->addWidget( m_contentWidget );
}
@ -78,13 +96,23 @@ SummaryPage::createTitleLabel( const QString& text ) const
{
QLabel* label = new QLabel( text );
QFont fnt = font();
fnt.setBold( true );
fnt.setWeight( QFont::Light );
fnt.setPointSize( CalamaresUtils::defaultFontSize() * 2 );
label->setFont( fnt );
label->setContentsMargins( 0, 0, 0, 0 );
return label;
}
QLabel*
SummaryPage::createBodyLabel( const QString& text ) const
{
return new QLabel( text );
QLabel* label = new QLabel;
label->setMargin( CalamaresUtils::defaultFontHeight() / 2 );
QPalette pal( palette() );
pal.setColor( QPalette::Background, palette().background().color().lighter( 108 ) );
label->setAutoFillBackground( true );
label->setPalette( pal );
label->setText( text );
return label;
}