OSDN Git Service

[plasmalnf] Move job creation to config
authorAdriaan de Groot <groot@kde.org>
Wed, 11 Nov 2020 13:45:31 +0000 (14:45 +0100)
committerAdriaan de Groot <groot@kde.org>
Wed, 11 Nov 2020 13:45:31 +0000 (14:45 +0100)
src/modules/plasmalnf/Config.cpp
src/modules/plasmalnf/Config.h
src/modules/plasmalnf/PlasmaLnfViewStep.cpp

index c813959..c7aea24 100644 (file)
@@ -9,6 +9,8 @@
 
 #include "Config.h"
 
+#include "PlasmaLnfJob.h"
+
 #include "utils/CalamaresUtilsSystem.h"
 #include "utils/Logger.h"
 #include "utils/Variant.h"
@@ -31,6 +33,27 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
     m_liveUser = CalamaresUtils::getString( configurationMap, "liveuser" );
 }
 
+Calamares::JobList
+Config::createJobs() const
+{
+    Calamares::JobList l;
+
+    cDebug() << "Creating Plasma LNF jobs ..";
+    if ( !theme().isEmpty() )
+    {
+        if ( !lnfToolPath().isEmpty() )
+        {
+            l.append( Calamares::job_ptr( new PlasmaLnfJob( lnfToolPath(), theme() ) ) );
+        }
+        else
+        {
+            cWarning() << "no lnftool given for plasmalnf module.";
+        }
+    }
+    return l;
+}
+
+
 void
 Config::setTheme( const QString& id )
 {
index 16980ab..ef32df2 100644 (file)
@@ -10,6 +10,8 @@
 #ifndef PLASMALNF_CONFIG_H
 #define PLASMALNF_CONFIG_H
 
+#include "Job.h"
+
 #include <QObject>
 
 class Config : public QObject
@@ -23,6 +25,7 @@ public:
     virtual ~Config() override = default;
 
     void setConfigurationMap( const QVariantMap& );
+    Calamares::JobList createJobs() const;
 
     /** @brief Full path to the lookandfeeltool (if it exists)
      *
index 7f8e196..52435d5 100644 (file)
@@ -9,7 +9,6 @@
 #include "PlasmaLnfViewStep.h"
 
 #include "Config.h"
-#include "PlasmaLnfJob.h"
 #include "PlasmaLnfPage.h"
 #include "ThemeInfo.h"
 
@@ -108,21 +107,7 @@ PlasmaLnfViewStep::onLeave()
 Calamares::JobList
 PlasmaLnfViewStep::jobs() const
 {
-    Calamares::JobList l;
-
-    cDebug() << "Creating Plasma LNF jobs ..";
-    if ( !m_config->theme().isEmpty() )
-    {
-        if ( !m_config->lnfToolPath().isEmpty() )
-        {
-            l.append( Calamares::job_ptr( new PlasmaLnfJob( m_config->lnfToolPath(), m_config->theme() ) ) );
-        }
-        else
-        {
-            cWarning() << "no lnftool given for plasmalnf module.";
-        }
-    }
-    return l;
+    return m_config->createJobs();
 }