calamares/src/modules/license/LicenseViewStep.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

112 lines
2.2 KiB
C++
Raw Normal View History

/* === This file is part of Calamares - <https://calamares.io> ===
*
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
*
* Calamares is Free Software: see the License-Identifier above.
*
*/
#include "LicenseViewStep.h"
#include "GlobalStorage.h"
2019-08-03 14:52:38 +02:00
#include "JobQueue.h"
#include "LicensePage.h"
#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
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 );
}
LicenseViewStep::~LicenseViewStep()
{
if ( m_widget && m_widget->parent() == nullptr )
2019-08-03 14:52:38 +02:00
{
m_widget->deleteLater();
2019-08-03 14:52:38 +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 )
{
const auto entries = configurationMap.value( "entries" ).toList();
for ( const QVariant& entryV : entries )
{
if ( entryV.type() != QVariant::Map )
2019-08-03 14:52:38 +02:00
{
continue;
2019-08-03 14:52:38 +02:00
}
LicenseEntry entry( entryV.toMap() );
if ( entry.isValid() )
2019-08-03 14:52:38 +02:00
{
entriesList.append( entry );
2019-08-03 14:52:38 +02:00
}
}
}
m_widget->setEntries( entriesList );
}