[license] Apply current coding style
This commit is contained in:
parent
05daa22542
commit
042852218f
@ -21,11 +21,11 @@
|
|||||||
|
|
||||||
#include "LicensePage.h"
|
#include "LicensePage.h"
|
||||||
|
|
||||||
#include "ui_LicensePage.h"
|
|
||||||
#include "LicenseWidget.h"
|
#include "LicenseWidget.h"
|
||||||
|
#include "ui_LicensePage.h"
|
||||||
|
|
||||||
#include "JobQueue.h"
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
#include "JobQueue.h"
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
|
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
@ -36,10 +36,10 @@
|
|||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
#include <QComboBox>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QComboBox>
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@ -62,7 +62,9 @@ LicenseEntry::typeNames()
|
|||||||
LicenseEntry::LicenseEntry( const QVariantMap& conf )
|
LicenseEntry::LicenseEntry( const QVariantMap& conf )
|
||||||
{
|
{
|
||||||
if ( !conf.contains( "id" ) || !conf.contains( "name" ) || !conf.contains( "url" ) )
|
if ( !conf.contains( "id" ) || !conf.contains( "name" ) || !conf.contains( "url" ) )
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
m_id = conf[ "id" ].toString();
|
m_id = conf[ "id" ].toString();
|
||||||
m_prettyName = conf[ "name" ].toString();
|
m_prettyName = conf[ "name" ].toString();
|
||||||
@ -75,8 +77,10 @@ LicenseEntry::LicenseEntry(const QVariantMap& conf)
|
|||||||
QString typeString = conf.value( "type", "software" ).toString();
|
QString typeString = conf.value( "type", "software" ).toString();
|
||||||
m_type = typeNames().find( typeString, ok );
|
m_type = typeNames().find( typeString, ok );
|
||||||
if ( !ok )
|
if ( !ok )
|
||||||
|
{
|
||||||
cWarning() << "License entry" << m_id << "has unknown type" << typeString << "(using 'software')";
|
cWarning() << "License entry" << m_id << "has unknown type" << typeString << "(using 'software')";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
LicenseEntry::isLocal() const
|
LicenseEntry::isLocal() const
|
||||||
@ -119,9 +123,7 @@ LicensePage::LicensePage(QWidget *parent)
|
|||||||
|
|
||||||
connect( ui->acceptCheckBox, &QCheckBox::toggled, this, &LicensePage::checkAcceptance );
|
connect( ui->acceptCheckBox, &QCheckBox::toggled, this, &LicensePage::checkAcceptance );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE( ui->acceptCheckBox->setText( tr( "I accept the terms and conditions above." ) ); )
|
||||||
ui->acceptCheckBox->setText( tr( "I accept the terms and conditions above." ) );
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -132,26 +134,27 @@ LicensePage::setEntries( const QList< LicenseEntry >& entriesList )
|
|||||||
m_entries.clear();
|
m_entries.clear();
|
||||||
m_entries.reserve( entriesList.count() );
|
m_entries.reserve( entriesList.count() );
|
||||||
|
|
||||||
const bool required = std::any_of( entriesList.cbegin(), entriesList.cend(), []( const LicenseEntry& e ){ return e.m_required; });
|
const bool required
|
||||||
|
= std::any_of( entriesList.cbegin(), entriesList.cend(), []( const LicenseEntry& e ) { return e.m_required; } );
|
||||||
if ( entriesList.isEmpty() )
|
if ( entriesList.isEmpty() )
|
||||||
|
{
|
||||||
m_allLicensesOptional = true;
|
m_allLicensesOptional = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
m_allLicensesOptional = !required;
|
m_allLicensesOptional = !required;
|
||||||
|
}
|
||||||
|
|
||||||
checkAcceptance( false );
|
checkAcceptance( false );
|
||||||
|
|
||||||
CALAMARES_RETRANSLATE(
|
CALAMARES_RETRANSLATE( if ( required ) {
|
||||||
if ( required )
|
|
||||||
{
|
|
||||||
ui->mainText->setText( tr( "<h1>License Agreement</h1>"
|
ui->mainText->setText( tr( "<h1>License Agreement</h1>"
|
||||||
"This setup procedure will install proprietary "
|
"This setup procedure will install proprietary "
|
||||||
"software that is subject to licensing terms." ) );
|
"software that is subject to licensing terms." ) );
|
||||||
ui->additionalText->setText( tr( "Please review the End User License "
|
ui->additionalText->setText( tr( "Please review the End User License "
|
||||||
"Agreements (EULAs) above.<br/>"
|
"Agreements (EULAs) above.<br/>"
|
||||||
"If you do not agree with the terms, the setup procedure cannot continue." ) );
|
"If you do not agree with the terms, the setup procedure cannot continue." ) );
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->mainText->setText( tr( "<h1>License Agreement</h1>"
|
ui->mainText->setText( tr( "<h1>License Agreement</h1>"
|
||||||
"This setup procedure can install proprietary "
|
"This setup procedure can install proprietary "
|
||||||
"software that is subject to licensing terms "
|
"software that is subject to licensing terms "
|
||||||
@ -161,12 +164,10 @@ LicensePage::setEntries( const QList< LicenseEntry >& entriesList )
|
|||||||
"Agreements (EULAs) above.<br/>"
|
"Agreements (EULAs) above.<br/>"
|
||||||
"If you do not agree with the terms, proprietary software will not "
|
"If you do not agree with the terms, proprietary software will not "
|
||||||
"be installed, and open source alternatives will be used instead." ) );
|
"be installed, and open source alternatives will be used instead." ) );
|
||||||
}
|
} ui->retranslateUi( this );
|
||||||
ui->retranslateUi( this );
|
|
||||||
|
|
||||||
for ( const auto& w : m_entries )
|
for ( const auto& w
|
||||||
w->retranslateUi();
|
: m_entries ) w->retranslateUi(); )
|
||||||
)
|
|
||||||
|
|
||||||
for ( const LicenseEntry& entry : entriesList )
|
for ( const LicenseEntry& entry : entriesList )
|
||||||
{
|
{
|
||||||
@ -190,7 +191,8 @@ LicensePage::updateGlobalStorage( bool v )
|
|||||||
Calamares::JobQueue::instance()->globalStorage()->insert( "licenseAgree", v );
|
Calamares::JobQueue::instance()->globalStorage()->insert( "licenseAgree", v );
|
||||||
}
|
}
|
||||||
|
|
||||||
void LicensePage::checkAcceptance( bool checked )
|
void
|
||||||
|
LicensePage::checkAcceptance( bool checked )
|
||||||
{
|
{
|
||||||
updateGlobalStorage( checked );
|
updateGlobalStorage( checked );
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
#include "utils/NamedEnum.h"
|
#include "utils/NamedEnum.h"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
namespace Ui
|
namespace Ui
|
||||||
{
|
{
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
|
|
||||||
#include "LicenseViewStep.h"
|
#include "LicenseViewStep.h"
|
||||||
|
|
||||||
#include "LicensePage.h"
|
|
||||||
#include "JobQueue.h"
|
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
|
#include "JobQueue.h"
|
||||||
|
#include "LicensePage.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <QVariantMap>
|
#include <QVariantMap>
|
||||||
@ -33,16 +33,17 @@ LicenseViewStep::LicenseViewStep( QObject* parent )
|
|||||||
, m_widget( new LicensePage )
|
, m_widget( new LicensePage )
|
||||||
{
|
{
|
||||||
emit nextStatusChanged( false );
|
emit nextStatusChanged( false );
|
||||||
connect( m_widget, &LicensePage::nextStatusChanged,
|
connect( m_widget, &LicensePage::nextStatusChanged, this, &LicenseViewStep::nextStatusChanged );
|
||||||
this, &LicenseViewStep::nextStatusChanged );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LicenseViewStep::~LicenseViewStep()
|
LicenseViewStep::~LicenseViewStep()
|
||||||
{
|
{
|
||||||
if ( m_widget && m_widget->parent() == nullptr )
|
if ( m_widget && m_widget->parent() == nullptr )
|
||||||
|
{
|
||||||
m_widget->deleteLater();
|
m_widget->deleteLater();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
@ -97,20 +98,23 @@ void
|
|||||||
LicenseViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
LicenseViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
QList< LicenseEntry > entriesList;
|
QList< LicenseEntry > entriesList;
|
||||||
if ( configurationMap.contains( "entries" ) &&
|
if ( configurationMap.contains( "entries" ) && configurationMap.value( "entries" ).type() == QVariant::List )
|
||||||
configurationMap.value( "entries" ).type() == QVariant::List )
|
|
||||||
{
|
{
|
||||||
const auto entries = configurationMap.value( "entries" ).toList();
|
const auto entries = configurationMap.value( "entries" ).toList();
|
||||||
for ( const QVariant& entryV : entries )
|
for ( const QVariant& entryV : entries )
|
||||||
{
|
{
|
||||||
if ( entryV.type() != QVariant::Map )
|
if ( entryV.type() != QVariant::Map )
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
LicenseEntry entry( entryV.toMap() );
|
LicenseEntry entry( entryV.toMap() );
|
||||||
if ( entry.isValid() )
|
if ( entry.isValid() )
|
||||||
|
{
|
||||||
entriesList.append( entry );
|
entriesList.append( entry );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_widget->setEntries( entriesList );
|
m_widget->setEntries( entriesList );
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,9 @@
|
|||||||
#ifndef LICENSEPAGEPLUGIN_H
|
#ifndef LICENSEPAGEPLUGIN_H
|
||||||
#define LICENSEPAGEPLUGIN_H
|
#define LICENSEPAGEPLUGIN_H
|
||||||
|
|
||||||
|
#include <PluginDllMacro.h>
|
||||||
#include <utils/PluginFactory.h>
|
#include <utils/PluginFactory.h>
|
||||||
#include <viewpages/ViewStep.h>
|
#include <viewpages/ViewStep.h>
|
||||||
#include <PluginDllMacro.h>
|
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
@ -34,7 +34,9 @@ static QString
|
|||||||
loadLocalFile( const QUrl& u )
|
loadLocalFile( const QUrl& u )
|
||||||
{
|
{
|
||||||
if ( !u.isLocalFile() )
|
if ( !u.isLocalFile() )
|
||||||
|
{
|
||||||
return QString();
|
return QString();
|
||||||
|
}
|
||||||
|
|
||||||
QFile file( u.path() );
|
QFile file( u.path() );
|
||||||
if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
if ( !file.open( QIODevice::ReadOnly | QIODevice::Text ) )
|
||||||
@ -108,11 +110,10 @@ LicenseWidget::LicenseWidget( LicenseEntry entry, QWidget* parent )
|
|||||||
retranslateUi();
|
retranslateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
LicenseWidget::~LicenseWidget()
|
LicenseWidget::~LicenseWidget() {}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void LicenseWidget::retranslateUi()
|
void
|
||||||
|
LicenseWidget::retranslateUi()
|
||||||
{
|
{
|
||||||
QString productDescription;
|
QString productDescription;
|
||||||
switch ( m_entry.m_type )
|
switch ( m_entry.m_type )
|
||||||
@ -173,7 +174,9 @@ LicenseWidget::expandClicked()
|
|||||||
|
|
||||||
// Show/hide based on the new arrow direction.
|
// Show/hide based on the new arrow direction.
|
||||||
if ( m_fullText )
|
if ( m_fullText )
|
||||||
|
{
|
||||||
m_fullText->setHidden( m_expandLicenseButton->arrowType() == Qt::UpArrow );
|
m_fullText->setHidden( m_expandLicenseButton->arrowType() == Qt::UpArrow );
|
||||||
|
}
|
||||||
|
|
||||||
updateExpandToolTip();
|
updateExpandToolTip();
|
||||||
}
|
}
|
||||||
@ -186,21 +189,15 @@ LicenseWidget::updateExpandToolTip()
|
|||||||
{
|
{
|
||||||
const bool isNowCollapsed = m_expandLicenseButton->arrowType() == Qt::UpArrow;
|
const bool isNowCollapsed = m_expandLicenseButton->arrowType() == Qt::UpArrow;
|
||||||
|
|
||||||
m_expandLicenseButton->setToolTip(
|
m_expandLicenseButton->setToolTip( isNowCollapsed ? tr( "Shows the complete license text" )
|
||||||
isNowCollapsed
|
: tr( "Hide license text" ) );
|
||||||
? tr( "Shows the complete license text" )
|
m_viewLicenseLabel->setText( isNowCollapsed ? tr( "Show license agreement" ) : tr( "Hide license agreement" ) );
|
||||||
: tr( "Hide license text" )
|
|
||||||
) ;
|
|
||||||
m_viewLicenseLabel->setText(
|
|
||||||
isNowCollapsed
|
|
||||||
? tr( "Show license agreement" )
|
|
||||||
: tr( "Hide license agreement" ) );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_expandLicenseButton->setToolTip( tr( "Opens the license agreement in a browser window." ) );
|
m_expandLicenseButton->setToolTip( tr( "Opens the license agreement in a browser window." ) );
|
||||||
m_viewLicenseLabel->setText( tr( "<a href=\"%1\">View license agreement</a>" )
|
m_viewLicenseLabel->setText(
|
||||||
.arg( m_entry.m_url.toString() ) );
|
tr( "<a href=\"%1\">View license agreement</a>" ).arg( m_entry.m_url.toString() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user