[welcome] Chase Branding API change

This commit is contained in:
Adriaan de Groot 2020-05-04 12:51:28 +02:00
parent 0046c3f161
commit 70054e5db4
5 changed files with 15 additions and 19 deletions

View File

@ -41,7 +41,7 @@ Config::Config( QObject* parent )
void void
Config::retranslate() Config::retranslate()
{ {
m_genericWelcomeMessage = genericWelcomeMessage().arg( *Calamares::Branding::VersionedName ); m_genericWelcomeMessage = genericWelcomeMessage().arg( Calamares::Branding::instance()->versionedName() );
emit genericWelcomeMessageChanged( m_genericWelcomeMessage ); emit genericWelcomeMessageChanged( m_genericWelcomeMessage );
if ( !m_requirementsModel->satisfiedRequirements() ) if ( !m_requirementsModel->satisfiedRequirements() )
@ -72,13 +72,13 @@ Config::retranslate()
"might be disabled." ); "might be disabled." );
} }
m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName ); m_warningMessage = message.arg( Calamares::Branding::instance()->shortVersionedName() );
} }
else else
{ {
m_warningMessage = tr( "This program will ask you some questions and " m_warningMessage = tr( "This program will ask you some questions and "
"set up %2 on your computer." ) "set up %2 on your computer." )
.arg( *Calamares::Branding::ProductName ); .arg( Calamares::Branding::instance()->productName() );
} }
emit warningMessageChanged( m_warningMessage ); emit warningMessageChanged( m_warningMessage );
@ -103,7 +103,7 @@ Config::initLanguages()
QLocale defaultLocale = QLocale( QLocale::system().name() ); QLocale defaultLocale = QLocale( QLocale::system().name() );
cDebug() << "Matching locale" << defaultLocale; cDebug() << "Matching locale" << defaultLocale;
int matchedLocaleIndex = m_languages->find( [&]( const QLocale& x ) { int matchedLocaleIndex = m_languages->find( [ & ]( const QLocale& x ) {
return x.language() == defaultLocale.language() && x.country() == defaultLocale.country(); return x.language() == defaultLocale.language() && x.country() == defaultLocale.country();
} ); } );
@ -112,7 +112,7 @@ Config::initLanguages()
cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language(); cDebug() << Logger::SubEntry << "Matching approximate locale" << defaultLocale.language();
matchedLocaleIndex 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 ) if ( matchedLocaleIndex < 0 )

View File

@ -56,9 +56,7 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); const int defaultFontHeight = CalamaresUtils::defaultFontHeight();
ui->setupUi( this ); ui->setupUi( this );
ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Information, CalamaresUtils::Information, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
CalamaresUtils::Original,
2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
// insert system-check widget below welcome text // insert system-check widget below welcome text
const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText );
@ -85,8 +83,6 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent )
initLanguages(); initLanguages();
cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares()
<< *Calamares::Branding::VersionedName;
CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate ) CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate )
connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox ); connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox );
@ -177,7 +173,7 @@ WelcomePage::setupButton( Button role, const QString& url )
{ {
auto size = 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ); auto size = 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() );
button->setIcon( CalamaresUtils::defaultPixmap( icon, CalamaresUtils::Original, size ) ); button->setIcon( CalamaresUtils::defaultPixmap( icon, CalamaresUtils::Original, size ) );
connect( button, &QPushButton::clicked, [u]() { QDesktopServices::openUrl( u ); } ); connect( button, &QPushButton::clicked, [ u ]() { QDesktopServices::openUrl( u ); } );
} }
else else
{ {
@ -235,9 +231,9 @@ WelcomePage::retranslate()
: tr( "<h1>Welcome to the %1 installer.</h1>" ); : tr( "<h1>Welcome to the %1 installer.</h1>" );
} }
ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) ); ui->mainText->setText( message.arg( Calamares::Branding::instance()->versionedName() ) );
ui->retranslateUi( this ); ui->retranslateUi( this );
ui->supportButton->setText( tr( "%1 support" ).arg( *Calamares::Branding::ShortProductName ) ); ui->supportButton->setText( tr( "%1 support" ).arg( Calamares::Branding::instance()->shortProductName() ) );
} }
void void
@ -261,7 +257,7 @@ WelcomePage::showAboutBox()
"Liberating Software." ) "Liberating Software." )
.arg( CALAMARES_APPLICATION_NAME ) .arg( CALAMARES_APPLICATION_NAME )
.arg( CALAMARES_VERSION ) .arg( CALAMARES_VERSION )
.arg( *Calamares::Branding::VersionedName ), .arg( Calamares::Branding::instance()->versionedName() ),
QMessageBox::Ok, QMessageBox::Ok,
this ); this );
mb.setIconPixmap( CalamaresUtils::defaultPixmap( mb.setIconPixmap( CalamaresUtils::defaultPixmap(

View File

@ -129,7 +129,7 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map
auto v = map.value( key ); auto v = map.value( key );
if ( v.type() == QVariant::Bool ) if ( v.type() == QVariant::Bool )
{ {
return v.toBool() ? ( *e ) : QString(); return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString();
} }
if ( v.type() == QVariant::String ) if ( v.type() == QVariant::String )
{ {
@ -174,7 +174,7 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap )
if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None ) if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None )
{ {
auto* future = new FWString(); auto* future = new FWString();
connect( future, &FWString::finished, [view = this, f = future, h = handler]() { connect( future, &FWString::finished, [ view = this, f = future, h = handler ]() {
QString countryResult = f->future().result(); QString countryResult = f->future().result();
cDebug() << "GeoIP result for welcome=" << countryResult; cDebug() << "GeoIP result for welcome=" << countryResult;
view->setCountry( countryResult, h ); view->setCountry( countryResult, h );

View File

@ -278,13 +278,13 @@ ResultsListWidget::retranslate()
"Installation can continue, but some features " "Installation can continue, but some features "
"might be disabled." ); "might be disabled." );
} }
m_explanation->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); m_explanation->setText( message.arg( Calamares::Branding::instance()->shortVersionedName() ) );
} }
else else
{ {
m_explanation->setText( tr( "This program will ask you some questions and " m_explanation->setText( tr( "This program will ask you some questions and "
"set up %2 on your computer." ) "set up %2 on your computer." )
.arg( *Calamares::Branding::ProductName ) ); .arg( Calamares::Branding::instance()->productName() ) );
} }
} }

View File

@ -120,7 +120,7 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map
auto v = map.value( key ); auto v = map.value( key );
if ( v.type() == QVariant::Bool ) if ( v.type() == QVariant::Bool )
{ {
return v.toBool() ? ( *e ) : QString(); return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString();
} }
if ( v.type() == QVariant::String ) if ( v.type() == QVariant::String )
{ {