mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-27 01:15:38 -04:00
[license] Use standard algorithms, simplify code
- Introduce isRequired() for readability later - Use std::any_of instead of rolling own loop
This commit is contained in:
parent
937f332441
commit
c245238b89
2 changed files with 4 additions and 9 deletions
|
@ -41,6 +41,8 @@
|
|||
#include <QComboBox>
|
||||
#include <QMessageBox>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
const NamedEnumTable< LicenseEntry::Type >&
|
||||
LicenseEntry::typeNames()
|
||||
{
|
||||
|
@ -134,15 +136,7 @@ LicensePage::setEntries( const QList< LicenseEntry >& entriesList )
|
|||
{
|
||||
CalamaresUtils::clearLayout( ui->licenseEntriesLayout );
|
||||
|
||||
bool required = false;
|
||||
for ( const LicenseEntry& entry : entriesList )
|
||||
{
|
||||
if ( entry.m_required )
|
||||
{
|
||||
required = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const bool required = std::any_of( entriesList.cbegin(), entriesList.cend(), []( const LicenseEntry& e ){ return e.m_required; });
|
||||
|
||||
m_isNextEnabled = !required;
|
||||
nextStatusChanged( m_isNextEnabled );
|
||||
|
|
|
@ -51,6 +51,7 @@ struct LicenseEntry
|
|||
LicenseEntry( const LicenseEntry& ) = default;
|
||||
|
||||
bool isValid() const { return !m_id.isEmpty(); }
|
||||
bool isRequired() const { return m_required; }
|
||||
|
||||
QString m_id;
|
||||
QString m_prettyName;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue