2014-06-18 18:05:04 +02:00
|
|
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
*
|
2015-03-10 19:47:39 +01:00
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
2014-06-18 18:05:04 +02:00
|
|
|
*
|
|
|
|
* Calamares is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* Calamares is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with Calamares. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2014-06-27 13:58:53 +02:00
|
|
|
#ifndef CALAMARES_MODULE_H
|
|
|
|
#define CALAMARES_MODULE_H
|
2014-06-18 18:05:04 +02:00
|
|
|
|
2014-06-26 14:41:34 +02:00
|
|
|
#include "UiDllMacro.h"
|
2014-06-18 18:05:04 +02:00
|
|
|
|
2014-07-22 16:54:34 +02:00
|
|
|
#include <Typedefs.h>
|
|
|
|
|
2014-06-18 18:05:04 +02:00
|
|
|
#include <QStringList>
|
2014-07-14 18:10:48 +02:00
|
|
|
#include <QVariant>
|
2014-06-18 18:05:04 +02:00
|
|
|
|
|
|
|
|
|
|
|
namespace Calamares
|
|
|
|
{
|
|
|
|
class Module;
|
|
|
|
}
|
|
|
|
|
2015-09-09 19:01:56 +02:00
|
|
|
void operator>>( const QVariantMap& moduleDescriptor, Calamares::Module* m );
|
2014-06-18 18:05:04 +02:00
|
|
|
|
|
|
|
namespace Calamares
|
|
|
|
{
|
|
|
|
|
|
|
|
class UIDLLEXPORT Module
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
enum Type
|
|
|
|
{
|
2014-07-10 12:27:53 +02:00
|
|
|
Job,
|
2014-06-18 18:05:04 +02:00
|
|
|
View
|
|
|
|
};
|
|
|
|
|
|
|
|
enum Interface
|
|
|
|
{
|
2016-10-02 19:14:56 +02:00
|
|
|
QtPluginInterface,
|
|
|
|
PythonInterface,
|
|
|
|
ProcessInterface,
|
|
|
|
PythonQtInterface
|
2014-06-18 18:05:04 +02:00
|
|
|
};
|
2014-06-27 13:58:53 +02:00
|
|
|
virtual ~Module();
|
|
|
|
|
2015-09-09 19:01:56 +02:00
|
|
|
static Module* fromDescriptor( const QVariantMap& moduleDescriptor,
|
|
|
|
const QString& instanceId,
|
|
|
|
const QString& configFileName,
|
|
|
|
const QString& moduleDirectory );
|
2014-06-27 13:58:53 +02:00
|
|
|
|
2015-09-09 19:01:56 +02:00
|
|
|
virtual QString name() const final;
|
|
|
|
virtual QString instanceId() const final;
|
|
|
|
virtual QString instanceKey() const final;
|
2014-07-10 12:27:53 +02:00
|
|
|
virtual QStringList requiredModules() const;
|
2015-09-09 19:01:56 +02:00
|
|
|
virtual QString location() const final;
|
2014-07-10 12:27:53 +02:00
|
|
|
virtual Type type() const = 0;
|
|
|
|
virtual Interface interface() const = 0;
|
2014-06-27 13:58:53 +02:00
|
|
|
|
2014-07-10 12:27:53 +02:00
|
|
|
virtual bool isLoaded() const;
|
2014-06-27 13:58:53 +02:00
|
|
|
|
|
|
|
virtual void loadSelf() = 0;
|
|
|
|
|
2014-07-22 16:54:34 +02:00
|
|
|
virtual QList< job_ptr > jobs() const = 0;
|
|
|
|
|
2015-03-10 19:47:39 +01:00
|
|
|
QVariantMap configurationMap();
|
|
|
|
|
2014-06-27 13:58:53 +02:00
|
|
|
protected:
|
|
|
|
explicit Module();
|
2015-09-09 19:01:56 +02:00
|
|
|
virtual void initFrom( const QVariantMap& moduleDescriptor );
|
2014-06-27 13:58:53 +02:00
|
|
|
bool m_loaded;
|
2014-07-15 11:27:26 +02:00
|
|
|
QVariantMap m_configurationMap;
|
2014-06-27 13:58:53 +02:00
|
|
|
|
2014-06-18 18:05:04 +02:00
|
|
|
private:
|
2015-09-09 19:01:56 +02:00
|
|
|
void loadConfigurationFile( const QString& configFileName ); //throws YAML::Exception
|
2014-06-18 18:05:04 +02:00
|
|
|
QString m_name;
|
|
|
|
QStringList m_requiredModules;
|
2014-06-27 13:58:53 +02:00
|
|
|
QString m_directory;
|
2015-09-09 19:01:56 +02:00
|
|
|
QString m_instanceId;
|
2014-06-18 18:05:04 +02:00
|
|
|
|
2015-09-09 19:01:56 +02:00
|
|
|
friend void ::operator>>( const QVariantMap& moduleDescriptor,
|
|
|
|
Calamares::Module* m );
|
2014-06-18 18:05:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-06-27 13:58:53 +02:00
|
|
|
#endif // CALAMARES_MODULE_H
|