From e756cc8720d203b2e714f66ab7d5b86d46eaa1bb Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Thu, 2 Apr 2020 22:12:56 +0200 Subject: [PATCH] [libcalamares] Tidy RequirementsModel some more - put signals in conventional place - remove const int& parameter, that can just be int - drop oddly-guarded code (that leaks memory); if the index (row) being passed in, it's probably best to just crash - remove unused signal warningMessageChanged --- src/libcalamares/modulesystem/RequirementsModel.h | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/libcalamares/modulesystem/RequirementsModel.h b/src/libcalamares/modulesystem/RequirementsModel.h index 03e00bec5..2acf785e7 100644 --- a/src/libcalamares/modulesystem/RequirementsModel.h +++ b/src/libcalamares/modulesystem/RequirementsModel.h @@ -51,13 +51,8 @@ public: bool satisfiedRequirements() const { return m_satisfiedRequirements; } bool satisfiedMandatory() const { return m_satisfiedMandatory; } - const Calamares::RequirementEntry& getEntry( const int& index ) const + const Calamares::RequirementEntry& getEntry( int index ) const { - if ( index > count() || index < 0 ) - { - return *( new Calamares::RequirementEntry() ); - } - return m_requirements.at( index ); } @@ -67,6 +62,10 @@ public: int rowCount( const QModelIndex& ) const override; int count() const { return m_requirements.count(); } +signals: + void satisfiedRequirementsChanged( bool value ); + void satisfiedMandatoryChanged( bool value ); + protected: QHash< int, QByteArray > roleNames() const override; @@ -75,10 +74,6 @@ private: bool m_satisfiedRequirements = false; bool m_satisfiedMandatory = false; -signals: - void satisfiedRequirementsChanged( bool value ); - void satisfiedMandatoryChanged( bool value ); - void warningMessageChanged(); }; } // namespace Calamares