2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2019-12-14 12:48:09 +01:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2014-2015 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-FileCopyrightText: 2018 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2019-12-14 12:48:09 +01:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2019-12-14 12:48:09 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "WelcomeQmlViewStep.h"
|
|
|
|
|
|
|
|
#include "checker/GeneralRequirements.h"
|
|
|
|
|
|
|
|
#include "locale/LabelModel.h"
|
2020-05-12 14:47:31 +02:00
|
|
|
#include "utils/Dirs.h"
|
2019-12-14 12:48:09 +01:00
|
|
|
#include "utils/Logger.h"
|
|
|
|
#include "utils/Variant.h"
|
|
|
|
|
|
|
|
#include "Branding.h"
|
|
|
|
#include "modulesystem/ModuleManager.h"
|
2020-03-10 23:56:09 +01:00
|
|
|
#include "utils/Yaml.h"
|
2019-12-14 12:48:09 +01:00
|
|
|
|
|
|
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeQmlViewStepFactory, registerPlugin< WelcomeQmlViewStep >(); )
|
|
|
|
|
|
|
|
WelcomeQmlViewStep::WelcomeQmlViewStep( QObject* parent )
|
2020-05-12 14:47:31 +02:00
|
|
|
: Calamares::QmlViewStep( parent )
|
|
|
|
, m_config( new Config( this ) )
|
2019-12-14 12:48:09 +01:00
|
|
|
, m_requirementsChecker( new GeneralRequirements( this ) )
|
|
|
|
{
|
2020-05-12 17:07:15 +02:00
|
|
|
connect( Calamares::ModuleManager::instance(),
|
2020-08-25 23:44:08 +02:00
|
|
|
&Calamares::ModuleManager::requirementsComplete,
|
|
|
|
this,
|
|
|
|
&WelcomeQmlViewStep::nextStatusChanged );
|
2019-12-14 12:48:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString
|
|
|
|
WelcomeQmlViewStep::prettyName() const
|
|
|
|
{
|
2020-05-12 14:47:31 +02:00
|
|
|
return tr( "Welcome" );
|
2019-12-14 12:48:09 +01:00
|
|
|
}
|
|
|
|
|
2020-03-10 23:56:09 +01:00
|
|
|
bool
|
|
|
|
WelcomeQmlViewStep::isNextEnabled() const
|
|
|
|
{
|
2020-05-12 17:07:15 +02:00
|
|
|
return m_config->requirementsModel()->satisfiedMandatory();
|
2020-03-10 23:56:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
WelcomeQmlViewStep::isBackEnabled() const
|
|
|
|
{
|
2020-05-12 14:47:31 +02:00
|
|
|
// TODO: should return true (it's weird that you are not allowed to have welcome *after* anything
|
|
|
|
return false;
|
2020-03-10 23:56:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
WelcomeQmlViewStep::isAtBeginning() const
|
|
|
|
{
|
2020-05-12 14:47:31 +02:00
|
|
|
// TODO: adjust to "pages" in the QML
|
|
|
|
return true;
|
2020-03-10 23:56:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
WelcomeQmlViewStep::isAtEnd() const
|
|
|
|
{
|
2020-05-12 14:47:31 +02:00
|
|
|
// TODO: adjust to "pages" in the QML
|
|
|
|
return true;
|
2020-03-10 23:56:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Calamares::JobList
|
|
|
|
WelcomeQmlViewStep::jobs() const
|
2019-12-14 12:48:09 +01:00
|
|
|
{
|
2020-05-12 14:47:31 +02:00
|
|
|
return Calamares::JobList();
|
2019-12-14 12:48:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
WelcomeQmlViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|
|
|
{
|
2020-05-06 15:08:31 +02:00
|
|
|
m_config->setConfigurationMap( configurationMap );
|
2020-03-10 23:56:09 +01:00
|
|
|
|
2020-05-12 14:47:31 +02:00
|
|
|
if ( configurationMap.contains( "requirements" )
|
|
|
|
&& configurationMap.value( "requirements" ).type() == QVariant::Map )
|
|
|
|
{
|
|
|
|
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cWarning() << "no valid requirements map found in welcomeq "
|
|
|
|
"module configuration.";
|
|
|
|
}
|
|
|
|
|
|
|
|
Calamares::QmlViewStep::setConfigurationMap( configurationMap ); // call parent implementation last
|
2020-03-18 11:02:35 +01:00
|
|
|
setContextProperty( "Welcome", m_config );
|
2019-12-14 12:48:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Calamares::RequirementsList
|
|
|
|
WelcomeQmlViewStep::checkRequirements()
|
|
|
|
{
|
2020-05-12 14:47:31 +02:00
|
|
|
return m_requirementsChecker->checkRequirements();
|
2020-03-10 23:56:09 +01:00
|
|
|
}
|
|
|
|
|
2020-03-11 16:49:07 +01:00
|
|
|
QObject*
|
|
|
|
WelcomeQmlViewStep::getConfig()
|
2020-03-10 23:56:09 +01:00
|
|
|
{
|
2020-05-12 14:47:31 +02:00
|
|
|
return m_config;
|
2019-12-14 12:48:09 +01:00
|
|
|
}
|