From 153757933a0b21dc305696bfdbf560a830c40ed3 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 11 May 2020 15:53:29 +0200 Subject: [PATCH] [libcalamares] Stop emitting signals with RequirementsList - The architecture of letting someone build up a list of requirements from data emitted by the ModuleManager is broken: if it gets loaded later, it will miss data; passing around complicated objects is no fun anyway. Get rid of it, on the way to "ModuleManager has its own model of requirements". --- .../modulesystem/RequirementsChecker.cpp | 23 ------------------- .../modulesystem/RequirementsChecker.h | 7 ------ .../modulesystem/ModuleManager.cpp | 3 +-- .../modulesystem/ModuleManager.h | 1 - 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/src/libcalamares/modulesystem/RequirementsChecker.cpp b/src/libcalamares/modulesystem/RequirementsChecker.cpp index 9fa9a72f8..92e194818 100644 --- a/src/libcalamares/modulesystem/RequirementsChecker.cpp +++ b/src/libcalamares/modulesystem/RequirementsChecker.cpp @@ -33,25 +33,6 @@ namespace Calamares { -static void -registerMetatypes() -{ - static bool done = false; - - if ( !done ) - { - qRegisterMetaType< RequirementEntry >( "RequirementEntry" ); - // It's sensitive to the names of types in parameters; in particular - // althrough QList is the same as RequirementsList, - // because we *name* the type as RequirementsList in the parameters, - // we need to register that (as well). Here, be safe and register - // both names. - qRegisterMetaType< QList< RequirementEntry > >( "QList" ); - qRegisterMetaType< RequirementsList >( "RequirementsList" ); - done = true; - } -} - RequirementsChecker::RequirementsChecker( QVector< Module* > modules, RequirementsModel* model, QObject* parent ) : QObject( parent ) , m_modules( std::move( modules ) ) @@ -60,8 +41,6 @@ RequirementsChecker::RequirementsChecker( QVector< Module* > modules, Requiremen , m_progressTimeouts( 0 ) { m_watchers.reserve( m_modules.count() ); - - registerMetatypes(); } RequirementsChecker::~RequirementsChecker() {} @@ -104,7 +83,6 @@ RequirementsChecker::finished() } m_model->describe(); - emit requirementsComplete( m_model->satisfiedMandatory() ); QTimer::singleShot( 0, this, &RequirementsChecker::done ); } } @@ -121,7 +99,6 @@ RequirementsChecker::addCheckedRequirements( Module* m ) requirementsProgress( tr( "Requirements checking for module %1 is complete." ).arg( m->name() ) ); - emit requirementsResult( l ); } void diff --git a/src/libcalamares/modulesystem/RequirementsChecker.h b/src/libcalamares/modulesystem/RequirementsChecker.h index 45aa4fc4f..21c86f0a6 100644 --- a/src/libcalamares/modulesystem/RequirementsChecker.h +++ b/src/libcalamares/modulesystem/RequirementsChecker.h @@ -60,13 +60,6 @@ public Q_SLOTS: signals: /// @brief Human-readable progress message void requirementsProgress( const QString& ); - /// @brief Requirements from a single module - void requirementsResult( RequirementsList ); - /** @brief When all requirements are collected - * - * The argument indicates if all mandatory requirements are satisfied. - */ - void requirementsComplete( bool ); /// @brief Emitted after requirementsComplete void done(); diff --git a/src/libcalamaresui/modulesystem/ModuleManager.cpp b/src/libcalamaresui/modulesystem/ModuleManager.cpp index 4734838ca..b6040371b 100644 --- a/src/libcalamaresui/modulesystem/ModuleManager.cpp +++ b/src/libcalamaresui/modulesystem/ModuleManager.cpp @@ -358,10 +358,9 @@ ModuleManager::checkRequirements() } RequirementsChecker* rq = new RequirementsChecker( modules, m_requirementsModel, this ); - connect( rq, &RequirementsChecker::requirementsResult, this, &ModuleManager::requirementsResult ); - connect( rq, &RequirementsChecker::requirementsComplete, this, &ModuleManager::requirementsComplete ); connect( rq, &RequirementsChecker::requirementsProgress, this, &ModuleManager::requirementsProgress ); connect( rq, &RequirementsChecker::done, rq, &RequirementsChecker::deleteLater ); + connect( rq, &RequirementsChecker::done, this, [=](){ this->requirementsComplete( m_requirementsModel->satisfiedMandatory() ); } ); QTimer::singleShot( 0, rq, &RequirementsChecker::run ); } diff --git a/src/libcalamaresui/modulesystem/ModuleManager.h b/src/libcalamaresui/modulesystem/ModuleManager.h index b0e537d9c..871a03a2a 100644 --- a/src/libcalamaresui/modulesystem/ModuleManager.h +++ b/src/libcalamaresui/modulesystem/ModuleManager.h @@ -97,7 +97,6 @@ signals: void modulesFailed( QStringList ); /// .. or not // Below, see RequirementsChecker documentation void requirementsComplete( bool ); - void requirementsResult( RequirementsList ); void requirementsProgress( const QString& ); private slots: