calamares/src/modules/license/LicenseViewStep.cpp
Adriaan de Groot 1cd9b93a22 REUSE: Giant boilerplate cleanup
- point to main Calamares site in the 'part of' headers instead
  of to github (this is the "this file is part of Calamares"
  opening line for most files).
- remove boilerplate from all source files, CMake modules and completions,
  this is the 3-paragraph summary of the GPL-3.0-or-later, which has
  a meaning entirely covered by the SPDX tag.
2020-08-26 02:28:38 +02:00

112 lines
2.2 KiB
C++

/* === This file is part of Calamares - <https://calamares.io> ===
*
* 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"
#include "JobQueue.h"
#include "LicensePage.h"
#include "utils/Logger.h"
#include <QVariantMap>
CALAMARES_PLUGIN_FACTORY_DEFINITION( LicenseViewStepFactory, registerPlugin< LicenseViewStep >(); )
LicenseViewStep::LicenseViewStep( QObject* parent )
: Calamares::ViewStep( parent )
, m_widget( new LicensePage )
{
emit nextStatusChanged( false );
connect( m_widget, &LicensePage::nextStatusChanged, this, &LicenseViewStep::nextStatusChanged );
}
LicenseViewStep::~LicenseViewStep()
{
if ( m_widget && m_widget->parent() == nullptr )
{
m_widget->deleteLater();
}
}
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;
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 )
{
continue;
}
LicenseEntry entry( entryV.toMap() );
if ( entry.isValid() )
{
entriesList.append( entry );
}
}
}
m_widget->setEntries( entriesList );
}