From 65273a262b0d5de3a40f39fa3fe5975b8ddccff9 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 12 Aug 2020 00:33:08 +0200 Subject: [PATCH] [libcalamares] Start putting data into the module Descriptor --- src/libcalamares/modulesystem/Descriptor.cpp | 17 +++++++++++++++++ src/libcalamares/modulesystem/Descriptor.h | 9 ++++++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/modulesystem/Descriptor.cpp b/src/libcalamares/modulesystem/Descriptor.cpp index 6927e74a6..b233686f0 100644 --- a/src/libcalamares/modulesystem/Descriptor.cpp +++ b/src/libcalamares/modulesystem/Descriptor.cpp @@ -55,6 +55,23 @@ Descriptor::fromDescriptorData( const QVariantMap& moduleDesc ) cDebug() << moduleDesc; + { + bool typeOk = false; + Type t = typeNames().find( moduleDesc.value( "type" ).toString(), typeOk ); + bool interfaceOk = false; + Interface i = interfaceNames().find( moduleDesc.value( "interface" ).toString(), interfaceOk ); + if ( typeOk && interfaceOk ) + { + d.m_type = t; + d.m_interface = i; + d.m_isValid = true; + } + } + if ( !d.m_isValid ) + { + return d; + } + return d; } diff --git a/src/libcalamares/modulesystem/Descriptor.h b/src/libcalamares/modulesystem/Descriptor.h index a1a04472e..709f37ff3 100644 --- a/src/libcalamares/modulesystem/Descriptor.h +++ b/src/libcalamares/modulesystem/Descriptor.h @@ -72,11 +72,11 @@ public: */ static Descriptor fromDescriptorData( const QVariantMap& moduleDesc ); - bool isValid() const { return false; } + bool isValid() const { return m_isValid; } QString name() const { return QString(); } - Type type() const { return Type::Job; } - Interface interface() const { return Interface::QtPlugin; } + Type type() const { return m_type; } + Interface interface() const { return m_interface; } bool isEmergency() const { return false; } bool hasConfig() const { return true; } @@ -120,6 +120,9 @@ public: private: QString m_directory; + Type m_type; + Interface m_interface; + bool m_isValid = false; }; } // namespace ModuleSystem