1 /* === This file is part of Calamares - <https://calamares.io> ===
2  *
3  *   SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac <teo@kde.org>
4  *   SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
5  *   SPDX-License-Identifier: GPL-3.0-or-later
6  *
7  *   Calamares is Free Software: see the License-Identifier above.
8  *
9  */
10 
11 #include "WelcomeQmlViewStep.h"
12 
13 #include "checker/GeneralRequirements.h"
14 
15 #include "locale/TranslationsModel.h"
16 #include "utils/Dirs.h"
17 #include "utils/Logger.h"
18 #include "utils/Variant.h"
19 
20 #include "Branding.h"
21 #include "modulesystem/ModuleManager.h"
22 #include "utils/Yaml.h"
23 
CALAMARES_PLUGIN_FACTORY_DEFINITION(WelcomeQmlViewStepFactory,registerPlugin<WelcomeQmlViewStep> ();)24 CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeQmlViewStepFactory, registerPlugin< WelcomeQmlViewStep >(); )
25 
26 WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
27     : Calamares::QmlViewStep( parent )
28     , m_config( new Config( this ) )
29 {
30     connect( Calamares::ModuleManager::instance(),
31              &Calamares::ModuleManager::requirementsComplete,
32              this,
33              &WelcomeQmlViewStep::nextStatusChanged );
34 }
35 
36 
37 QString
prettyName() const38 WelcomeQmlViewStep::prettyName() const
39 {
40     return tr( "Welcome" );
41 }
42 
43 bool
isNextEnabled() const44 WelcomeQmlViewStep::isNextEnabled() const
45 {
46     return m_config->requirementsModel()->satisfiedMandatory();
47 }
48 
49 bool
isBackEnabled() const50 WelcomeQmlViewStep::isBackEnabled() const
51 {
52     // TODO: should return true (it's weird that you are not allowed to have welcome *after* anything
53     return false;
54 }
55 
56 
57 bool
isAtBeginning() const58 WelcomeQmlViewStep::isAtBeginning() const
59 {
60     return true;
61 }
62 
63 
64 bool
isAtEnd() const65 WelcomeQmlViewStep::isAtEnd() const
66 {
67     return true;
68 }
69 
70 
71 Calamares::JobList
jobs() const72 WelcomeQmlViewStep::jobs() const
73 {
74     return Calamares::JobList();
75 }
76 
77 void
setConfigurationMap(const QVariantMap & configurationMap)78 WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
79 {
80     m_config->setConfigurationMap( configurationMap );
81     Calamares::QmlViewStep::setConfigurationMap( configurationMap );  // call parent implementation last
82 }
83 
84 Calamares::RequirementsList
checkRequirements()85 WelcomeQmlViewStep::checkRequirements()
86 {
87     return m_config->checkRequirements();
88 }
89 
90 QObject*
getConfig()91 WelcomeQmlViewStep::getConfig()
92 {
93     return m_config;
94 }
95