[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() CalamaresApplication::initViewSteps()
{ {
cDebug() << "STARTUP: loadModules for all modules done"; cDebug() << "STARTUP: loadModules for all modules done";
m_moduleManager->checkRequirements();
m_mainwindow->show(); m_mainwindow->show();
ProgressTreeModel* m = new ProgressTreeModel( nullptr ); ProgressTreeModel* m = new ProgressTreeModel( nullptr );
ProgressTreeView::instance()->setModel( m ); ProgressTreeView::instance()->setModel( m );

View File

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

View File

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

View File

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