OSDN Git Service

Better settings format, rename a bit of stuff in module loading.
authorTeo Mrnjavac <teo@kde.org>
Thu, 10 Jul 2014 16:03:59 +0000 (18:03 +0200)
committerTeo Mrnjavac <teo@kde.org>
Fri, 11 Jul 2014 12:21:50 +0000 (14:21 +0200)
settings.conf
src/calamares/CalamaresApplication.cpp
src/libcalamaresui/Settings.cpp
src/libcalamaresui/Settings.h
src/libcalamaresui/modulesystem/ModuleManager.cpp
src/libcalamaresui/modulesystem/ModuleManager.h

index 517e6c2..d3c4d56 100644 (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
index e05cf41..21076ef 100644 (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();
index f9c3e31..65749f3 100644 (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;
 }
 
 
index f2ee7c8..35d9965 100644 (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;
 };
 
 }
index 1b61274..16f0e5b 100644 (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 ) )
         {
index e086577..2ccb692 100644 (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 );