[libcalamares] Remove runaround through free function
- Call into a method directly to do the work of adding results from a single module.
This commit is contained in:
parent
b7c60cec66
commit
9b0ea3f63d
@ -52,18 +52,6 @@ registerMetatypes()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
check( Module* const& m, RequirementsChecker* c )
|
|
||||||
{
|
|
||||||
RequirementsList l = m->checkRequirements();
|
|
||||||
if ( l.count() > 0 )
|
|
||||||
{
|
|
||||||
c->addCheckedRequirements( l );
|
|
||||||
}
|
|
||||||
c->requirementsProgress(
|
|
||||||
QObject::tr( "Requirements checking for module <i>%1</i> is complete." ).arg( m->name() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
RequirementsChecker::RequirementsChecker( QVector< Module* > modules, RequirementsModel* model, QObject* parent )
|
RequirementsChecker::RequirementsChecker( QVector< Module* > modules, RequirementsModel* model, QObject* parent )
|
||||||
: QObject( parent )
|
: QObject( parent )
|
||||||
, m_modules( std::move( modules ) )
|
, m_modules( std::move( modules ) )
|
||||||
@ -88,7 +76,7 @@ RequirementsChecker::run()
|
|||||||
for ( const auto& module : m_modules )
|
for ( const auto& module : m_modules )
|
||||||
{
|
{
|
||||||
Watcher* watcher = new Watcher( this );
|
Watcher* watcher = new Watcher( this );
|
||||||
watcher->setFuture( QtConcurrent::run( check, module, this ) );
|
watcher->setFuture( QtConcurrent::run( this, &RequirementsChecker::addCheckedRequirements, module ) );
|
||||||
watcher->setObjectName( module->name() );
|
watcher->setObjectName( module->name() );
|
||||||
m_watchers.append( watcher );
|
m_watchers.append( watcher );
|
||||||
connect( watcher, &Watcher::finished, this, &RequirementsChecker::finished );
|
connect( watcher, &Watcher::finished, this, &RequirementsChecker::finished );
|
||||||
@ -122,10 +110,17 @@ RequirementsChecker::finished()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
RequirementsChecker::addCheckedRequirements( RequirementsList l )
|
RequirementsChecker::addCheckedRequirements( Module* m )
|
||||||
{
|
{
|
||||||
m_model->addRequirementsList( l );
|
RequirementsList l = m->checkRequirements();
|
||||||
cDebug() << "Added" << l.count() << "requirement results";
|
cDebug() << "Got" << l.count() << "requirement results from" << m->name();
|
||||||
|
if ( l.count() > 0 )
|
||||||
|
{
|
||||||
|
m_model->addRequirementsList( l );
|
||||||
|
}
|
||||||
|
|
||||||
|
requirementsProgress(
|
||||||
|
tr( "Requirements checking for module <i>%1</i> is complete." ).arg( m->name() ) );
|
||||||
emit requirementsResult( l );
|
emit requirementsResult( l );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public Q_SLOTS:
|
|||||||
void run();
|
void run();
|
||||||
|
|
||||||
/// @brief Called when requirements are reported by a module
|
/// @brief Called when requirements are reported by a module
|
||||||
void addCheckedRequirements( RequirementsList );
|
void addCheckedRequirements( Module* );
|
||||||
|
|
||||||
/// @brief Called when all requirements have been checked
|
/// @brief Called when all requirements have been checked
|
||||||
void finished();
|
void finished();
|
||||||
|
Loading…
Reference in New Issue
Block a user