[libcalamaresui] Switch to using three state icons for requirements
This commit is contained in:
parent
65cf28b716
commit
1d18ea264d
@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
* 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
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -23,7 +24,15 @@
|
|||||||
|
|
||||||
#include <QBoxLayout>
|
#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,
|
CheckItemWidget::CheckItemWidget( bool checked,
|
||||||
|
bool required,
|
||||||
QWidget* parent )
|
QWidget* parent )
|
||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
{
|
{
|
||||||
@ -38,15 +47,13 @@ CheckItemWidget::CheckItemWidget( bool checked,
|
|||||||
m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
m_textLabel->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
|
||||||
if ( checked )
|
if ( checked )
|
||||||
m_iconLabel->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::Yes,
|
// Condition is satisfied
|
||||||
CalamaresUtils::Original,
|
setCondition( m_iconLabel, CalamaresUtils::StatusOk );
|
||||||
QSize( m_iconLabel->height(),
|
|
||||||
m_iconLabel->height() ) ) );
|
|
||||||
else
|
else
|
||||||
m_iconLabel->setPixmap( CalamaresUtils::defaultPixmap( CalamaresUtils::No,
|
if ( required )
|
||||||
CalamaresUtils::Original,
|
setCondition( m_iconLabel, CalamaresUtils::StatusError );
|
||||||
QSize( m_iconLabel->height(),
|
else
|
||||||
m_iconLabel->height() ) ) );
|
setCondition( m_iconLabel, CalamaresUtils::StatusWarning );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
* 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
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -25,7 +26,7 @@ class CheckItemWidget : public QWidget
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit CheckItemWidget( bool checked,
|
explicit CheckItemWidget( bool checked, bool required,
|
||||||
QWidget* parent = nullptr );
|
QWidget* parent = nullptr );
|
||||||
|
|
||||||
void setText( const QString& text );
|
void setText( const QString& text );
|
||||||
|
@ -62,7 +62,7 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
|
|||||||
{
|
{
|
||||||
if ( !entry.checked )
|
if ( !entry.checked )
|
||||||
{
|
{
|
||||||
CheckItemWidget* ciw = new CheckItemWidget( entry.checked );
|
CheckItemWidget* ciw = new CheckItemWidget( entry.checked, entry.required );
|
||||||
CALAMARES_RETRANSLATE( ciw->setText( entry.negatedText() ); )
|
CALAMARES_RETRANSLATE( ciw->setText( entry.negatedText() ); )
|
||||||
m_entriesLayout->addWidget( ciw );
|
m_entriesLayout->addWidget( ciw );
|
||||||
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
@ -182,7 +182,7 @@ CheckerWidget::showDetailsDialog( const QList< PrepareEntry >& checkEntries )
|
|||||||
if ( entry.enumerationText().isEmpty() )
|
if ( entry.enumerationText().isEmpty() )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CheckItemWidget* ciw = new CheckItemWidget( entry.checked );
|
CheckItemWidget* ciw = new CheckItemWidget( entry.checked, entry.required );
|
||||||
CALAMARES_RETRANSLATE( ciw->setText( entry.enumerationText() ); )
|
CALAMARES_RETRANSLATE( ciw->setText( entry.enumerationText() ); )
|
||||||
entriesLayout->addWidget( ciw );
|
entriesLayout->addWidget( ciw );
|
||||||
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
||||||
*
|
*
|
||||||
* Copyright 2014-2017, Teo Mrnjavac <teo@kde.org>
|
* 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
|
* Calamares is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
Loading…
Reference in New Issue
Block a user