|
|
|
|
@ -17,10 +17,10 @@
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "Config.h"
|
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
#include "Branding.h"
|
|
|
|
|
#include "Settings.h"
|
|
|
|
|
#include "utils/Logger.h"
|
|
|
|
|
#include "utils/Retranslator.h"
|
|
|
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
|
|
|
|
|
|
@ -38,7 +38,7 @@ RequirementsModel::setRequirementsList( const Calamares::RequirementsList& requi
|
|
|
|
|
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 satisfiedRequirementsChanged( m_satisfiedRequirements );
|
|
|
|
|
emit satisfiedMandatoryChanged();
|
|
|
|
|
emit endResetModel();
|
|
|
|
|
}
|
|
|
|
|
@ -54,40 +54,41 @@ 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();
|
|
|
|
|
}
|
|
|
|
|
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>
|
|
|
|
|
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;
|
|
|
|
|
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 ))
|
|
|
|
|
Config::Config( QObject* parent )
|
|
|
|
|
: QObject( parent )
|
|
|
|
|
, m_requirementsModel( new RequirementsModel( this ) )
|
|
|
|
|
, m_languages( CalamaresUtils::Locale::availableTranslations() )
|
|
|
|
|
{
|
|
|
|
|
connect(m_requirementsModel, &RequirementsModel::satisfiedRequirementsChanged, this, &Config::setIsNextEnabled);
|
|
|
|
|
connect( m_requirementsModel, &RequirementsModel::satisfiedRequirementsChanged, this, &Config::setIsNextEnabled );
|
|
|
|
|
|
|
|
|
|
initLanguages();
|
|
|
|
|
|
|
|
|
|
@ -106,13 +107,13 @@ Config::retranslate()
|
|
|
|
|
CalamaresUtils::Locale::LabelModel*
|
|
|
|
|
Config::languagesModel() const
|
|
|
|
|
{
|
|
|
|
|
return m_languages;
|
|
|
|
|
return m_languages;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString
|
|
|
|
|
Config::languageIcon() const
|
|
|
|
|
{
|
|
|
|
|
return m_languageIcon;
|
|
|
|
|
return m_languageIcon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
@ -131,7 +132,7 @@ Config::initLanguages()
|
|
|
|
|
cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language();
|
|
|
|
|
|
|
|
|
|
matchedLocaleIndex
|
|
|
|
|
= m_languages->find( [&]( const QLocale& x ) { return x.language() == defaultLocale.language(); } );
|
|
|
|
|
= m_languages->find( [&]( const QLocale& x ) { return x.language() == defaultLocale.language(); } );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ( matchedLocaleIndex < 0 )
|
|
|
|
|
@ -154,7 +155,7 @@ Config::initLanguages()
|
|
|
|
|
cDebug() << Logger::SubEntry << "Matched with index" << matchedLocaleIndex << name;
|
|
|
|
|
|
|
|
|
|
CalamaresUtils::installTranslator( name, Calamares::Branding::instance()->translationsDirectory(), qApp );
|
|
|
|
|
setLocaleIndex( matchedLocaleIndex );
|
|
|
|
|
setLocaleIndex( matchedLocaleIndex );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@ -165,23 +166,26 @@ Config::initLanguages()
|
|
|
|
|
void
|
|
|
|
|
Config::setCountryCode( const QString& countryCode )
|
|
|
|
|
{
|
|
|
|
|
m_countryCode = countryCode;
|
|
|
|
|
setLocaleIndex(CalamaresUtils::Locale::availableTranslations()->find( m_countryCode ));
|
|
|
|
|
m_countryCode = countryCode;
|
|
|
|
|
setLocaleIndex( CalamaresUtils::Locale::availableTranslations()->find( m_countryCode ) );
|
|
|
|
|
|
|
|
|
|
emit countryCodeChanged( m_countryCode );
|
|
|
|
|
emit countryCodeChanged( m_countryCode );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Config::setLanguageIcon(const QString &languageIcon )
|
|
|
|
|
Config::setLanguageIcon( const QString& languageIcon )
|
|
|
|
|
{
|
|
|
|
|
m_languageIcon = languageIcon;
|
|
|
|
|
m_languageIcon = languageIcon;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Config::setLocaleIndex(const int& index)
|
|
|
|
|
Config::setLocaleIndex( const int& index )
|
|
|
|
|
{
|
|
|
|
|
if(index == m_localeIndex || index > CalamaresUtils::Locale::availableTranslations()->rowCount(QModelIndex()) || index < 0)
|
|
|
|
|
if ( index == m_localeIndex || index > CalamaresUtils::Locale::availableTranslations()->rowCount( QModelIndex() )
|
|
|
|
|
|| index < 0 )
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_localeIndex = index;
|
|
|
|
|
|
|
|
|
|
@ -189,8 +193,7 @@ Config::setLocaleIndex(const int& index)
|
|
|
|
|
cDebug() << "Selected locale" << selectedLocale;
|
|
|
|
|
|
|
|
|
|
QLocale::setDefault( selectedLocale );
|
|
|
|
|
CalamaresUtils::installTranslator(
|
|
|
|
|
selectedLocale, Calamares::Branding::instance()->translationsDirectory(), qApp );
|
|
|
|
|
CalamaresUtils::installTranslator( selectedLocale, Calamares::Branding::instance()->translationsDirectory(), qApp );
|
|
|
|
|
|
|
|
|
|
emit localeIndexChanged( m_localeIndex );
|
|
|
|
|
}
|
|
|
|
|
@ -215,7 +218,7 @@ Config::donateUrl() const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Config::setDonateUrl(const QString& url)
|
|
|
|
|
Config::setDonateUrl( const QString& url )
|
|
|
|
|
{
|
|
|
|
|
m_donateUrl = url;
|
|
|
|
|
emit donateUrlChanged();
|
|
|
|
|
@ -228,17 +231,17 @@ Config::knownIssuesUrl() const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Config::setKnownIssuesUrl(const QString& url)
|
|
|
|
|
Config::setKnownIssuesUrl( const QString& url )
|
|
|
|
|
{
|
|
|
|
|
m_knownIssuesUrl = url;
|
|
|
|
|
emit knownIssuesUrlChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Config::setReleaseNotesUrl(const QString& url)
|
|
|
|
|
Config::setReleaseNotesUrl( const QString& url )
|
|
|
|
|
{
|
|
|
|
|
m_releaseNotesUrl = url;
|
|
|
|
|
emit releaseNotesUrlChanged();
|
|
|
|
|
m_releaseNotesUrl = url;
|
|
|
|
|
emit releaseNotesUrlChanged();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString
|
|
|
|
|
@ -254,7 +257,7 @@ Config::supportUrl() const
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
Config::setSupportUrl(const QString& url)
|
|
|
|
|
Config::setSupportUrl( const QString& url )
|
|
|
|
|
{
|
|
|
|
|
m_supportUrl = url;
|
|
|
|
|
emit supportUrlChanged();
|
|
|
|
|
@ -271,32 +274,33 @@ RequirementsModel::retranslate()
|
|
|
|
|
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
|
|
|
|
|
"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." );
|
|
|
|
|
"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
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_warningMessage = tr( "This program will ask you some questions and "
|
|
|
|
|
"set up %2 on your computer." )
|
|
|
|
|
.arg( *Calamares::Branding::ProductName );
|
|
|
|
|
"set up %2 on your computer." )
|
|
|
|
|
.arg( *Calamares::Branding::ProductName );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit warningMessageChanged();
|
|
|
|
|
@ -310,16 +314,15 @@ Config::genericWelcomeMessage()
|
|
|
|
|
if ( Calamares::Settings::instance()->isSetupMode() )
|
|
|
|
|
{
|
|
|
|
|
message = Calamares::Branding::instance()->welcomeStyleCalamares()
|
|
|
|
|
? tr( "<h1>Welcome to the Calamares setup program for %1.</h1>" )
|
|
|
|
|
: tr( "<h1>Welcome to %1 setup.</h1>" );
|
|
|
|
|
? tr( "<h1>Welcome to the Calamares setup program for %1.</h1>" )
|
|
|
|
|
: tr( "<h1>Welcome to %1 setup.</h1>" );
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
message = Calamares::Branding::instance()->welcomeStyleCalamares()
|
|
|
|
|
? tr( "<h1>Welcome to the Calamares installer for %1.</h1>" )
|
|
|
|
|
: tr( "<h1>Welcome to the %1 installer.</h1>" );
|
|
|
|
|
? tr( "<h1>Welcome to the Calamares installer for %1.</h1>" )
|
|
|
|
|
: tr( "<h1>Welcome to the %1 installer.</h1>" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return message;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|