[libcalamaresui] Improve module loading

- Add a TODO for allowing modules to come from somewhere other
   than the module loader (this would allow "internal" modules
   that are always present)
 - Warnings are warnings
This commit is contained in:
Adriaan de Groot 2018-06-13 04:37:52 -04:00
parent 35124c149e
commit 8b406cac9b

View File

@ -52,27 +52,32 @@ ViewModule::loadSelf()
PluginFactory* pf = qobject_cast< PluginFactory* >( m_loader->instance() ); PluginFactory* pf = qobject_cast< PluginFactory* >( m_loader->instance() );
if ( !pf ) if ( !pf )
{ {
cDebug() << Q_FUNC_INFO << "No factory:" << m_loader->errorString(); cWarning() << Q_FUNC_INFO << "No factory:" << m_loader->errorString();
return; return;
} }
m_viewStep = pf->create< Calamares::ViewStep >(); m_viewStep = pf->create< Calamares::ViewStep >();
if ( !m_viewStep ) if ( !m_viewStep )
{ {
cDebug() << Q_FUNC_INFO << "create() failed" << m_loader->errorString(); cWarning() << Q_FUNC_INFO << "create() failed" << m_loader->errorString();
return; return;
} }
// cDebug() << "ViewModule loading self for instance" << instanceKey() }
// << "\nViewModule at address" << this
// << "\nCalamares::PluginFactory at address" << pf
// << "\nViewStep at address" << m_viewStep;
// TODO: allow internal view steps to be created here; they would
// have to be linked into the main application somehow.
// If any method created the view step, use it now.
if ( m_viewStep )
{
m_viewStep->setModuleInstanceKey( instanceKey() ); m_viewStep->setModuleInstanceKey( instanceKey() );
m_viewStep->setConfigurationMap( m_configurationMap ); m_viewStep->setConfigurationMap( m_configurationMap );
ViewManager::instance()->addViewStep( m_viewStep ); ViewManager::instance()->addViewStep( m_viewStep );
m_loaded = true; m_loaded = true;
cDebug() << "ViewModule" << instanceKey() << "loading complete."; cDebug() << "ViewModule" << instanceKey() << "loading complete.";
} }
else
cWarning() << Q_FUNC_INFO << "No view step was created";
} }