2014-06-11 13:37:10 +02:00
|
|
|
/* === This file is part of Calamares - <http://github.com/calamares> ===
|
|
|
|
*
|
2015-01-29 20:24:09 +01:00
|
|
|
* Copyright 2014-2015, Teo Mrnjavac <teo@kde.org>
|
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
|
|
|
|
2015-05-13 12:44:11 +02:00
|
|
|
#include "WelcomePage.h"
|
2015-05-14 18:02:26 +02:00
|
|
|
#include "checker/RequirementsChecker.h"
|
2016-09-16 10:52:42 +02:00
|
|
|
#include "utils/Logger.h"
|
2015-05-14 18:02:26 +02:00
|
|
|
|
2014-06-27 13:58:53 +02:00
|
|
|
|
2015-04-02 12:27:54 +02:00
|
|
|
#include <QVariant>
|
|
|
|
|
2015-09-09 18:46:13 +02:00
|
|
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( WelcomeViewStepFactory, registerPlugin<WelcomeViewStep>(); )
|
|
|
|
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::WelcomeViewStep( QObject* parent )
|
2014-06-27 18:00:27 +02:00
|
|
|
: Calamares::ViewStep( parent )
|
2015-05-14 18:02:26 +02:00
|
|
|
, m_requirementsChecker( new RequirementsChecker( this ) )
|
2014-06-11 13:37:10 +02:00
|
|
|
{
|
2014-06-27 18:00:27 +02:00
|
|
|
emit nextStatusChanged( true );
|
2015-05-14 18:02:26 +02:00
|
|
|
m_widget = new WelcomePage( m_requirementsChecker );
|
|
|
|
connect( m_requirementsChecker, &RequirementsChecker::verdictChanged,
|
|
|
|
this, &WelcomeViewStep::nextStatusChanged );
|
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
|
|
|
{
|
|
|
|
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
|
|
|
{
|
|
|
|
return tr( "Welcome" );
|
|
|
|
}
|
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
|
|
|
{
|
|
|
|
return m_widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::next()
|
2014-06-27 18:00:27 +02:00
|
|
|
{
|
|
|
|
emit done();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::back()
|
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
|
|
|
{
|
2015-05-14 18:02:26 +02:00
|
|
|
return m_requirementsChecker->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
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::isAtEnd() const
|
2014-06-27 18:00:27 +02:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-07-08 14:02:21 +02:00
|
|
|
|
|
|
|
QList< Calamares::job_ptr >
|
2015-05-13 12:44:11 +02:00
|
|
|
WelcomeViewStep::jobs() const
|
2014-07-08 14:02:21 +02:00
|
|
|
{
|
|
|
|
return QList< Calamares::job_ptr >();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
|
|
|
bool showSupportUrl =
|
|
|
|
configurationMap.contains( "showSupportUrl" ) &&
|
|
|
|
configurationMap.value( "showSupportUrl" ).type() == QVariant::Bool &&
|
|
|
|
configurationMap.value( "showSupportUrl" ).toBool();
|
|
|
|
bool showKnownIssuesUrl =
|
|
|
|
configurationMap.contains( "showKnownIssuesUrl" ) &&
|
|
|
|
configurationMap.value( "showKnownIssuesUrl" ).type() == QVariant::Bool &&
|
|
|
|
configurationMap.value( "showKnownIssuesUrl" ).toBool();
|
|
|
|
bool showReleaseNotesUrl =
|
|
|
|
configurationMap.contains( "showReleaseNotesUrl" ) &&
|
|
|
|
configurationMap.value( "showReleaseNotesUrl" ).type() == QVariant::Bool &&
|
|
|
|
configurationMap.value( "showReleaseNotesUrl" ).toBool();
|
|
|
|
|
|
|
|
m_widget->setUpLinks( showSupportUrl,
|
|
|
|
showKnownIssuesUrl,
|
|
|
|
showReleaseNotesUrl );
|
2015-05-14 18:02:26 +02:00
|
|
|
|
|
|
|
if ( configurationMap.contains( "requirements" ) &&
|
|
|
|
configurationMap.value( "requirements" ).type() == QVariant::Map )
|
|
|
|
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
2016-09-16 10:52:42 +02:00
|
|
|
else
|
|
|
|
cDebug() << "WARNING: no valid requirements map found in welcome "
|
|
|
|
"module configuration.";
|
2015-04-02 12:27:54 +02:00
|
|
|
}
|
|
|
|
|