[libcalamaresui] Report on failed module loading

- Collect the failed modules, instead of bailing out on the first one
   (this also prevents crashes caused by quit() called from a timer).
 - Introduce a slot to report on failed module loading (no UI yet).
main
Adriaan de Groot 7 years ago
parent 1999e4e5c2
commit a40c36ef49

@ -335,6 +335,8 @@ CalamaresApplication::initView()
connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded,
this, &CalamaresApplication::initViewSteps );
connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed,
this, &CalamaresApplication::initFailed );
m_moduleManager->loadModules();
@ -356,6 +358,12 @@ CalamaresApplication::initViewSteps()
cDebug() << "STARTUP: Window now visible and ProgressTreeView populated";
}
void
CalamaresApplication::initFailed(const QStringList& l)
{
cError() << "STARTUP: failed modules are" << l;
m_mainwindow->show();
}
void
CalamaresApplication::initJobQueue()

@ -70,6 +70,7 @@ public:
private slots:
void initView();
void initViewSteps();
void initFailed( const QStringList& l );
private:
void initQmlPath();

@ -181,6 +181,7 @@ ModuleManager::loadModules()
QTimer::singleShot( 0, this, [ this ]()
{
QStringList failedModules;
Settings::InstanceDescriptionList customInstances =
Settings::instance()->customModuleInstances();
@ -201,8 +202,8 @@ ModuleManager::loadModules()
{
cError() << "Wrong module entry format for module" << moduleEntry << '.'
<< GOODBYE;
qApp->exit( 1 );
return;
failedModules.append( moduleEntry );
continue;
}
moduleName = moduleEntrySplit.first();
instanceId = moduleEntrySplit.last();
@ -214,8 +215,8 @@ ModuleManager::loadModules()
cError() << "Module" << moduleName << "not found in module search paths."
<< Logger::DebugList( m_paths )
<< GOODBYE;
qApp->exit( 1 );
return;
failedModules.append( moduleName );
continue;
}
if ( moduleName != instanceId ) //means this is a custom instance
@ -228,8 +229,8 @@ ModuleManager::loadModules()
{
cError() << "Custom instance" << moduleEntry << "not found in custom instances section."
<< GOODBYE;
qApp->exit( 1 );
return;
failedModules.append( moduleEntry );
continue;
}
}
@ -251,8 +252,8 @@ ModuleManager::loadModules()
{
cError() << "Module" << instanceKey << "exists but not loaded."
<< GOODBYE;
qApp->exit( 1 );
return;
failedModules.append( instanceKey );
continue;
}
if ( thisModule && thisModule->isLoaded() )
@ -270,7 +271,8 @@ ModuleManager::loadModules()
{
cError() << "Module" << instanceKey << "cannot be created from descriptor" << configFileName
<< GOODBYE;
qApp->exit( 1 );
failedModules.append( instanceKey );
continue;
}
// If it's a ViewModule, it also appends the ViewStep to the ViewManager.
thisModule->loadSelf();
@ -279,7 +281,8 @@ ModuleManager::loadModules()
{
cError() << "Module" << instanceKey << "loading FAILED"
<< GOODBYE;
qApp->exit( 1 );
failedModules.append( instanceKey );
continue;
}
}
@ -300,7 +303,10 @@ ModuleManager::loadModules()
}
}
}
emit modulesLoaded();
if ( !failedModules.isEmpty() )
emit modulesFailed( failedModules );
else
emit modulesLoaded();
} );
}

@ -82,7 +82,8 @@ public:
signals:
void initDone();
void modulesLoaded();
void modulesLoaded(); /// All of the modules were loaded successfully
void modulesFailed( QStringList ); /// .. or not
private slots:
void doInit();

Loading…
Cancel
Save