2017-12-20 14:39:09 +01:00
|
|
|
/* === This file is part of Calamares - <https://github.com/calamares> ===
|
2014-06-11 13:37:10 +02: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
|
2014-06-11 13:37:10 +02:00
|
|
|
*
|
|
|
|
* 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 <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2015-05-13 12:44:11 +02:00
|
|
|
#include "WelcomeViewStep.h"
|
2014-06-11 13:37:10 +02:00
|
|
|
|
2020-03-25 13:46:27 +01:00
|
|
|
#include "Config.h"
|
2015-05-13 12:44:11 +02:00
|
|
|
#include "WelcomePage.h"
|
2019-02-23 18:29:59 +01:00
|
|
|
#include "checker/GeneralRequirements.h"
|
2015-05-14 18:02:26 +02:00
|
|
|
|
2020-03-25 13:46:27 +01:00
|
|
|
#include "Branding.h"
|
|
|
|
#include "modulesystem/ModuleManager.h"
|
2019-02-25 12:11:14 +01:00
|
|
|
#include "utils/Logger.h"
|
2019-05-02 20:00:32 +02:00
|
|
|
#include "utils/Variant.h"
|
2014-06-27 13:58:53 +02:00
|
|
|
|
2019-08-13 22:29:01 +02:00
|
|
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin< WelcomeViewStep >(); )
|
2015-09-09 18:46:13 +02:00
|
|
|
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
2020-03-25 11:41:39 +01:00
|
|
|
: Calamares::ViewStep( parent )
|
|
|
|
, m_conf( new Config( this ) )
|
2020-05-12 14:54:18 +02:00
|
|
|
, m_widget( new WelcomePage( m_conf ) )
|
|
|
|
, m_requirementsChecker( new GeneralRequirements( this ) )
|
2014-06-11 13:37:10 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
connect( Calamares::ModuleManager::instance(),
|
|
|
|
&Calamares::ModuleManager::requirementsComplete,
|
|
|
|
this,
|
|
|
|
&WelcomeViewStep::nextStatusChanged );
|
2020-04-02 23:04:23 +02:00
|
|
|
connect( m_conf, &Config::localeIndexChanged, m_widget, &WelcomePage::externallySelectedLanguage );
|
2020-03-10 22:44:48 +01:00
|
|
|
}
|
2014-06-27 18:00:27 +02:00
|
|
|
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::~WelcomeViewStep()
|
2014-06-27 18:00:27 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
if ( m_widget && m_widget->parent() == nullptr )
|
|
|
|
{
|
|
|
|
m_widget->deleteLater();
|
|
|
|
}
|
2014-06-11 13:37:10 +02:00
|
|
|
}
|
2014-06-27 13:58:53 +02:00
|
|
|
|
|
|
|
QString
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::prettyName() const
|
2014-06-27 13:58:53 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return tr( "Welcome" );
|
2014-06-27 13:58:53 +02:00
|
|
|
}
|
2014-06-27 18:00:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
QWidget*
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::widget()
|
2014-06-27 18:00:27 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return m_widget;
|
2014-06-27 18:00:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::isNextEnabled() const
|
2014-06-27 18:00:27 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return m_widget->verdict();
|
2014-06-27 18:00:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-29 20:24:09 +01:00
|
|
|
bool
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::isBackEnabled() const
|
2015-01-29 20:24:09 +01:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return false;
|
2015-01-29 20:24:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-06-27 18:00:27 +02:00
|
|
|
bool
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::isAtBeginning() const
|
2014-06-27 18:00:27 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return true;
|
2014-06-27 18:00:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::isAtEnd() const
|
2014-06-27 18:00:27 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return true;
|
2014-06-27 18:00:27 +02:00
|
|
|
}
|
|
|
|
|
2014-07-08 14:02:21 +02:00
|
|
|
|
2019-02-25 13:05:12 +01:00
|
|
|
Calamares::JobList
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::jobs() const
|
2014-07-08 14:02:21 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return Calamares::JobList();
|
2014-07-08 14:02:21 +02:00
|
|
|
}
|
|
|
|
|
2015-04-02 12:27:54 +02:00
|
|
|
|
|
|
|
void
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
2015-04-02 12:27:54 +02:00
|
|
|
{
|
2020-05-06 15:08:31 +02:00
|
|
|
m_conf->setConfigurationMap( configurationMap );
|
2020-03-10 22:44:48 +01:00
|
|
|
|
2020-03-25 11:41:39 +01:00
|
|
|
if ( configurationMap.contains( "requirements" )
|
|
|
|
&& configurationMap.value( "requirements" ).type() == QVariant::Map )
|
|
|
|
{
|
|
|
|
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
|
|
|
}
|
|
|
|
else
|
2020-05-11 14:21:57 +02:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
cWarning() << "no valid requirements map found in welcome "
|
|
|
|
"module configuration.";
|
2020-05-11 14:21:57 +02:00
|
|
|
}
|
2020-03-25 11:41:39 +01:00
|
|
|
|
|
|
|
//here init the qml or qwidgets needed bits
|
|
|
|
m_widget->init();
|
2015-04-02 12:27:54 +02:00
|
|
|
}
|
|
|
|
|
2019-05-10 13:53:44 +02:00
|
|
|
Calamares::RequirementsList
|
|
|
|
WelcomeViewStep::checkRequirements()
|
2017-12-02 17:25:26 +01:00
|
|
|
{
|
2020-03-25 11:41:39 +01:00
|
|
|
return m_requirementsChecker->checkRequirements();
|
2017-12-02 17:25:26 +01:00
|
|
|
}
|