Add details dialog to requirements widget.
This commit is contained in:
parent
2fd84fc9f7
commit
e09976d91c
@ -24,7 +24,10 @@
|
|||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
#include "Branding.h"
|
#include "Branding.h"
|
||||||
|
|
||||||
|
#include <QAbstractButton>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
|
|
||||||
@ -99,11 +102,19 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
|
|||||||
iconLabel->size() ) );
|
iconLabel->size() ) );
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
textLabel->setText( tr( "This computer does not satisfy the minimum "
|
textLabel->setText( tr( "This computer does not satisfy the minimum "
|
||||||
"requirements for installing %1.\n"
|
"requirements for installing %1.<br/>"
|
||||||
"Installation cannot continue." )
|
"Installation cannot continue. "
|
||||||
|
"<a href=\"#details\">Details...</a>" )
|
||||||
.arg( Calamares::Branding::instance()->
|
.arg( Calamares::Branding::instance()->
|
||||||
string( Calamares::Branding::ShortVersionedName ) ) );
|
string( Calamares::Branding::ShortVersionedName ) ) );
|
||||||
)
|
)
|
||||||
|
textLabel->setOpenExternalLinks( false );
|
||||||
|
connect( textLabel, &QLabel::linkActivated,
|
||||||
|
this, [ this, checkEntries ]( const QString& link )
|
||||||
|
{
|
||||||
|
if ( link == "#details" )
|
||||||
|
showDetailsDialog( checkEntries );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -112,7 +123,7 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
|
|||||||
iconLabel->size() ) );
|
iconLabel->size() ) );
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE(
|
||||||
textLabel->setText( tr( "This computer does not satisfy some of the "
|
textLabel->setText( tr( "This computer does not satisfy some of the "
|
||||||
"recommended requirements for installing %1.\n"
|
"recommended requirements for installing %1.<br/>"
|
||||||
"Installation can continue, but some features "
|
"Installation can continue, but some features "
|
||||||
"might be disabled." )
|
"might be disabled." )
|
||||||
.arg( Calamares::Branding::instance()->
|
.arg( Calamares::Branding::instance()->
|
||||||
@ -121,3 +132,46 @@ CheckerWidget::init( const QList< PrepareEntry >& checkEntries )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
CheckerWidget::showDetailsDialog( const QList< PrepareEntry >& checkEntries )
|
||||||
|
{
|
||||||
|
QDialog* detailsDialog = new QDialog( this );
|
||||||
|
QBoxLayout* mainLayout = new QVBoxLayout;
|
||||||
|
detailsDialog->setLayout( mainLayout );
|
||||||
|
|
||||||
|
QLabel* textLabel = new QLabel;
|
||||||
|
mainLayout->addWidget( textLabel );
|
||||||
|
CALAMARES_RETRANSLATE(
|
||||||
|
textLabel->setText( tr( "For best results, please ensure that this computer:" ) );
|
||||||
|
)
|
||||||
|
QBoxLayout* entriesLayout = new QVBoxLayout;
|
||||||
|
CalamaresUtils::unmarginLayout( entriesLayout );
|
||||||
|
mainLayout->addLayout( entriesLayout );
|
||||||
|
|
||||||
|
for ( const PrepareEntry& entry : checkEntries )
|
||||||
|
{
|
||||||
|
CheckItemWidget* ciw = new CheckItemWidget( entry.checked );
|
||||||
|
CALAMARES_RETRANSLATE( ciw->setText( entry.enumerationText() ); )
|
||||||
|
entriesLayout->addWidget( ciw );
|
||||||
|
ciw->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Preferred );
|
||||||
|
|
||||||
|
ciw->setAutoFillBackground( true );
|
||||||
|
QPalette pal( ciw->palette() );
|
||||||
|
pal.setColor( QPalette::Background, Qt::white );
|
||||||
|
ciw->setPalette( pal );
|
||||||
|
}
|
||||||
|
|
||||||
|
QDialogButtonBox* buttonBox = new QDialogButtonBox( QDialogButtonBox::Close,
|
||||||
|
Qt::Horizontal,
|
||||||
|
this );
|
||||||
|
mainLayout->addWidget( buttonBox );
|
||||||
|
|
||||||
|
detailsDialog->setModal( true );
|
||||||
|
|
||||||
|
connect( buttonBox, &QDialogButtonBox::clicked,
|
||||||
|
detailsDialog, &QDialog::close );
|
||||||
|
detailsDialog->exec();
|
||||||
|
detailsDialog->deleteLater();
|
||||||
|
}
|
||||||
|
@ -33,6 +33,8 @@ public:
|
|||||||
void init( const QList< PrepareEntry >& checkEntries );
|
void init( const QList< PrepareEntry >& checkEntries );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void showDetailsDialog( const QList< PrepareEntry >& checkEntries );
|
||||||
|
|
||||||
QBoxLayout* m_entriesLayout;
|
QBoxLayout* m_entriesLayout;
|
||||||
int m_paddingSize;
|
int m_paddingSize;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user