[welcome] Use convenience function

- Introduce a hasDetails() for RequirementEntry, which is just
   a short-cut, but makes code more readable.
This commit is contained in:
Adriaan de Groot 2019-02-26 06:20:20 -05:00
parent bfb5a4efb9
commit 54ba0aaf13
2 changed files with 6 additions and 3 deletions

View File

@ -45,14 +45,17 @@ struct RequirementEntry
/// @brief name of this requirement; not shown to user and used as ID /// @brief name of this requirement; not shown to user and used as ID
QString name; QString name;
/// @brief Description of this requirement, for use in user-visible lists /// @brief Detailed description of this requirement, for use in user-visible lists
TextFunction enumerationText; TextFunction enumerationText;
/// @brief User-visible string to show that the requirement is not met /// @brief User-visible string to show that the requirement is not met, short form
TextFunction negatedText; TextFunction negatedText;
bool satisfied; bool satisfied;
bool mandatory; bool mandatory;
/// @brief Convenience to check if this entry should be shown in details dialog
bool hasDetails() const { return !enumerationText().isEmpty(); }
}; };
using RequirementsList = QList< RequirementEntry >; using RequirementsList = QList< RequirementEntry >;

View File

@ -179,7 +179,7 @@ ResultsListWidget::showDetailsDialog( const Calamares::RequirementsList& checkEn
for ( const auto& entry : checkEntries ) for ( const auto& entry : checkEntries )
{ {
if ( entry.enumerationText().isEmpty() ) if ( !entry.hasDetails() )
continue; continue;
ResultWidget* ciw = new ResultWidget( entry.satisfied, entry.mandatory ); ResultWidget* ciw = new ResultWidget( entry.satisfied, entry.mandatory );