diff --git a/settings.conf b/settings.conf index 6728193e9..a1af122c1 100644 --- a/settings.conf +++ b/settings.conf @@ -25,10 +25,10 @@ prepare: # 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 +install: - dummyprocess - dummypython -#- partition +- partition #- unsquashfs - locale - keyboard diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp index 5150f8287..4889a57b5 100644 --- a/src/calamares/CalamaresApplication.cpp +++ b/src/calamares/CalamaresApplication.cpp @@ -165,14 +165,10 @@ CalamaresApplication::initPlugins() Calamares::ViewManager* vm = Calamares::ViewManager::instance(); Calamares::JobQueue* queue = Calamares::JobQueue::instance(); - //FIXME: we should enqueue viewmodule jobs in the order from settings.conf, - // not in the order they show up in the UI - // Ideally, if a module is a viewmodule and isLoaded we should ask - // for jobs, else if it's a viewmodule and not isLoaded we bail with - // error, else if jobmodule and not isLoaded, just loadSelf. - for( Calamares::ViewStep* step : vm->prepareSteps() ) + for( const QString& name : Calamares::Settings::instance()->modules( Calamares::Install ) ) { - queue->enqueue( step->jobs() ); + Calamares::Module* module = m_moduleManager->module( name ); + queue->enqueue( module->jobs() ); } connect( queue, &Calamares::JobQueue::failed, vm, &Calamares::ViewManager::onInstallationFailed ); diff --git a/src/libcalamaresui/modulesystem/Module.h b/src/libcalamaresui/modulesystem/Module.h index 2b47245dd..fddfcf81c 100644 --- a/src/libcalamaresui/modulesystem/Module.h +++ b/src/libcalamaresui/modulesystem/Module.h @@ -21,6 +21,8 @@ #include "UiDllMacro.h" +#include + #include #include @@ -69,6 +71,8 @@ public: virtual void loadSelf() = 0; + virtual QList< job_ptr > jobs() const = 0; + protected: explicit Module(); virtual void initFrom( const YAML::Node& node ); diff --git a/src/libcalamaresui/modulesystem/ProcessJobModule.cpp b/src/libcalamaresui/modulesystem/ProcessJobModule.cpp index 9f5781ff4..902f15d82 100644 --- a/src/libcalamaresui/modulesystem/ProcessJobModule.cpp +++ b/src/libcalamaresui/modulesystem/ProcessJobModule.cpp @@ -18,7 +18,6 @@ #include "ProcessJobModule.h" -#include "JobQueue.h" #include "ProcessJob.h" #include @@ -48,14 +47,20 @@ ProcessJobModule::loadSelf() if ( m_loaded ) return; - Calamares::job_ptr j = Calamares::job_ptr( new ProcessJob( m_command, - m_workingPath, - m_secondsTimeout ) ); - JobQueue::instance()->enqueue( j ); + m_job = Calamares::job_ptr( new ProcessJob( m_command, + m_workingPath, + m_secondsTimeout ) ); m_loaded = true; } +QList< job_ptr > +ProcessJobModule::jobs() const +{ + return QList< job_ptr >() << m_job; +} + + void ProcessJobModule::initFrom( const YAML::Node& node ) { diff --git a/src/libcalamaresui/modulesystem/ProcessJobModule.h b/src/libcalamaresui/modulesystem/ProcessJobModule.h index f5999087e..e8b1851c9 100644 --- a/src/libcalamaresui/modulesystem/ProcessJobModule.h +++ b/src/libcalamaresui/modulesystem/ProcessJobModule.h @@ -32,6 +32,7 @@ public: Interface interface() const override; void loadSelf() override; + QList< job_ptr > jobs() const override; protected: void initFrom( const YAML::Node &node ) override; @@ -44,6 +45,7 @@ private: QString m_command; QString m_workingPath; int m_secondsTimeout; + job_ptr m_job; }; } // namespace Calamares diff --git a/src/libcalamaresui/modulesystem/PythonJobModule.cpp b/src/libcalamaresui/modulesystem/PythonJobModule.cpp index c9e8522e7..c635e8f49 100644 --- a/src/libcalamaresui/modulesystem/PythonJobModule.cpp +++ b/src/libcalamaresui/modulesystem/PythonJobModule.cpp @@ -18,7 +18,6 @@ #include "PythonJobModule.h" -#include "JobQueue.h" #include "PythonJob.h" #include @@ -49,14 +48,20 @@ PythonJobModule::loadSelf() if ( m_loaded ) return; - Calamares::job_ptr j = Calamares::job_ptr( new PythonJob( m_scriptFileName, - m_workingPath, - m_configurationMap ) ); - JobQueue::instance()->enqueue( j ); + m_job = Calamares::job_ptr( new PythonJob( m_scriptFileName, + m_workingPath, + m_configurationMap ) ); m_loaded = true; } +QList< job_ptr > +PythonJobModule::jobs() const +{ + return QList< job_ptr >() << m_job; +} + + void PythonJobModule::initFrom( const YAML::Node& node ) { diff --git a/src/libcalamaresui/modulesystem/PythonJobModule.h b/src/libcalamaresui/modulesystem/PythonJobModule.h index 95b318929..b8721f565 100644 --- a/src/libcalamaresui/modulesystem/PythonJobModule.h +++ b/src/libcalamaresui/modulesystem/PythonJobModule.h @@ -32,6 +32,7 @@ public: Interface interface() const override; void loadSelf() override; + QList< job_ptr > jobs() const override; protected: void initFrom( const YAML::Node &node ) override; @@ -43,6 +44,7 @@ private: QString m_scriptFileName; QString m_workingPath; + job_ptr m_job; }; } // namespace Calamares diff --git a/src/libcalamaresui/modulesystem/ViewModule.cpp b/src/libcalamaresui/modulesystem/ViewModule.cpp index 145b65843..2c8c073f9 100644 --- a/src/libcalamaresui/modulesystem/ViewModule.cpp +++ b/src/libcalamaresui/modulesystem/ViewModule.cpp @@ -50,11 +50,11 @@ ViewModule::loadSelf() cDebug() << Q_FUNC_INFO << "for module" << name(); if ( m_loader ) { - ViewStep *vs = qobject_cast< ViewStep* >( m_loader->instance() ); - vs->setConfigurationMap( m_configurationMap ); - if ( vs ) + m_viewStep = qobject_cast< ViewStep* >( m_loader->instance() ); + m_viewStep->setConfigurationMap( m_configurationMap ); + if ( m_viewStep ) { - ViewManager::instance()->addViewStep( vs ); + ViewManager::instance()->addViewStep( m_viewStep ); m_loaded = true; } else @@ -65,6 +65,13 @@ ViewModule::loadSelf() } +QList< job_ptr > +ViewModule::jobs() const +{ + return m_viewStep->jobs(); +} + + void ViewModule::initFrom( const YAML::Node& node ) { diff --git a/src/libcalamaresui/modulesystem/ViewModule.h b/src/libcalamaresui/modulesystem/ViewModule.h index 886861c44..3563ac96d 100644 --- a/src/libcalamaresui/modulesystem/ViewModule.h +++ b/src/libcalamaresui/modulesystem/ViewModule.h @@ -26,6 +26,8 @@ class QPluginLoader; namespace Calamares { +class ViewStep; + class UIDLLEXPORT ViewModule : public Module { public: @@ -33,6 +35,7 @@ public: Interface interface() const override; void loadSelf() override; + QList< job_ptr > jobs() const override; protected: void initFrom( const YAML::Node &node ) override; @@ -43,6 +46,7 @@ private: virtual ~ViewModule(); QPluginLoader *m_loader; + ViewStep* m_viewStep = nullptr; }; } // namespace Calamares