[libcalamares] Detailed InstanceDescription type
This commit is contained in:
parent
0e68013bb3
commit
e37809a126
@ -72,7 +72,18 @@ namespace Calamares
|
||||
{
|
||||
|
||||
InstanceDescription::InstanceDescription( const QVariantMap& m )
|
||||
: module( m.value( "module" ).toString() )
|
||||
, id( m.value( "id" ).toString() )
|
||||
, config( m.value( "config" ).toString() )
|
||||
{
|
||||
if ( id.isEmpty() )
|
||||
{
|
||||
id = module;
|
||||
}
|
||||
if ( config.isEmpty() )
|
||||
{
|
||||
config = module + QStringLiteral( ".conf" );
|
||||
}
|
||||
}
|
||||
|
||||
Settings* Settings::s_instance = nullptr;
|
||||
|
@ -32,16 +32,20 @@
|
||||
namespace Calamares
|
||||
{
|
||||
|
||||
class DLLEXPORT InstanceDescription
|
||||
struct DLLEXPORT InstanceDescription
|
||||
{
|
||||
public:
|
||||
InstanceDescription( const QVariantMap& );
|
||||
|
||||
QString module; ///< Module name (e.g. "welcome")
|
||||
QString id; ///< Id, to distinguish multiple instances (e.g. "one", for "welcome@one")
|
||||
QString config; ///< Config-file name (for multiple instances)
|
||||
};
|
||||
|
||||
class DLLEXPORT Settings : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
explicit Settings( const QString& settingsFilePath, bool debugMode );
|
||||
|
||||
public:
|
||||
static Settings* instance();
|
||||
/// @brief Find a settings.conf, following @p debugMode
|
||||
|
@ -129,9 +129,8 @@ ModuleManager::doInit()
|
||||
}
|
||||
// At this point m_availableDescriptorsByModuleName is filled with
|
||||
// the modules that were found in the search paths.
|
||||
cDebug() << "Found"
|
||||
<< m_availableDescriptorsByModuleName.count() << "modules"
|
||||
<< m_moduleDirectoriesByModuleName.count() << "names";
|
||||
cDebug() << "Found" << m_availableDescriptorsByModuleName.count() << "modules"
|
||||
<< m_moduleDirectoriesByModuleName.count() << "names";
|
||||
emit initDone();
|
||||
}
|
||||
|
||||
@ -167,7 +166,7 @@ findCustomInstance( const Settings::InstanceDescriptionList& customInstances, co
|
||||
for ( int i = 0; i < customInstances.count(); ++i )
|
||||
{
|
||||
const auto& thisInstance = customInstances[ i ];
|
||||
if ( thisInstance.value( "module" ) == m.module() && thisInstance.value( "id" ) == m.id() )
|
||||
if ( thisInstance.module == m.module() && thisInstance.id == m.id() )
|
||||
{
|
||||
return i;
|
||||
}
|
||||
@ -196,7 +195,7 @@ getConfigFileName( const Settings::InstanceDescriptionList& customInstances,
|
||||
return QString();
|
||||
}
|
||||
|
||||
return customInstances[ found ].value( "config" );
|
||||
return customInstances[ found ].config;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user