[libcalamares] Expand instance with weight

This commit is contained in:
Adriaan de Groot 2020-03-13 02:59:09 +01:00
parent e37809a126
commit 07da6e3905
2 changed files with 4 additions and 0 deletions

View File

@ -75,6 +75,7 @@ InstanceDescription::InstanceDescription( const QVariantMap& m )
: module( m.value( "module" ).toString() ) : module( m.value( "module" ).toString() )
, id( m.value( "id" ).toString() ) , id( m.value( "id" ).toString() )
, config( m.value( "config" ).toString() ) , config( m.value( "config" ).toString() )
, weight( m.value( "weight" ).toInt() )
{ {
if ( id.isEmpty() ) if ( id.isEmpty() )
{ {
@ -84,6 +85,8 @@ InstanceDescription::InstanceDescription( const QVariantMap& m )
{ {
config = module + QStringLiteral( ".conf" ); config = module + QStringLiteral( ".conf" );
} }
weight = qBound( 1, weight, 100 );
} }
Settings* Settings::s_instance = nullptr; Settings* Settings::s_instance = nullptr;

View File

@ -39,6 +39,7 @@ struct DLLEXPORT InstanceDescription
QString module; ///< Module name (e.g. "welcome") QString module; ///< Module name (e.g. "welcome")
QString id; ///< Id, to distinguish multiple instances (e.g. "one", for "welcome@one") QString id; ///< Id, to distinguish multiple instances (e.g. "one", for "welcome@one")
QString config; ///< Config-file name (for multiple instances) QString config; ///< Config-file name (for multiple instances)
int weight;
}; };
class DLLEXPORT Settings : public QObject class DLLEXPORT Settings : public QObject