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 YAML
|
|
|
|
{
|
|
|
|
class Node;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace Calamares
|
|
|
|
{
|
|
|
|
class Module;
|
|
|
|
}
|
|
|
|
|
2014-06-27 13:58:53 +02:00
|
|
|
void operator>>( const YAML::Node& node, 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
|
|
|
|
{
|
|
|
|
QtPlugin,
|
|
|
|
Python,
|
|
|
|
Process
|
|
|
|
};
|
2014-06-27 13:58:53 +02:00
|
|
|
virtual ~Module();
|
|
|
|
|
2014-08-05 18:18:57 +02:00
|
|
|
static Module* fromDescriptorFile( const QString& path );
|
2014-06-27 13:58:53 +02:00
|
|
|
|
2014-07-10 12:27:53 +02:00
|
|
|
virtual QString name() const;
|
|
|
|
virtual QStringList requiredModules() const;
|
|
|
|
virtual QString location() const;
|
|
|
|
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();
|
|
|
|
virtual void initFrom( const YAML::Node& node );
|
|
|
|
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:
|
2014-08-05 18:18:57 +02:00
|
|
|
void loadConfigurationFile(); //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;
|
2014-06-18 18:05:04 +02:00
|
|
|
|
2014-06-27 13:58:53 +02:00
|
|
|
friend void ::operator>>( const YAML::Node& node, Calamares::Module* m );
|
2014-06-18 18:05:04 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-06-27 13:58:53 +02:00
|
|
|
#endif // CALAMARES_MODULE_H
|