From 70054e5db4d6dabd6ea1e35be1889a14562e79a7 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 4 May 2020 12:51:28 +0200 Subject: [PATCH] [welcome] Chase Branding API change --- src/modules/welcome/Config.cpp | 10 +++++----- src/modules/welcome/WelcomePage.cpp | 14 +++++--------- src/modules/welcome/WelcomeViewStep.cpp | 4 ++-- src/modules/welcome/checker/ResultsListWidget.cpp | 4 ++-- src/modules/welcomeq/WelcomeQmlViewStep.cpp | 2 +- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index 1f12033a5..6612fd030 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -41,7 +41,7 @@ Config::Config( QObject* parent ) void Config::retranslate() { - m_genericWelcomeMessage = genericWelcomeMessage().arg( *Calamares::Branding::VersionedName ); + m_genericWelcomeMessage = genericWelcomeMessage().arg( Calamares::Branding::instance()->versionedName() ); emit genericWelcomeMessageChanged( m_genericWelcomeMessage ); if ( !m_requirementsModel->satisfiedRequirements() ) @@ -72,13 +72,13 @@ Config::retranslate() "might be disabled." ); } - m_warningMessage = message.arg( *Calamares::Branding::ShortVersionedName ); + m_warningMessage = message.arg( Calamares::Branding::instance()->shortVersionedName() ); } else { m_warningMessage = tr( "This program will ask you some questions and " "set up %2 on your computer." ) - .arg( *Calamares::Branding::ProductName ); + .arg( Calamares::Branding::instance()->productName() ); } emit warningMessageChanged( m_warningMessage ); @@ -103,7 +103,7 @@ Config::initLanguages() QLocale defaultLocale = QLocale( QLocale::system().name() ); 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(); } ); @@ -112,7 +112,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 ) diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 89fde33a0..15b5f5a69 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -56,9 +56,7 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) const int defaultFontHeight = CalamaresUtils::defaultFontHeight(); ui->setupUi( this ); ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( - CalamaresUtils::Information, - CalamaresUtils::Original, - 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); + CalamaresUtils::Information, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) ); // insert system-check widget below welcome text const int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); @@ -85,8 +83,6 @@ WelcomePage::WelcomePage( Config* conf, QWidget* parent ) initLanguages(); - cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares() - << *Calamares::Branding::VersionedName; CALAMARES_RETRANSLATE_SLOT( &WelcomePage::retranslate ) 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() ); 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 { @@ -235,9 +231,9 @@ WelcomePage::retranslate() : tr( "

Welcome to the %1 installer.

" ); } - ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) ); + ui->mainText->setText( message.arg( Calamares::Branding::instance()->versionedName() ) ); 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 @@ -261,7 +257,7 @@ WelcomePage::showAboutBox() "Liberating Software." ) .arg( CALAMARES_APPLICATION_NAME ) .arg( CALAMARES_VERSION ) - .arg( *Calamares::Branding::VersionedName ), + .arg( Calamares::Branding::instance()->versionedName() ), QMessageBox::Ok, this ); mb.setIconPixmap( CalamaresUtils::defaultPixmap( diff --git a/src/modules/welcome/WelcomeViewStep.cpp b/src/modules/welcome/WelcomeViewStep.cpp index 3a0bef18f..8e6ca13ed 100644 --- a/src/modules/welcome/WelcomeViewStep.cpp +++ b/src/modules/welcome/WelcomeViewStep.cpp @@ -129,7 +129,7 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map auto v = map.value( key ); if ( v.type() == QVariant::Bool ) { - return v.toBool() ? ( *e ) : QString(); + return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString(); } if ( v.type() == QVariant::String ) { @@ -174,7 +174,7 @@ WelcomeViewStep::setConfigurationMap( const QVariantMap& configurationMap ) if ( handler->type() != CalamaresUtils::GeoIP::Handler::Type::None ) { 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(); cDebug() << "GeoIP result for welcome=" << countryResult; view->setCountry( countryResult, h ); diff --git a/src/modules/welcome/checker/ResultsListWidget.cpp b/src/modules/welcome/checker/ResultsListWidget.cpp index c16cda4c4..3fa49298f 100644 --- a/src/modules/welcome/checker/ResultsListWidget.cpp +++ b/src/modules/welcome/checker/ResultsListWidget.cpp @@ -278,13 +278,13 @@ ResultsListWidget::retranslate() "Installation can continue, but some features " "might be disabled." ); } - m_explanation->setText( message.arg( *Calamares::Branding::ShortVersionedName ) ); + m_explanation->setText( message.arg( Calamares::Branding::instance()->shortVersionedName() ) ); } else { m_explanation->setText( tr( "This program will ask you some questions and " "set up %2 on your computer." ) - .arg( *Calamares::Branding::ProductName ) ); + .arg( Calamares::Branding::instance()->productName() ) ); } } diff --git a/src/modules/welcomeq/WelcomeQmlViewStep.cpp b/src/modules/welcomeq/WelcomeQmlViewStep.cpp index c1046b506..fcda52314 100644 --- a/src/modules/welcomeq/WelcomeQmlViewStep.cpp +++ b/src/modules/welcomeq/WelcomeQmlViewStep.cpp @@ -120,7 +120,7 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map auto v = map.value( key ); if ( v.type() == QVariant::Bool ) { - return v.toBool() ? ( *e ) : QString(); + return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString(); } if ( v.type() == QVariant::String ) {