mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-25 16:38:21 -04:00
[libcalamaresui] Adjust the emergency-ness of modules
A potentially emergency module is one that has EMERGENCY (in CMake) or emergency: true (in module.desc) set. Any such module must also set emergency: true in the configuration of the module. This is to allow for instances of a module that **don't** run as emergency modules, alongside actual emergency ones.
This commit is contained in:
parent
53161f6e36
commit
3ed6f13fa8
3 changed files with 15 additions and 4 deletions
|
@ -52,6 +52,8 @@ name: "foo" #the module name. must be unique and same as the parent di
|
||||||
interface: "qtplugin" #can be: qtplugin, python, process, ...
|
interface: "qtplugin" #can be: qtplugin, python, process, ...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
static const char EMERGENCY[] = "emergency";
|
||||||
|
|
||||||
namespace Calamares
|
namespace Calamares
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -198,6 +200,9 @@ Module::loadConfigurationFile( const QString& configFileName ) //throws YAML::Ex
|
||||||
}
|
}
|
||||||
|
|
||||||
m_configurationMap = CalamaresUtils::yamlMapToVariant( doc ).toMap();
|
m_configurationMap = CalamaresUtils::yamlMapToVariant( doc ).toMap();
|
||||||
|
m_emergency = m_maybe_emergency
|
||||||
|
&& m_configurationMap.contains( EMERGENCY )
|
||||||
|
&& m_configurationMap[ EMERGENCY ].toBool();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -291,10 +296,9 @@ Module::initFrom( const QVariantMap& moduleDescriptor )
|
||||||
{
|
{
|
||||||
m_name = moduleDescriptor.value( "name" ).toString();
|
m_name = moduleDescriptor.value( "name" ).toString();
|
||||||
|
|
||||||
auto em = QStringLiteral( "emergency" );
|
if ( moduleDescriptor.contains( EMERGENCY ) )
|
||||||
if ( moduleDescriptor.contains( em ) )
|
|
||||||
{
|
{
|
||||||
m_emergency = moduleDescriptor[ em ].toBool();
|
m_maybe_emergency = moduleDescriptor[ EMERGENCY ].toBool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -185,7 +185,8 @@ protected:
|
||||||
QVariantMap m_configurationMap;
|
QVariantMap m_configurationMap;
|
||||||
|
|
||||||
bool m_loaded = false;
|
bool m_loaded = false;
|
||||||
bool m_emergency = false;
|
bool m_emergency = false; // Based on module and local config
|
||||||
|
bool m_maybe_emergency = false; // Based on the module.desc
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadConfigurationFile( const QString& configFileName ); //throws YAML::Exception
|
void loadConfigurationFile( const QString& configFileName ); //throws YAML::Exception
|
||||||
|
|
|
@ -145,3 +145,9 @@ processing continues.
|
||||||
|
|
||||||
Use the EMERGENCY keyword in the CMake description of a C++ module
|
Use the EMERGENCY keyword in the CMake description of a C++ module
|
||||||
to generate a suitable `module.desc`.
|
to generate a suitable `module.desc`.
|
||||||
|
|
||||||
|
A module that is marked as an emergency module in its module.desc
|
||||||
|
must **also** set the *emergency* key to *true* in its configuration file.
|
||||||
|
If it does not, the module is not considered to be an emergency module
|
||||||
|
after all (this is so that you can have modules that have several
|
||||||
|
instances, only some of which are actually needed for emergencies.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue