Better settings format, rename a bit of stuff in module loading.

This commit is contained in:
Teo Mrnjavac 2014-07-10 18:03:59 +02:00
parent 22ff18f2cc
commit a09ab36386
6 changed files with 54 additions and 25 deletions

View file

@ -1,22 +1,40 @@
# Configuration file for Calamares
# Syntax is YAML 1.2
---
# Modules can be core modules (with different interfaces) and QtWidgets page modules.
# Modules can be job modules (with different interfaces) and QtWidgets view modules.
# They could all be placed in a number of different paths.
modules-search: [ local, /path/to/dir/with/more/modules ]
# We define the module names in the order they should show up (QtWidget page modules,
# We define the module names in the order they should show up (QtWidget view modules,
# with one or more pages) OR be executed if enqueued (all other modules).
# Pages can also enqueue jobs for delayed execution.
# TBD: do we want to allow non-page modules (core-modules) to be set as immediate or
# delayed? Is this an intrinsic property of a module? Does it depend on whether it's
# a QProcess, a Python script or a plugin? More research is required. --teo
modules-prepare :
# Pages can also enqueue jobs for delayed execution in the order specified for the
# install phase.
# Phase 1 - prepare.
# View modules are shown as UI pages, jobs from job modules are executed immediately in
# the background.
# Jobs should be executed sparingly (if at all) in this phase.
prepare:
- greeting
- locale
- keyboard
- partition
- summary
modules-postinstall :
# Phase 2 - install.
# View modules are not shown. Only the view modules shown in the previous phase are
# allowed, their names should be added here as placeholders to specify the order in
# which view module jobs should be enqueued. Job modules are also allowed.
install: #TODO: actually use this
- partition
- unsquashfs
- locale
- keyboard
- users
# Phase 3 - postinstall.
# View modules are shown as UI pages, jobs from job modules are executed immediately in
# the background.
# Jobs should be executed sparingly (if at all) in this phase.
postinstall: #TODO: actually use this
- finished

View file

@ -151,7 +151,7 @@ CalamaresApplication::onPluginsReady()
m_mainwindow = new CalamaresWindow();
m_moduleManager->loadRequiredModules();
m_moduleManager->loadModulesPrepare();
connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded, [this]
{
m_mainwindow->show();

View file

@ -93,8 +93,9 @@ Settings::Settings( bool debugMode, QObject* parent )
}
}
config[ "modules-prepare" ] >> m_viewModulesPrepareList;
config[ "modules-postinstall" ] >> m_viewModulesPostInstallList;
config[ "prepare" ] >> m_modulesPrepareList;
config[ "install" ] >> m_modulesInstallList;
config[ "postinstall" ] >> m_modulesPostInstallList;
}
catch ( YAML::Exception& e )
{
@ -118,16 +119,23 @@ Settings::modulesSearchPaths()
QStringList
Settings::viewModulesPrepare()
Settings::modulesPrepare()
{
return m_viewModulesPrepareList;
return m_modulesPrepareList;
}
QStringList
Settings::viewModulesPostInstall()
Settings::modulesInstall()
{
return m_viewModulesPostInstallList;
return m_modulesInstallList;
}
QStringList
Settings::modulesPostInstall()
{
return m_modulesPostInstallList;
}

View file

@ -39,17 +39,20 @@ public:
QStringList modulesSearchPaths();
QStringList viewModulesPrepare();
QStringList modulesPrepare();
QStringList viewModulesPostInstall();
QStringList modulesInstall();
QStringList modulesPostInstall();
private:
static Settings* s_instance;
QStringList m_modulesSearchPaths;
QStringList m_viewModulesPrepareList;
QStringList m_viewModulesPostInstallList;
QStringList m_modulesPrepareList;
QStringList m_modulesInstallList;
QStringList m_modulesPostInstallList;
};
}

View file

@ -69,9 +69,9 @@ ModuleManager::module( const QString& name )
void
ModuleManager::loadRequiredModules()
ModuleManager::loadModulesPrepare()
{
QTimer::singleShot( 0, this, SLOT( doLoadModules() ) );
QTimer::singleShot( 0, this, SLOT( doLoadModulesPrepare() ) );
}
@ -134,9 +134,9 @@ ModuleManager::doInit()
void
ModuleManager::doLoadModules()
ModuleManager::doLoadModulesPrepare()
{
foreach ( const QString& moduleName, Settings::instance()->viewModulesPrepare() )
foreach ( const QString& moduleName, Settings::instance()->modulesPrepare() )
{
if ( !m_availableModules.contains( moduleName ) )
{

View file

@ -42,7 +42,7 @@ public:
QStringList availableModules();
Module* module( const QString& name );
void loadRequiredModules();
void loadModulesPrepare();
signals:
void initDone();
@ -50,7 +50,7 @@ signals:
private slots:
void doInit();
void doLoadModules();
void doLoadModulesPrepare();
private:
void recursiveLoad( const QString& moduleName );