[welcome] Refactor link-clicking
- remove intermediate lambda - rename dialog slot to one handling links in general (which now **only** does the dialog link)
This commit is contained in:
parent
ecc7719abd
commit
b476e4b386
@ -159,10 +159,10 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
||||
|
||||
// Check that all are satisfied (gives warnings if not) and
|
||||
// all *mandatory* entries are satisfied (gives errors if not).
|
||||
auto isUnSatisfied = [](const Calamares::RequirementEntry& e){ return !e.satisfied; };
|
||||
auto isMandatoryAndUnSatisfied = [](const Calamares::RequirementEntry& e){ return e.mandatory && !e.satisfied; };
|
||||
const bool requirementsSatisfied = std::none_of(checkEntries.begin(), checkEntries.end(), isUnSatisfied);
|
||||
const bool mandatorySatisfied = std::none_of(checkEntries.begin(), checkEntries.end(), isMandatoryAndUnSatisfied);
|
||||
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
||||
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
|
||||
const bool requirementsSatisfied = std::none_of( checkEntries.begin(), checkEntries.end(), isUnSatisfied );
|
||||
const bool mandatorySatisfied = std::none_of( checkEntries.begin(), checkEntries.end(), isMandatoryAndUnSatisfied );
|
||||
|
||||
for ( const auto& entry : checkEntries )
|
||||
{
|
||||
@ -205,12 +205,7 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
||||
"<a href=\"#details\">Details...</a>" );
|
||||
textLabel->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); )
|
||||
textLabel->setOpenExternalLinks( false );
|
||||
connect( textLabel, &QLabel::linkActivated, this, [this, checkEntries]( const QString& link ) {
|
||||
if ( link == "#details" )
|
||||
{
|
||||
showDetailsDialog( checkEntries );
|
||||
}
|
||||
} );
|
||||
connect( textLabel, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -267,9 +262,12 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
||||
|
||||
|
||||
void
|
||||
ResultsListWidget::showDetailsDialog( const Calamares::RequirementsList& checkEntries )
|
||||
ResultsListWidget::linkClicked( const QString& link )
|
||||
{
|
||||
auto* dialog = new ResultsListDialog( this, checkEntries );
|
||||
if ( link == "#details" )
|
||||
{
|
||||
auto* dialog = new ResultsListDialog( this, m_entries );
|
||||
dialog->exec();
|
||||
dialog->deleteLater();
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,9 @@ public:
|
||||
explicit ResultsListWidget( QWidget* parent, const Calamares::RequirementsList& checkEntries );
|
||||
|
||||
private:
|
||||
void showDetailsDialog( const Calamares::RequirementsList& checkEntries );
|
||||
/// @brief A link in the explanatory text has been clicked
|
||||
void linkClicked( const QString& link );
|
||||
void retranslate();
|
||||
|
||||
const Calamares::RequirementsList& m_entries;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user