From 4c0719d95da31f7043b1c0f3dbd331dd9ada2bba Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 1 Oct 2019 13:44:06 +0200 Subject: [PATCH] [machineid] Start porting to C++ --- src/modules/machineid/CMakeLists.txt | 9 +++++ src/modules/machineid/MachineIdJob.cpp | 55 ++++++++++++++++++++++++++ src/modules/machineid/MachineIdJob.h | 48 ++++++++++++++++++++++ src/modules/machineid/module.desc | 5 --- 4 files changed, 112 insertions(+), 5 deletions(-) create mode 100644 src/modules/machineid/CMakeLists.txt create mode 100644 src/modules/machineid/MachineIdJob.cpp create mode 100644 src/modules/machineid/MachineIdJob.h delete mode 100644 src/modules/machineid/module.desc diff --git a/src/modules/machineid/CMakeLists.txt b/src/modules/machineid/CMakeLists.txt new file mode 100644 index 000000000..aa82d672f --- /dev/null +++ b/src/modules/machineid/CMakeLists.txt @@ -0,0 +1,9 @@ +calamares_add_plugin( machineid + TYPE job + EXPORT_MACRO PLUGINDLLEXPORT_PRO + SOURCES + MachineIdJob.cpp + LINK_PRIVATE_LIBRARIES + calamares + SHARED_LIB +) diff --git a/src/modules/machineid/MachineIdJob.cpp b/src/modules/machineid/MachineIdJob.cpp new file mode 100644 index 000000000..b604c645b --- /dev/null +++ b/src/modules/machineid/MachineIdJob.cpp @@ -0,0 +1,55 @@ +/* === This file is part of Calamares - === + * + * Copyright 2014, Kevin Kofler + * Copyright 2016, Philip Müller + * Copyright 2017, Alf Gaida + * Copyright 2019, Adriaan de Groot + * + * 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 . + */ + +#include "MachineIdJob.h" + +#include "utils/CalamaresUtilsSystem.h" +#include "utils/Logger.h" + +MachineIdJob::MachineIdJob( QObject* parent ) + : Calamares::CppJob( parent ) +{ +} + + +MachineIdJob::~MachineIdJob() {} + + +QString +MachineIdJob::prettyName() const +{ + return tr( "Generate machine-id." ); +} + + +Calamares::JobResult +MachineIdJob::exec() +{ + return Calamares::JobResult::ok(); +} + + +void +MachineIdJob::setConfigurationMap( const QVariantMap& configurationMap ) +{ +} + +CALAMARES_PLUGIN_FACTORY_DEFINITION( MachineIdJobFactory, registerPlugin< MachineIdJob >(); ) diff --git a/src/modules/machineid/MachineIdJob.h b/src/modules/machineid/MachineIdJob.h new file mode 100644 index 000000000..7fb705201 --- /dev/null +++ b/src/modules/machineid/MachineIdJob.h @@ -0,0 +1,48 @@ +/* === This file is part of Calamares - === + * + * Copyright 2019, Adriaan de Groot + * + * 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 . + */ + +#ifndef MACHINEIDJOB_H +#define MACHINEIDJOB_H + +#include +#include + +#include + +#include + +#include + +class PLUGINDLLEXPORT MachineIdJob : public Calamares::CppJob +{ + Q_OBJECT + +public: + explicit MachineIdJob( QObject* parent = nullptr ); + virtual ~MachineIdJob() override; + + QString prettyName() const override; + + Calamares::JobResult exec() override; + + void setConfigurationMap( const QVariantMap& configurationMap ) override; +}; + +CALAMARES_PLUGIN_FACTORY_DECLARATION( MachineIdJobFactory ) + +#endif // DUMMYCPPJOB_H diff --git a/src/modules/machineid/module.desc b/src/modules/machineid/module.desc deleted file mode 100644 index 8d42b64f5..000000000 --- a/src/modules/machineid/module.desc +++ /dev/null @@ -1,5 +0,0 @@ ---- -type: "job" -name: "machineid" -interface: "python" -script: "main.py"