diff --git a/src/modules/welcome/WelcomePage.cpp b/src/modules/welcome/WelcomePage.cpp index 05c955a2d..f46300097 100644 --- a/src/modules/welcome/WelcomePage.cpp +++ b/src/modules/welcome/WelcomePage.cpp @@ -73,61 +73,13 @@ WelcomePage::WelcomePage( QWidget* parent ) cDebug() << "Welcome string" << Calamares::Branding::instance()->welcomeStyleCalamares() << *Calamares::Branding::VersionedName; - CALAMARES_RETRANSLATE( - QString message; - - if ( Calamares::Settings::instance()->isSetupMode() ) - { - message = Calamares::Branding::instance()->welcomeStyleCalamares() - ? tr( "

Welcome to the Calamares setup program for %1.

" ) - : tr( "

Welcome to %1 setup.

" ); - } - else - { - message = Calamares::Branding::instance()->welcomeStyleCalamares() - ? tr( "

Welcome to the Calamares installer for %1.

" ) - : tr( "

Welcome to the %1 installer.

" ); - } - - ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) ); - ui->retranslateUi( this ); - ui->supportButton->setText( tr( "%1 support" ).arg( *Calamares::Branding::ShortProductName ) ); ) + CALAMARES_RETRANSLATE( retranslate(); ) ui->aboutButton->setIcon( CalamaresUtils::defaultPixmap( CalamaresUtils::Information, CalamaresUtils::Original, 2 * QSize( CalamaresUtils::defaultFontHeight(), CalamaresUtils::defaultFontHeight() ) ) ); - connect( ui->aboutButton, &QPushButton::clicked, this, [this] { - QString title - = Calamares::Settings::instance()->isSetupMode() ? tr( "About %1 setup" ) : tr( "About %1 installer" ); - QMessageBox mb( QMessageBox::Information, - title.arg( CALAMARES_APPLICATION_NAME ), - tr( "

%1


" - "%2
" - "for %3


" - "Copyright 2014-2017 Teo Mrnjavac <teo@kde.org>
" - "Copyright 2017-2019 Adriaan de Groot <groot@kde.org>
" - "Thanks to the Calamares team " - "and the Calamares " - "translators team.

" - "Calamares " - "development is sponsored by
" - "Blue Systems - " - "Liberating Software." ) - .arg( CALAMARES_APPLICATION_NAME ) - .arg( CALAMARES_VERSION ) - .arg( *Calamares::Branding::VersionedName ), - QMessageBox::Ok, - this ); - mb.setIconPixmap( CalamaresUtils::defaultPixmap( - CalamaresUtils::Squid, - CalamaresUtils::Original, - QSize( CalamaresUtils::defaultFontHeight() * 6, CalamaresUtils::defaultFontHeight() * 6 ) ) ); - QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() ); - if ( layout ) - layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 ); - mb.exec(); - } ); + connect( ui->aboutButton, &QPushButton::clicked, this, &WelcomePage::showAboutBox ); int welcome_text_idx = ui->verticalLayout->indexOf( ui->mainText ); ui->verticalLayout->insertWidget( welcome_text_idx + 1, m_checkingWidget ); @@ -284,6 +236,65 @@ WelcomePage::setLanguageIcon( QPixmap i ) ui->languageIcon->setPixmap( i ); } +void +WelcomePage::retranslate() +{ + QString message; + + if ( Calamares::Settings::instance()->isSetupMode() ) + { + message = Calamares::Branding::instance()->welcomeStyleCalamares() + ? tr( "

Welcome to the Calamares setup program for %1.

" ) + : tr( "

Welcome to %1 setup.

" ); + } + else + { + message = Calamares::Branding::instance()->welcomeStyleCalamares() + ? tr( "

Welcome to the Calamares installer for %1.

" ) + : tr( "

Welcome to the %1 installer.

" ); + } + + ui->mainText->setText( message.arg( *Calamares::Branding::VersionedName ) ); + ui->retranslateUi( this ); + ui->supportButton->setText( tr( "%1 support" ).arg( *Calamares::Branding::ShortProductName ) ); +} + +void +WelcomePage::showAboutBox() +{ + QString title + = Calamares::Settings::instance()->isSetupMode() ? tr( "About %1 setup" ) : tr( "About %1 installer" ); + QMessageBox mb( QMessageBox::Information, + title.arg( CALAMARES_APPLICATION_NAME ), + tr( "

%1


" + "%2
" + "for %3


" + "Copyright 2014-2017 Teo Mrnjavac <teo@kde.org>
" + "Copyright 2017-2019 Adriaan de Groot <groot@kde.org>
" + "Thanks to the Calamares team " + "and the Calamares " + "translators team.

" + "Calamares " + "development is sponsored by
" + "Blue Systems - " + "Liberating Software." ) + .arg( CALAMARES_APPLICATION_NAME ) + .arg( CALAMARES_VERSION ) + .arg( *Calamares::Branding::VersionedName ), + QMessageBox::Ok, + this ); + mb.setIconPixmap( CalamaresUtils::defaultPixmap( + CalamaresUtils::Squid, + CalamaresUtils::Original, + QSize( CalamaresUtils::defaultFontHeight() * 6, CalamaresUtils::defaultFontHeight() * 6 ) ) ); + QGridLayout* layout = reinterpret_cast< QGridLayout* >( mb.layout() ); + if ( layout ) + { + layout->setColumnMinimumWidth( 2, CalamaresUtils::defaultFontHeight() * 24 ); + } + mb.exec(); +} + void LocaleTwoColumnDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const diff --git a/src/modules/welcome/WelcomePage.h b/src/modules/welcome/WelcomePage.h index 3e776a5f0..3e20ab9ea 100644 --- a/src/modules/welcome/WelcomePage.h +++ b/src/modules/welcome/WelcomePage.h @@ -58,6 +58,10 @@ public: /// @brief Change the language from an external source. void externallySelectedLanguage( int row ); +public slots: + void retranslate(); + void showAboutBox(); + protected: void focusInEvent( QFocusEvent* e ) override; //choose the child widget to focus