Refactor CheckerWidget for better integration with Welcome page.
This commit is contained in:
parent
7622abce94
commit
51f74315f6
@ -29,25 +29,21 @@
|
|||||||
|
|
||||||
|
|
||||||
CheckerWidget::CheckerWidget( QWidget* parent )
|
CheckerWidget::CheckerWidget( QWidget* parent )
|
||||||
: QWidget()
|
: QWidget( parent )
|
||||||
{
|
{
|
||||||
|
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||||
|
|
||||||
QBoxLayout* mainLayout = new QVBoxLayout;
|
QBoxLayout* mainLayout = new QVBoxLayout;
|
||||||
setLayout( mainLayout );
|
setLayout( mainLayout );
|
||||||
|
|
||||||
QLabel* text = new QLabel( this );
|
|
||||||
CALAMARES_RETRANSLATE(
|
|
||||||
text->setText( tr( "For best results, please ensure that this computer:" ) );
|
|
||||||
)
|
|
||||||
|
|
||||||
mainLayout->addSpacing( CalamaresUtils::defaultFontHeight() );
|
|
||||||
mainLayout->addWidget( text );
|
|
||||||
QHBoxLayout* spacerLayout = new QHBoxLayout;
|
QHBoxLayout* spacerLayout = new QHBoxLayout;
|
||||||
mainLayout->addLayout( spacerLayout );
|
mainLayout->addLayout( spacerLayout );
|
||||||
spacerLayout->addSpacing( CalamaresUtils::defaultFontHeight() * 2 );
|
m_paddingSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 4, 128 );
|
||||||
|
spacerLayout->addSpacing( m_paddingSize );
|
||||||
m_entriesLayout = new QVBoxLayout;
|
m_entriesLayout = new QVBoxLayout;
|
||||||
spacerLayout->addLayout( m_entriesLayout );
|
spacerLayout->addLayout( m_entriesLayout );
|
||||||
|
spacerLayout->addSpacing( m_paddingSize );
|
||||||
CalamaresUtils::unmarginLayout( spacerLayout );
|
CalamaresUtils::unmarginLayout( spacerLayout );
|
||||||
mainLayout->addStretch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -59,32 +55,41 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
|
|||||||
|
|
||||||
for ( const PrepareEntry& entry : checkEntries )
|
for ( const PrepareEntry& entry : checkEntries )
|
||||||
{
|
{
|
||||||
CheckItemWidget* ciw = new CheckItemWidget( entry.checked );
|
|
||||||
CALAMARES_RETRANSLATE( ciw->setText( entry.text() ); )
|
|
||||||
m_entriesLayout->addWidget( ciw );
|
|
||||||
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
|
||||||
|
|
||||||
if ( !entry.checked )
|
if ( !entry.checked )
|
||||||
{
|
{
|
||||||
|
CheckItemWidget* ciw = new CheckItemWidget( entry.checked );
|
||||||
|
CALAMARES_RETRANSLATE( ciw->setText( entry.negatedText() ); )
|
||||||
|
m_entriesLayout->addWidget( ciw );
|
||||||
|
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
|
||||||
allChecked = false;
|
allChecked = false;
|
||||||
if ( entry.required )
|
if ( entry.required )
|
||||||
{
|
{
|
||||||
requirementsSatisfied = false;
|
requirementsSatisfied = false;
|
||||||
}
|
}
|
||||||
|
ciw->setAutoFillBackground( true );
|
||||||
|
QPalette pal( ciw->palette() );
|
||||||
|
pal.setColor( QPalette::Background, Qt::white );
|
||||||
|
ciw->setPalette( pal );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !allChecked )
|
if ( !allChecked )
|
||||||
{
|
{
|
||||||
QBoxLayout* mainLayout = dynamic_cast< QBoxLayout* >( layout() );
|
|
||||||
QBoxLayout* infoLayout = new QHBoxLayout;
|
|
||||||
QLabel* iconLabel = new QLabel;
|
QLabel* iconLabel = new QLabel;
|
||||||
QLabel* textLabel = new QLabel;
|
QLabel* textLabel = new QLabel;
|
||||||
int iconSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 6, 128 );
|
int iconSize = qBound( 32, CalamaresUtils::defaultFontHeight() * 6, 128 );
|
||||||
|
QHBoxLayout* iconLayout = new QHBoxLayout;
|
||||||
|
iconLayout->addStretch();
|
||||||
|
iconLayout->addWidget( iconLabel );
|
||||||
|
iconLayout->addStretch();
|
||||||
iconLabel->setFixedSize( iconSize, iconSize );
|
iconLabel->setFixedSize( iconSize, iconSize );
|
||||||
|
CalamaresUtils::unmarginLayout( iconLayout );
|
||||||
textLabel->setWordWrap( true );
|
textLabel->setWordWrap( true );
|
||||||
infoLayout->addWidget( iconLabel );
|
m_entriesLayout->insertLayout( 0, iconLayout );
|
||||||
infoLayout->addWidget( textLabel );
|
m_entriesLayout->insertWidget( 1, textLabel );
|
||||||
|
m_entriesLayout->insertSpacing( 2, CalamaresUtils::defaultFontHeight() / 2 );
|
||||||
textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
|
||||||
if ( !requirementsSatisfied )
|
if ( !requirementsSatisfied )
|
||||||
@ -114,7 +119,5 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
|
|||||||
string( Calamares::Branding::ShortVersionedName ) ) );
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
mainLayout->insertLayout( mainLayout->count(), infoLayout );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QBoxLayout* m_entriesLayout;
|
QBoxLayout* m_entriesLayout;
|
||||||
|
int m_paddingSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CHECKERWIDGET_H
|
#endif // CHECKERWIDGET_H
|
||||||
|
Loading…
Reference in New Issue
Block a user