[libcalamaresui] Switch to using three state icons for requirements

This commit is contained in:
Adriaan de Groot 2017-11-20 08:50:15 -05:00
parent 65cf28b716
commit 1d18ea264d
4 changed files with 20 additions and 11 deletions

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -23,7 +24,15 @@
#include <QBoxLayout>
static inline void setCondition( QLabel* label, CalamaresUtils::ImageType t )
{
label->setPixmap( CalamaresUtils::defaultPixmap( t,
CalamaresUtils::Original,
QSize( label->height(), label->height() ) ) );
}
CheckItemWidget::CheckItemWidget( bool checked,
bool required,
QWidget* parent )
: QWidget( parent )
{
@ -38,15 +47,13 @@ CheckItemWidget::CheckItemWidget( bool checked,
m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
if ( checked )
m_iconLabel->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::Yes,
CalamaresUtils::Original,
QSize( m_iconLabel->height(),
m_iconLabel->height() ) ) );
// Condition is satisfied
setCondition( m_iconLabel, CalamaresUtils::StatusOk );
else
m_iconLabel->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::No,
CalamaresUtils::Original,
QSize( m_iconLabel->height(),
m_iconLabel->height() ) ) );
if ( required )
setCondition( m_iconLabel, CalamaresUtils::StatusError );
else
setCondition( m_iconLabel, CalamaresUtils::StatusWarning );
}

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,7 +26,7 @@ class CheckItemWidget : public QWidget
{
Q_OBJECT
public:
explicit CheckItemWidget( bool checked,
explicit CheckItemWidget( bool checked, bool required,
QWidget* parent = nullptr );
void setText( const QString& text );

View File

@ -62,7 +62,7 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
{
if ( !entry.checked )
{
CheckItemWidget* ciw = new CheckItemWidget( entry.checked );
CheckItemWidget* ciw = new CheckItemWidget( entry.checked, entry.required );
CALAMARES_RETRANSLATE( ciw->setText( entry.negatedText() ); )
m_entriesLayout->addWidget( ciw );
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
@ -182,7 +182,7 @@ CheckerWidget::showDetailsDialog( const QList< PrepareEntry >& checkEntries )
if ( entry.enumerationText().isEmpty() )
continue;
CheckItemWidget* ciw = new CheckItemWidget( entry.checked );
CheckItemWidget* ciw = new CheckItemWidget( entry.checked, entry.required );
CALAMARES_RETRANSLATE( ciw->setText( entry.enumerationText() ); )
entriesLayout->addWidget( ciw );
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by