[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).
This commit is contained in:
parent
1999e4e5c2
commit
a40c36ef49
@ -335,6 +335,8 @@ CalamaresApplication::initView()
|
|||||||
|
|
||||||
connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded,
|
connect( m_moduleManager, &Calamares::ModuleManager::modulesLoaded,
|
||||||
this, &CalamaresApplication::initViewSteps );
|
this, &CalamaresApplication::initViewSteps );
|
||||||
|
connect( m_moduleManager, &Calamares::ModuleManager::modulesFailed,
|
||||||
|
this, &CalamaresApplication::initFailed );
|
||||||
|
|
||||||
m_moduleManager->loadModules();
|
m_moduleManager->loadModules();
|
||||||
|
|
||||||
@ -356,6 +358,12 @@ CalamaresApplication::initViewSteps()
|
|||||||
cDebug() << "STARTUP: Window now visible and ProgressTreeView populated";
|
cDebug() << "STARTUP: Window now visible and ProgressTreeView populated";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CalamaresApplication::initFailed(const QStringList& l)
|
||||||
|
{
|
||||||
|
cError() << "STARTUP: failed modules are" << l;
|
||||||
|
m_mainwindow->show();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CalamaresApplication::initJobQueue()
|
CalamaresApplication::initJobQueue()
|
||||||
|
@ -70,6 +70,7 @@ public:
|
|||||||
private slots:
|
private slots:
|
||||||
void initView();
|
void initView();
|
||||||
void initViewSteps();
|
void initViewSteps();
|
||||||
|
void initFailed( const QStringList& l );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initQmlPath();
|
void initQmlPath();
|
||||||
|
@ -181,6 +181,7 @@ ModuleManager::loadModules()
|
|||||||
|
|
||||||
QTimer::singleShot( 0, this, [ this ]()
|
QTimer::singleShot( 0, this, [ this ]()
|
||||||
{
|
{
|
||||||
|
QStringList failedModules;
|
||||||
Settings::InstanceDescriptionList customInstances =
|
Settings::InstanceDescriptionList customInstances =
|
||||||
Settings::instance()->customModuleInstances();
|
Settings::instance()->customModuleInstances();
|
||||||
|
|
||||||
@ -201,8 +202,8 @@ ModuleManager::loadModules()
|
|||||||
{
|
{
|
||||||
cError() << "Wrong module entry format for module" << moduleEntry << '.'
|
cError() << "Wrong module entry format for module" << moduleEntry << '.'
|
||||||
<< GOODBYE;
|
<< GOODBYE;
|
||||||
qApp->exit( 1 );
|
failedModules.append( moduleEntry );
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
moduleName = moduleEntrySplit.first();
|
moduleName = moduleEntrySplit.first();
|
||||||
instanceId = moduleEntrySplit.last();
|
instanceId = moduleEntrySplit.last();
|
||||||
@ -214,8 +215,8 @@ ModuleManager::loadModules()
|
|||||||
cError() << "Module" << moduleName << "not found in module search paths."
|
cError() << "Module" << moduleName << "not found in module search paths."
|
||||||
<< Logger::DebugList( m_paths )
|
<< Logger::DebugList( m_paths )
|
||||||
<< GOODBYE;
|
<< GOODBYE;
|
||||||
qApp->exit( 1 );
|
failedModules.append( moduleName );
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( moduleName != instanceId ) //means this is a custom instance
|
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."
|
cError() << "Custom instance" << moduleEntry << "not found in custom instances section."
|
||||||
<< GOODBYE;
|
<< GOODBYE;
|
||||||
qApp->exit( 1 );
|
failedModules.append( moduleEntry );
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,8 +252,8 @@ ModuleManager::loadModules()
|
|||||||
{
|
{
|
||||||
cError() << "Module" << instanceKey << "exists but not loaded."
|
cError() << "Module" << instanceKey << "exists but not loaded."
|
||||||
<< GOODBYE;
|
<< GOODBYE;
|
||||||
qApp->exit( 1 );
|
failedModules.append( instanceKey );
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( thisModule && thisModule->isLoaded() )
|
if ( thisModule && thisModule->isLoaded() )
|
||||||
@ -270,7 +271,8 @@ ModuleManager::loadModules()
|
|||||||
{
|
{
|
||||||
cError() << "Module" << instanceKey << "cannot be created from descriptor" << configFileName
|
cError() << "Module" << instanceKey << "cannot be created from descriptor" << configFileName
|
||||||
<< GOODBYE;
|
<< GOODBYE;
|
||||||
qApp->exit( 1 );
|
failedModules.append( instanceKey );
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
// If it's a ViewModule, it also appends the ViewStep to the ViewManager.
|
// If it's a ViewModule, it also appends the ViewStep to the ViewManager.
|
||||||
thisModule->loadSelf();
|
thisModule->loadSelf();
|
||||||
@ -279,7 +281,8 @@ ModuleManager::loadModules()
|
|||||||
{
|
{
|
||||||
cError() << "Module" << instanceKey << "loading FAILED"
|
cError() << "Module" << instanceKey << "loading FAILED"
|
||||||
<< GOODBYE;
|
<< GOODBYE;
|
||||||
qApp->exit( 1 );
|
failedModules.append( instanceKey );
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,6 +303,9 @@ ModuleManager::loadModules()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( !failedModules.isEmpty() )
|
||||||
|
emit modulesFailed( failedModules );
|
||||||
|
else
|
||||||
emit modulesLoaded();
|
emit modulesLoaded();
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,8 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void initDone();
|
void initDone();
|
||||||
void modulesLoaded();
|
void modulesLoaded(); /// All of the modules were loaded successfully
|
||||||
|
void modulesFailed( QStringList ); /// .. or not
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void doInit();
|
void doInit();
|
||||||
|
Loading…
Reference in New Issue
Block a user