[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
|
// Check that all are satisfied (gives warnings if not) and
|
||||||
// all *mandatory* entries are satisfied (gives errors if not).
|
// all *mandatory* entries are satisfied (gives errors if not).
|
||||||
auto isUnSatisfied = [](const Calamares::RequirementEntry& e){ return !e.satisfied; };
|
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
||||||
auto isMandatoryAndUnSatisfied = [](const Calamares::RequirementEntry& e){ return e.mandatory && !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 requirementsSatisfied = std::none_of( checkEntries.begin(), checkEntries.end(), isUnSatisfied );
|
||||||
const bool mandatorySatisfied = std::none_of(checkEntries.begin(), checkEntries.end(), isMandatoryAndUnSatisfied);
|
const bool mandatorySatisfied = std::none_of( checkEntries.begin(), checkEntries.end(), isMandatoryAndUnSatisfied );
|
||||||
|
|
||||||
for ( const auto& entry : checkEntries )
|
for ( const auto& entry : checkEntries )
|
||||||
{
|
{
|
||||||
@ -205,12 +205,7 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
|||||||
"<a href=\"#details\">Details...</a>" );
|
"<a href=\"#details\">Details...</a>" );
|
||||||
textLabel->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); )
|
textLabel->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); )
|
||||||
textLabel->setOpenExternalLinks( false );
|
textLabel->setOpenExternalLinks( false );
|
||||||
connect( textLabel, &QLabel::linkActivated, this, [this, checkEntries]( const QString& link ) {
|
connect( textLabel, &QLabel::linkActivated, this, &ResultsListWidget::linkClicked );
|
||||||
if ( link == "#details" )
|
|
||||||
{
|
|
||||||
showDetailsDialog( checkEntries );
|
|
||||||
}
|
|
||||||
} );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -267,9 +262,12 @@ ResultsListWidget::ResultsListWidget( QWidget* parent, const Calamares::Requirem
|
|||||||
|
|
||||||
|
|
||||||
void
|
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->exec();
|
||||||
dialog->deleteLater();
|
dialog->deleteLater();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,9 @@ public:
|
|||||||
explicit ResultsListWidget( QWidget* parent, const Calamares::RequirementsList& checkEntries );
|
explicit ResultsListWidget( QWidget* parent, const Calamares::RequirementsList& checkEntries );
|
||||||
|
|
||||||
private:
|
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;
|
const Calamares::RequirementsList& m_entries;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user