2020-08-25 16:05:56 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
2015-09-10 18:21:51 +02:00
|
|
|
*
|
2020-08-22 01:19:58 +02:00
|
|
|
* SPDX-FileCopyrightText: 2015 Anke Boersma <demm@kaosx.us>
|
|
|
|
* SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
2015-09-10 18:21:51 +02:00
|
|
|
*
|
2020-08-25 16:05:56 +02:00
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
2015-09-10 18:21:51 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "LicenseViewStep.h"
|
|
|
|
|
|
|
|
#include "GlobalStorage.h"
|
2019-08-03 14:52:38 +02:00
|
|
|
#include "JobQueue.h"
|
|
|
|
#include "LicensePage.h"
|
2015-09-10 18:21:51 +02:00
|
|
|
#include "utils/Logger.h"
|
|
|
|
|
|
|
|
#include <QVariantMap>
|
|
|
|
|
2019-08-03 14:52:38 +02:00
|
|
|
CALAMARES_PLUGIN_FACTORY_DEFINITION( LicenseViewStepFactory, registerPlugin< LicenseViewStep >(); )
|
2015-09-15 17:21:19 +02:00
|
|
|
|
2015-09-10 18:21:51 +02:00
|
|
|
LicenseViewStep::LicenseViewStep( QObject* parent )
|
|
|
|
: Calamares::ViewStep( parent )
|
|
|
|
, m_widget( new LicensePage )
|
|
|
|
{
|
|
|
|
emit nextStatusChanged( false );
|
2019-08-03 14:52:38 +02:00
|
|
|
connect( m_widget, &LicensePage::nextStatusChanged, this, &LicenseViewStep::nextStatusChanged );
|
2015-09-10 18:21:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
LicenseViewStep::~LicenseViewStep()
|
|
|
|
{
|
|
|
|
if ( m_widget && m_widget->parent() == nullptr )
|
2019-08-03 14:52:38 +02:00
|
|
|
{
|
2015-09-10 18:21:51 +02:00
|
|
|
m_widget->deleteLater();
|
2019-08-03 14:52:38 +02:00
|
|
|
}
|
2015-09-10 18:21:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QString
|
|
|
|
LicenseViewStep::prettyName() const
|
|
|
|
{
|
|
|
|
return tr( "License" );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QWidget*
|
|
|
|
LicenseViewStep::widget()
|
|
|
|
{
|
|
|
|
return m_widget;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
LicenseViewStep::isNextEnabled() const
|
|
|
|
{
|
|
|
|
return m_widget->isNextEnabled();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
LicenseViewStep::isBackEnabled() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
LicenseViewStep::isAtBeginning() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool
|
|
|
|
LicenseViewStep::isAtEnd() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QList< Calamares::job_ptr >
|
|
|
|
LicenseViewStep::jobs() const
|
|
|
|
{
|
|
|
|
return QList< Calamares::job_ptr >();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
LicenseViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
|
|
|
{
|
|
|
|
QList< LicenseEntry > entriesList;
|
2019-08-03 14:52:38 +02:00
|
|
|
if ( configurationMap.contains( "entries" ) && configurationMap.value( "entries" ).type() == QVariant::List )
|
2015-09-10 18:21:51 +02:00
|
|
|
{
|
2016-09-01 14:21:05 +02:00
|
|
|
const auto entries = configurationMap.value( "entries" ).toList();
|
|
|
|
for ( const QVariant& entryV : entries )
|
2015-09-10 18:21:51 +02:00
|
|
|
{
|
2016-02-26 13:34:30 +01:00
|
|
|
if ( entryV.type() != QVariant::Map )
|
2019-08-03 14:52:38 +02:00
|
|
|
{
|
2015-09-10 18:21:51 +02:00
|
|
|
continue;
|
2019-08-03 14:52:38 +02:00
|
|
|
}
|
2015-09-10 18:21:51 +02:00
|
|
|
|
2019-03-22 19:31:39 +01:00
|
|
|
LicenseEntry entry( entryV.toMap() );
|
|
|
|
if ( entry.isValid() )
|
2019-08-03 14:52:38 +02:00
|
|
|
{
|
2019-03-22 19:31:39 +01:00
|
|
|
entriesList.append( entry );
|
2019-08-03 14:52:38 +02:00
|
|
|
}
|
2015-09-10 18:21:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_widget->setEntries( entriesList );
|
|
|
|
}
|