|
|
|
@ -25,6 +25,7 @@
|
|
|
|
|
#include "UiDllMacro.h"
|
|
|
|
|
|
|
|
|
|
#include "modulesystem/Descriptor.h"
|
|
|
|
|
#include "modulesystem/InstanceKey.h"
|
|
|
|
|
|
|
|
|
|
#include <QStringList>
|
|
|
|
|
#include <QVariant>
|
|
|
|
@ -85,13 +86,13 @@ public:
|
|
|
|
|
* @brief name returns the name of this module.
|
|
|
|
|
* @return a string with this module's name.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString name() const final;
|
|
|
|
|
QString name() const { return m_key.module(); }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief instanceId returns the instance id of this module.
|
|
|
|
|
* @return a string with this module's instance id.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString instanceId() const final;
|
|
|
|
|
QString instanceId() const { return m_key.id(); }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief instanceKey returns the instance key of this module.
|
|
|
|
@ -100,43 +101,49 @@ public:
|
|
|
|
|
* For instance, "partition\@partition" (default configuration) or
|
|
|
|
|
* "locale\@someconfig" (custom configuration)
|
|
|
|
|
*/
|
|
|
|
|
virtual QString instanceKey() const final;
|
|
|
|
|
QString instanceKey() const { return m_key.toString(); }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief location returns the full path of this module's directory.
|
|
|
|
|
* @return the path.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString location() const final;
|
|
|
|
|
QString location() const { return m_directory; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief type returns the Type of this module object.
|
|
|
|
|
* @return the type enum value.
|
|
|
|
|
* @brief Is this an emergency module?
|
|
|
|
|
*
|
|
|
|
|
* An emergency module is run even if an error occurs
|
|
|
|
|
* which would terminate Calamares earlier in the same
|
|
|
|
|
* *exec* block. Emergency modules in later exec blocks
|
|
|
|
|
* are not run (in the common case where there is only
|
|
|
|
|
* one exec block, this doesn't really matter).
|
|
|
|
|
*/
|
|
|
|
|
virtual Type type() const = 0;
|
|
|
|
|
bool isEmergency() const { return m_emergency; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief typeString returns a user-visible string for the module's type.
|
|
|
|
|
* @return the type string.
|
|
|
|
|
* @brief isLoaded reports on the loaded status of a module.
|
|
|
|
|
* @return true if the module's loading phase has finished, otherwise false.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString typeString() const;
|
|
|
|
|
bool isLoaded() const { return m_loaded; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief interface the Interface used by this module.
|
|
|
|
|
* @return the interface enum value.
|
|
|
|
|
* @brief configurationMap returns the contents of the configuration file for
|
|
|
|
|
* this module instance.
|
|
|
|
|
* @return the instance's configuration, already parsed from YAML into a variant map.
|
|
|
|
|
*/
|
|
|
|
|
virtual Interface interface() const = 0;
|
|
|
|
|
QVariantMap configurationMap();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief interface returns a user-visible string for the module's interface.
|
|
|
|
|
* @return the interface string.
|
|
|
|
|
* @brief typeString returns a user-visible string for the module's type.
|
|
|
|
|
* @return the type string.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString interfaceString() const;
|
|
|
|
|
QString typeString() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief isLoaded reports on the loaded status of a module.
|
|
|
|
|
* @return true if the module's loading phase has finished, otherwise false.
|
|
|
|
|
* @brief interface returns a user-visible string for the module's interface.
|
|
|
|
|
* @return the interface string.
|
|
|
|
|
*/
|
|
|
|
|
bool isLoaded() const { return m_loaded; }
|
|
|
|
|
QString interfaceString() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief loadSelf initialized the module.
|
|
|
|
@ -144,17 +151,6 @@ public:
|
|
|
|
|
*/
|
|
|
|
|
virtual void loadSelf() = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Is this an emergency module?
|
|
|
|
|
*
|
|
|
|
|
* An emergency module is run even if an error occurs
|
|
|
|
|
* which would terminate Calamares earlier in the same
|
|
|
|
|
* *exec* block. Emergency modules in later exec blocks
|
|
|
|
|
* are not run (in the common case where there is only
|
|
|
|
|
* one exec block, this doesn't really matter).
|
|
|
|
|
*/
|
|
|
|
|
bool isEmergency() const { return m_emergency; }
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief jobs returns any jobs exposed by this module.
|
|
|
|
|
* @return a list of jobs (can be empty).
|
|
|
|
@ -162,11 +158,16 @@ public:
|
|
|
|
|
virtual JobList jobs() const = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief configurationMap returns the contents of the configuration file for
|
|
|
|
|
* this module instance.
|
|
|
|
|
* @return the instance's configuration, already parsed from YAML into a variant map.
|
|
|
|
|
* @brief type returns the Type of this module object.
|
|
|
|
|
* @return the type enum value.
|
|
|
|
|
*/
|
|
|
|
|
QVariantMap configurationMap();
|
|
|
|
|
virtual Type type() const = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief interface the Interface used by this module.
|
|
|
|
|
* @return the interface enum value.
|
|
|
|
|
*/
|
|
|
|
|
virtual Interface interface() const = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Check the requirements of this module.
|
|
|
|
@ -175,7 +176,12 @@ public:
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
explicit Module();
|
|
|
|
|
virtual void initFrom( const QVariantMap& moduleDescriptor );
|
|
|
|
|
|
|
|
|
|
/// @brief For subclasses to read their part of the descriptor
|
|
|
|
|
virtual void initFrom( const QVariantMap& moduleDescriptor ) = 0;
|
|
|
|
|
/// @brief Generic part of descriptor reading (and instance id)
|
|
|
|
|
void initFrom( const QVariantMap& moduleDescriptor, const QString& id );
|
|
|
|
|
|
|
|
|
|
QVariantMap m_configurationMap;
|
|
|
|
|
|
|
|
|
|
bool m_loaded = false;
|
|
|
|
@ -185,9 +191,8 @@ protected:
|
|
|
|
|
private:
|
|
|
|
|
void loadConfigurationFile( const QString& configFileName ); //throws YAML::Exception
|
|
|
|
|
|
|
|
|
|
QString m_name;
|
|
|
|
|
QString m_directory;
|
|
|
|
|
QString m_instanceId;
|
|
|
|
|
ModuleSystem::InstanceKey m_key;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Calamares
|
|
|
|
|