[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".
This commit is contained in:
Adriaan de Groot 2020-05-11 15:53:29 +02:00
parent 9b0ea3f63d
commit 153757933a
4 changed files with 1 additions and 33 deletions

View File

@ -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<RequirementEntry> 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<RequirementEntry>" );
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 <i>%1</i> is complete." ).arg( m->name() ) );
emit requirementsResult( l );
}
void

View File

@ -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();

View File

@ -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 );
}

View File

@ -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: