Merge pull request #1809 from dalto8/ismoduleenabled

[libcalamares] Add isModuleEnabled function
This commit is contained in:
Adriaan de Groot 2021-10-29 11:20:07 +02:00 committed by GitHub
commit ebf8d63669
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 0 deletions

View File

@ -269,6 +269,21 @@ Settings::Settings( const QString& settingsFilePath, bool debugMode )
s_instance = this;
}
const bool
Settings::isModuleEnabled( const QString& module )
{
// Iterate over the list of modules searching for a match
for ( const auto& moduleInstance : qAsConst( m_moduleInstances ) )
{
if ( moduleInstance.key().module() == module )
{
return true;
}
}
return false;
}
void
Settings::reconcileInstancesAndSequence()
{

View File

@ -152,8 +152,21 @@ public:
*/
bool isSetupMode() const { return m_isSetupMode; }
/** @brief Returns whether the named module is enabled
*
* Returns true if @p module is enabled in settings.conf. Be aware that it
* only tests for a specific module name so if a QML and non-QML version
* of the same module exists, it must be specified explicitly
*
* @p module is a module name or module key e.g. packagechooser) and not a
* full module key+id (e.g. packagechooser@packagechooser)
*
*/
const bool isModuleEnabled( const QString& module );
/** @brief Global setting of disable-cancel: can't cancel ever. */
bool disableCancel() const { return m_disableCancel; }
/** @brief Temporary setting of disable-cancel: can't cancel during exec. */
bool disableCancelDuringExec() const { return m_disableCancelDuringExec; }