|
|
|
@ -37,15 +37,32 @@ void operator>>( const QVariantMap& moduleDescriptor, Calamares::Module* m );
|
|
|
|
|
namespace Calamares
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The Module class is a common supertype for Calamares modules.
|
|
|
|
|
* It enforces a common interface for all the different types of modules, and it
|
|
|
|
|
* takes care of creating an object of the correct type starting from a module
|
|
|
|
|
* descriptor structure.
|
|
|
|
|
*/
|
|
|
|
|
class UIDLLEXPORT Module
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
/**
|
|
|
|
|
* @brief The Type enum represents the intended functionality of the module
|
|
|
|
|
* Every module is either a job module or a view module.
|
|
|
|
|
* A job module is a single Calamares job.
|
|
|
|
|
* A view module has a UI (one or more view pages) and zero-to-many jobs.
|
|
|
|
|
*/
|
|
|
|
|
enum Type
|
|
|
|
|
{
|
|
|
|
|
Job,
|
|
|
|
|
View
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The Interface enum represents the interface through which the module
|
|
|
|
|
* talks to Calamares.
|
|
|
|
|
* Not all Type-Interface associations are valid.
|
|
|
|
|
*/
|
|
|
|
|
enum Interface
|
|
|
|
|
{
|
|
|
|
|
QtPluginInterface,
|
|
|
|
@ -55,27 +72,100 @@ public:
|
|
|
|
|
};
|
|
|
|
|
virtual ~Module();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief fromDescriptor creates a new Module object of the correct type.
|
|
|
|
|
* @param moduleDescriptor a module descriptor, already parsed into a variant map.
|
|
|
|
|
* @param instanceId the instance id of the new module instance.
|
|
|
|
|
* @param configFileName the name of the configuration file to read.
|
|
|
|
|
* @param moduleDirectory the path to the directory with this module's files.
|
|
|
|
|
* @return a pointer to an object of a subtype of Module.
|
|
|
|
|
*/
|
|
|
|
|
static Module* fromDescriptor( const QVariantMap& moduleDescriptor,
|
|
|
|
|
const QString& instanceId,
|
|
|
|
|
const QString& configFileName,
|
|
|
|
|
const QString& moduleDirectory );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief name returns the name of this module.
|
|
|
|
|
* @return a string with this module's name.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString name() const final;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief instanceId returns the instance id of this module.
|
|
|
|
|
* @return a string with this module's instance id.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString instanceId() const final;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief instanceKey returns the instance key of this module.
|
|
|
|
|
* @return a string with the instance key.
|
|
|
|
|
* A module instance's instance key is modulename@instanceid.
|
|
|
|
|
* @example "partition@partition" (default configuration) or
|
|
|
|
|
* "locale@someconfig" (custom configuration)
|
|
|
|
|
*/
|
|
|
|
|
virtual QString instanceKey() const final;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief requiredModules a list of names of modules required by this one.
|
|
|
|
|
* @return the list of names.
|
|
|
|
|
* The module dependencies system is currently incomplete and unused.
|
|
|
|
|
*/
|
|
|
|
|
virtual QStringList requiredModules() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief location returns the full path of this module's directory.
|
|
|
|
|
* @return the path.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString location() const final;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief type returns the Type of this module object.
|
|
|
|
|
* @return the type enum value.
|
|
|
|
|
*/
|
|
|
|
|
virtual Type type() const = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief typeString returns a user-visible string for the module's type.
|
|
|
|
|
* @return the type string.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString typeString() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief interface the Interface used by this module.
|
|
|
|
|
* @return the interface enum value.
|
|
|
|
|
*/
|
|
|
|
|
virtual Interface interface() const = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief interface returns a user-visible string for the module's interface.
|
|
|
|
|
* @return the interface string.
|
|
|
|
|
*/
|
|
|
|
|
virtual QString interfaceString() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief isLoaded reports on the loaded status of a module.
|
|
|
|
|
* @return true if the module's loading phase has finished, otherwise false.
|
|
|
|
|
*/
|
|
|
|
|
virtual bool isLoaded() const;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief loadSelf initialized the module.
|
|
|
|
|
* Subclasses must reimplement this depending on the module type and interface.
|
|
|
|
|
*/
|
|
|
|
|
virtual void loadSelf() = 0;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief jobs returns any jobs exposed by this module.
|
|
|
|
|
* @return a list of jobs (can be empty).
|
|
|
|
|
*/
|
|
|
|
|
virtual QList< job_ptr > 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.
|
|
|
|
|
*/
|
|
|
|
|
QVariantMap configurationMap();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|