|
|
|
|
@ -23,71 +23,12 @@
|
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requirements )
|
|
|
|
|
{
|
|
|
|
|
CALAMARES_RETRANSLATE_SLOT( &RequirementsModel::retranslate )
|
|
|
|
|
|
|
|
|
|
emit beginResetModel();
|
|
|
|
|
m_requirements = requirements;
|
|
|
|
|
|
|
|
|
|
auto isUnSatisfied = []( const Calamares::RequirementEntry& e ) { return !e.satisfied; };
|
|
|
|
|
auto isMandatoryAndUnSatisfied = []( const Calamares::RequirementEntry& e ) { return e.mandatory && !e.satisfied; };
|
|
|
|
|
|
|
|
|
|
m_satisfiedRequirements = std::none_of( m_requirements.begin(), m_requirements.end(), isUnSatisfied );
|
|
|
|
|
m_satisfiedMandatory = std::none_of( m_requirements.begin(), m_requirements.end(), isMandatoryAndUnSatisfied );
|
|
|
|
|
|
|
|
|
|
emit satisfiedRequirementsChanged( m_satisfiedRequirements );
|
|
|
|
|
emit satisfiedMandatoryChanged();
|
|
|
|
|
emit endResetModel();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
RequirementsModel::rowCount( const QModelIndex& ) const
|
|
|
|
|
{
|
|
|
|
|
return m_requirements.count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QVariant
|
|
|
|
|
RequirementsModel::data( const QModelIndex& index, int role ) const
|
|
|
|
|
{
|
|
|
|
|
const auto requirement = m_requirements.at( index.row() );
|
|
|
|
|
|
|
|
|
|
switch ( role )
|
|
|
|
|
{
|
|
|
|
|
case Roles::Name:
|
|
|
|
|
return requirement.name;
|
|
|
|
|
case Roles::Details:
|
|
|
|
|
return requirement.enumerationText();
|
|
|
|
|
case Roles::NegatedText:
|
|
|
|
|
return requirement.negatedText();
|
|
|
|
|
case Roles::Satisfied:
|
|
|
|
|
return requirement.satisfied;
|
|
|
|
|
case Roles::Mandatory:
|
|
|
|
|
return requirement.mandatory;
|
|
|
|
|
default:
|
|
|
|
|
return QVariant();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QHash< int, QByteArray >
|
|
|
|
|
RequirementsModel::roleNames() const
|
|
|
|
|
{
|
|
|
|
|
static QHash< int, QByteArray > roles;
|
|
|
|
|
roles[ Roles::Name ] = "name";
|
|
|
|
|
roles[ Roles::Details ] = "details";
|
|
|
|
|
roles[ Roles::NegatedText ] = "negatedText";
|
|
|
|
|
roles[ Roles::Satisfied ] = "satisfied";
|
|
|
|
|
roles[ Roles::Mandatory ] = "mandatory";
|
|
|
|
|
return roles;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Config::Config( QObject* parent )
|
|
|
|
|
: QObject( parent )
|
|
|
|
|
, m_requirementsModel( new RequirementsModel( this ) )
|
|
|
|
|
, m_requirementsModel( new Calamares::RequirementsModel( this ) )
|
|
|
|
|
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
|
|
|
|
{
|
|
|
|
|
connect( m_requirementsModel, &RequirementsModel::satisfiedRequirementsChanged, this, &Config::setIsNextEnabled );
|
|
|
|
|
connect( m_requirementsModel, &Calamares::RequirementsModel::satisfiedRequirementsChanged, this, &Config::setIsNextEnabled );
|
|
|
|
|
|
|
|
|
|
initLanguages();
|
|
|
|
|
|
|
|
|
|
@ -100,7 +41,44 @@ Config::retranslate()
|
|
|
|
|
m_genericWelcomeMessage = genericWelcomeMessage().arg( *Calamares::Branding::VersionedName );
|
|
|
|
|
emit genericWelcomeMessageChanged();
|
|
|
|
|
|
|
|
|
|
m_requirementsModel->retranslate();
|
|
|
|
|
if ( !m_requirementsModel->satisfiedRequirements() )
|
|
|
|
|
{
|
|
|
|
|
QString message;
|
|
|
|
|
const bool setup = Calamares::Settings::instance()->isSetupMode();
|
|
|
|
|
|
|
|
|
|
if ( !m_requirementsModel->satisfiedMandatory() )
|
|
|
|
|
{
|
|
|
|
|
message = setup ? tr( "This computer does not satisfy the minimum "
|
|
|
|
|
"requirements for setting up %1.<br/>"
|
|
|
|
|
"Setup cannot continue. "
|
|
|
|
|
"<a href=\"#details\">Details...</a>" )
|
|
|
|
|
: tr( "This computer does not satisfy the minimum "
|
|
|
|
|
"requirements for installing %1.<br/>"
|
|
|
|
|
"Installation cannot continue. "
|
|
|
|
|
"<a href=\"#details\">Details...</a>" );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
message = setup ? tr( "This computer does not satisfy some of the "
|
|
|
|
|
"recommended requirements for setting up %1.<br/>"
|
|
|
|
|
"Setup can continue, but some features "
|
|
|
|
|
"might be disabled." )
|
|
|
|
|
: tr( "This computer does not satisfy some of the "
|
|
|
|
|
"recommended requirements for installing %1.<br/>"
|
|
|
|
|
"Installation can continue, but some features "
|
|
|
|
|
"might be disabled." );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_warningMessage = tr( "This program will ask you some questions and "
|
|
|
|
|
"set up %2 on your computer." )
|
|
|
|
|
.arg( *Calamares::Branding::ProductName );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit warningMessageChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CalamaresUtils::Locale::LabelModel*
|
|
|
|
|
@ -197,7 +175,7 @@ Config::setLocaleIndex( const int& index )
|
|
|
|
|
emit localeIndexChanged( m_localeIndex );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
RequirementsModel&
|
|
|
|
|
Calamares::RequirementsModel&
|
|
|
|
|
Config::requirementsModel() const
|
|
|
|
|
{
|
|
|
|
|
return *m_requirementsModel;
|
|
|
|
|
@ -262,51 +240,8 @@ Config::setSupportUrl( const QString& url )
|
|
|
|
|
emit supportUrlChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
RequirementsModel::retranslate()
|
|
|
|
|
{
|
|
|
|
|
if ( !m_satisfiedRequirements )
|
|
|
|
|
{
|
|
|
|
|
QString message;
|
|
|
|
|
const bool setup = Calamares::Settings::instance()->isSetupMode();
|
|
|
|
|
|
|
|
|
|
if ( !m_satisfiedMandatory )
|
|
|
|
|
{
|
|
|
|
|
message = setup ? tr( "This computer does not satisfy the minimum "
|
|
|
|
|
"requirements for setting up %1.<br/>"
|
|
|
|
|
"Setup cannot continue. "
|
|
|
|
|
"<a href=\"#details\">Details...</a>" )
|
|
|
|
|
: tr( "This computer does not satisfy the minimum "
|
|
|
|
|
"requirements for installing %1.<br/>"
|
|
|
|
|
"Installation cannot continue. "
|
|
|
|
|
"<a href=\"#details\">Details...</a>" );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
message = setup ? tr( "This computer does not satisfy some of the "
|
|
|
|
|
"recommended requirements for setting up %1.<br/>"
|
|
|
|
|
"Setup can continue, but some features "
|
|
|
|
|
"might be disabled." )
|
|
|
|
|
: tr( "This computer does not satisfy some of the "
|
|
|
|
|
"recommended requirements for installing %1.<br/>"
|
|
|
|
|
"Installation can continue, but some features "
|
|
|
|
|
"might be disabled." );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_warningMessage = tr( "This program will ask you some questions and "
|
|
|
|
|
"set up %2 on your computer." )
|
|
|
|
|
.arg( *Calamares::Branding::ProductName );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit warningMessageChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString
|
|
|
|
|
Config::genericWelcomeMessage()
|
|
|
|
|
Config::genericWelcomeMessage() const
|
|
|
|
|
{
|
|
|
|
|
QString message;
|
|
|
|
|
|
|
|
|
|
@ -325,3 +260,8 @@ Config::genericWelcomeMessage()
|
|
|
|
|
|
|
|
|
|
return message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString Config::warningMessage() const
|
|
|
|
|
{
|
|
|
|
|
return m_warningMessage;
|
|
|
|
|
}
|
|
|
|
|
|