From 69f6a2c73ccce5ee6bfa21d39a9ca225ee34f9e1 Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Thu, 9 Apr 2015 17:49:00 +0200 Subject: [PATCH] Formatting in Summary page. --- .../partition/gui/PartitionViewStep.cpp | 19 +++++++--- src/modules/summary/SummaryPage.cpp | 36 ++++++++++++++++--- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index bfa330602..418770789 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -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 %1 (%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:
%1" ) - .arg( jobsLines.join( "
" ) ) ); + jobsLabel->setText( jobsLines.join( "
" ) ); + 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; } diff --git a/src/modules/summary/SummaryPage.cpp b/src/modules/summary/SummaryPage.cpp index d803a3d61..eb7bd2355 100644 --- a/src/modules/summary/SummaryPage.cpp +++ b/src/modules/summary/SummaryPage.cpp @@ -20,6 +20,8 @@ #include "ViewManager.h" #include "viewpages/ViewStep.h" +#include "utils/Retranslator.h" +#include "utils/CalamaresUtilsGui.h" #include #include @@ -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; }