[libcalamaresui] Stub requirements checking.

Introduce a method checkRequirements() into the module system so that
individual modules can do their own checking (as opposed to stuffing
it all into the welcome module).
This commit is contained in:
Adriaan de Groot 2017-11-30 12:01:11 -05:00
parent d63f8f6922
commit 24e04645b6
5 changed files with 33 additions and 0 deletions

View File

@ -355,6 +355,7 @@ void
CalamaresApplication::initViewSteps()
{
cDebug() << "STARTUP: loadModules for all modules done";
m_moduleManager->checkRequirements();
m_mainwindow->show();
ProgressTreeModel* m = new ProgressTreeModel( nullptr );
ProgressTreeView::instance()->setModel( m );

View File

@ -297,4 +297,9 @@ Module::initFrom( const QVariantMap& moduleDescriptor )
m_name = moduleDescriptor.value( "name" ).toString();
}
void
Module::checkRequirements()
{
}
} //ns

View File

@ -1,6 +1,7 @@
/* === This file is part of Calamares - <http://github.com/calamares> ===
*
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
* Copyright 2017, Adriaan de Groot <groot@kde.org>
*
* Calamares is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -161,6 +162,11 @@ public:
*/
QVariantMap configurationMap();
/**
* @brief Check the requirements of this module.
*/
virtual void checkRequirements();
protected:
explicit Module();
virtual void initFrom( const QVariantMap& moduleDescriptor );

View File

@ -315,4 +315,18 @@ ModuleManager::loadModules()
} );
}
void
ModuleManager::checkRequirements()
{
QTimer::singleShot( 0, this, [ this ]()
{
for (const auto& module : m_loadedModulesByInstanceKey )
{
module->checkRequirements();
}
emit modulesChecked();
} );
}
} // namespace

View File

@ -80,9 +80,16 @@ public:
*/
void loadModules();
/**
* @brief Starts asynchronous requirements checking for each module.
* When this is done, the signal modulesChecked is emitted.
*/
void checkRequirements();
signals:
void initDone();
void modulesLoaded();
void modulesChecked();
private slots:
void doInit();