mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 02:15:36 -04:00
Massive refactor of module loading, configuration, startup, management.
This commit is contained in:
parent
c74c67805e
commit
fb44fb97b6
12 changed files with 374 additions and 282 deletions
|
@ -18,12 +18,11 @@
|
|||
|
||||
#include "ViewModule.h"
|
||||
|
||||
#include "utils/PluginFactory.h"
|
||||
#include "utils/Logger.h"
|
||||
#include "viewpages/ViewStep.h"
|
||||
#include "ViewManager.h"
|
||||
|
||||
#include <yaml-cpp/yaml.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QPluginLoader>
|
||||
|
||||
|
@ -49,12 +48,25 @@ ViewModule::loadSelf()
|
|||
{
|
||||
if ( m_loader )
|
||||
{
|
||||
m_viewStep = qobject_cast< ViewStep* >( m_loader->instance() );
|
||||
if ( !m_viewStep )
|
||||
PluginFactory* pf = qobject_cast< PluginFactory* >( m_loader->instance() );
|
||||
if ( !pf )
|
||||
{
|
||||
cLog() << Q_FUNC_INFO << m_loader->errorString();
|
||||
cDebug() << Q_FUNC_INFO << m_loader->errorString();
|
||||
return;
|
||||
}
|
||||
|
||||
m_viewStep = pf->create< Calamares::ViewStep >();
|
||||
if ( !m_viewStep )
|
||||
{
|
||||
cDebug() << Q_FUNC_INFO << m_loader->errorString();
|
||||
return;
|
||||
}
|
||||
cDebug() << "ViewModule loading self for instance" << instanceKey()
|
||||
<< "\nViewModule at address" << this
|
||||
<< "\nCalamares::PluginFactory at address" << pf
|
||||
<< "\nViewStep at address" << m_viewStep;
|
||||
|
||||
m_viewStep->setModuleInstanceKey( instanceKey() );
|
||||
m_viewStep->setConfigurationMap( m_configurationMap );
|
||||
ViewManager::instance()->addViewStep( m_viewStep );
|
||||
m_loaded = true;
|
||||
|
@ -70,14 +82,14 @@ ViewModule::jobs() const
|
|||
|
||||
|
||||
void
|
||||
ViewModule::initFrom( const YAML::Node& node )
|
||||
ViewModule::initFrom( const QVariantMap& moduleDescriptor )
|
||||
{
|
||||
Module::initFrom( node );
|
||||
Module::initFrom( moduleDescriptor );
|
||||
QDir directory( location() );
|
||||
QString load;
|
||||
if ( node[ "load" ] )
|
||||
if ( !moduleDescriptor.value( "load" ).toString().isEmpty() )
|
||||
{
|
||||
load = QString::fromStdString( node[ "load" ].as< std::string >() );
|
||||
load = moduleDescriptor.value( "load" ).toString();
|
||||
load = directory.absoluteFilePath( load );
|
||||
}
|
||||
// If a load path is not specified, we look for a plugin to load in the directory.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue